javafx.scene.control.TreeTableCell Java Examples
The following examples show how to use
javafx.scene.control.TreeTableCell.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DoubleRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { // Default format to two decimals NumberFormat formatter = new DecimalFormat("#0.00"); Double doubleValue = Double.parseDouble(object.toString()); setText(formatter.format(doubleValue)); } } }; }
Example #2
Source File: RtRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { NumberFormat formatter = MZmineCore.getConfiguration().getRTFormat(); Float floatValue = Float.parseFloat(object.toString()); setText(formatter.format(floatValue)); } } }; }
Example #3
Source File: IntensityRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { Double doubleValue = Double.parseDouble(object.toString()); NumberFormat formatter = MZmineCore.getConfiguration().getIntensityFormat(); setText(formatter.format(doubleValue)); } } }; }
Example #4
Source File: RtRangeRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { Range rangeValue = (Range) object; NumberFormat formatter = MZmineCore.getConfiguration().getMZFormat(); String value = formatter.format(rangeValue.lowerEndpoint()) + " - " + formatter.format(rangeValue.upperEndpoint()); setText(value); } } }; }
Example #5
Source File: IntegerRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { Integer integerValue = Integer.parseInt(object.toString()); setText(integerValue.toString()); } } }; }
Example #6
Source File: DefaultRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { try { NumberFormat formatter = new DecimalFormat("#0.00"); Double doubleValue = Double.parseDouble(object.toString()); setText(formatter.format(doubleValue)); } catch (NumberFormatException e) { setText(object.toString()); } } } }; }
Example #7
Source File: MzRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 6 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { NumberFormat formatter = MZmineCore.getConfiguration().getMZFormat(); Double doubleValue = Double.parseDouble(object.toString()); setText(formatter.format(doubleValue)); } } }; }
Example #8
Source File: TreeTableTimeCell.java From MyBox with Apache License 2.0 | 6 votes |
@Override public TreeTableCell<T, Long> call(TreeTableColumn<T, Long> param) { TreeTableCell<T, Long> cell = new TreeTableCell<T, Long>() { private final Text text = new Text(); @Override protected void updateItem(final Long item, boolean empty) { super.updateItem(item, empty); if (empty || item == null || (long) item <= 0) { setText(null); setGraphic(null); return; } text.setText(DateTools.datetimeToString((long) item)); setGraphic(text); } }; return cell; }
Example #9
Source File: TreeTableFileSizeCell.java From MyBox with Apache License 2.0 | 6 votes |
@Override public TreeTableCell<T, Long> call(TreeTableColumn<T, Long> param) { TreeTableCell<T, Long> cell = new TreeTableCell<T, Long>() { private final Text text = new Text(); @Override protected void updateItem(final Long item, boolean empty) { super.updateItem(item, empty); if (empty || item == null || (long) item <= 0) { setText(null); setGraphic(null); return; } text.setText(FileTools.showFileSize((long) item)); setGraphic(text); } }; return cell; }
Example #10
Source File: RFXComponentTest.java From marathonv5 with Apache License 2.0 | 6 votes |
protected Point2D getPoint(TreeTableView<?> treeTableView, int rowIndex, int columnIndex) { Set<Node> treeTableRowCell = treeTableView.lookupAll(".tree-table-row-cell"); TreeTableRow<?> row = null; for (Node tableRow : treeTableRowCell) { TreeTableRow<?> r = (TreeTableRow<?>) tableRow; if (r.getIndex() == rowIndex) { row = r; break; } } Set<Node> cells = row.lookupAll(".tree-table-cell"); for (Node node : cells) { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node; if (treeTableView.getColumns().indexOf(cell.getTableColumn()) == columnIndex) { Bounds bounds = cell.getBoundsInParent(); Point2D localToParent = cell.localToParent(bounds.getWidth() / 2, bounds.getHeight() / 2); Point2D rowLocal = row.localToScene(localToParent, true); return rowLocal; } } return null; }
Example #11
Source File: IonAnnotationRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER-LEFT;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { List<IonAnnotation> ionAnnotations = (List<IonAnnotation>) object; String value = ""; for (IonAnnotation ionAnnotation : ionAnnotations) { if (value != "") value = value + "\n"; if (ionAnnotation.getDescription() != null) value = value + ionAnnotation.getDescription(); else value = value + ionAnnotation.getAnnotationId(); } setText(value); } } }; }
Example #12
Source File: JavaFXTreeTableViewCellElement.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public void click(int button, Node target, PickResult pickResult, int clickCount, double xoffset, double yoffset) { Node cell = getPseudoComponent(); target = getTextObj((TreeTableCell<?, ?>) cell); Point2D targetXY = target.localToParent(xoffset, yoffset); targetXY = node.localToScene(targetXY); super.click(button, target, new PickResult(target, targetXY.getX(), targetXY.getY()), clickCount, xoffset, yoffset); }
Example #13
Source File: JavaFXTreeTableViewCellElement.java From marathonv5 with Apache License 2.0 | 5 votes |
private Node getTextObj(TreeTableCell<?, ?> cell) { for (Node child : cell.getChildrenUnmodifiable()) { if (child instanceof Text) { return child; } } return cell; }
Example #14
Source File: JavaFXTreeTableViewCellElement.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public Object _makeVisible() { TreeTableView<?> treeTableView = (TreeTableView<?>) getComponent(); TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) getPseudoComponent(); if (cell == null) { treeTableView.scrollToColumnIndex(viewColumn); treeTableView.scrollTo(getTreeTableNodeIndex(treeTableView, path)); return false; } return true; }
Example #15
Source File: RFXTreeTableView.java From marathonv5 with Apache License 2.0 | 5 votes |
public String getTreeTableCellValueAt(TreeTableView<?> treeTableView, int row, int column) { if (row == -1 || column == -1) { return null; } TreeTableCell<?, ?> treeTableCell = getCellAt(treeTableView, row, column); RFXComponent cellComponent = getFinder().findRCellComponent(treeTableCell, null, recorder); return cellComponent == null ? null : cellComponent.getValue(); }
Example #16
Source File: RFXTreeTableView.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public String _getText() { if (row != -1 && column != -1) { TreeTableCell<?, ?> treeTableCell = getCellAt((TreeTableView<?>) node, row, column); if (treeTableCell != null) { return treeTableCell.getText(); } } return getTreeTableSelection((TreeTableView<?>) node); }
Example #17
Source File: FxTreeTableColumn.java From FxDock with Apache License 2.0 | 5 votes |
private TreeTableCell<T,Object> getCellFactory(TreeTableColumn<T,Object> tc) { return new TreeTableCell<T,Object>() { @Override protected void updateItem(Object item, boolean empty) { super.updateItem(item, empty); if(empty) { setText(null); setGraphic(null); } else { if(renderer == null) { String text = formatter.toString(item); setText(text); setGraphic(null); setAlignment(alignment); } else { Node n = renderer.apply(item); setText(null); setGraphic(n); } } } }; }
Example #18
Source File: FxTreeTable.java From FxDock with Apache License 2.0 | 5 votes |
private Callback createCellFactory() { return new Callback<TreeTableColumn<T,?>,TreeTableCell<T,?>>() { @Override public TreeTableCell<T,?> call(TreeTableColumn<T,?> column) { return new TreeTableCell() { @Override protected void updateItem(Object item, boolean empty) { if(item == getItem()) { return; } super.updateItem(item, empty); if(item == null) { super.setText(null); super.setGraphic(null); } else if(item instanceof Node) { super.setText(null); super.setGraphic((Node)item); } else { super.setText(item.toString()); super.setGraphic(null); } } }; } }; }
Example #19
Source File: DetectionType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public Node getCellNode(TreeTableCell<ModularFeatureListRow, FeatureStatus> cell, TreeTableColumn<ModularFeatureListRow, FeatureStatus> coll, FeatureStatus cellData, RawDataFile raw) { if (cellData == null) return null; Circle circle = new Circle(); circle.setRadius(10); circle.setFill(cellData.getColorFX()); return circle; }
Example #20
Source File: ChromatographyInfoRenderer.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) { return new TreeTableCell<FeatureTableRow, Object>() { @Override public void updateItem(Object object, boolean empty) { super.updateItem(object, empty); setStyle("-fx-alignment: CENTER;" + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;"); if (object == null) { setText(null); } else { // Format to RT1, RT2 String value = null; ChromatographyInfo chromatographyInfo = (ChromatographyInfo) object; Float rt1 = chromatographyInfo.getRetentionTime(); Float rt2 = chromatographyInfo.getSecondaryRetentionTime(); NumberFormat formatter = MZmineCore.getConfiguration().getRTFormat(); if (rt1 != null) { value = formatter.format(rt1); } if (value != null && rt2 != null) { value = value + ", "; } if (rt2 != null) { value = value + formatter.format(rt2); } setText(value); } } }; }
Example #21
Source File: JFXTreeTableColumn.java From JFoenix with Apache License 2.0 | 5 votes |
private void init() { this.setCellFactory(new Callback<TreeTableColumn<S, T>, TreeTableCell<S, T>>() { @Override public TreeTableCell<S, T> call(TreeTableColumn<S, T> param) { return new JFXTreeTableCell<S, T>() { @Override protected void updateItem(T item, boolean empty) { if (item == getItem()) { return; } super.updateItem(item, empty); if (item == null) { super.setText(null); super.setGraphic(null); } else if (item instanceof Node) { super.setText(null); super.setGraphic((Node) item); } else { super.setText(item.toString()); super.setGraphic(null); } } }; } }); final ContextMenu contextMenu = new ContextMenu(); MenuItem item1 = new MenuItem("Group"); item1.setOnAction((action) -> { ((JFXTreeTableView) getTreeTableView()).group(this); }); MenuItem item2 = new MenuItem("UnGroup"); item2.setOnAction((action) -> { ((JFXTreeTableView) getTreeTableView()).unGroup(this); }); contextMenu.getItems().addAll(item1, item2); setContextMenu(contextMenu); }
Example #22
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
protected int getTreeTableColumnAt(TreeTableView<?> treeTableView, Point2D point) { TreeTableCell<?, ?> selected = getTreeTableCellAt(treeTableView, point); if (selected == null) { return -1; } return treeTableView.getColumns().indexOf(selected.getTableColumn()); }
Example #23
Source File: FeaturesType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override @Nullable public String getFormattedSubColValue(int subcolumn, TreeTableCell<ModularFeatureListRow, Object> cell, TreeTableColumn<ModularFeatureListRow, Object> coll, Object cellData, RawDataFile raw) { return ""; }
Example #24
Source File: RawColorType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public Node getCellNode(TreeTableCell<ModularFeatureListRow, ObjectProperty<Color>> cell, TreeTableColumn<ModularFeatureListRow, ObjectProperty<Color>> coll, ObjectProperty<Color> value, RawDataFile raw) { Pane pane = new Pane(); pane.setStyle("-fx-background-color: #" + ColorsFX.toHexString(value.getValue() == null ? Color.BLACK : value.getValue())); return pane; }
Example #25
Source File: NumberRangeType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override @Nullable public String getFormattedSubColValue(int subcolumn, TreeTableCell<ModularFeatureListRow, Object> cell, TreeTableColumn<ModularFeatureListRow, Object> coll, Object value, RawDataFile raw) { if (value == null) return ""; switch (subcolumn) { case 0: return getFormatter().format(((Range) value).lowerEndpoint()); case 1: return getFormatter().format(((Range) value).upperEndpoint()); } return ""; }
Example #26
Source File: EditableDataTypeCellFactory.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override public TreeTableCell<ModularFeatureListRow, Object> call( TreeTableColumn<ModularFeatureListRow, Object> param) { TextFieldTreeTableCell<ModularFeatureListRow, Object> cell = new TextFieldTreeTableCell<>(); if (type instanceof StringParser) { cell.setConverter(((StringParser) type).getStringConverter()); cell.setAlignment(Pos.CENTER); return cell; } else { logger.log(Level.SEVERE, "Class in editable CellFactory is no StringParser: " + type.getClass().toString()); return null; } }
Example #27
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
public TreeTableCell<?, ?> getTreeTableCellAt(TreeTableView<?> treeTableView, Point2D point) { point = treeTableView.localToScene(point); Set<Node> lookupAll = getTreeTableCells(treeTableView); TreeTableCell<?, ?> selected = null; for (Node cellNode : lookupAll) { Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true); if (boundsInScene.contains(point)) { selected = (TreeTableCell<?, ?>) cellNode; break; } } return selected; }
Example #28
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
protected int getTreeTableRowAt(TreeTableView<?> treeTableView, Point2D point) { TreeTableCell<?, ?> selected = getTreeTableCellAt(treeTableView, point); if (selected == null) { return -1; } return selected.getTreeTableRow().getIndex(); }
Example #29
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
@SuppressWarnings("rawtypes") public TreeTableCell getVisibleCellAt(TreeTableView<?> treeTableView, int row, int column) { Set<Node> lookupAll = getTreeTableCells(treeTableView); TreeTableCell cell = null; for (Node node : lookupAll) { TreeTableCell<?, ?> cell1 = (TreeTableCell<?, ?>) node; TreeTableRow<?> tableRow = cell1.getTreeTableRow(); TreeTableColumn<?, ?> tableColumn = cell1.getTableColumn(); if (tableRow.getIndex() == row && tableColumn == treeTableView.getColumns().get(column)) { cell = cell1; break; } } return cell; }
Example #30
Source File: JavaFXElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
private Set<Node> getTreeTableCells(TreeTableView<?> treeTableView) { Set<Node> l = treeTableView.lookupAll("*"); Set<Node> r = new HashSet<>(); for (Node node : l) { if (node instanceof TreeTableCell<?, ?>) { if (!((TreeTableCell<?, ?>) node).isEmpty()) r.add(node); } } return r; }