本文整理汇总了Java中javafx.scene.control.CheckBoxTreeItem.setExpanded方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBoxTreeItem.setExpanded方法的具体用法?Java CheckBoxTreeItem.setExpanded怎么用?Java CheckBoxTreeItem.setExpanded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.CheckBoxTreeItem
的用法示例。
在下文中一共展示了CheckBoxTreeItem.setExpanded方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CheckBoxTreeViewSample
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
public CheckBoxTreeViewSample() {
final CheckBoxTreeItem<String> treeRoot = new CheckBoxTreeItem<String>("Root node");
treeRoot.getChildren().addAll(Arrays.asList(new CheckBoxTreeItem<String>("Child Node 1"),
new CheckBoxTreeItem<String>("Child Node 2"), new CheckBoxTreeItem<String>("Child Node 3")));
treeRoot.getChildren().get(2).getChildren()
.addAll(Arrays.asList(new CheckBoxTreeItem<String>("Child Node 4"), new CheckBoxTreeItem<String>("Child Node 5"),
new CheckBoxTreeItem<String>("Child Node 6"), new CheckBoxTreeItem<String>("Child Node 7"),
new TreeItem<String>("Child Node 8"), new CheckBoxTreeItem<String>("Child Node 9"),
new CheckBoxTreeItem<String>("Child Node 10"), new CheckBoxTreeItem<String>("Child Node 11"),
new CheckBoxTreeItem<String>("Child Node 12")));
final TreeView treeView = new TreeView();
treeView.setCellFactory(CheckBoxTreeCell.forTreeView());
treeView.setShowRoot(true);
treeView.setRoot(treeRoot);
treeRoot.setExpanded(true);
getChildren().add(treeView);
}
示例2: buildItem
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
private CheckBoxTreeItem<String> buildItem(Relation node) {
final CheckBoxTreeItem<String> item = new CheckBoxTreeItem<String>(node.getLabel());
item.setExpanded(true);
item.setIndependent(true);
item.setSelected(!node.isFold());
item.selectedProperty()
.addListener((o, p, c) -> {
node.setFold(!c);
});
node.getChildren()
.stream()
.filter(c -> c instanceof Relation)
.map(c -> (Relation) c)
.forEach(c -> {
item.getChildren()
.add(buildItem(c));
});
return item;
}
示例3: initialize
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
/**
* Native init method.
* Create VUFS folders tree view
* @param location
* @param resources
*/
@Override
public void initialize(URL location, ResourceBundle resources) {
//TODO: replace to getting elements from Repository
CheckBoxTreeItem<String> root = new CheckBoxTreeItem<>("Root");
root.setExpanded(true);
CheckBoxTreeItem<String> folder1 = new CheckBoxTreeItem<>("Folder1");
folder1.getChildren().addAll(
new CheckBoxTreeItem<>("MyFoto"),
new CheckBoxTreeItem<>("OtherFiles")
);
root.getChildren().addAll(
folder1,
new CheckBoxTreeItem<>("Documents"),
new CheckBoxTreeItem<>("WorkFiles"),
new CheckBoxTreeItem<>("Projects"));
// Create the CheckTreeView with the data
final CheckTreeView<String> checkTreeView = new CheckTreeView<>(root);
checkTreeView.getCheckModel().getCheckedItems().addListener((ListChangeListener<TreeItem<String>>) c -> {
System.out.println(checkTreeView.getCheckModel().getCheckedItems());
});
checkTreeView.setId("sync-tree-view");
container.getChildren().add(checkTreeView);
}
示例4: addNewRepoFile
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
private void addNewRepoFile(RepoFile repoFile, CheckBoxTreeItem<RepoFile> newItem, TreeItem<RepoFile> root) {
Path pathToParent = repoFile.getFilePath().getParent();
if (pathToParent != null) {
// Check if the file should be added to an existing directory
CheckBoxTreeItem<RepoFile> parentDirectory = null;
for (TreeItem<RepoFile> directory : root.getChildren()) {
if (!directory.equals(checkBox) && directory.getValue().toString().equals(pathToParent.toString())) {
parentDirectory = (CheckBoxTreeItem<RepoFile>) directory;
break;
}
}
if (parentDirectory == null) {
// Create a new directory and add it to the root
DirectoryRepoFile parent = new DirectoryRepoFile(pathToParent, this.sessionModel.getCurrentRepoHelper());
parent.setShowFullPath(true);
parentDirectory = new CheckBoxTreeItem<>(parent);
parentDirectory.setExpanded(true);
root.getChildren().add(parentDirectory);
}
parentDirectory.getChildren().add(newItem);
} else {
root.getChildren().add(newItem);
}
}
示例5: TreeViewSample
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
public TreeViewSample() {
String dir = "./src";
final CheckBoxTreeItem<File> treeRoot = buildRoot(dir);
treeView = new TreeView<File>();
treeView.setCellFactory(CheckBoxTreeCell.<File> forTreeView());
treeView.setShowRoot(true);
treeView.setRoot(treeRoot);
treeRoot.setExpanded(true);
getChildren().add(treeView);
}
示例6: initTreeView
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
private void initTreeView(){
CheckBoxTreeItem<FileItem> root = new CheckBoxTreeItem<>( dataManager.getRoot());
setTreeChildren(root);
treeView = new CheckTreeView<>(root);
treeViewPane.getChildren().add(treeView);
root.setExpanded(true);
treeView.setShowRoot(true);
treeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
treeView.getCheckModel().getCheckedItems().addListener(this::onCheckListener);
selected.forEach(item -> item.setSelected(true));
}
示例7: selectAndExpandTreeItem
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
private void selectAndExpandTreeItem(CheckBoxTreeItem<ModifiedPath> item) {
item.setSelected(true);
item.setExpanded(true);
}
示例8: initialize
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
/**
* Initializer for OutputController. Call constructor before initializing.
* Initializes elements and loads settings.
* @param url not in use
* @param rb the given resource bundle
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
this.rb=rb;
//type.getItems().addAll("ODBC","MySQL","PostgreSQL");
for(DriverType driver : DriverType.values()) {
type.getItems().add(driver.toString());
}
CheckBoxTreeItem<String> rootItem = new CheckBoxTreeItem<>(rb.getString("key.alloutputs"));
rootItem.setExpanded(true);
outputselection.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
outputselection.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.base")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carboncountry")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carbonsoil")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingmatrix")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingresidues")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.naturalmortality")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningmatrix")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningresidues")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.treecarbon")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.generalregions")));
rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.generalspecies")));
rootItem.selectedProperty().set(true);
outputselection.setRoot(rootItem);
CheckBoxTreeItem<String> rootItem2 = new CheckBoxTreeItem<>(rb.getString("key.alloutputs"));
rootItem2.setExpanded(true);
databaseTree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
databaseTree.setCellFactory(CheckBoxTreeCell.<String>forTreeView());
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.base")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carboncountry")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carbonsoil")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.deadwood")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingmatrix")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingresidues")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.naturalmortality")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningmatrix")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningresidues")));
rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.treecarbon")));
rootItem2.selectedProperty().set(true);
databaseTree.setRoot(rootItem2);
rootItem.selectedProperty().set(true);
update();
chooser = new DirectoryChooser();
chooser.setTitle(rb.getString("key.outputpath"));
}
示例9: reset
import javafx.scene.control.CheckBoxTreeItem; //导入方法依赖的package包/类
protected void reset() {
CheckBoxTreeItem<String> root = new CheckBoxTreeItem<String>("Root");
root.setExpanded(true);
addLevel(root, DATA_ITEMS_DEPTH);
treeView.setRoot(root);
treeView.setShowRoot(true);
}