Example usage for javafx.scene.control TableColumn getSortType

List of usage examples for javafx.scene.control TableColumn getSortType

Introduction

In this page you can find the example usage for javafx.scene.control TableColumn getSortType.

Prototype

public final SortType getSortType() 

Source Link

Usage

From source file:com.panemu.tiwulfx.table.TableControl.java

/**
 * Reload data on current page. This method is called when pressing reload
 * button TODO: put it in separate thread and display progress indicator on
 * TableView/*w  w w .j a v a2  s .  c  o m*/
 *
 * @see #reloadFirstPage()
 */
public void reload() {
    if (!lstChangedRow.isEmpty()) {
        if (!controller.revertConfirmation(this, lstChangedRow.size())) {
            return;
        }
    }
    lstCriteria.clear();
    /**
     * Should be in new arraylist to avoid
     * java.lang.IllegalArgumentException: Children: duplicate children
     * added
     */
    List<TableColumn<R, ?>> lstColumns = new ArrayList<>(tblView.getColumns());
    lstColumns = getColumnsRecursively(lstColumns);
    for (TableColumn clm : lstColumns) {
        if (clm instanceof BaseColumn) {
            BaseColumn baseColumn = (BaseColumn) clm;
            if (baseColumn.getTableCriteria() != null) {
                lstCriteria.add(baseColumn.getTableCriteria());
            }
        }
    }
    List<String> lstSortedColumn = new ArrayList<>();
    List<SortType> lstSortedType = new ArrayList<>();
    for (TableColumn<R, ?> tc : tblView.getSortOrder()) {
        if (tc instanceof BaseColumn) {
            lstSortedColumn.add(((BaseColumn) tc).getPropertyName());
            lstSortedType.add(tc.getSortType());
        } else if (tc.getCellValueFactory() instanceof PropertyValueFactory) {
            PropertyValueFactory valFactory = (PropertyValueFactory) tc.getCellValueFactory();
            lstSortedColumn.add(valFactory.getProperty());
            lstSortedType.add(tc.getSortType());
        }
    }

    service.runLoadInBackground(lstSortedColumn, lstSortedType);
}