GemsFX Documentation

repository·master·Indexed 20 days ago

https://github.com/dlsc-software-consulting-gmbh/gemsfx

A collection of custom JavaFX controls and utilities for Java 11 and JavaFX 17+. GemsFX provides advanced UI components including CalendarView, DateRangePicker, SearchField, TagsField, and specialized text areas. It also includes layout panes like ResponsivePane, PowerPane, and DrawerStackPane, as well as utilities for internationalization via ResourceBundleManager and state persistence via SessionManager and StageManager.

Tokens
14.6K
Snippets
27
Records
105
Agent score
67%

What's inside GemsFX

  1. Use TextView to display and select multiline text

    master

    The TextView component is used to display multiline text. It supports text selection, allowing users to highlight content and copy it to the clipboard.

    Selection behaviors:

    • Mouse Dragging: Select text by clicking and dragging the mouse.
    • Double Click: Selects a single word.
    • Triple Click: Selects an entire paragraph.

    Copying text:

    • Keyboard Shortcuts: Users can use OS-specific shortcuts (e.g., CTRL-C on Windows/Linux or Command-C on macOS).
    • Context Menu: A built-in context menu is provided for copying selected text.
  2. Configure Internationalization in GemsFX

    master

    GemsFX uses ResourceBundleManager (com.dlsc.gemsfx.util) for built-in localized labels. The active locale defaults to Locale.getDefault().

    To set a custom locale, call ResourceBundleManager.setLocale() before creating your controls. Note that changing the locale clears the internal bundle cache and affects future lookups, but existing control instances are not guaranteed to live-refresh their text automatically.

    ResourceBundleManager.setLocale(Locale.GERMAN);
  3. Use SelectionBox for flexible single or multiple selection

    master
    The SelectionBox is a versatile selection control that combines the functionality of ComboBox and ChoiceBox. Unlike those standard controls which are limited to single selection, SelectionBox supports both single and multiple selection modes. This makes it suitable for UI requirements where users need to pick one item or a collection of items from a list.
  4. Use CalendarPicker for date selection

    master
    The CalendarPicker is a replacement for the standard JavaFX DatePicker. It provides a more advanced user experience by using a CalendarView for its month selection interface. Unlike the default JavaFX DatePicker, the CalendarPicker allows users to jump directly to specific months or years via the month view triggered by the button on the right-hand side of the control.
  5. Use the SearchField component

    master

    The SearchField is a specialized text field designed for auto-suggest capabilities where the primary outcome is a specific object type (defined by a generic type argument) rather than just raw text.

    Key features include:

    • Object-oriented selection: Automatically finds and selects objects matching user input.
    • On-the-fly creation: Can create new instances of the object type if no match is found (requires a New Item Producer).
    • Asynchronous suggestions: Uses JavaFX concurrency (Service & Task) to fetch suggestions with a built-in delay to prevent excessive searching while typing.
    • History support: Can be configured with a HistoryManager to track previous searches.
  6. Use TreeNodeView to display hierarchical structures

    master
    The TreeNodeView is a visual JavaFX control designed to display tree-like hierarchical structures. It is built upon the TreeNode class, where each node can contain children, making it suitable for representing data such as file systems, organizational charts, or any nested data model. The control is highly customizable in terms of layout, alignment, and styling.
  7. Use ResponsivePane for responsive layouts

    master

    The ResponsivePane is a container designed to manage the visibility of a sidebar and a main content panel based on the dimensions of the pane. It automatically adjusts the sidebar's visibility and size according to the available width (for left/right sidebars) or height (for top/bottom sidebars).

    Responsive Behavior (Width-based)

    When the sidebar is positioned on the LEFT or RIGHT:

    • Narrow width: The sidebar is hidden; only the content panel is visible.
    • Moderate width: Both a small sidebar and a large sidebar are available, alongside the content panel.
    • Wide width: The large sidebar and the main content pane are both displayed.

    Responsive Behavior (Height-based)

    When the sidebar is positioned at the TOP or BOTTOM, visibility is adjusted based on the height of the pane.

    Manual Override

    You can force the sidebar to remain visible regardless of the current pane dimensions.

  8. Track changes in nested ObservableLists with NestedListChangeTracker

    master

    Use NestedListChangeTracker to monitor modifications in a nested list structure (an ObservableList containing other ObservableList instances).

    This class extends AbstractChangeTracker and is designed to track changes at two levels:

    1. Outer List Changes: Additions, removals, or replacements of the inner lists themselves.
    2. Inner List Changes: Modifications (additions, removals, or updates) occurring within any of the nested inner lists.

    When any modification occurs at either level, the tracker notifies its consumer, making it ideal for synchronizing complex UI components with deeply nested data models.

    // Note: The provided documentation describes the concept but does not include a code snippet. 
    // Conceptually, it is used to wrap an ObservableList<ObservableList<T>>.
  9. Use PowerPane for rich client application layouts

    master

    The PowerPane is a composite layout component that aggregates several specialized panes from GemsFX and ControlsFX into a single structure. It is designed to serve as the foundational layout for rich client applications that require integrated notification and dialog management.

    PowerPane integrates the following specialized panes:

    • InfoCenterPane: Used for displaying notifications.
    • DialogPane: Used for displaying dialogs.
    • DrawerStackPane: Used to display a drawer or tray that slides in from the bottom.
    • HiddenSidesPane: Used to display trays that slide in from any of the four sides.
  10. Use StretchingTilePane to display a grid of stretched tiles

    master
    The StretchingTilePane is a specialized JavaFX pane designed to display a list of nodes (tiles) arranged in one or more rows. Unlike the standard JavaFX TilePane, StretchingTilePane automatically calculates how many tiles fit in a row and then stretches all tiles in that row to ensure they fill the entire width of the pane. All tiles within the pane maintain the same height and width.
  11. Use TemplatePane for flexible layouts

    master
    The TemplatePane is an incubating layout pane designed to arrange child nodes based on a flexible, named-position template. Instead of using traditional coordinate-based or stack-based layouts, you assign children to specific named areas such as header, footer, left, right, or content. This allows for highly adaptable UI structures where the layout logic is driven by the names of the positions rather than the order of addition.