Package org.conical.common.bbl.web.util
Class BreadCrumbTrail
java.lang.Object
org.conical.common.bbl.web.util.BreadCrumbTrail
Keeps track of BreadCrumbs and manages how they are added and removed. This implementation
uses a stack to access the crumbs, and will remove crumbs that are the same level deep as
others are added.
- Author:
- rdoherty
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBreadCrumb
(BreadCrumb newCrumb) Adds the passedBreadCrumb
to the trail.void
clear()
Clears the stack of crumbs.Returns the current stack of crumbs (in bottom to top order).
-
Constructor Details
-
BreadCrumbTrail
public BreadCrumbTrail()
-
-
Method Details
-
addBreadCrumb
Adds the passedBreadCrumb
to the trail. If the trail is empty, simply pushes onto the stack. If not, traverses the stack looking for a BreadCrumb of a lower level, removing each as it goes along. If it finds one of the same level, that one will be the last to be removed and the passed crumb replaces it. If the stack is empty before this happens, the passed crumb is simply added and is the lowest level.- Parameters:
newCrumb
- new crumb to be added
-
getCrumbs
Returns the current stack of crumbs (in bottom to top order).- Returns:
- current bread crumbs on the stack
-
clear
public void clear()Clears the stack of crumbs.
-