Top Description Inners Fields Constructors Methods
com.dlsc.gemsfx

public Class MultiColumnListView<T>

extends Control
Class Inheritance
Type Parameters
<T>
the item types, e.g. "Issues" or "Tickets"
Imports
com.dlsc.gemsfx.LoadingPane.Size, .LoadingPane.Status, com.dlsc.gemsfx.skins.MultiColumnListViewSkin, com.dlsc.gemsfx.util.ListUtils, javafx.beans.InvalidationListener, javafx.beans.property.BooleanProperty, .ListProperty, .ObjectProperty, .ReadOnlyBooleanProperty, .ReadOnlyBooleanWrapper, .SimpleBooleanProperty, .SimpleListProperty, .SimpleObjectProperty, javafx.collections.FXCollections, .ObservableList, javafx.css.PseudoClass, javafx.scene.Node, .SnapshotParameters, javafx.scene.control.Control, .Label, .ListCell, .ListView, .ProgressIndicator, .Skin, javafx.scene.image.WritableImage, javafx.scene.input.ClipboardContent, .DragEvent, .Dragboard, .TransferMode, javafx.scene.layout.Region, javafx.scene.paint.Color, javafx.util.Callback, java.util.Objects

A view for displaying multiple columns where each column consists of a header control and a ListView. The control allows the user to rearrange the items in each ListView and also to drag and drop items from one column to another.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
MultiColumnListView.ColumnListCell<
the type of items in the list
T
>

A special list cell to be used in combination with the MultiColumnListView control.

public static class
MultiColumnListView.ListViewColumn<
the type of items shown by the column
T
>

The model object representing a single column.

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>>
private final ListProperty<MultiColumnListView.ListViewColumn<T>>
private final BooleanProperty
private final ObjectProperty<T>
private final ObservableList<T>
private final ObjectProperty<Callback<MultiColumnListView<T>, ListView<T>>>
private final ObjectProperty<LoadingPane.Status>
private final ObjectProperty<LoadingPane.Size>
private final ObjectProperty<T>
private final ObjectProperty<T>
private final ObjectProperty<ProgressIndicator>
private final ObjectProperty<Callback<Integer, Node>>
private final BooleanProperty

Constructor Summary

AccessConstructor and Description
public
MultiColumnListView()

Constructs a new view.

Method Summary

Modifier and TypeMethod and Description
public final ObjectProperty<Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>>

Returns:

the cell factory
cellFactoryProperty
()

The cell factory that will be used for each one of the ListView instances.

public final ListProperty<MultiColumnListView.ListViewColumn<T>>

Returns:

the list of columns
columnsProperty
()

A list of columns that define how many columns will be shown inside the view.

protected Skin<?>
createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control.

public final BooleanProperty

Returns:

"true" if the control allows rearranging items via drag and drop
disableDragAndDropProperty
()

Controls whether the user can rearrange items via drag and drop or not.

public final ObjectProperty<T>
public final Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>
public final ObservableList<MultiColumnListView.ListViewColumn<T>>
public final T
public final ObservableList<T>
public final Callback<MultiColumnListView<T>, ListView<T>>
public final LoadingPane.Status
public LoadingPane.Size
public final T
public final T
public final ProgressIndicator
public final Callback<Integer, Node>
public String
getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method.

public final boolean
public final boolean
public final ObjectProperty<Callback<MultiColumnListView<T>, ListView<T>>>

Returns:

the factory for creating the required list views, one for each column
listViewFactoryProperty
()

Stores the callback that will be invoked to produce new ListView instances.

public final ObjectProperty<LoadingPane.Status>
public ObjectProperty<LoadingPane.Size>
public final ObjectProperty<T>

Returns:

the placeholder model item for the "from" location
placeholderFromProperty
()

A model item that represents the "from" location during drag and drop operations.

public final ObjectProperty<T>

Returns:

the placeholder model item for the "to" location
placeholderToProperty
()

A model item that represents the "to" location during drag and drop operations.

public final ObjectProperty<ProgressIndicator>

Returns:

the progress indicator
progressIndicatorProperty
()

The progress indicator that will be used to display percentage progress or the indeterminate state of the loading progress.

public final ObjectProperty<Callback<Integer, Node>>

Returns:

