package org.apache.wicket;
Component serves as the highest level abstract base class for all components.
- Identity - All Components must have a non-null id which is
retrieved by calling getId(). The id must be unique within the
MarkupContainer that holds the Component, but does not have to be globally
unique or unique within a Page's component hierarchy.
- Hierarchy - A component has a parent which can be retrieved with
getParent(). If a component is an instance of MarkupContainer, it
may have children. In this way it has a place in the hierarchy of components
contained on a given page.
- Component Paths - The path from the Page at the root of the
component hierarchy to a given Component is simply the concatenation with dot
separators of each id along the way. For example, the path "a.b.c" would
refer to the component named "c" inside the MarkupContainer named "b" inside
the container named "a". The path to a component can be retrieved by calling
getPath(). This path is an absolute path beginning with the id of the Page at
the root. Pages bear a PageMap/Session-relative identifier as their id, so
each absolute path will begin with a number, such as "0.a.b.c". To get a
Component path relative to the page that contains it, you can call
getPageRelativePath().
- LifeCycle - Components participate in the following lifecycle
phases:
- Construction - A Component is constructed with the Java language
new operator. Children may be added during construction if the Component is a
MarkupContainer.
- Request Handling - An incoming request is processed by a protocol
request handler such as WicketServlet. An associated Application object
creates Session, Request and Response objects for use by a given Component in
updating its model and rendering a response. These objects are stored inside
a container called
RequestCycle which is accessible via
getRequestCycle(). The convenience methods
getRequest(), getResponse() and
getSession() provide easy access to the contents of this
container.
- Listener Invocation - If the request references a listener on an
existing Component, that listener is called, allowing arbitrary user code to
handle events such as link clicks or form submits. Although arbitrary
listeners are supported in Wicket, the need to implement a new class of
listener is unlikely for a web application and even the need to implement a
listener interface directly is highly discouraged. Instead, calls to
listeners are routed through logic specific to the event, resulting in calls
to user code through other overridable methods. For example, the
org.apache.wicket.markup.html.form.IFormSubmitListener.onFormSubmitted()
method implemented by the Form class is really a private implementation
detail of the Form class that is not designed to be overridden (although
unfortunately, it must be public since all interface methods in Java must be
public). Instead, Form subclasses should override user-oriented methods such
as onValidate(), onSubmit() and onError() (although only the latter two are
likely to be overridden in practice).
- onBeginRequest - The
onBeginRequest() method is
called.
- Form Submit - If a Form has been submitted and the Component is a
FormComponent, the component's model is validated by a call to
FormComponent.validate().
- Form Model Update - If a valid Form has been submitted and the
Component is a FormComponent, the component's model is updated by a call to
FormComponent.updateModel().
- Rendering - A markup response is generated by the Component via
render(), which calls subclass implementation code
contained in onRender(org.apache.wicket.markup.MarkupStream). Once this phase begins, a
Component becomes immutable. Attempts to alter the Component will result in a
WicketRuntimeException.
- onEndRequest () - The
onEndRequest() method is
called.
- Component Models - The primary responsibility of a component is
to use its model (an object that implements IModel), which can be set via
setModel(org.apache.wicket.model.IModel) and retrieved via
getModel(), to render a response in an appropriate markup
language, such as HTML. In addition, form components know how to update their
models based on request information. Since the IModel interface is a wrapper
around an actual model object, a convenience method
getModelObject() is provided to retrieve the model Object
from its IModel wrapper. A further convenience method,
getModelObjectAsString(), is provided for the very common
operation of converting the wrapped model Object to a String.
- Visibility - Components which have setVisible(false) will return
false from isVisible() and will not render a response (nor will their
children).
- Page - The Page containing any given Component can be retrieved
by calling
getPage(). If the Component is not attached to
a Page, an IllegalStateException will be thrown. An equivalent method,
findPage() is available for special circumstances where it
might be desirable to get a null reference back instead.
- Session - The Page for a Component points back to the Session
that contains the Page. The Session for a component can be accessed with the
convenience method getSession(), which simply calls getPage().getSession().
- Locale - The Locale for a Component is available through the
convenience method getLocale(), which is equivalent to
getSession().getLocale().
- String Resources - Components can have associated String
resources via the Application's Localizer, which is available through the
method
getLocalizer(). The convenience methods
getString(java.lang.String) and
getString(java.lang.String,org.apache.wicket.model.IModel) wrap the identical
methods on the Application Localizer for easy access in Components.
- Style - The style ("skin") for a component is available through
getStyle(), which is equivalent to
getSession().getStyle(). Styles are intended to give a particular look to a
Component or Resource that is independent of its Locale. For example, a style
might be a set of resources, including images and markup files, which gives
the design look of "ocean" to the user. If the Session's style is set to
"ocean" and these resources are given names suffixed with "_ocean", Wicket's
resource management logic will prefer these resources to other resources,
such as default resources, which are not as good of a match.
- Variation - Whereas Styles are Session (user) specific,
variations are component specific. E.g. if the Style is "ocean" and the
Variation is "NorthSea", than the resources are given the names suffixed with
"_ocean_NorthSea".
- AttributeModifiers - You can add one or more
AttributeModifiers to any component if you need to programmatically
manipulate attributes of the markup tag to which a Component is attached.
- Application, ApplicationSettings and ApplicationPages - The
getApplication() method provides convenient access to the Application for a
Component via getSession().getApplication(). The getApplicationSettings()
method is equivalent to getApplication().getSettings(). The
getApplicationPages is equivalent to getApplication().getPages().
- Feedback Messages - The
debug(java.lang.String),
info(java.lang.String), warn(java.lang.String),
error(java.io.Serializable) and fatal(java.lang.String) methods
associate feedback messages with a Component. It is generally not necessary
to use these methods directly since Wicket validators automatically register
feedback messages on Components. Any feedback message for a given Component
can be retrieved with getFeedbackMessage().
- Page Factory - It is possible to change the way that Pages are
constructed by overriding the
getPageFactory() method,
returning your own implementation of IPageFactory.
- Versioning - Pages are the unit of versioning in Wicket, but
fine-grained control of which Components should participate in versioning is
possible via the
setVersioned(boolean) method. The
versioning participation of a given Component can be retrieved with
isVersioned().
- AJAX support- Components can be re-rendered after the whole Page
has been rendered at least once by calling doRender().
- Author(s):
- Jonathan Locke
- Chris Turner
- Eelco Hillenius
- Johan Compagner
- Juergen Donnerstag
- Igor Vaynberg (ivaynberg)
Change record of a model.
return "ComponentModelChange[component: " + getPath() + "]";
Generic component visitor interface for component traversals.
Value to return to continue a traversal.
A generic value to return to contiue a traversal, but if the
component is a container, don't visit its children.
A generic value to return to stop a traversal.
Called at each component in a traversal.
- Parameters:
component
The component- Returns:
- CONTINUE_TRAVERSAL (null) if the traversal should continue,
or a non-null return value for the traversal method if it
should stop. If no return value is useful, the generic
non-null value STOP_TRAVERSAL can be used.
Change object for undoing addition of behavior
- Author(s):
- Igor Vaynberg (ivaynberg)
Undo change for component border property
Change object for undoing removal of behavior
- Author(s):
- Igor Vaynberg (ivaynberg)
A enabled change operation.
A visibility change operation.
Action used with IAuthorizationStrategy to determine whether a component
is allowed to be enabled.
If enabling is authorized, a component may decide by itself (typically
using it's enabled property) whether it is enabled or not. If enabling is
not authorized, the given component is marked disabled, regardless its
enabled property.
When a component is not allowed to be enabled (in effect disabled through
the implementation of this interface), Wicket will try to prevent model
updates too. This is not completely fail safe, as constructs like:
User u = (User)getModelObject();
u.setName("got you there!");
can't be prevented. Indeed it can be argued that any model protection is
best dealt with in your model objects to be completely secured. Wicket
will catch all normal framework-directed use though.
Separator for component paths
Action used with IAuthorizationStrategy to determine whether a component
and its children are allowed to be rendered.
There are two uses for this method:
- The 'normal' use is for controlling whether a component is rendered
without having any effect on the rest of the processing. If a strategy
lets this method return 'false', then the target component and its
children will not be rendered, in the same fashion as if that component
had visibility property 'false'.
- The other use is when a component should block the rendering of the
whole page. So instead of 'hiding' a component, what we generally want to
achieve here is that we force the user to logon/give-credentials for a
higher level of authorization. For this functionality, the strategy
implementation should throw a
org.apache.wicket.authorization.AuthorizationException, which will
then be handled further by the framework.
meta data key for missing body tags logging.
private static final long serialVersionUID = 1L;
Basic model IModelComparator implementation for normal object models
private static final long serialVersionUID = 1L;
if (a == null && b == null)
if (a == null || b == null)
True when a component is being auto-added
True when a component is enabled for model updates and is reachable.
Flag for escaping HTML in model strings
Boolean whether this component was rendered at least once for tracking
changes.
Ignore attribute modifiers
Flag for escaping HTML in model strings
Internal indicator of whether this component may be rendered given the
current context's authorization. It overrides the visible flag in case
this is false. Authorization is done before trying to render any
component (otherwise we would end up with a half rendered page in the
buffer)
Whether or not the component should print out its markup id into the id
attribute
Ouput a placeholder tag if the component is not visible. This is useful
in ajax mode to go to visible(false) to visible(true) without the
overhead of repaiting a visible parent container
The name of attribute that will hold markup id
Metadata key used to store/retrieve markup id
private static final long serialVersionUID = 1L;
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Reserved subclass-definable flag bit
Meta data key for line precise error logging for the moment of addition.
Made package private for access in
MarkupContainer and
Page
private static final long serialVersionUID = 1L;
meta data key for line precise error logging for the moment of
construction. Made package private for access in
Page
private static final long serialVersionUID = 1L;
List of behaviors to be applied for this Component
Component flags. See FLAG_* for possible non-exclusive flag values.
I really dislike it, but for now we need it. Reason: due to transparent
containers and IComponentResolver there is guaranteed 1:1 mapping between
component and markup
The model for this component.
Constructor. All components have names. A component's id cannot be null.
This is the minimal constructor of component. It does not register a
model.
- Parameters:
id
The non-null id of this component- Throws:
WicketRuntimeException
Thrown if the component has been given a null id.
Constructor. All components have names. A component's id cannot be null.
This constructor includes a model.
- Parameters:
id
The non-null id of this componentmodel
The component's model- Throws:
WicketRuntimeException
Thrown if the component has been given a null id.
Adds an behavior modifier to the component.
Note: this method is override to enable users to do things like discussed
in this
thread.
- Parameters:
behavior
The behavior modifier to be added- Returns:
- this (to allow method call chaining)
Called on very component after the page is renderd It will call
onAfterRender for it self and its childeren.
+ " has not been properly detached. Something in the hierarchy of "
+ " has not called super.onAfterRender() in the override of onAfterRender() method");
Attaches the component. This is called when the page is starting to be
used for rendering or when a component listener call is executed on it.
Called for every component when the page is getting to be rendered. it
will call onBeforeRender for this component and all the child components
+ " has not been properly rendered. Something in the hierarchy of "
+ " has not called super.onBeforeRender() in the override of onBeforeRender() method");
Redirects to any intercept page previously specified by a call to
redirectToInterceptPage.
Registers a debug feedback message for this component
- Parameters:
message
The feedback message
Detaches the component. This is called at the end of the request for all
the pages that are touched in that request.
+ " has not been properly detached. Something in the hierarchy of "
+ " has not called super.onDetach() in the override of onDetach() method");
THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.
Traverses all behaviors and calls detachModel() on them. This is needed
to cleanup behavior after render. This method is necessary for
org.apache.wicket.ajax.AjaxRequestTarget to be able to cleanup component's behaviors
after header contribution has been done (which is separated from
component render).
Registers an error feedback message for this component
- Parameters:
message
The feedback message
Registers an fatal error feedback message for this component
- Parameters:
message
The feedback message
Finds the first container parent of this component of the given class.
- Parameters:
c
MarkupContainer class to search for- Returns:
- First container parent that is an instance of the given class, or
null if none can be found
- Returns:
- The nearest markup container with associated markup
while (container != null)
Gets interface to application that this component is a part of.
- Returns:
- The application associated with the session that this component
is in.
- See also:
Application
return Application.get();
Gets the currently coupled
org.apache.wicket.behavior.IBehaviors as a unmodifiable list.
Returns an empty list rather than null if there are no behaviors coupled
to this component.
- Returns:
- The currently coupled behaviors as a unmodifiable list
- Returns:
- component border assigned to this component, or null if none
Gets the converter that should be used by this component.
- Parameters:
type
The type to convert to- Returns:
- The converter that should be used by this component
Gets whether model strings should be escaped.
- Returns:
- Returns whether model strings should be escaped
- Returns:
- Any feedback message for this component
Gets the id of this component.
- Returns:
- The id of this component
- Returns:
- Innermost model for this component
Gets the locale for the session holding this component.
- Returns:
- The locale for the session holding this component
- See also:
getSession()
Convenience method to provide easy access to the localizer object within
any component.
- Returns:
- The localizer object
THIS IS WICKET INTERNAL ONLY. DO NOT USE IT.
Get a copy of the markup's attributes which are associated with the
component.
Modifications to the map returned don't change the tags attributes. It is
just a copy.
Note: The component must have been added (directly or indirectly) to a
container with an associated markup file (Page, Panel or Border).
- Returns:
- markup attributes
Retrieves id by which this component is represented within the markup.
This is either the id attribute if it is set explicitly in the markup, or
a generated id.
The point of this function is to generate a unique id to make it easy to
locate this component in the generated markup for post-wicket processing
such as javascript or an xslt transform in case no explicit id was set
yet.
Note: This method should only be called after the component or its parent
have been added to the page.
- Returns:
- markup id of the component
"This component is not (yet) coupled to a page. It has to be able "
+ "to find the page it is supposed to operate in before you can call "
+ "this method (Component#getMarkupId)");
Gets metadata for this component using the given key.
- Parameters:
key
The key for the data- Returns:
- The metadata or null of no metadata was found for the given key
- See also:
MetaDataKey
Gets the model. It returns the object that wraps the backing model.
Gets the backing model object; this is shorthand for
getModel().getObject().
- Returns:
- The backing model object
Gets a model object as a string.
- Returns:
- Model object for this component as a string
- Parameters:
modelObject
Model object to convert to string- Returns:
- The string
Gets whether or not component will output id attribute into the markup.
id attribute will be set to the value returned from
getMarkupId().
- Returns:
- whether or not component will output id attribute into the markup
Gets the page holding this component.
- Returns:
- The page factory for the session that this component is in
Gets the path to this component relative to the page it is in.
- Returns:
- The path to this component relative to the page it is in
Gets any parent container, or null if there is none.
- Returns:
- Any parent container, or null if there is none
Gets this component's path.
- Returns:
- Colon separated path to this component in the component hierarchy
If false the component's tag will be printed as well as its body (which
is default). If true only the body will be printed, but not the
component's tag.
- Returns:
- If true, the component tag will not be printed
- Returns:
- The request for this component's active request cycle
if (requestCycle == null)
Gets the active request cycle for this component
- Returns:
- The request cycle
return RequestCycle.get();
- Returns:
- The response for this component's active request cycle
Gets the current Session object.
- Returns:
- The Session that this component is in
- Returns:
- Size of this Component in bytes
log.error("Exception getting size for component " + this, e); - Parameters:
key
Key of string resource in property file- Returns:
- The String
- See also:
Localizer
- Parameters:
key
The resource keymodel
The model- Returns:
- The formatted string
- See also:
Localizer
- Parameters:
key
The resource keymodel
The modeldefaultValue
A default value if the string cannot be found- Returns:
- The formatted string
- See also:
Localizer
Gets the style of this component (see
Session).
if (variation != null && !"".equals(variation))
if (style != null && !"".equals(style))
style = variation + "_" + style;
Gets the variation string of this component that will be used to look up
markup for this component. Subclasses can override this method to define
by an instance what markup variation should be picked up. By default it
will return null.
- Returns:
- The variation of this component.
Gets whether this component was rendered at least once.
- Returns:
- true if the component has been rendered before, false if it is
merely constructed
- Returns:
- True if this component has an error message
- Returns:
- True if this component has some kind of feedback message
Registers an informational feedback message for this component
- Parameters:
message
The feedback message
Authorizes an action for a component.
if (authorizationStrategy != null)
Returns true if this component is an ancestor of the given component
- Deprecated:
- use getParent().contains(component, false)
- Parameters:
component
The component to check- Returns:
- True if the given component has this component as an ancestor
- Returns:
- true if this component is authorized to be enabled, false
otherwise
Gets whether this component is enabled. Specific components may decide to
implement special behavior that uses this property, like web form
components that add a disabled='disabled' attribute when enabled is
false.
- Returns:
- Whether this component is enabled.
Returns if the component is stateless or not. It checks the stateless
hint if that is false it returns directly false. If that is still true it
checks all its behaviours if they can be stateless.
- Returns:
- whether the component is stateless.
- Returns:
- True if this component is versioned
Gets whether this component and any children are visible.
WARNING: this method can be called multiple times during a request. If
you override this method, it is a good idea to keep it cheap in terms of
processing. Alternatively, you can call setVisible(boolean).
- Returns:
- True if component and any children are visible
Checks if the component itself and all its parents are visible.
- Returns:
- true if the component and all its parents are visible.
while (component != null)
Called to indicate that the model content for this component has been
changed
Called to indicate that the model content for this component is about to
change
Creates a new page using the component's page factory
- Parameters:
c
The class of page to create- Returns:
- The new page
Creates a new page using the component's page factory
- Parameters:
c
The class of page to createparameters
Any parameters to pass to the constructor- Returns:
- The new page
Redirects browser to an intermediate page such as a sign-in page. The
current request's url is saved for future use by method
continueToOriginalDestination(); Only use this method when you plan to
continue to the current url at some later time; otherwise just use
setResponsePage or - when you are in a constructor or checkAccessMethod,
call redirectTo.
Removes this component from its parent. It's important to remember that a
component that is removed cannot be referenced from the markup still.
Removes behavior from component
- Parameters:
behavior
behavior to remove- Returns:
- this (to allow method call chaining)
"Tried to remove a behavior that was not added to the component. Behavior: "
Performs a render of this component as part of a Page level render
process.
For component level re-render (e.g. AJAX) please call
renderComponent(). Though render() does seem to work, it will
fail for panel children.
log.error("Error while cleaning up after exception", ex2); Page.renderPage() is used to render a whole page. With AJAX however it
must be possible to render any one component contained in a page. That is
what this method is for.
Note: it is not necessary that the page has previously been rendered. But
the component must have been added (directly or indirectly) to a
container with an associated markup file (Page, Panel or Border).
if (this instanceof Page)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.
Renders the component at the current position in the given markup stream.
The method onComponentTag() is called to allow the component to mutate
the start tag. The method onComponentTagBody() is then called to permit
the component to render its body.
- Parameters:
markupStream
The markup stream
Called to indicate that a component has been rendered. This method should
only very rarely be called at all. One usage is in ImageMap, which
renders its link children its own special way (without calling render()
on them). If ImageMap did not call rendered() to indicate that its child
components were actually rendered, the framework would think they had
never been rendered, and in development mode this would result in a
runtime exception.
Replaces this component with another. The replacing component must have
the same component id as this component. This method serves as a shortcut
to
this.getParent().replace(replacement) and provides a
better context for errors.
- Parameters:
replacement
component to replace this one- Since:
- 1.2.1
"Replacement component must have the same id as the component it will replace. Replacement id [["
+ replacement.getId() + "]], replaced id [[" + getId() + "]].");
"This method can only be called on a component that has already been added to its parent.");
- Parameters:
component
The component to compare with- Returns:
- True if the given component's model is the same as this
component's model.
- Parameters:
model
The model to compare with- Returns:
- True if the given component's model is the same as this
component's model.
if (thisModel != null && thatModel != null)
Assigns a component border to this component. If called with
null any previous border will be cleared.
- Parameters:
border
componnet border to assign, or null to clear
any previous- Returns:
- component for chaining
Sets whether this component is enabled. Specific components may decide to
implement special behavior that uses this property, like web form
components that add a disabled='disabled' attribute when enabled is
false. If it is not enabled, it will not be allowed to call any listener
method on it (e.g. Link.onClick) and the model object will be protected
(for the common use cases, not for programmer's misuse)
- Parameters:
enabled
whether this component is enabled- Returns:
- This
Sets whether model strings should be escaped.
- Parameters:
escapeMarkup
True is model strings should be escaped- Returns:
- This
Sets the metadata for this component using the given key. If the metadata
object is not of the correct type for the metadata key, an
IllegalArgumentException will be thrown. For information on creating
MetaDataKeys, see
MetaDataKey.
Sets the given model.
WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON
FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK
BACK-BUTTON SUPPORT.
- Parameters:
model
The model- Returns:
- This
Sets the backing model object; shorthand for
getModel().setObject(object).
- Parameters:
object
The object to set- Returns:
- This
"Attempt to set model object on null model of component: "
Sets whether or not component will output id attribute into the markup.
id attribute will be set to the value returned from
getMarkupId().
- Parameters:
output- Returns:
- this for chaining
Render a placeholder tag when the component is not visible. The tag is of
form: <componenttag style="display:none;" id="componentid"/>. This
method will also call
setOutputMarkupId(true).
This is useful, for example, in ajax situations where the component
starts out invisible and then becomes visible through an ajax update.
With a placeholder tag already in the markup you do not need to repaint
this component's parent, instead you can repaint the component directly.
When this method is called with parameter
false the
outputmarkupid flag is not reverted to false.
- Parameters:
outputTag- Returns:
- this for chaining
If false the component's tag will be printed as well as its body (which
is default). If true only the body will be printed, but not the
component's tag.
- Parameters:
renderTag
If true, the component tag will not be printed- Returns:
- This
Sets the page that will respond to this request
Sets the page class and its parameters that will respond to this request
Sets the page that will respond to this request
- Parameters:
versioned
True to turn on versioning for this component, false to turn
it off for this component and any children.- Returns:
- This
Sets whether this component and any children are visible.
- Parameters:
visible
True if this component and any children should be visible- Returns:
- This
Gets the string representation of this component.
- Returns:
- The path to this component
- Parameters:
detailed
True if a detailed string is desired- Returns:
- The string
return "[Component id = " + getId() + "]";
Returns a bookmarkable URL that references a given page class using a
given set of page parameters. Since the URL which is returned contains
all information necessary to instantiate and render the page, it can be
stored in a user's browser as a stable bookmark.
Gets a URL for the listener interface on a behaviour (e.g.
IBehaviorListener on AjaxPagingNavigationBehavior).
- Parameters:
behaviour
The behaviour that the URL should point tolistener
The listener interface that the URL should call- Returns:
- The URL
Returns a bookmarkable URL that references a given page class using a
given set of page parameters. Since the URL which is returned contains
all information necessary to instantiate and render the page, it can be
stored in a user's browser as a stable bookmark.
Returns a URL that references the given request target.
Gets a URL for the listener interface (e.g. ILinkListener).
- Parameters:
listener
The listener interface that the URL should call- Returns:
- The URL
Returns a URL that references a shared resource through the provided
resource reference.
Traverses all parent components of the given class in this container,
calling the visitor's visit method at each one.
- Parameters:
c
Classvisitor
The visitor to call at each parent of the given type- Returns:
- First non-null value returned by visitor callback
Registers a warning feedback message for this component.
- Parameters:
message
The feedback message
Adds state change to page.
- Parameters:
change
The change
Checks whether the given type has the expected name.
"Component " + getId() + " must be applied to a tag of type '" + name
Checks that a given tag has a required attribute value.
"Component " + getId() + " must be applied to a tag with '" + key
+ "' attribute matching '" + value + "', not '" + tagAttributeValue
Checks whether the hierarchy may be changed at all, and throws an
exception if this is not the case.
- Parameters:
component
the component which is about to be added or removed
"Cannot modify component hierarchy during render phase");
"Cannot modify component hierarchy during attach phase");
Detaches the model for this component if it is detachable.
Prefixes an exception message with useful information about this.
component.
- Parameters:
message
The message- Returns:
- The modified message
Finds the markup stream for this component.
- Returns:
- The markup stream for this component. Since a Component cannot
have a markup stream, we ask this component's parent to search
for it.
+ " as there is no parent");
If this Component is a Page, returns self. Otherwise, searches for the
nearest Page parent in the component hierarchy. If no Page parent can be
found, null is returned.
- Returns:
- The Page or null if none can be found
Gets the subset of the currently coupled
org.apache.wicket.behavior.IBehaviors that are of
the provided type as a unmodifiable list or null if there are no
behaviors attached. Returns an empty list rather than null if there are
no behaviors coupled to this component.
- Parameters:
type
The type or null for all- Returns:
- The subset of the currently coupled behaviors that are of the
provided type as a unmodifiable list or null
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
- Parameters:
flag
The flag to test- Returns:
- True if the flag is set
protected final boolean getFlag(final int flag)
return (this.flags & flag) != 0;
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
- Parameters:
flag
The flag to test- Returns:
- True if the flag is set
protected final boolean getFlag(final short flag)
Finds the innermost IModel object for an IModel that might contain nested
IModel(s).
- Parameters:
model
The model- Returns:
- The innermost (most nested) model
while (nested != null && nested instanceof IWrapModel)
Gets the value defaultModelComparator. Implementations of this interface
can be used in the Component.getComparator() for testing the current
value of the components model data with the new value that is given.
- Returns:
- the value defaultModelComparator
Returns whether the component can be stateless. Being able to be
stateless doesn't necessary mean, that the component should be stateless.
Whether the component should be stateless depends on
- Returns:
- whether the component can be stateless
Called when a null model is about to be retrieved in order to allow a
subclass to provide an initial model. This gives FormComponent, for
example, an opportunity to instantiate a model on the fly using the
containing Form's model.
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
OVERRIDE.
Called when a request begins.
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
OVERRIDE.
Called when a request ends.
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL OR
OVERRIDE.
Called anytime a model is changed via setModel or setModelObject.
- Returns:
- true if this component is attached
Components are allowed to reject behavior modifiers.
- Parameters:
behavior- Returns:
- False, if the component should not apply this behavior
If true, all attribute modifiers will be ignored
- Returns:
- True, if attribute modifiers are to be ignored
Called just after a component is rendered.
Called to allow a component to attach resources for use.
Overrides of this method MUST call the super implementation, the most
logical place to do this is the first line of the override method.
Called just before a component is rendered. If you override this, you
*must* call super.onBeforeRender() within your implementation.
- Deprecated:
- use onAttach() instead
Processes the component tag.
- Parameters:
tag
Tag to modify
Processes the body.
- Parameters:
markupStream
The markup streamopenTag
The open tag for the body
Called to allow a component to detach resources after use.
Overrides of this method MUST call the super implementation, the most
logical place to do this is the last line of the override method.
- Deprecated:
- use onDetach() instead
Called anytime a model is changed after the change has occurred
Called anytime a model is changed, but before the change actually occurs
Implementation that renders this component.
- Parameters:
markupStream- Since:
- Wicket 1.2
Writes a simple tag out to the response stream. Any components that might
be referenced by the tag are ignored. Also undertakes any tag attribute
modifications if they have been added to the component.
- Parameters:
tag
The tag to write
if (!(tag instanceof WicketTag) || !stripWicketTags)
Replaces the body with the given one.
- Parameters:
markupStream
The markup stream to replace the tag body intag
The tagbody
The new markup
markupOpenTag = markupStream.getTag();
if ((markupOpenTag != null) && markupOpenTag.isOpen() && !markupStream.atCloseTag())
+ "' Possible attempt to embed component(s) '" + markupStream.get()
+ "' in the body of this component which discards its body");
- Parameters:
auto
True to put component into auto-add mode
protected final void setAuto(final boolean auto)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
- Parameters:
flag
The flag to setset
True to turn the flag on, false to turn it off
protected final void setFlag(final int flag, final boolean set)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!
- Parameters:
flag
The flag to setset
True to turn the flag on, false to turn it off
protected final void setFlag(final short flag, final boolean set)
If true, all attribute modifiers will be ignored
- Parameters:
ignore
If true, all attribute modifiers will be ignored- Returns:
- This
The markup stream will be assigned to the component at the beginning of
the component render phase. It is temporary working variable only.
- Parameters:
model
The model to wrap if need be- Returns:
- The wrapped model
Detaches any child components
Gets the component at the given path.
- Parameters:
path
Path to component- Returns:
- The component at the path
+ "not contain the path " + path));
Attaches any child components
This method is here only for
MarkupContainer. It is broken out
of
onBeforeRender() so we can guarantee that it executes as the
last in onAttach() chain no matter where user places the
super.onAttach() call
+ " has not been properly attached. "
+ "Something in its class hierarchy has failed to call super.onAttach() in an override of onAttach() method");
- Returns:
- True if this component or any of its parents is in auto-add mode
This method is here for
MarkupContainer. It is broken out of
onBeforeRender() so we can guarantee that it executes as the
last in onBeforeRender() chain no matter where user places the
super.onBeforeRender() call.
Renders the close tag at the current position in the markup stream.
- Parameters:
markupStream
the markup streamopenTag
the tag to renderrenderTagOnly
if true, the tag will not be written to the output
if (renderTagOnly == false)
Sets the id of this component. This method is private because the only
time a component's id can be set is in its constructor.
- Parameters:
id
The non-null id of this component
if (id == null && !(this instanceof Page))
Sets the parent of a component.
- Parameters:
parent
The parent container
Sets the render allowed flag.