本文整理汇总了Java中javafx.scene.control.TreeTableView.setRowFactory方法的典型用法代码示例。如果您正苦于以下问题:Java TreeTableView.setRowFactory方法的具体用法?Java TreeTableView.setRowFactory怎么用?Java TreeTableView.setRowFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TreeTableView
的用法示例。
在下文中一共展示了TreeTableView.setRowFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TreeTableHandler
import javafx.scene.control.TreeTableView; //导入方法依赖的package包/类
public TreeTableHandler(TreeTableView<T> tree)
{
this.tree = tree;
tree.setRowFactory(this::rowFactory);
// mouse handlers
tree.addEventHandler(DragEvent.DRAG_EXITED, (ev) -> handleTreeDragExited(ev));
tree.addEventHandler(DragEvent.DRAG_ENTERED, (ev) -> handleTreeDragEntered(ev));
tree.addEventHandler(DragEvent.DRAG_DONE, (ev) -> handleTreeDragDone(ev));
// key handler
tree.addEventFilter(KeyEvent.ANY, (ev) -> handleTreeKeyEvent(ev));
}
示例2: getTreeTableViewTab
import javafx.scene.control.TreeTableView; //导入方法依赖的package包/类
/**
* Returns a <code>Tab</code> containing a <code>TreeTableView</code> displaying the with the given
* <code>root</code>.
*
* @param root
* the root of the tree to display
* @return a <code>Tab</code> containing the tree
*/
static Tab getTreeTableViewTab(TreeItem<TreeDumpNode> root) {
TreeTableView<TreeDumpNode> tableView = new TreeTableView<>(root);
TreeTableColumn<TreeDumpNode, String> id = new TreeTableColumn<>("ID");
TreeTableColumn<TreeDumpNode, String> label = new TreeTableColumn<>("AST Type");
tableView.setRowFactory(param -> {
TreeTableRow<TreeDumpNode> row = new TreeTableRow<>();
TreeDumpNode node = row.getItem();
if (node == null) {
return row;
}
String color = node.getFillColor();
if (color != null) {
try {
BackgroundFill fill = new BackgroundFill(Color.valueOf(color), CornerRadii.EMPTY, Insets.EMPTY);
row.setBackground(new Background(fill));
} catch (IllegalArgumentException e) {
LOG.fine(() -> String.format("Could not convert '%s' to a JavaFX Color.", color));
}
}
return row;
});
id.setCellValueFactory(param -> param.getValue().getValue().idProperty());
label.setCellValueFactory(param -> param.getValue().getValue().labelProperty());
tableView.getColumns().setAll(Arrays.asList(label, id));
return new Tab("Tree View", tableView);
}
示例3: initialize
import javafx.scene.control.TreeTableView; //导入方法依赖的package包/类
public void initialize(TreeTableView<DocumentTreeValue> queryResultTree, MongoDatabase mongoDatabase) {
this.queryResultTree = queryResultTree;
this.mongoDatabase = mongoDatabase;
queryResultTree.setRowFactory(ttv -> new ResultRow());
queryResultTree.setOnKeyPressed(this::onKeyPressed);
buildRootContextMenu();
}
示例4: setupFileListingView
import javafx.scene.control.TreeTableView; //导入方法依赖的package包/类
public static void setupFileListingView(final TreeTableView<TorrentFileEntry> fileView,
final FileTreeViewer fileTreeViewer) {
fileView.setPlaceholder(GuiUtils.getEmptyTablePlaceholder());
fileView.setTableMenuButtonVisible(false);
fileView.setShowRoot(false);
fileView.setEditable(true);
fileView.setRowFactory(table -> new TorrentContentTreeRow(fileTreeViewer));
}