a separator node
separatorFactoryProperty
()

An optional factory for creating separators that will be placed between columns.

public final void
public final void
public final void
setDisableDragAndDrop(boolean disableDragAndDrop)

public final void
setDraggedItem(T draggedItem)

public final void
public final void
public void
public final void
setPlaceholderFrom(T placeholderFrom)

public final void
setPlaceholderTo(T placeholderTo)

public final void
public final void
public final void
setShowHeaders(boolean showHeaders)

public final BooleanProperty

Returns:

true if the headers should be shown
showHeadersProperty
()

Determines whether the headers will be shown or not.

Inherited from javafx.scene.control.Control:
computeMaxHeightcomputeMaxWidthcomputeMinHeightcomputeMinWidthcomputePrefHeightcomputePrefWidthcontextMenuPropertyexecuteAccessibleActiongetBaselineOffsetgetClassCssMetaDatagetContextMenugetControlCssMetaDatagetCssMetaDatagetInitialFocusTraversablegetSkingetTooltipisResizablelayoutChildrenqueryAccessibleAttributesetContextMenusetSkinsetTooltipskinPropertytooltipProperty

Field Detail

cellFactoryback to summary
private final ObjectProperty<Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>> cellFactory
columnsback to summary
private final ListProperty<MultiColumnListView.ListViewColumn<T>> columns
disableDragAndDropback to summary
private final BooleanProperty disableDragAndDrop
draggedItemback to summary
private final ObjectProperty<T> draggedItem
draggedItemsback to summary
private final ObservableList<T> draggedItems
listViewFactoryback to summary
private final ObjectProperty<Callback<MultiColumnListView<T>, ListView<T>>> listViewFactory
loadingStatusback to summary
private final ObjectProperty<LoadingPane.Status> loadingStatus
loadingStatusSizeback to summary
private final ObjectProperty<LoadingPane.Size> loadingStatusSize
placeholderFromback to summary
private final ObjectProperty<T> placeholderFrom
placeholderToback to summary
private final ObjectProperty<T> placeholderTo
progressIndicatorback to summary
private final ObjectProperty<ProgressIndicator> progressIndicator
separatorFactoryback to summary
private final ObjectProperty<Callback<Integer, Node>> separatorFactory
showHeadersback to summary
private final BooleanProperty showHeaders

Constructor Detail

MultiColumnListViewback to summary
public MultiColumnListView()

Constructs a new view.

Method Detail

cellFactoryPropertyback to summary
public final ObjectProperty<Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>> cellFactoryProperty()

The cell factory that will be used for each one of the ListView instances.

Returns:ObjectProperty<Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>>>

the cell factory

columnsPropertyback to summary
public final ListProperty<MultiColumnListView.ListViewColumn<T>> columnsProperty()

A list of columns that define how many columns will be shown inside the view. The model objects in this list also store the header and the data for each column.

Returns:ListProperty<MultiColumnListView.ListViewColumn<T>>

the list of columns

createDefaultSkinback to summary
protected Skin<?> createDefaultSkin()

Overrides javafx.scene.control.Control.createDefaultSkin.

Doc from javafx.scene.control.Control.createDefaultSkin.

Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).

Annotations
@Override
disableDragAndDropPropertyback to summary
public final BooleanProperty disableDragAndDropProperty()

Controls whether the user can rearrange items via drag and drop or not.

Returns:BooleanProperty

"true" if the control allows rearranging items via drag and drop

draggedItemPropertyback to summary
public final ObjectProperty<T> draggedItemProperty()
getCellFactoryback to summary
public final Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>> getCellFactory()
getColumnsback to summary
public final ObservableList<MultiColumnListView.ListViewColumn<T>> getColumns()
getDraggedItemback to summary
public final T getDraggedItem()
getDraggedItemsback to summary
public final ObservableList<T> getDraggedItems()
getListViewFactoryback to summary
public final Callback<MultiColumnListView<T>, ListView<T>> getListViewFactory()
getLoadingStatusback to summary
public final LoadingPane.Status getLoadingStatus()
getLoadingStatusSizeback to summary
public LoadingPane.Size getLoadingStatusSize()
getPlaceholderFromback to summary
public final T getPlaceholderFrom()
getPlaceholderToback to summary
public final T getPlaceholderTo()
getProgressIndicatorback to summary
public final ProgressIndicator getProgressIndicator()
getSeparatorFactoryback to summary
public final Callback<Integer, Node> getSeparatorFactory()
getUserAgentStylesheetback to summary
public String getUserAgentStylesheet()

