use of com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationLeafNodeItem in project Gargoyle by callakrsos.
the class CustomSkinConfigView method initialize.
@FXML
public void initialize() {
ttvIConfig.setRowFactory(new Callback<TreeTableView<ConfigurationTreeItem>, TreeTableRow<ConfigurationTreeItem>>() {
@Override
public TreeTableRow<ConfigurationTreeItem> call(TreeTableView<ConfigurationTreeItem> param) {
TreeTableRow<ConfigurationTreeItem> treeTableRow = new TreeTableRow<>();
treeTableRow.setOnMouseClicked(ev -> {
ConfigurationTreeItem item = treeTableRow.getItem();
selectedItem.set(item);
});
return treeTableRow;
}
});
ttcConfig.setCellValueFactory(param -> param.getValue().getValue().itemNameProperty());
ConfigurationTreeItem root = new ConfigurationTreeItem();
root.setItemName("Basic");
{
ConfigurationLeafNodeItem fontConfigItem = new ConfigurationLeafNodeItem();
fontConfigItem.setItemName("Font Management");
fontConfigItem.setContentNode(FontViewComposite.class);
ConfigurationLeafNodeItem backgroundConfigItem = new ConfigurationLeafNodeItem();
backgroundConfigItem.setItemName("Color Management");
backgroundConfigItem.setContentNode(SkinPreviewViewComposite.class);
root.setChildrens(Arrays.asList(fontConfigItem, backgroundConfigItem));
}
TreeItem<ConfigurationTreeItem> createNode = new ConfigItemTreeItem().createNode(root);
createNode.setExpanded(true);
ttvIConfig.setRoot(createNode);
ttvIConfig.setOnMouseClicked(ev -> {
if (ev.getClickCount() == 2) {
load(selectedItem.get());
}
});
selectedItem.addListener((oba, o, n) -> {
btnEdit.setDisable(true);
if (n instanceof ConfigurationLeafNodeItem) {
if (((ConfigurationLeafNodeItem) n).getContentNode() != null) {
btnEdit.setDisable(false);
}
}
});
}
use of com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationLeafNodeItem in project Gargoyle by callakrsos.
the class ConfigItemTreeItem method createNode.
/**
* 파일 트리를 생성하기 위한 노드를 반환한다.
*
* @Date 2015. 10. 14.
* @param f
* @return
* @User KYJ
*/
public TreeItem<ConfigurationTreeItem> createNode(final ConfigurationTreeItem f) {
TreeItem<ConfigurationTreeItem> treeItem = new TreeItem<ConfigurationTreeItem>(f) {
private boolean isLeaf;
private boolean isFirstTimeChildren = true;
private boolean isFirstTimeLeaf = true;
@Override
public ObservableList<TreeItem<ConfigurationTreeItem>> getChildren() {
if (isFirstTimeChildren) {
isFirstTimeChildren = false;
super.getChildren().setAll(buildChildren(this));
}
return super.getChildren();
}
@Override
public boolean isLeaf() {
if (isFirstTimeLeaf) {
isFirstTimeLeaf = false;
ConfigurationTreeItem f = getValue();
if (f instanceof ConfigurationLeafNodeItem)
isLeaf = true;
else
isLeaf = false;
}
return isLeaf;
}
private ObservableList<TreeItem<ConfigurationTreeItem>> buildChildren(TreeItem<ConfigurationTreeItem> treeItem) {
ConfigurationTreeItem f = treeItem.getValue();
if (f == null) {
return FXCollections.emptyObservableList();
}
List<ConfigurationTreeItem> childrens = f.getChildrens();
if (childrens == null || childrens.isEmpty() || f instanceof ConfigurationLeafNodeItem) {
return FXCollections.emptyObservableList();
} else {
ObservableList<TreeItem<ConfigurationTreeItem>> children = FXCollections.observableArrayList();
for (ConfigurationTreeItem child : childrens) {
TreeItem<ConfigurationTreeItem> createNode = createNode(child);
createNode.setExpanded(true);
children.add(createNode);
}
return children;
}
}
};
return treeItem;
}
Aggregations