Class BreadCrumbTrail

java.lang.Object
org.conical.common.bbl.web.util.BreadCrumbTrail

public class BreadCrumbTrail extends Object
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 Details

    • BreadCrumbTrail

      public BreadCrumbTrail()
  • Method Details

    • addBreadCrumb

      public void addBreadCrumb(BreadCrumb newCrumb)
      Adds the passed BreadCrumb 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

      public Collection<BreadCrumb> 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.