Interface IBreadCrumbModel
-
- All Superinterfaces:
IClusterable
,Serializable
- All Known Implementing Classes:
BreadCrumbBar
,DefaultBreadCrumbsModel
public interface IBreadCrumbModel extends IClusterable
Bread crumbs provide a means to track certain history of client actions. Bread crumbs are typically rendered as a list of links, and are useful when users 'dig deeper' into the site structure so that they can find their way back again and have a notion of where they currently are.Bread crumbs in the original sense just represent where people are in a site hierarchy. For example, when browsing a product site, bread crumbs could look like this:
Home > Products & Solutions > Hardware > Desktop Systems
orWorld > Europe > The Netherlands > Utrecht
These items would be rendered as links to the corresponding site location. Classes that implement this interface are responsible for managing such a bread crumb structure. Atypical implementation
regards bread crumbs as a stack. Whena bread crumb is activated
that was not in the stack yet, it would add it to the stack, or when a bread crumb is activated that is already on the stack, it would roll back to the corresponding depth.This model does not make any presumptions on how it should interact with components. Just that there is a list of
bread crumb participants
, and the notion of a currently active bread crumb participant.A
bread crumb participant
is not an actual bread crumb, but rather a proxy to components that represent a certain location relative to other bread crumbs in this model, and a means to get the bread crumb title, which is typically rendered as a link label of the actual bread crumb. The actual bread crumbs are supposed to be rendered by a component that works together with this model. I choose this model as this would suit what I think is one of the nicest patterns:bread crumb aware panels
.- Author:
- Eelco Hillenius
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.void
removeListener(IBreadCrumbModelListener listener)
Removes a bread crumb model listener.void
setActive(IBreadCrumbParticipant breadCrumbParticipant)
Sets thebread crumb
as the active one.
-
-
-
Method Detail
-
addListener
void addListener(IBreadCrumbModelListener listener)
Adds a bread crumb model listener.- Parameters:
listener
- The listener to add
-
allBreadCrumbParticipants
List<IBreadCrumbParticipant> allBreadCrumbParticipants()
Lists the bread crumb participants in this model.- Returns:
- The bread crumbs participants, as list with
bread crumb participants
.
-
getActive
IBreadCrumbParticipant getActive()
Gets the currently active participant, if any.- Returns:
- The currently active participant, may be null
-
removeListener
void removeListener(IBreadCrumbModelListener listener)
Removes a bread crumb model listener.- Parameters:
listener
- The listener to remove
-
setActive
void setActive(IBreadCrumbParticipant breadCrumbParticipant)
Sets thebread crumb
as the active one. Implementations should callbread crumb added
when the bread crumb was not yet part of the model, andbread crumb removed
for every crumb that was removed as the result of this call.- Parameters:
breadCrumbParticipant
- The bread crump that should be set as the currently active
-
-