org.apache.wicket.markup.html.basic
Class EnclosureContainer
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.basic.EnclosureContainer
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<Component>, IClusterable, IConverterLocator, IRequestableComponent
public class EnclosureContainer
- extends WebMarkupContainer
<wicket:enclosure>
is nice and prevents that users have to add boilerplate to
their application. But it is not without problems. The child components are children in the
markup, but the auto-component generated for the enclosure tag will not magically re-parent the
child components. Thus the markup hierarchy and the component hierarchy will be out of sync. The
automatically created enclosure container will be created along side its "children" with both
attached to the very same parent container. That leads to a tricky situation since e.g.
onBeforeRender()
will be called for enclosure children even if the enclosure is made
invisible by it controlling child.
On top auto-components cannot keep any state. A new instance is created during each render
process and automatically deleted at the end. That implies that we cannot prevent
validation() from being called, since validation() is called before the actual
render process has started.
Where any of these problems apply, you may replace the tag and manually add this simple container
which basically does the same. But instead of adding the children to the Page, Panel whatever,
you must add the children to this container in order to keep the component hierarchy in sync.
- Since:
- 1.5
- Author:
- Juergen Donnerstag
- See Also:
- Serialized Form
Fields inherited from class org.apache.wicket.Component |
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Method Summary |
boolean |
isVisible()
Gets whether this component and any children are visible. |
Methods inherited from class org.apache.wicket.MarkupContainer |
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupStream, getMarkupType, hasAssociatedMarkup, internalAdd, iterator, iterator, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren |
Methods inherited from class org.apache.wicket.Component |
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, isActionAuthorized, isAttached, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponent, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
EnclosureContainer
public EnclosureContainer(java.lang.String id,
Component child)
- Construct.
- Parameters:
id
- child
-
isVisible
public boolean isVisible()
- Description copied from class:
Component
- 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 Component.setVisible(boolean)
.
- Overrides:
isVisible
in class Component
- Returns:
- True if component and any children are visible
- See Also:
Component.isVisible()
Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.