Class TraversingMenuSelector

java.lang.Object
com.foreach.across.modules.web.menu.TraversingMenuSelector
All Implemented Interfaces:
MenuSelector

public abstract class TraversingMenuSelector extends Object implements MenuSelector
Simple implementation of MenuSelector that will iterate over all items in a menu tree and find the lowest item that matches.
  • Constructor Details

    • TraversingMenuSelector

      protected TraversingMenuSelector(boolean findLowest)
      If the boolean parameter is true, the entire tree will be scanned for the lowest matching item. If false, the first matching item will be returned.
      Parameters:
      findLowest - True if the lowest matching item should be found.
  • Method Details

    • isFindLowest

      public boolean isFindLowest()
    • setFindLowest

      public void setFindLowest(boolean findLowest)
    • find

      public Menu find(Menu menu)
      Description copied from interface: MenuSelector
      Search the given Menu for an item that matches the current selector.
      Specified by:
      find in interface MenuSelector
      Parameters:
      menu - Menu tree to search top-down.
      Returns:
      Matching Menu item or null if not found.
    • matches

      protected abstract boolean matches(Menu item)