|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
public abstract class Component
Component serves as the highest level abstract base class for all components.
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.
RequestCycle
which is accessible via
getRequestCycle()
. The convenience methods getRequest()
,
getResponse()
and getSession()
provide easy access to the
contents of this container.
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()
method is called.
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()
method is called.
setModel(IModel model)
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.
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.
getLocalizer()
.
The convenience methods getString(String key)
and
getString(String key, IModel model)
wrap the identical methods on the
Application Localizer for easy access in Components.
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.
AttributeModifier
s to any
component if you need to programmatically manipulate attributes of the markup tag to which a
Component is attached.
debug(String)
,
info(String)
, warn(String)
,
error(java.io.Serializable)
and fatal(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()
.
getPageFactory()
method, returning your own implementation of
IPageFactory
.
setVersioned(boolean)
method. The versioning participation of a given Component
can be retrieved with isVersioned()
.
Nested Class Summary | |
---|---|
class |
Component.ComponentModelChange
Change record of a model. |
protected static class |
Component.EnabledChange
A enabled change operation. |
static interface |
Component.IVisitor
Generic component visitor interface for component traversals. |
protected static class |
Component.VisibilityChange
A visibility change operation. |
Field Summary | |
---|---|
static Action |
ENABLE
Action used with IAuthorizationStrategy to determine whether a component is allowed to be enabled. |
protected static int |
FLAG_RESERVED1
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED2
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED3
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED4
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED5
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED6
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED7
Reserved subclass-definable flag bit |
protected static int |
FLAG_RESERVED8
Reserved subclass-definable flag bit |
static char |
PATH_SEPARATOR
Separator for component paths |
static Action |
RENDER
Action used with IAuthorizationStrategy to determine whether a component and its children are allowed to be rendered. |
Constructor Summary | |
---|---|
Component(java.lang.String id)
Constructor. |
|
Component(java.lang.String id,
IModel model)
Constructor. |
Method Summary | |
---|---|
Component |
add(IBehavior behavior)
Adds an behavior modifier to the component. |
protected void |
addStateChange(Change change)
Adds state change to page. |
void |
afterRender()
Called on very component after the page is rendered. |
void |
beforeRender()
Called for every component when the page is getting to be rendered. |
protected boolean |
callOnBeforeRenderIfNotVisible()
Override this method if you want onBeforeRender to be called even when your component is not visible. |
protected void |
checkComponentTag(ComponentTag tag,
java.lang.String name)
Checks whether the given type has the expected name. |
protected void |
checkComponentTagAttribute(ComponentTag tag,
java.lang.String key,
java.lang.String value)
Checks that a given tag has a required attribute value. |
protected void |
checkHierarchyChange(Component component)
Checks whether the hierarchy may be changed at all, and throws an exception if this is not the case. |
boolean |
continueToOriginalDestination()
Redirects to any intercept page previously specified by a call to redirectToInterceptPage. |
void |
debug(java.lang.String message)
Registers a debug feedback message for this component |
void |
detach()
Detaches the component. |
void |
detachBehaviors()
THIS IS WICKET INTERNAL ONLY. |
protected void |
detachModel()
Detaches the model for this component if it is detachable. |
void |
detachModels()
Detaches all models |
boolean |
determineVisibility()
Determines whether or not a component should be visible, taking into account all the factors: isVisible() , isVisibilityAllowed() , isRenderAllowed() |
void |
error(java.io.Serializable message)
Registers an error feedback message for this component |
protected java.lang.String |
exceptionMessage(java.lang.String message)
Prefixes an exception message with useful information about this. |
void |
fatal(java.lang.String message)
Registers an fatal error feedback message for this component |
protected MarkupStream |
findMarkupStream()
Finds the markup stream for this component. |
protected Page |
findPage()
If this Component is a Page, returns self. |
MarkupContainer |
findParent(java.lang.Class c)
Finds the first container parent of this component of the given class. |
MarkupContainer |
findParentWithAssociatedMarkup()
|
Application |
getApplication()
Gets interface to application that this component is a part of. |
java.util.List |
getBehaviors()
Gets the currently coupled IBehavior s as a unmodifiable list. |
protected java.util.List |
getBehaviors(java.lang.Class type)
Gets the subset of the currently coupled IBehavior s that are of the provided type as
a unmodifiable list or null if there are no behaviors attached. |
java.lang.String |
getClassRelativePath()
|
IComponentBorder |
getComponentBorder()
|
IConverter |
getConverter()
Deprecated. To be removed. Please use/ override getConverter(Class) instead. |
IConverter |
getConverter(java.lang.Class type)
Gets the converter that should be used by this component. |
boolean |
getEscapeModelStrings()
Gets whether model strings should be escaped. |
FeedbackMessage |
getFeedbackMessage()
|
protected boolean |
getFlag(int flag)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected boolean |
getFlag(short flag)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
java.lang.String |
getId()
Gets the id of this component. |
IModel |
getInnermostModel()
|
protected IModel |
getInnermostModel(IModel model)
Finds the innermost IModel object for an IModel that might contain nested IModel(s). |
java.util.Locale |
getLocale()
Gets the locale for this component. |
Localizer |
getLocalizer()
Convenience method to provide easy access to the localizer object within any component. |
ValueMap |
getMarkupAttributes()
THIS IS WICKET INTERNAL ONLY. |
java.lang.String |
getMarkupId()
Retrieves id by which this component is represented within the markup. |
java.lang.String |
getMarkupId(boolean createIfDoesNotExist)
Retrieves id by which this component is represented within the markup. |
java.io.Serializable |
getMetaData(MetaDataKey key)
Gets metadata for this component using the given key. |
IModel |
getModel()
Gets the model. |
protected IModelComparator |
getModelComparator()
Gets the value defaultModelComparator. |
java.lang.Object |
getModelObject()
Gets the backing model object; this is shorthand for getModel().getObject(). |
java.lang.String |
getModelObjectAsString()
Gets a model object as a string. |
java.lang.String |
getModelObjectAsString(java.lang.Object modelObject)
Gets a model object as a string. |
boolean |
getOutputMarkupId()
Gets whether or not component will output id attribute into the markup. |
boolean |
getOutputMarkupPlaceholderTag()
Gets whether or not an invisible component will render a placeholder tag. |
Page |
getPage()
Gets the page holding this component. |
IPageFactory |
getPageFactory()
|
java.lang.String |
getPageRelativePath()
Gets the path to this component relative to the page it is in. |
MarkupContainer |
getParent()
Gets any parent container, or null if there is none. |
java.lang.String |
getPath()
Gets this component's path. |
boolean |
getRenderBodyOnly()
If false the component's tag will be printed as well as its body (which is default). |
Request |
getRequest()
|
RequestCycle |
getRequestCycle()
Gets the active request cycle for this component |
Response |
getResponse()
|
Session |
getSession()
Gets the current Session object. |
long |
getSizeInBytes()
|
protected boolean |
getStatelessHint()
Returns whether the component can be stateless. |
java.lang.String |
getString(java.lang.String key)
|
java.lang.String |
getString(java.lang.String key,
IModel model)
|
java.lang.String |
getString(java.lang.String key,
IModel model,
java.lang.String defaultValue)
|
java.lang.String |
getStyle()
Gets the style of this component (see Session ). |
java.lang.String |
getVariation()
Gets the variation string of this component that will be used to look up markup for this component. |
boolean |
hasBeenRendered()
Gets whether this component was rendered at least once. |
boolean |
hasErrorMessage()
|
boolean |
hasFeedbackMessage()
|
void |
info(java.lang.String message)
Registers an informational feedback message for this component |
protected IModel |
initModel()
Called when a null model is about to be retrieved in order to allow a subclass to provide an initial model. |
void |
internalAttach()
Deprecated. |
void |
internalDetach()
Deprecated. |
protected void |
internalOnAttach()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
internalOnDetach()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
internalOnModelChanged()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
boolean |
isActionAuthorized(Action action)
Authorizes an action for a component. |
boolean |
isAncestorOf(Component component)
Deprecated. use getParent().contains(component, false) |
protected boolean |
isAttached()
|
protected boolean |
isBehaviorAccepted(IBehavior behavior)
Components are allowed to reject behavior modifiers. |
boolean |
isEnableAllowed()
|
boolean |
isEnabled()
Gets whether this component is enabled. |
protected boolean |
isIgnoreAttributeModifier()
If true, all attribute modifiers will be ignored |
boolean |
isRenderAllowed()
Checks the security strategy if the RENDER action is allowed on this
component |
boolean |
isStateless()
Returns if the component is stateless or not. |
boolean |
isVersioned()
|
boolean |
isVisibilityAllowed()
Gets whether or not visibility is allowed on this component. |
boolean |
isVisible()
Gets whether this component and any children are visible. |
boolean |
isVisibleInHierarchy()
Checks if the component itself and all its parents are visible. |
protected MarkupStream |
locateMarkupStream()
|
protected void |
markAttached(boolean attached)
Convenience method that sets the attached flags. |
void |
markRendering()
Sets the RENDERING flag on component and it's children. |
void |
modelChanged()
Called to indicate that the model content for this component has been changed |
void |
modelChanging()
Called to indicate that the model content for this component is about to change |
Page |
newPage(java.lang.Class c)
Creates a new page using the component's page factory |
Page |
newPage(java.lang.Class c,
PageParameters parameters)
Creates a new page using the component's page factory |
protected void |
onAfterRender()
Called just after a component is rendered. |
protected void |
onAttach()
Deprecated. |
protected void |
onBeforeRender()
Called just before a component is rendered. |
protected void |
onBeginRequest()
Deprecated. use onAttach() instead |
protected void |
onComponentTag(ComponentTag tag)
Processes the component tag. |
protected void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body. |
protected void |
onDetach()
Called to allow a component to detach resources after use. |
protected void |
onEndRequest()
Deprecated. use onDetach() instead |
protected void |
onModelChanged()
Called anytime a model is changed after the change has occurred |
protected void |
onModelChanging()
Called anytime a model is changed, but before the change actually occurs |
protected abstract void |
onRender(MarkupStream markupStream)
Implementation that renders this component. |
void |
prepareForRender()
Prepares the component and it's children for rendering. |
void |
redirectToInterceptPage(Page page)
Redirects browser to an intermediate page such as a sign-in page. |
void |
remove()
Removes this component from its parent. |
Component |
remove(IBehavior behavior)
Removes behavior from component |
void |
render()
Performs a render of this component as part of a Page level render process. |
void |
render(MarkupStream markupStream)
Performs a render of this component as part of a Page level render process. |
void |
renderComponent()
Page.renderPage() is used to render a whole page. |
void |
renderComponent(MarkupStream markupStream)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
renderComponentTag(ComponentTag tag)
Writes a simple tag out to the response stream. |
void |
rendered()
Called to indicate that a component has been rendered. |
void |
renderHead(HtmlHeaderContainer container)
Print to the web response what ever the component wants to contribute to the head section. |
protected void |
replaceComponentTagBody(MarkupStream markupStream,
ComponentTag tag,
java.lang.CharSequence body)
Replaces the body with the given one. |
void |
replaceWith(Component replacement)
Replaces this component with another. |
boolean |
sameInnermostModel(Component component)
|
boolean |
sameInnermostModel(IModel model)
|
protected void |
setAuto(boolean auto)
|
Component |
setComponentBorder(IComponentBorder border)
Assigns a component border to this component. |
Component |
setEnabled(boolean enabled)
Sets whether this component is enabled. |
Component |
setEscapeModelStrings(boolean escapeMarkup)
Sets whether model strings should be escaped. |
protected void |
setFlag(int flag,
boolean set)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
setFlag(short flag,
boolean set)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected Component |
setIgnoreAttributeModifier(boolean ignore)
If true, all attribute modifiers will be ignored |
void |
setMarkupId(java.lang.String markupId)
Sets this component's markup id to a user defined value. |
protected void |
setMarkupStream(MarkupStream markupStream)
The markup stream will be assigned to the component at the beginning of the component render phase. |
void |
setMetaData(MetaDataKey key,
java.io.Serializable object)
Sets the metadata for this component using the given key. |
Component |
setModel(IModel model)
Sets the given model. |
Component |
setModelObject(java.lang.Object object)
Sets the backing model object; shorthand for getModel().setObject(object). |
Component |
setOutputMarkupId(boolean output)
Sets whether or not component will output id attribute into the markup. |
Component |
setOutputMarkupPlaceholderTag(boolean outputTag)
Render a placeholder tag when the component is not visible. |
void |
setRedirect(boolean redirect)
|
Component |
setRenderBodyOnly(boolean renderTag)
If false the component's tag will be printed as well as its body (which is default). |
void |
setResponsePage(java.lang.Class cls)
Sets the page that will respond to this request |
void |
setResponsePage(java.lang.Class cls,
PageParameters parameters)
Sets the page class and its parameters that will respond to this request |
void |
setResponsePage(Page page)
Sets the page that will respond to this request |
Component |
setVersioned(boolean versioned)
|
Component |
setVisibilityAllowed(boolean allowed)
Sets whether or not this component is allowed to be visible. |
Component |
setVisible(boolean visible)
Sets whether this component and any children are visible. |
java.lang.String |
toString()
Gets the string representation of this component. |
java.lang.String |
toString(boolean detailed)
|
java.lang.CharSequence |
urlFor(java.lang.Class pageClass,
PageParameters parameters)
Returns a bookmarkable URL that references a given page class using a given set of page parameters. |
java.lang.CharSequence |
urlFor(IBehavior behaviour,
RequestListenerInterface listener)
Gets a URL for the listener interface on a behavior (e.g. |
java.lang.CharSequence |
urlFor(IPageMap pageMap,
java.lang.Class pageClass,
PageParameters parameters)
Returns a bookmarkable URL that references a given page class using a given set of page parameters. |
java.lang.CharSequence |
urlFor(IRequestTarget requestTarget)
Returns a URL that references the given request target. |
java.lang.CharSequence |
urlFor(RequestListenerInterface listener)
Gets a URL for the listener interface (e.g. |
java.lang.CharSequence |
urlFor(ResourceReference resourceReference)
Returns a URL that references a shared resource through the provided resource reference. |
java.lang.Object |
visitParents(java.lang.Class c,
Component.IVisitor visitor)
Traverses all parent components of the given class in this container, calling the visitor's visit method at each one. |
void |
warn(java.lang.String message)
Registers a warning feedback message for this component. |
protected IModel |
wrap(IModel model)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Action ENABLE
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.
public static final char PATH_SEPARATOR
public static final Action RENDER
There are two uses for this method:
AuthorizationException
, which will then
be handled further by the framework.
protected static final int FLAG_RESERVED1
protected static final int FLAG_RESERVED2
protected static final int FLAG_RESERVED3
protected static final int FLAG_RESERVED4
protected static final int FLAG_RESERVED5
protected static final int FLAG_RESERVED6
protected static final int FLAG_RESERVED7
protected static final int FLAG_RESERVED8
Constructor Detail |
---|
public Component(java.lang.String id)
id
- The non-null id of this component
WicketRuntimeException
- Thrown if the component has been given a null id.public Component(java.lang.String id, IModel model)
id
- The non-null id of this componentmodel
- The component's model
WicketRuntimeException
- Thrown if the component has been given a null id.Method Detail |
---|
public Component add(IBehavior behavior)
Note: this method is override to enable users to do things like discussed in this thread.
behavior
- The behavior modifier to be added
public final void afterRender()
public final void beforeRender()
public final boolean continueToOriginalDestination()
redirectToInterceptPage(Page)
public final void debug(java.lang.String message)
message
- The feedback messagepublic final void detach()
public final void detachBehaviors()
AjaxRequestTarget
to be able to cleanup
component's behaviors after header contribution has been done (which is separated from
component render).
public void detachModels()
public final void error(java.io.Serializable message)
message
- The feedback messagepublic final void fatal(java.lang.String message)
message
- The feedback messagepublic final MarkupContainer findParent(java.lang.Class c)
c
- MarkupContainer class to search for
public final MarkupContainer findParentWithAssociatedMarkup()
public final Application getApplication()
Application
public final java.util.List getBehaviors()
IBehavior
s as a unmodifiable list. Returns an empty list
rather than null if there are no behaviors coupled to this component.
public final java.lang.String getClassRelativePath()
getPageRelativePath()
public final IComponentBorder getComponentBorder()
public final IConverter getConverter()
getConverter(Class)
instead.
getConverter(Class)
instead.public IConverter getConverter(java.lang.Class type)
getConverter
in interface IConverterLocator
type
- The type to convert to
public final boolean getEscapeModelStrings()
public final FeedbackMessage getFeedbackMessage()
public java.lang.String getId()
public final IModel getInnermostModel()
public java.util.Locale getLocale()
Session.getLocale()
public final Localizer getLocalizer()
public final ValueMap getMarkupAttributes()
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).
public java.lang.String getMarkupId(boolean createIfDoesNotExist)
setMarkupId(String)
, id attribute defined in
the markup, or an automatically generated id - in that order.
If no id is set and createIfDoesNotExist
is false, this method will return
null. Otherwise it will generate an id value that will be unique in the page. This is the
preferred way as there is no chance of id collision.
Note: This method should only be called after the component or its parent have been added to the page.
createIfDoesNotExist
- When there is no existing markup id, determines whether it should be generated or
whether null
should be returned.
public java.lang.String getMarkupId()
setMarkupId(String)
, id attribute defined in
the markup, or an automatically generated id - in that order.
If no explicit id is set this function will generate an id value that will be unique in the page. This is the preferred way as there is no chance of id collision.
Note: This method should only be called after the component or its parent have been added to the page.
public final java.io.Serializable getMetaData(MetaDataKey key)
key
- The key for the data
MetaDataKey
public final IModel getModel()
public final java.lang.Object getModelObject()
public final java.lang.String getModelObjectAsString()
Strings.escapeMarkup(String, boolean, boolean)
on the model string returned.
Strings.escapeMarkup(String, boolean, boolean)
,
getEscapeModelStrings()
public final java.lang.String getModelObjectAsString(java.lang.Object modelObject)
Strings.escapeMarkup(String, boolean, boolean)
on the model string returned.
modelObject
- Model object to convert to string
Strings.escapeMarkup(String, boolean, boolean)
,
getEscapeModelStrings()
public final boolean getOutputMarkupId()
getMarkupId()
.
public final boolean getOutputMarkupPlaceholderTag()
public final Page getPage()
java.lang.IllegalStateException
- Thrown if component is not yet attached to a Page.public final IPageFactory getPageFactory()
public final java.lang.String getPageRelativePath()
public final MarkupContainer getParent()
public final java.lang.String getPath()
public final boolean getRenderBodyOnly()
public final Request getRequest()
public final RequestCycle getRequestCycle()
public final Response getResponse()
public Session getSession()
public long getSizeInBytes()
public final java.lang.String getString(java.lang.String key)
key
- Key of string resource in property file
Localizer
public final java.lang.String getString(java.lang.String key, IModel model)
key
- The resource keymodel
- The model
Localizer
public final java.lang.String getString(java.lang.String key, IModel model, java.lang.String defaultValue)
key
- The resource keymodel
- The modeldefaultValue
- A default value if the string cannot be found
Localizer
public final java.lang.String getStyle()
Session
).
Session
,
Session.getStyle()
public java.lang.String getVariation()
public final boolean hasBeenRendered()
public final boolean hasErrorMessage()
public final boolean hasFeedbackMessage()
public final void info(java.lang.String message)
message
- The feedback messagepublic final void internalAttach()
public final void internalDetach()
public final boolean isActionAuthorized(Action action)
action
- The action to authorize
AuthorizationException
- Can be thrown by implementation if action is unauthorizedpublic final boolean isAncestorOf(Component component)
component
- The component to check
public final boolean isEnableAllowed()
public boolean isEnabled()
public final boolean isRenderAllowed()
RENDER
action is allowed on this
component
RENDER
action is allowed, false otherwisepublic final boolean isStateless()
public boolean isVersioned()
public boolean isVisible()
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)
.
public final boolean isVisibleInHierarchy()
public final void markRendering()
public final void modelChanged()
public final void modelChanging()
public final Page newPage(java.lang.Class c)
c
- The class of page to create
public final Page newPage(java.lang.Class c, PageParameters parameters)
c
- The class of page to createparameters
- Any parameters to pass to the constructor
public void prepareForRender()
public final void redirectToInterceptPage(Page page)
page
- The sign in pagecontinueToOriginalDestination()
public final void remove()
public Component remove(IBehavior behavior)
behavior
- behavior to remove
public final void render()
For component level re-render (e.g. AJAX) please call renderComponent()
. Though
render() does seem to work, it will fail for panel children.
public final void render(MarkupStream markupStream)
For component level re-render (e.g. AJAX) please call renderComponent(MarkupStream)
.
Though render() does seem to work, it will fail for panel children.
markupStream
- public final void renderComponent()
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).
public final void renderComponent(MarkupStream markupStream)
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.
markupStream
- The markup streampublic final void rendered()
public void renderHead(HtmlHeaderContainer container)
NOT intended for overriding by framework clients. Rather, use
IHeaderContributor.renderHead(org.apache.wicket.markup.html.IHeaderResponse)
container
- The HtmlHeaderContainerpublic void replaceWith(Component replacement)
this.getParent().replace(replacement)
and provides a better context for
errors.
replacement
- component to replace this onepublic final boolean sameInnermostModel(Component component)
component
- The component to compare with
public final boolean sameInnermostModel(IModel model)
model
- The model to compare with
public final Component setComponentBorder(IComponentBorder border)
null
any previous
border will be cleared.
border
- component border to assign, or null
to clear any previous
public final Component setEnabled(boolean enabled)
enabled
- whether this component is enabled
public final Component setEscapeModelStrings(boolean escapeMarkup)
escapeMarkup
- True is model strings should be escaped
public void setMarkupId(java.lang.String markupId)
The recommended way is to let wicket generate the value automatically, this method is here to serve as an override for that value in cases where a specific id must be used.
If null is passed in the user defined value is cleared and markup id value will fall back on automatically generated value
markupId
- markup id value or null to clear any previous user defined valuegetMarkupId()
public final void setMetaData(MetaDataKey key, java.io.Serializable object)
MetaDataKey
.
key
- The singleton key for the metadataobject
- The metadata object
java.lang.IllegalArgumentException
MetaDataKey
public Component setModel(IModel 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.
model
- The model
public final Component setModelObject(java.lang.Object object)
object
- The object to set
public final Component setOutputMarkupId(boolean output)
getMarkupId()
.
output
- True if the component will out the id attribute into markup. Please note that the
default behavior is to use the same id as the component. This means that your
component must begin with [a-zA-Z] in order to generate a valid markup id
according to: http://www.w3.org/TR/html401/types.html#type-name
public final Component setOutputMarkupPlaceholderTag(boolean outputTag)
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.
outputTag
-
public final void setRedirect(boolean redirect)
redirect
- True if the response should be redirected toRequestCycle.setRedirect(boolean)
public final Component setRenderBodyOnly(boolean renderTag)
renderTag
- If true, the component tag will not be printed
public final void setResponsePage(java.lang.Class cls)
cls
- The response page classRequestCycle.setResponsePage(Class)
public final void setResponsePage(java.lang.Class cls, PageParameters parameters)
cls
- The response page classparameters
- The parameters for this bookmarkable page.RequestCycle.setResponsePage(Class, PageParameters)
public final void setResponsePage(Page page)
page
- The response pageRequestCycle.setResponsePage(Page)
public Component setVersioned(boolean versioned)
versioned
- True to turn on versioning for this component, false to turn it off for this
component and any children.
public final Component setVisible(boolean visible)
visible
- True if this component and any children should be visible
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean detailed)
detailed
- True if a detailed string is desired
public final java.lang.CharSequence urlFor(java.lang.Class pageClass, PageParameters parameters)
pageClass
- Class of pageparameters
- Parameters to page
RequestCycle.urlFor(IPageMap, Class, PageParameters)
public final java.lang.CharSequence urlFor(IBehavior behaviour, RequestListenerInterface listener)
behaviour
- The behavior that the URL should point tolistener
- The listener interface that the URL should call
public final java.lang.CharSequence urlFor(IPageMap pageMap, java.lang.Class pageClass, PageParameters parameters)
pageMap
- Page map to usepageClass
- Class of pageparameters
- Parameters to page
RequestCycle.urlFor(IPageMap, Class, PageParameters)
public final java.lang.CharSequence urlFor(IRequestTarget requestTarget)
requestTarget
- the request target to reference
RequestCycle.urlFor(IRequestTarget)
public final java.lang.CharSequence urlFor(RequestListenerInterface listener)
listener
- The listener interface that the URL should call
public final java.lang.CharSequence urlFor(ResourceReference resourceReference)
resourceReference
- The resource reference
RequestCycle.urlFor(ResourceReference)
public final java.lang.Object visitParents(java.lang.Class c, Component.IVisitor visitor)
c
- Classvisitor
- The visitor to call at each parent of the given type
public final void warn(java.lang.String message)
message
- The feedback messageprotected final void addStateChange(Change change)
change
- The changeprotected final void checkComponentTag(ComponentTag tag, java.lang.String name)
tag
- The tag to checkname
- The expected tag name
MarkupException
- Thrown if the tag is not of the right nameprotected final void checkComponentTagAttribute(ComponentTag tag, java.lang.String key, java.lang.String value)
tag
- The tagkey
- The attribute keyvalue
- The required value for the attribute key
MarkupException
- Thrown if the tag does not have the required attribute valueprotected void checkHierarchyChange(Component component)
component
- the component which is about to be added or removedprotected void detachModel()
protected final java.lang.String exceptionMessage(java.lang.String message)
message
- The message
protected MarkupStream findMarkupStream()
protected final Page findPage()
protected java.util.List getBehaviors(java.lang.Class type)
IBehavior
s 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.
type
- The type or null for all
protected final boolean getFlag(int flag)
flag
- The flag to test
protected final boolean getFlag(short flag)
flag
- The flag to test
protected final IModel getInnermostModel(IModel model)
model
- The model
protected IModelComparator getModelComparator()
protected boolean getStatelessHint()
protected IModel initModel()
protected final void internalOnAttach()
protected final void internalOnDetach()
protected void internalOnModelChanged()
protected final void markAttached(boolean attached)
attached
- protected final boolean isAttached()
protected boolean isBehaviorAccepted(IBehavior behavior)
behavior
-
protected final boolean isIgnoreAttributeModifier()
protected MarkupStream locateMarkupStream()
protected void onAfterRender()
protected final void onAttach()
If you need to initialize component before it is rendered, either use
onBeforeRender()
or do the initialization lazily (on first demand, such as
LoadableDetachableModel
does.
If you need to get notification when page is taken out of Session (before calling the event
listener), you can use the Page.onPageAttached()
method.
protected void onBeforeRender()
*NOTE* If you override this, you *must* call super.onBeforeRender() within your
implementation.
Because this method is responsible for cascading onBeforeRender()
call to its
children it is strongly recommended that super call is made at the end of the override.
callOnBeforeRenderIfNotVisible()
protected boolean callOnBeforeRenderIfNotVisible()
onBeforeRender()
protected final void onBeginRequest()
protected void onComponentTag(ComponentTag tag)
tag
- Tag to modifyprotected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
markupStream
- The markup streamopenTag
- The open tag for the bodyprotected void onDetach()
protected final void onEndRequest()
protected void onModelChanged()
protected void onModelChanging()
protected abstract void onRender(MarkupStream markupStream)
markupStream
- protected final void renderComponentTag(ComponentTag tag)
tag
- The tag to writeprotected final void replaceComponentTagBody(MarkupStream markupStream, ComponentTag tag, java.lang.CharSequence body)
markupStream
- The markup stream to replace the tag body intag
- The tagbody
- The new markupprotected final void setAuto(boolean auto)
auto
- True to put component into auto-add modeprotected final void setFlag(int flag, boolean set)
flag
- The flag to setset
- True to turn the flag on, false to turn it offprotected final void setFlag(short flag, boolean set)
flag
- The flag to setset
- True to turn the flag on, false to turn it offprotected final Component setIgnoreAttributeModifier(boolean ignore)
ignore
- If true, all attribute modifiers will be ignored
protected void setMarkupStream(MarkupStream markupStream)
markupStream
- The current markup stream which should be applied by the component to render
itselffindMarkupStream()
,
MarkupContainer.getMarkupStream()
protected final IModel wrap(IModel model)
model
- The model to wrap if need be
public final Component setVisibilityAllowed(boolean allowed)
setVisible(boolean)
will not always have a desired effect because that component may
have isVisible()
overridden. Both setVisibilityAllowed(boolean)
and
isVisibilityAllowed()
are final
so their contract is enforced always.
allowed
-
this
for chainingpublic final boolean isVisibilityAllowed()
setVisibilityAllowed(boolean)
for details.
public final boolean determineVisibility()
isVisible()
, isVisibilityAllowed()
, isRenderAllowed()
true
if the component should be visible, false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |