org.controlsfx.control.BreadCrumbBar Java Examples

The following examples show how to use org.controlsfx.control.BreadCrumbBar. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BreadCrumbPresenter.java    From PreferencesFX with Apache License 2.0 6 votes vote down vote up
/**
 * Sets up the BreadcrumbBar depending on the displayed category.
 */
public void setupBreadCrumbBar() {
  String[] stringArr = model.getDisplayedCategory().getBreadcrumb().split(BREADCRUMB_DELIMITER);
  Category[] categories = new Category[stringArr.length];

  // Collecting all parent categories from the displayed category using the breadcrumb.
  // There will always be at least one category which will be added to the breadcrumb.
  categories[0] = searchCategory(stringArr[0]);

  // If there are more than one category in the stringArr[], they will be added. For this reason
  // the Integer in the loop starts with one, thus only the second element in the array is needed.
  for (int i = 1; i < stringArr.length; ++i) {
    stringArr[i] = stringArr[i - 1] + BREADCRUMB_DELIMITER + stringArr[i];
    categories[i] = searchCategory(stringArr[i]);
  }

  breadCrumbView.breadcrumbsItm = BreadCrumbBar.buildTreeModel(categories);
  breadCrumbView.breadCrumbBar.setSelectedCrumb(breadCrumbView.breadcrumbsItm);
}