org.apache.wicket.extensions.breadcrumb
Class BreadCrumbBar

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
                  extended by org.apache.wicket.markup.html.panel.Panel
                      extended by org.apache.wicket.extensions.breadcrumb.BreadCrumbBar
All Implemented Interfaces:
Serializable, IBreadCrumbModel, IClusterable, IConverterLocator, IHeaderPartContainerProvider

public class BreadCrumbBar
extends Panel
implements IBreadCrumbModel

A component that renders bread crumbs. By default, it renders a horizontal list from left to right (oldest left) with bread crumb links and a ' / ' as a separator, e.g.

 first / second / third
 

Delegates how the bread crumb model works to DefaultBreadCrumbsModel.

Override and provide your own markup file if you want to work with other elements, e.g. uls instead of spans.

Author:
Eelco Hillenius
See Also:
Serialized Form

Nested Class Summary
protected  class BreadCrumbBar.BreadCrumbsListView
          List view for rendering the bread crumbs.
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange
 
Field Summary
 
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_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
BreadCrumbBar(String id)
          Construct.
 
Method Summary
 void addListener(IBreadCrumbModelListener listener)
          Adds a bread crumb model listener.
 List<IBreadCrumbParticipant> allBreadCrumbParticipants()
          Lists the bread crumb participants in this model.
 IBreadCrumbParticipant getActive()
          Gets the currently active participant, if any.
protected  boolean getEnableLinkToCurrent()
          Gets whether the current bread crumb should be displayed as a link (e.g.
protected  String getSeparatorMarkup()
           
protected  Component newBreadCrumbComponent(String id, int index, int total, IBreadCrumbParticipant breadCrumbParticipant)
          Creates a new bread crumb component.
protected  void onDetach()
          Called to allow a component to detach resources after use.
 void removeListener(IBreadCrumbModelListener listener)
          Removes a bread crumb model listener.
 void setActive(IBreadCrumbParticipant breadCrumbParticipant)
          Sets the bread crumb as the active one.
 
Methods inherited from class org.apache.wicket.markup.html.panel.Panel
onComponentTag, onComponentTagBody, renderHead
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, toString, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, 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, internalAttach, internalDetach, internalOnAttach, internalOnDetach, internalOnModelChanged, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onConfigure, onEndRequest, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, 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
 

Constructor Detail

BreadCrumbBar

public BreadCrumbBar(String id)
Construct.

Parameters:
id - Component id
Method Detail

addListener

public void addListener(IBreadCrumbModelListener listener)
Description copied from interface: IBreadCrumbModel
Adds a bread crumb model listener.

Specified by:
addListener in interface IBreadCrumbModel
Parameters:
listener - The listener to add
See Also:
IBreadCrumbModel.addListener(org.apache.wicket.extensions.breadcrumb.IBreadCrumbModelListener)

allBreadCrumbParticipants

public List<IBreadCrumbParticipant> allBreadCrumbParticipants()
Description copied from interface: IBreadCrumbModel
Lists the bread crumb participants in this model.

Specified by:
allBreadCrumbParticipants in interface IBreadCrumbModel
Returns:
The bread crumbs participants, as list with bread crumb participants.
See Also:
IBreadCrumbModel.allBreadCrumbParticipants()

getActive

public IBreadCrumbParticipant getActive()
Description copied from interface: IBreadCrumbModel
Gets the currently active participant, if any.

Specified by:
getActive in interface IBreadCrumbModel
Returns:
The currently active participant, may be null
See Also:
IBreadCrumbModel.getActive()

removeListener

public void removeListener(IBreadCrumbModelListener listener)
Description copied from interface: IBreadCrumbModel
Removes a bread crumb model listener.

Specified by:
removeListener in interface IBreadCrumbModel
Parameters:
listener - The listener to remove
See Also:
IBreadCrumbModel.removeListener(org.apache.wicket.extensions.breadcrumb.IBreadCrumbModelListener)

setActive

public void setActive(IBreadCrumbParticipant breadCrumbParticipant)
Description copied from interface: IBreadCrumbModel
Sets the bread crumb as the active one. Implementations should call bread crumb added when the bread crumb was not yet part of the model, and bread crumb removed for every crumb that was removed as the result of this call.

Specified by:
setActive in interface IBreadCrumbModel
Parameters:
breadCrumbParticipant - The bread crump that should be set as the currently active
See Also:
IBreadCrumbModel.setActive(org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant)

getEnableLinkToCurrent

protected boolean getEnableLinkToCurrent()
Gets whether the current bread crumb should be displayed as a link (e.g. for refreshing) or as a disabled link (effectively just a label). The latter is the default. Override if you want different behavior.

Returns:
Whether the current bread crumb should be displayed as a link; this method returns false

getSeparatorMarkup

protected String getSeparatorMarkup()
Returns:
markup used as a separator between breadcrumbs. By default / is used, but >> is also a popular choice.

newBreadCrumbComponent

protected Component newBreadCrumbComponent(String id,
                                           int index,
                                           int total,
                                           IBreadCrumbParticipant breadCrumbParticipant)
Creates a new bread crumb component. That component will be rendered as part of the bread crumbs list (which is a <ul> <li> structure).

Parameters:
id - The component id
index - The index of the bread crumb
total - The total number of bread crumbs in the current model
breadCrumbParticipant - the bread crumb
Returns:
A new bread crumb component

onDetach

protected void onDetach()
Description copied from class: Component
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.

Overrides:
onDetach in class Component
See Also:
Component.onDetach()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.