Class ListActionView<T>

Type Parameters:
T - Type of ListActionView.
All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class ListActionView<T> extends Control
A control used to perform actions on a ListView. Actions can be added by accessing the action list. These actions are represented as buttons on the control. These buttons can be moved to any side of the ListView using the sideProperty().

Screenshot

Screenshot of ListActionView

Code Example

     ListActionView view = new ListActionView<>();
     view.getItems().add("One", "Two", "Three");
     view.getActions().add(new ListActionView.ListAction() {
         {
             setGraphic(new FontAwesome().create(FontAwesome.Glyph.BOLT));
         }

        @Override
         public void initialize(ListView listView) {
             setEventHandler(e -> System.out.println("Action fired!"));
         }
     });
     view.getActions().add(ActionUtils.ACTION_SEPARATOR);
 
  • Property Details

    • side

      public ObjectProperty<Side> sideProperty
      The position of the action buttons in the ListActionView.
      See Also:
    • cellFactory

      public final ObjectProperty<Callback<ListView<T>,ListCell<T>>> cellFactoryProperty
      Setting a custom cell factory has the effect of deferring all cell creation, allowing for total customization of the cell. Internally, the ListView is responsible for reusing ListCells - all that is necessary is for the custom cell factory to return from this function a ListCell which might be usable for representing any item in the ListView.

      Refer to the Cell class documentation for more detail.

      See Also:
  • Constructor Details

    • ListActionView

      public ListActionView()
  • Method Details

    • getItems

      public final ObservableList<T> getItems()
      The list of items for the list view.
      Returns:
      An ObservableList of T.
    • getActions

      public final ObservableList<Action> getActions()
      The list of actions shown on one of the sides of the ListView. All actions except, ActionUtils.ACTION_SEPARATOR and ActionUtils.ACTION_SPAN, are represented as buttons.

      For actions dependent on the internal ListView, an instance of ListActionView.ListAction should be used.

      Returns:
      An ObservableList of actions.
    • getSide

      public Side getSide()
      The current position of the action buttons in the ListActionView.
      Default value:
      Side.LEFT
      Returns:
      The current position of the action buttons in the ListActionView.
    • sideProperty

      public ObjectProperty<Side> sideProperty()
      The position of the action buttons in the ListActionView.
      See Also:
    • setSide

      public void setSide(Side side)
      The position to place the action buttons in this ListActionView. Whenever this changes the ListActionView will immediately update the location of the action buttons to reflect the same.
      Parameters:
      side - The side to place the action buttons.
    • setCellFactory

      public final void setCellFactory(Callback<ListView<T>,ListCell<T>> value)
      Sets a new cell factory for the list view. This forces all old ListCell's to be thrown away, and new ListCell's created with the new cell factory.
    • getCellFactory

      public final Callback<ListView<T>,ListCell<T>> getCellFactory()
      Returns the current cell factory.
    • cellFactoryProperty

      public final ObjectProperty<Callback<ListView<T>,ListCell<T>>> cellFactoryProperty()
      Setting a custom cell factory has the effect of deferring all cell creation, allowing for total customization of the cell. Internally, the ListView is responsible for reusing ListCells - all that is necessary is for the custom cell factory to return from this function a ListCell which might be usable for representing any item in the ListView.

      Refer to the Cell class documentation for more detail.

      See Also:
    • 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)