List of usage examples for javafx.scene.control TableColumn getColumns
@Override public final ObservableList<TableColumn<S, ?>> getColumns()
From source file:Main.java
@Override public void start(Stage primaryStage) { TableView table = new TableView(); table.setEditable(true);/*ww w. j a va2 s . c o m*/ TableColumn firstNameCol = new TableColumn("First Name"); TableColumn lastNameCol = new TableColumn("Last Name"); TableColumn addressCol = new TableColumn("Email"); table.getColumns().addAll(firstNameCol, lastNameCol, addressCol); TableColumn cityCol = new TableColumn("City"); TableColumn stateCol = new TableColumn("State"); addressCol.getColumns().addAll(cityCol, stateCol); StackPane root = new StackPane(); root.getChildren().add(table); primaryStage.setScene(new Scene(root, 200, 250)); primaryStage.show(); }
From source file:com.panemu.tiwulfx.table.TableControl.java
/** * Get list of columns including the nested ones. * * @param lstColumn//from w w w .ja va 2 s . com * @return */ private List<TableColumn<R, ?>> getColumnsRecursively(List<TableColumn<R, ?>> lstColumn) { List<TableColumn<R, ?>> newColumns = new ArrayList<>(); for (TableColumn column : lstColumn) { if (column.getColumns().isEmpty()) { newColumns.add(column); } else { /** * Should be in new arraylist to avoid * java.lang.IllegalArgumentException: Children: duplicate * children added */ newColumns.addAll(getColumnsRecursively(new ArrayList(column.getColumns()))); } } return newColumns; }
From source file:com.panemu.tiwulfx.table.TableControl.java
/** * Get list of columns that is hold cell. It excludes columns that are * containers of nested columns./*from w w w .ja va 2s .c o m*/ * * @return */ public List<TableColumn<R, ?>> getLeafColumns() { List<TableColumn<R, ?>> result = new ArrayList<>(); for (TableColumn<R, ?> clm : tblView.getColumns()) { if (clm.getColumns().isEmpty()) { result.add(clm); } else { result.addAll(getColumnsRecursively(clm.getColumns())); } } return result; }