wicket.markup.html.border
Class Border

java.lang.Object
  extended bywicket.Component
      extended bywicket.MarkupContainer
          extended bywicket.markup.html.WebMarkupContainer
              extended bywicket.markup.html.border.Border
All Implemented Interfaces:
IAjaxListener, IComponentResolver, IComponentResolverMarker, IHeaderContributor, IHeaderRenderer, IRequestListener, java.io.Serializable
Direct Known Subclasses:
BoxBorder, FormComponentFeedbackBorder

public abstract class Border
extends WebMarkupContainer
implements IComponentResolver, IComponentResolverMarker, IHeaderRenderer

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 inherited from class wicket.Component
Component.ComponentModelChange, Component.IVisitor, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4
 
Constructor Summary
Border(java.lang.String id)
           
Border(java.lang.String id, IModel model)
           
 
Method Summary
protected  void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
          Render the tag body
 void renderHeaderSections(HtmlHeaderContainer container)
          "Visit all components of the component hierarchie and ask if they have something to contribute to the header section of the page.
 boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
          Border makes use of a <wicket:body> tag to indentify the position to insert within the border's body.
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, onRender, renderHead
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalBeginRequest, internalEndRequest, iterator, iterator, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, add, addStateChange, checkComponentTag, checkComponentTagAttribute, debug, detachModel, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxHandlers, getApplication, getApplicationPages, getApplicationSettings, getClassRelativePath, getComparator, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getId, getLocale, getLocalizer, getModel, getModelObject, getModelObjectAsString, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResource, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnBeginRequest, internalOnEndRequest, internalOnModelChanged, internalOnModelChanging, isAncestorOf, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onBeginRequest, onComponentTag, onEndRequest, onModelChanged, onModelChanging, onRequest, onSessionAttach, redirectTo, remove, render, renderComponent, renderComponentTag, rendered, replaceComponentTagBody, sameRootModel, sameRootModel, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setModelObject, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, 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

resolve

public boolean resolve(MarkupContainer container,
                       MarkupStream markupStream,
                       ComponentTag tag)
Border makes use of a <wicket:body> tag to indentify 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)

renderHeaderSections

public final void renderHeaderSections(HtmlHeaderContainer container)
"Visit all components of the component hierarchie and ask if they have something to contribute to the header section of the page. If yes, child components will return a MarkupContainer of there header section which gets (auto) added to the component hierarchie and immediately rendered.". In case of bordered Pages, the header component is not added to the Page, but to the Border component. Thus, in order to handle bordered pages properly, we must the request down one more level. In case of a bordered page, it is a Page component.

Specified by:
renderHeaderSections in interface IHeaderRenderer
Parameters:
container - The current html header container


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