javafx.scene.control.TreeTableRow Java Examples
The following examples show how to use
javafx.scene.control.TreeTableRow.
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: 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 #2
Source File: TextTableExt.java From Jupiter with GNU General Public License v3.0 | 6 votes |
/** recomputes table view first visible and last visible cells indexes */ private void recomputeVisibleIndexes() { firstIndex = -1; lastIndex = -1; // Work out which of the rows are visible double tblViewHeight = treeTableView.getHeight(); double headerHeight = treeTableView.lookup(".column-header-background").getBoundsInLocal().getHeight(); double viewPortHeight = tblViewHeight - headerHeight; for (TreeTableRow<StatementItem> r : rows) { double minY = r.getBoundsInParent().getMinY(); double maxY = r.getBoundsInParent().getMaxY(); boolean hidden = (maxY < 0) || (minY > viewPortHeight); if (!hidden) { if (firstIndex < 0 || r.getIndex() < firstIndex) firstIndex = r.getIndex(); if (lastIndex < 0 || r.getIndex() > lastIndex) lastIndex = r.getIndex(); } } }
Example #3
Source File: ResourceTree.java From sis with Apache License 2.0 | 6 votes |
@Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); setText(item); setGraphic(null); setContentDisplay(ContentDisplay.LEFT); setAlignment(Pos.CENTER_LEFT); setTextAlignment(TextAlignment.LEFT); setWrapText(false); if (empty) return; final TreeTableRow<Resource> row = getTreeTableRow(); if (row == null) { return; } final TreeItem<Resource> ti = row.getTreeItem(); if (ti == null) { return; } final Resource resource = ti.getValue(); setGraphic(new ImageView(getTypeIcon(resource))); }
Example #4
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 #5
Source File: TextTableExt.java From Jupiter with GNU General Public License v3.0 | 5 votes |
/** * Initializes a new table view extension. * * @param tableView tree table view to extend */ public TextTableExt(JFXTreeTableView<StatementItem> treeTableView) { this.treeTableView = treeTableView; // Callback to monitor row creation and to identify visible screen rows final Callback<TreeTableView<StatementItem>, TreeTableRow<StatementItem>> rf = treeTableView.getRowFactory(); // modify row factory final Callback<TreeTableView<StatementItem>, TreeTableRow<StatementItem>> modifiedRowFactory = param -> { TreeTableRow<StatementItem> r = rf != null ? rf.call(param) : new TreeTableRow<StatementItem>(); // Save row, this implementation relies on JaxaFX re-using TableRow efficiently rows.add(r); return r; }; treeTableView.setRowFactory(modifiedRowFactory); }
Example #6
Source File: PacketHex.java From trex-stateless-gui with Apache License 2.0 | 5 votes |
/** * Handle mouse clicked event */ private void handleMouseClickedEvent() { TreeTableRow<HexData> selectedRow = (TreeTableRow<HexData>) textField.getParent().getParent(); if (!selectedRow.getTreeItem().getValue().getOffset().contains("-")) { String originalLine = textField.getText(); String selectedHex = textField.getSelectedText().trim(); String replacedHex = showDialog(selectedHex); if (replacedHex != null) { try { textField.replaceSelection(replacedHex.toUpperCase()); String payLoad = hexToASCII(textField.getText()); TreeTableRow<HexData> hexTable = (TreeTableRow<HexData>) textField.getParent().getParent(); TreeItem<HexData> selectedItem = hexTable.getTreeItem(); selectedItem.setValue(new HexData(selectedItem.getValue().getOffset(), textField.getText(), packetParser.formatPayLoad(payLoad))); String originalHex = getPacketHexFromList(); if (selectedItem.getValue().getOffset().contains("-")) { originalHex = originalHex.replaceAll(originalLine.replaceAll(" ", "").replaceAll("\n", ""), textField.getText().replaceAll(" ", "").replaceAll("\n", "")); } byte[] rawdata = DatatypeConverter.parseHexBinary(originalHex); EthernetPacket p = EthernetPacket.newPacket(rawdata, 0, rawdata.length); packetParser.parsePacket(p, packetInfo); treeRoot.getChildren().clear(); setData(packetInfo); } catch (IllegalRawDataException ex) { java.util.logging.Logger.getLogger(PacketHex.class.getName()).log(Level.SEVERE, null, ex); } } } }
Example #7
Source File: CObjectArrayColumnModel.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
/** * generate a tree table view * * @param actionmanager action manager * @return a tree table view model for the given column model */ public TreeTableView<ObjectDataElt> generateTreeTableViewModel(PageActionManager actionmanager) { // initializes the tree table TreeTableView<ObjectDataElt> treetable = new TreeTableView<ObjectDataElt>(); double totalwidth = 0; boolean firsttreecolumn = true; for (int i = 0; i < arraycolumns.size(); i++) { CBusinessField<?> thisfield = arraycolumns.get(i); if (!thisfield.isShowinbottomnotes()) { String actionkeyforupdate = updateactionfields.get(thisfield.getFieldname()); if (actionkeyforupdate != null) { logger.info("setting the column " + thisfield.getFieldname() + " to readwrite for action " + actionkeyforupdate); } TreeTableColumn< ObjectDataElt, ?> thiscolumn = thisfield.getTreeTableColumn(actionmanager, actionkeyforupdate); if (firsttreecolumn) { thiscolumn.setMinWidth(thiscolumn.getMinWidth() + 50); firsttreecolumn = false; } totalwidth += thiscolumn.getMinWidth(); treetable.getColumns().add(thiscolumn); thiscolumn.widthProperty().addListener(new ChangeListener<Number>() { @Override public void changed( ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { double currentwidth = treetable.getWidth(); double minwidth = treetable.getMinWidth(); double extrawidth = newValue.doubleValue() - oldValue.doubleValue(); treetable.setPrefWidth(currentwidth + extrawidth); treetable.setMinWidth(minwidth + extrawidth); } }); } else { columnstoshowintooltip.add(thisfield); } treetable.setRowFactory(tv -> new TreeTableRow<ObjectDataElt>() { private Tooltip tooltip = new Tooltip(); @Override public void updateItem(ObjectDataElt object, boolean empty) { super.updateItem(object, empty); if (object == null) { setTooltip(null); } else { tooltip.setText(generateTextForTooltip(columnstoshowintooltip, object)); this.setTooltip(tooltip); } } }); } // this is a hack to compensate for potential right scrollbar treetable.setMinWidth(totalwidth + 14); treetable.setPrefWidth(totalwidth + 14); return treetable; }