Search in sources :

Example 1 with ConfigItemTreeItem

use of com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem in project Gargoyle by callakrsos.

the class ConfigurationViewController method initialize.

@FXML
public void initialize() {
    ConfigItemTreeItem configItemTreeItem = new ConfigItemTreeItem();
    TreeItem<ConfigurationTreeItem> createNode = configItemTreeItem.createNode(root);
    tvItems.setRoot(createNode);
    createNode.setExpanded(true);
    tvItems.setShowRoot(true);
    tvItems.getSelectionModel().selectedItemProperty().addListener((oba, o, n) -> {
        if (o != n) {
            change(n);
        }
    });
}
Also used : ConfigItemTreeItem(com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem) ConfigurationTreeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationTreeItem) FXML(javafx.fxml.FXML)

Example 2 with ConfigItemTreeItem

use of com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem 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);
            }
        }
    });
}
Also used : Button(javafx.scene.control.Button) Arrays(java.util.Arrays) TreeItem(javafx.scene.control.TreeItem) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) TreeTableRow(javafx.scene.control.TreeTableRow) Parent(javafx.scene.Parent) TreeTableView(javafx.scene.control.TreeTableView) Callback(javafx.util.Callback) ObjectProperty(javafx.beans.property.ObjectProperty) Logger(org.slf4j.Logger) FontViewComposite(com.kyj.fx.voeditor.visual.component.font.FontViewComposite) FXMLController(com.kyj.fx.voeditor.visual.framework.annotation.FXMLController) ConfigItemTreeItem(com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem) ValueUtil(com.kyj.fx.voeditor.visual.util.ValueUtil) Consumer(java.util.function.Consumer) FXML(javafx.fxml.FXML) FxUtil(com.kyj.fx.voeditor.visual.util.FxUtil) TreeTableColumn(javafx.scene.control.TreeTableColumn) ConfigurationLeafNodeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationLeafNodeItem) ConfigurationGraphicsNodeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationGraphicsNodeItem) ConfigurationTreeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationTreeItem) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) SkinManager(com.kyj.fx.voeditor.visual.momory.SkinManager) BorderPane(javafx.scene.layout.BorderPane) FontViewComposite(com.kyj.fx.voeditor.visual.component.font.FontViewComposite) TreeTableView(javafx.scene.control.TreeTableView) ConfigurationLeafNodeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationLeafNodeItem) TreeTableRow(javafx.scene.control.TreeTableRow) ConfigurationTreeItem(com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationTreeItem) ConfigItemTreeItem(com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem) FXML(javafx.fxml.FXML)

Aggregations

ConfigItemTreeItem (com.kyj.fx.voeditor.visual.component.ConfigItemTreeItem)2 ConfigurationTreeItem (com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationTreeItem)2 FXML (javafx.fxml.FXML)2 FontViewComposite (com.kyj.fx.voeditor.visual.component.font.FontViewComposite)1 FXMLController (com.kyj.fx.voeditor.visual.framework.annotation.FXMLController)1 ConfigurationGraphicsNodeItem (com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationGraphicsNodeItem)1 ConfigurationLeafNodeItem (com.kyj.fx.voeditor.visual.main.model.vo.ConfigurationLeafNodeItem)1 SkinManager (com.kyj.fx.voeditor.visual.momory.SkinManager)1 FxUtil (com.kyj.fx.voeditor.visual.util.FxUtil)1 ValueUtil (com.kyj.fx.voeditor.visual.util.ValueUtil)1 URISyntaxException (java.net.URISyntaxException)1 Arrays (java.util.Arrays)1 Consumer (java.util.function.Consumer)1 ObjectProperty (javafx.beans.property.ObjectProperty)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 Parent (javafx.scene.Parent)1 Button (javafx.scene.control.Button)1 TreeItem (javafx.scene.control.TreeItem)1 TreeTableColumn (javafx.scene.control.TreeTableColumn)1 TreeTableRow (javafx.scene.control.TreeTableRow)1