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
    • Constructor Detail

      • 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 Detail

      • 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(), setSelectedCrumb(TreeItem)
      • 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 -
      • 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 -
      • 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 -
      • 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.
      • 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)