wicket.markup.html.border
Class Border

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
                  extended by wicket.markup.html.border.Border
All Implemented Interfaces:
java.io.Serializable, IComponentResolver
Direct Known Subclasses:
BoxBorder, FormComponentFeedbackBorder

public abstract class Border
extends WebMarkupContainerWithAssociatedMarkup
implements IComponentResolver

A border component has associated markup which is drawn and determines placement of any markup and/or components nested within the border component.

The portion of the border's associated markup file which is to be used in rendering the border is denoted by a <wicket:border> tag. The children of the border component instance are then inserted into this markup, replacing the first <wicket:body> tag in the border's associated markup.

For example, if a border's associated markup looked like this:

              <html>
              <body>
                <wicket:border>
                    First <wicket:body/> Last
                </wicket:border>
              </body>
              </html>
 
And the border was used on a page like this:
              <html>
              <body>
                <span wicket:id = "myBorder">
                    Middle
                </span>
              </body>
              </html>
 
Then the resulting HTML would look like this:
              <html>
              <body>
                    First Middle Last
              </body>
              </html>
 
In other words, the body of the myBorder component is substituted into the border's associated markup at the position indicated by the <wicket:body> tag.

Regarding <wicket:body/> you have two options. Either use <wicket:body/> (open-close tag) which will automatically be expanded to <wicket:body>body content</wicket:body> or use <wicket:body>preview region</wicket:body> in your border's markup. The preview region (everything in between the open and close tag) will automatically be removed.

Author:
Jonathan Locke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
WebMarkupContainerWithAssociatedMarkup.HeaderPartContainer
 
Nested classes/interfaces inherited from class wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
Border(java.lang.String id)
           
Border(java.lang.String id, IModel model)
           
 
Method Summary
 boolean isTransparentResolver()
          Some MarkupContainers (e.g.
protected  void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
          Render the tag body
 void renderBodyComponent(MarkupStream markupStream, WicketTag wtag)
          Render the wicket:body and all what is in it.
protected  ComponentTag renderBodyComponentTag(MarkupStream markupStream, ComponentTag tag)
          Render the wicket:body tag
 void renderBodyComponentTagBody(MarkupStream markupStream, ComponentTag tag)
          Render the wicket:body tag
 void renderHead(HtmlHeaderContainer container)
          Print to the web response what ever the component wants to contribute to the head section.
 boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
          Border makes use of a <wicket:body> tag to identify the position to insert within the border's body.
 Border setBorderBodyVisible(boolean bodyVisible)
          When this method is called with a false value the components and raw markup that this border wraps will not be rendered.
 Border setTransparentResolver(boolean transparentResolver)
          Borders used for bordered pages should set it to "true".
 
Methods inherited from class wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onDetach, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Border

public Border(java.lang.String id)
See Also:
Component.Component(String)

Border

public Border(java.lang.String id,
              IModel model)
See Also:
Component.Component(String, IModel)
Method Detail

setBorderBodyVisible

public Border setBorderBodyVisible(boolean bodyVisible)
When this method is called with a false value the components and raw markup that this border wraps will not be rendered.

Parameters:
bodyVisible -
Returns:
this for chaining

isTransparentResolver

public boolean isTransparentResolver()
Description copied from class: MarkupContainer
Some MarkupContainers (e.g. HtmlHeaderContainer, BodyOnLoadContainer) have to be transparent with respect to there child components. A transparent container gets its children from its parent container.

Overrides:
isTransparentResolver in class MarkupContainer
Returns:
false. By default a MarkupContainer is not transparent.
See Also:
MarkupContainer.isTransparentResolver()

setTransparentResolver

public final Border setTransparentResolver(boolean transparentResolver)
Borders used for bordered pages should set it to "true". Default is "false".

Parameters:
transparentResolver -
Returns:
this for chaining

resolve

public final boolean resolve(MarkupContainer container,
                             MarkupStream markupStream,
                             ComponentTag tag)
Border makes use of a <wicket:body> tag to identify the position to insert within the border's body. As <wicket:body> is a special tag and MarkupContainer is not able to handle it, we do that here.

You have two options. Either use <wicket:body/> (open-close tag) which will automatically be expanded to <wicket:body>body content</wicket:body> or use <wicket:body>preview region</wicket:body> in your border's markup. The preview region (everything in between the open and close tag) will automatically be removed.

Specified by:
resolve in interface IComponentResolver
Parameters:
container - The container parsing its markup
markupStream - The current markupStream
tag - The current component tag while parsing the markup
Returns:
True if componentId was handled by the resolver, false otherwise.
See Also:
IComponentResolver.resolve(MarkupContainer, MarkupStream, ComponentTag)

onComponentTagBody

protected final void onComponentTagBody(MarkupStream markupStream,
                                        ComponentTag openTag)
Render the tag body

Overrides:
onComponentTagBody in class MarkupContainer
Parameters:
markupStream - The markup stream
openTag - The open tag for the body
See Also:
Component.onComponentTagBody(wicket.markup.MarkupStream, wicket.markup.ComponentTag)

renderHead

public void renderHead(HtmlHeaderContainer container)
Description copied from class: Component
Print to the web response what ever the component wants to contribute to the head section. Make sure that all attached behaviors are asked as well.

Overrides:
renderHead in class Component
Parameters:
container - The HtmlHeaderContainer
See Also:
Component.renderHead(wicket.markup.html.internal.HtmlHeaderContainer)

renderBodyComponent

public void renderBodyComponent(MarkupStream markupStream,
                                WicketTag wtag)
Render the wicket:body and all what is in it.

Parameters:
markupStream - The associated markup stream
wtag - The wicket:body tag

renderBodyComponentTagBody

public void renderBodyComponentTagBody(MarkupStream markupStream,
                                       ComponentTag tag)
Render the wicket:body tag

Parameters:
markupStream - The associated markup stream
tag - The wicket:body tag

renderBodyComponentTag

protected ComponentTag renderBodyComponentTag(MarkupStream markupStream,
                                              ComponentTag tag)
Render the wicket:body tag

Parameters:
tag - The wicket:body tag
markupStream - The associated markup stream
Returns:
the body tag. May be its type has been changed


Copyright © 2004-2007 Wicket developers. All Rights Reserved.