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 Detail

      • 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:
        getCellFactory(), setCellFactory(Callback)
    • Constructor Detail

      • ListActionView

        public ListActionView()
    • Method Detail

      • getItems

        public final ObservableList<T> getItems()
        The list of items for the list view.
        Returns:
        An ObservableList of T.
      • 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.
      • 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.
      • 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:
        getCellFactory(), setCellFactory(Callback)
      • 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)