Class BreadCrumbBar<T>

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class BreadCrumbBar<T> extends Control
Represents a bread crumb bar. This control is useful to visualize and navigate a hierarchical path structure, such as file systems.

Shown below is a screenshot of the BreadCrumbBar control:

Screenshot of BreadCrumbBar
  • Property Details

  • Constructor Details

    • BreadCrumbBar

      public BreadCrumbBar()
      Creates an empty bread crumb bar
    • BreadCrumbBar

      public BreadCrumbBar(TreeItem<T> selectedCrumb)
      Creates a bread crumb bar with the given TreeItem as the currently selected crumb.
  • Method Details

    • buildTreeModel

      public static <T> TreeItem<T> buildTreeModel(T... crumbs)
      Construct a tree model from the flat list which then can be set as selectedCrumb node to be shown
      Parameters:
      crumbs -
    • selectedCrumbProperty

      public final ObjectProperty<TreeItem<T>> selectedCrumbProperty()
      Represents the bottom-most path node (the node on the most-right side in terms of the bread crumb bar). The full path is then being constructed using getParent() of the tree-items.

      Consider the following hierarchy: [Root] > [Folder] > [SubFolder] > [myfile.txt] To show the above bread crumb bar, you have to set the [myfile.txt] tree-node as selected crumb.

      See Also:
    • getSelectedCrumb

      public final TreeItem<T> getSelectedCrumb()
      Get the current target path
    • setSelectedCrumb

      public final void setSelectedCrumb(TreeItem<T> selectedCrumb)
      Select one node in the BreadCrumbBar for being the bottom-most path node.
      Parameters:
      selectedCrumb -
    • autoNavigationEnabledProperty

      public final BooleanProperty autoNavigationEnabledProperty()
      Enable or disable auto navigation (default is enabled). If auto navigation is enabled, it will automatically navigate to the crumb which was clicked by the user.
      See Also:
    • isAutoNavigationEnabled

      public final boolean isAutoNavigationEnabled()
      Return whether auto-navigation is enabled.
      Returns:
      whether auto-navigation is enabled.
    • setAutoNavigationEnabled

      public final void setAutoNavigationEnabled(boolean enabled)
      Enable or disable auto navigation (default is enabled). If auto navigation is enabled, it will automatically navigate to the crumb which was clicked by the user.
      Parameters:
      enabled -
    • crumbFactoryProperty

      public final ObjectProperty<Callback<TreeItem<T>,Button>> crumbFactoryProperty()
      Return an ObjectProperty of the CrumbFactory.
      See Also:
    • setCrumbFactory

      public final void setCrumbFactory(Callback<TreeItem<T>,Button> value)
      Sets the crumb factory to create (custom) BreadCrumbBar.BreadCrumbButton instances. null is not allowed and will result in a fall back to the default factory.
      Parameters:
      value -
    • getCrumbFactory

      public final Callback<TreeItem<T>,Button> getCrumbFactory()
      Returns the cell factory that will be used to create BreadCrumbBar.BreadCrumbButton instances
    • onCrumbActionProperty

      public final ObjectProperty<EventHandler<BreadCrumbBar.BreadCrumbActionEvent<T>>> onCrumbActionProperty()
      See Also:
    • setOnCrumbAction

      public final void setOnCrumbAction(EventHandler<BreadCrumbBar.BreadCrumbActionEvent<T>> value)
      Set a new EventHandler for when a user selects a crumb.
      Parameters:
      value -
    • getOnCrumbAction

      public final EventHandler<BreadCrumbBar.BreadCrumbActionEvent<T>> getOnCrumbAction()
      Return the EventHandler currently used when a user selects a crumb.
      Returns:
      the EventHandler currently used when a user selects a crumb.
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Overrides:
      createDefaultSkin in class Control
    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class Region
    • getUserAgentStylesheet

      protected final String getUserAgentStylesheet(Class<?> clazz, String fileName)
      A helper method that ensures that the resource based lookup of the user agent stylesheet only happens once. Caches the external form of the resource.
      Parameters:
      clazz - the class used for the resource lookup
      fileName - the name of the user agent stylesheet
      Returns:
      the external form of the user agent stylesheet (the path)