Overrides javafx.scene.layout.Region.getUserAgentStylesheet.

Doc from javafx.scene.layout.Region.getUserAgentStylesheet.

An implementation may specify its own user-agent styles for this Region, and its children, by overriding this method. These styles are used in addition to whatever user-agent stylesheets are in use. This provides a mechanism for third parties to introduce styles for custom controls.

The URL is a hierarchical URI of the form [scheme:][//authority][path]. If the URL does not have a [scheme:] component, the URL is considered to be the [path] component only. Any leading '/' character of the [path] is ignored and the [path] is treated as a path relative to the root of the application's classpath.

Subclasses overriding this method should not assume any particular implementation approach as to the number and frequency with which it is called. For this reason, attempting any kind of dynamic implementation (i.e. returning different user agent stylesheet values) based on some state change is highly discouraged, as there is no guarantee when, or even if, this method will be called. Some JavaFX CSS implementations may choose to cache this response for an indefinite period of time, and therefore there should be no expectation around when this method is called.



package com.example.javafx.app;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class MyApp extends Application {

    @Override public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        scene.getStylesheets().add("/com/example/javafx/app/mystyles.css");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
For additional information about using CSS with the scene graph, see the CSS Reference Guide.
Annotations
@Override
isDisableDragAndDropback to summary
public final boolean isDisableDragAndDrop()
isShowHeadersback to summary
public final boolean isShowHeaders()
listViewFactoryPropertyback to summary
public final ObjectProperty<Callback<MultiColumnListView<T>, ListView<T>>> listViewFactoryProperty()

Stores the callback that will be invoked to produce new ListView instances.

Returns:ObjectProperty<Callback<MultiColumnListView<T>, ListView<T>>>

the factory for creating the required list views, one for each column

loadingStatusPropertyback to summary
public final ObjectProperty<LoadingPane.Status> loadingStatusProperty()
loadingStatusSizePropertyback to summary
public ObjectProperty<LoadingPane.Size> loadingStatusSizeProperty()
placeholderFromPropertyback to summary
public final ObjectProperty<T> placeholderFromProperty()

A model item that represents the "from" location during drag and drop operations.

Returns:ObjectProperty<T>

the placeholder model item for the "from" location

placeholderToPropertyback to summary
public final ObjectProperty<T> placeholderToProperty()

A model item that represents the "to" location during drag and drop operations.

Returns:ObjectProperty<T>

the placeholder model item for the "to" location

progressIndicatorPropertyback to summary
public final ObjectProperty<ProgressIndicator> progressIndicatorProperty()

The progress indicator that will be used to display percentage progress or the indeterminate state of the loading progress.

Returns:ObjectProperty<ProgressIndicator>

the progress indicator

separatorFactoryPropertyback to summary
public final ObjectProperty<Callback<Integer, Node>> separatorFactoryProperty()

An optional factory for creating separators that will be placed between columns. The default implementation creates a region and adds the style class "column-separator". No separators will be added to the view when the factory is being set to null.

Returns:ObjectProperty<Callback<Integer, Node>>

a separator node

setCellFactoryback to summary
public final void setCellFactory(Callback<MultiColumnListView<T>, MultiColumnListView.ColumnListCell<T>> cellFactory)
setColumnsback to summary
public final void setColumns(ObservableList<MultiColumnListView.ListViewColumn<T>> columns)
setDisableDragAndDropback to summary
public final void setDisableDragAndDrop(boolean disableDragAndDrop)
setDraggedItemback to summary
public final void setDraggedItem(T draggedItem)
setListViewFactoryback to summary
public final void setListViewFactory(Callback<MultiColumnListView<T>, ListView<T>> listViewFactory)
setLoadingStatusback to summary
public final void setLoadingStatus(LoadingPane.Status loadingStatus)
setLoadingStatusSizeback to summary
public void setLoadingStatusSize(LoadingPane.Size loadingStatusSize)
setPlaceholderFromback to summary
public final void setPlaceholderFrom(T placeholderFrom)
setPlaceholderToback to summary
public final void setPlaceholderTo(T placeholderTo)
setProgressIndicatorback to summary
public final void setProgressIndicator(ProgressIndicator progressIndicator)
setSeparatorFactoryback to summary
public final void setSeparatorFactory(Callback<Integer, Node> separatorFactory)
setShowHeadersback to summary
public final void setShowHeaders(boolean showHeaders)
showHeadersPropertyback to summary
public final BooleanProperty showHeadersProperty()

Determines whether the headers will be shown or not. Toggling this property will trigger a rebuild of the view.

Returns:BooleanProperty

true if the headers should be shown

com.dlsc.gemsfx back to summary

public Class MultiColumnListView.ColumnListCell<T>

extends ListCell<T>
Class Inheritance
Type Parameters
<T>
the type of items in the list

A special list cell to be used in combination with the MultiColumnListView control. The cell adds drag and drop support for re-arranging list cells and for dragging them from one column to another.

Field Summary

Modifier and TypeField and Description
private final ReadOnlyBooleanWrapper
private final MultiColumnListView<T>
private final ReadOnlyBooleanWrapper
private final ReadOnlyBooleanWrapper

Constructor Summary

AccessConstructor and Description
public
ColumnListCell(MultiColumnListView<T>
reference to the MultiColumnListView control where the cell is being used
multiColumnListView
)

Creates a new list cell.

Method Summary

Modifier and TypeMethod and Description
public final ReadOnlyBooleanProperty

Returns:

true if the currently shown item is the "from" placeholder object
fromPlaceholderProperty
()

A read-only property that is being set to true if the item in the cell is currently the "from" placeholder item (see MultiColumnListView#placeholderFromProperty()).

public final MultiColumnListView<T>

Returns:

the parent control
getMultiColumnListView
()

Returns the MultiColumnListView control where the cell is being used.

protected Node

Returns:

the snapshot node
getSnapshotNode
()

Retrieves the node that will be used to create a drag image via the Node#snapshot(SnapshotParameters, WritableImage) method.

public final boolean
public final boolean
public final boolean
private void
log(String text)

private boolean
notNextToEachOther(int fromIndex, int toIndex)

public final ReadOnlyBooleanWrapper

Returns:

true if the currently shown item is either the "from" or the "to" placeholder object
placeholderProperty
()

A read-only property that is being set to true if the item in the cell is currently either one of the two placeholder items (see MultiColumnListView#placeholderFromProperty() or MultiColumnListView#placeholderToProperty()).

public final ReadOnlyBooleanProperty

Returns:

true if the currently shown item is the "to" placeholder object
toPlaceholderProperty
()

A read-only property that is being set to true if the item in the cell is currently the "to" placeholder item (see MultiColumnListView#placeholderToProperty()).

private void
protected void
updateItem(T item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell.

private void
Inherited from javafx.scene.control.ListCell:
cancelEditcommitEditcreateDefaultSkinexecuteAccessibleActiongetListViewlayoutChildrenlistViewPropertyqueryAccessibleAttributestartEditupdateListView

Field Detail

fromPlaceholderback to summary
private final ReadOnlyBooleanWrapper fromPlaceholder
multiColumnListViewback to summary
private final MultiColumnListView<T> multiColumnListView
placeholderback to summary
private final ReadOnlyBooleanWrapper placeholder
toPlaceholderback to summary
private final ReadOnlyBooleanWrapper toPlaceholder

Constructor Detail

ColumnListCellback to summary
public ColumnListCell(MultiColumnListView<T> multiColumnListView)

Creates a new list cell.

Parameters
multiColumnListView:MultiColumnListView<T>

reference to the MultiColumnListView control where the cell is being used

Method Detail

fromPlaceholderPropertyback to summary
public final ReadOnlyBooleanProperty fromPlaceholderProperty()

A read-only property that is being set to true if the item in the cell is currently the "from" placeholder item (see MultiColumnListView#placeholderFromProperty()).

Returns:ReadOnlyBooleanProperty

true if the currently shown item is the "from" placeholder object

getMultiColumnListViewback to summary
public final MultiColumnListView<T> getMultiColumnListView()

Returns the MultiColumnListView control where the cell is being used.

Returns:MultiColumnListView<T>

the parent control

getSnapshotNodeback to summary
protected Node getSnapshotNode()

Retrieves the node that will be used to create a drag image via the Node#snapshot(SnapshotParameters, WritableImage) method.

Returns:Node

the snapshot node

isFromPlaceholderback to summary
public final boolean isFromPlaceholder()
isPlaceholderback to summary
public final boolean isPlaceholder()
isToPlaceholderback to summary
public final boolean isToPlaceholder()
logback to summary
private void log(String text)
notNextToEachOtherback to summary
private boolean notNextToEachOther(int fromIndex, int toIndex)
placeholderPropertyback to summary
public final ReadOnlyBooleanWrapper placeholderProperty()

A read-only property that is being set to true if the item in the cell is currently either one of the two placeholder items (see MultiColumnListView#placeholderFromProperty() or MultiColumnListView#placeholderToProperty()).

Returns:ReadOnlyBooleanWrapper

true if the currently shown item is either the "from" or the "to" placeholder object

toPlaceholderPropertyback to summary
public final ReadOnlyBooleanProperty toPlaceholderProperty()

A read-only property that is being set to true if the item in the cell is currently the "to" placeholder item (see MultiColumnListView#placeholderToProperty()).

Returns:ReadOnlyBooleanProperty

true if the currently shown item is the "to" placeholder object

updateDraggedPseudoStateback to summary
private void updateDraggedPseudoState()
updateItemback to summary
protected void updateItem(T item, boolean empty)

Overrides javafx.scene.control.Cell.updateItem.

Doc from javafx.scene.control.Cell.updateItem.

The updateItem method should not be called by developers, but it is the best method for developers to override to allow for them to customise the visuals of the cell. To clarify, developers should never call this method in their code (they should leave it up to the UI control, such as the javafx.scene.control.ListView control) to call this method. However, the purpose of having the updateItem method is so that developers, when specifying custom cell factories (again, like the ListView cell factory), the updateItem method can be overridden to allow for complete customisation of the cell.

It is very important that subclasses of Cell override the updateItem method properly, as failure to do so will lead to issues such as blank cells or cells with unexpected content appearing within them. Here is an example of how to properly override the updateItem method:

protected void updateItem(T item, boolean empty) {
    super.updateItem(item, empty);

    if (empty || item == null) {
        setText(null);
        setGraphic(null);
    } else {
        setText(item.toString());
    }
}

Note in this code sample two important points:

  1. We call the super.updateItem(T, boolean) method. If this is not done, the item and empty properties are not correctly set, and you are likely to end up with graphical issues.
  2. We test for the empty condition, and if true, we set the text and graphic properties to null. If we do not do this, it is almost guaranteed that end users will see graphical artifacts in cells unexpectedly.
Annotations
@Override
updateItemsback to summary
private void updateItems(DragEvent event)
com.dlsc.gemsfx back to summary

public Class MultiColumnListView.ListViewColumn<T>

extends Object
Class Inheritance
Type Parameters
<T>
the type of items shown by the column

The model object representing a single column. The type of the items in all columns must be the same.

Field Summary

Modifier and TypeField and Description
private final ObjectProperty<Node>
private final ListProperty<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final Node
public final ObservableList<T>
public final ObjectProperty<Node>

Returns:

the header node / header UI
headerProperty
()

An optional node that will serve as the column's header.

public final ListProperty<T>

Returns:

the model for this column
itemsProperty
()

The data shown in the column.

public final void
setHeader(Node header)

public final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

headerback to summary
private final ObjectProperty<Node> header
itemsback to summary
private final ListProperty<T> items

Constructor Detail

ListViewColumnback to summary
public ListViewColumn()

Method Detail

getHeaderback to summary
public final Node getHeader()
getItemsback to summary
public final ObservableList<T> getItems()
headerPropertyback to summary
public final ObjectProperty<Node> headerProperty()

An optional node that will serve as the column's header. It will be shown above the column.

Returns:ObjectProperty<Node>

the header node / header UI

itemsPropertyback to summary
public final ListProperty<T> itemsProperty()

The data shown in the column.

Returns:ListProperty<T>

the model for this column

setHeaderback to summary
public final void setHeader(Node header)
setItemsback to summary
public final void setItems(ObservableList<T> items)