javafx.scene.control.cell.TreeItemPropertyValueFactory Java Examples

The following examples show how to use javafx.scene.control.cell.TreeItemPropertyValueFactory. 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: ServiceViewer.java    From diirt with MIT License 6 votes vote down vote up
public ServiceViewer() {
    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("ServiceViewer.fxml"));

    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);

    try {
        fxmlLoader.load();
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }

    TreeItem<BrowserItem> root = new TreeBrowserItem(new ServiceRootBrowserItem());
    root.setExpanded(true);
    servicesTreeTable.setRoot(root);
    servicesTreeTable.setShowRoot(false);
    servicesTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
    TreeTableColumn<BrowserItem,String> nameCol = new TreeTableColumn<>("Name");
    TreeTableColumn<BrowserItem,String> descriptionCol = new TreeTableColumn<>("Description");

    servicesTreeTable.getColumns().setAll(nameCol, descriptionCol);

    nameCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
    descriptionCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("description"));
}
 
Example #2
Source File: ChannelInfoTreeController.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@FXML
private void initialize()
{
    name.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
    value.setCellValueFactory(new TreeItemPropertyValueFactory<>("value"));
    treeTable.setShowRoot(false);
}
 
Example #3
Source File: DefaultTreeTable.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
protected void addColumnString (String heading, int width, Justification justification,
    String propertyName)
{
  TreeTableColumn<T, String> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, String> (propertyName));
  getColumns ().add (column);

  if (justification == Justification.CENTER)
    column.setStyle ("-fx-alignment: CENTER;");
}
 
Example #4
Source File: DefaultTreeTable.java    From xframium-java with GNU General Public License v3.0 5 votes vote down vote up
protected void addColumnNumber (String heading, int width, String propertyName)
{
  TreeTableColumn<T, Number> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, Number> (propertyName));
  getColumns ().add (column);
  column.setStyle ("-fx-alignment: CENTER-RIGHT;");
}
 
Example #5
Source File: DefaultTreeTable.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
protected void addColumnString (String heading, int width, Justification justification,
    String propertyName)
{
  TreeTableColumn<T, String> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, String> (propertyName));
  getColumns ().add (column);

  if (justification == Justification.CENTER)
    column.setStyle ("-fx-alignment: CENTER;");
}
 
Example #6
Source File: DefaultTreeTable.java    From dm3270 with Apache License 2.0 5 votes vote down vote up
protected void addColumnNumber (String heading, int width, String propertyName)
{
  TreeTableColumn<T, Number> column = new TreeTableColumn<> (heading);
  column.setPrefWidth (width);
  column
      .setCellValueFactory (new TreeItemPropertyValueFactory<T, Number> (propertyName));
  getColumns ().add (column);
  column.setStyle ("-fx-alignment: CENTER-RIGHT;");
}
 
Example #7
Source File: FormulaFunctionViewer.java    From diirt with MIT License 5 votes vote down vote up
public FormulaFunctionViewer() {
        FXMLLoader fxmlLoader = new FXMLLoader(
                getClass().getResource("FormulaFunctionViewer.fxml"));

        fxmlLoader.setRoot(this);
        fxmlLoader.setController(this);

        try {
            fxmlLoader.load();
        } catch (IOException exception) {
            throw new RuntimeException(exception);
        }
//        functionsTreeTable = new TreeTableView<>();
//        setHgrow(functionsTreeTable, Priority.ALWAYS);
        TreeItem<BrowserItem> root = new TreeBrowserItem(new FormulaFunctionRootBrowserItem());
        root.setExpanded(true);
        functionsTreeTable.setRoot(root);
        functionsTreeTable.setShowRoot(false);
        functionsTreeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
        TreeTableColumn<BrowserItem,String> nameCol = new TreeTableColumn<>("Name");
        TreeTableColumn<BrowserItem,String> descriptionCol = new TreeTableColumn<>("Description");

        functionsTreeTable.getColumns().setAll(nameCol, descriptionCol);

        nameCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
        descriptionCol.setCellValueFactory(new TreeItemPropertyValueFactory<>("description"));
    }
 
Example #8
Source File: FilesTreeController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
protected void initTreeTableView() {
        try {

            fileColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileName"));
            fileColumn.setPrefWidth(400);

//            selectedColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("selected"));
            selectedColumn.setCellValueFactory(
                    new Callback<TreeTableColumn.CellDataFeatures<FileInformation, Boolean>, ObservableValue<Boolean>>() {
                @Override
                public ObservableValue<Boolean> call(TreeTableColumn.CellDataFeatures<FileInformation, Boolean> param) {
                    if (param.getValue() != null) {
                        return param.getValue().getValue().getSelectedProperty();
                    }
                    return null;
                }
            });
            selectedColumn.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(selectedColumn));

            typeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileSuffix"));

            sizeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileSize"));
            sizeColumn.setCellFactory(new TreeTableFileSizeCell());

            modifyTimeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("modifyTime"));
            modifyTimeColumn.setCellFactory(new TreeTableTimeCell());

            createTimeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("createTime"));
            createTimeColumn.setCellFactory(new TreeTableTimeCell());

            filesTreeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
            if (listenDoubleClick) {
                filesTreeView.setOnMouseClicked(new EventHandler<MouseEvent>() {
                    @Override
                    public void handle(MouseEvent event) {
                        if (event.getClickCount() > 1) {
                            TreeItem<FileInformation> item = filesTreeView.getSelectionModel().getSelectedItem();
                            if (item == null) {
                                return;
                            }
                            File file = item.getValue().getFile();
                            if (file == null || !file.exists() || !file.isFile()) {
                                return;
                            }
                            view(file);
                        }
                    }
                });
            }
        } catch (Exception e) {

        }

    }
 
Example #9
Source File: FileUnarchiveController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
private void initUnarchiveBox() {
    try {

        fileColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileName"));
        fileColumn.setPrefWidth(400);

        selectedColumn.setCellValueFactory(
                new Callback<TreeTableColumn.CellDataFeatures<FileInformation, Boolean>, ObservableValue<Boolean>>() {
            @Override
            public ObservableValue<Boolean> call(TreeTableColumn.CellDataFeatures<FileInformation, Boolean> param) {
                if (param.getValue() != null) {
                    return param.getValue().getValue().getSelectedProperty();
                }
                return null;
            }
        });
        selectedColumn.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(selectedColumn));

        typeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileSuffix"));

        sizeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("fileSize"));
        sizeColumn.setCellFactory(new TreeTableFileSizeCell());

        modifyTimeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("modifyTime"));
        modifyTimeColumn.setCellFactory(new TreeTableTimeCell());

        createTimeColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("createTime"));
        createTimeColumn.setCellFactory(new TreeTableTimeCell());

        filesTreeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

        List<String> setNames = TextTools.getCharsetNames();
        encodeSelector.getItems().addAll(setNames);
        encodeSelector.getSelectionModel().select(
                AppVariables.getUserConfigValue("FilesUnarchiveEncoding", Charset.defaultCharset().name()));
        encodeSelector.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> ov,
                    String oldItem, String newItem) {
                AppVariables.setUserConfigValue("FilesUnarchiveEncoding", newItem);
                readEntries();
            }
        });

    } catch (Exception e) {

    }

}
 
Example #10
Source File: MissionLogController.java    From logbook-kai with MIT License 4 votes vote down vote up
@FXML
void initialize() {
    TableTool.setVisible(this.detail, this.getClass() + "#" + "detail");
    TableTool.setVisible(this.aggregate, this.getClass() + "#" + "aggregate");
    // SplitPaneの分割サイズ
    Timeline x = new Timeline();
    x.getKeyFrames().add(new KeyFrame(Duration.millis(1), (e) -> {
        Tools.Conrtols.setSplitWidth(this.splitPane1, this.getClass() + "#" + "splitPane1");
        Tools.Conrtols.setSplitWidth(this.splitPane2, this.getClass() + "#" + "splitPane2");
        Tools.Conrtols.setSplitWidth(this.splitPane3, this.getClass() + "#" + "splitPane3");
    }));
    x.play();

    // 集計
    this.collect.setShowRoot(false);
    this.collect.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    this.unit.setCellValueFactory(new TreeItemPropertyValueFactory<>("unit"));
    this.successGood.setCellValueFactory(new TreeItemPropertyValueFactory<>("successGood"));
    this.success.setCellValueFactory(new TreeItemPropertyValueFactory<>("success"));
    this.fail.setCellValueFactory(new TreeItemPropertyValueFactory<>("fail"));

    // 詳細
    SortedList<MissionLogDetail> sortedList = new SortedList<>(this.details);
    this.detail.setItems(this.details);
    sortedList.comparatorProperty().bind(this.detail.comparatorProperty());
    this.detail.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    this.detail.setOnKeyPressed(TableTool::defaultOnKeyPressedHandler);

    this.date.setCellValueFactory(new PropertyValueFactory<>("date"));
    this.name.setCellValueFactory(new PropertyValueFactory<>("name"));
    this.result.setCellValueFactory(new PropertyValueFactory<>("result"));
    this.fuel.setCellValueFactory(new PropertyValueFactory<>("fuel"));
    this.ammo.setCellValueFactory(new PropertyValueFactory<>("ammo"));
    this.metal.setCellValueFactory(new PropertyValueFactory<>("metal"));
    this.bauxite.setCellValueFactory(new PropertyValueFactory<>("bauxite"));
    this.item1name.setCellValueFactory(new PropertyValueFactory<>("item1name"));
    this.item1count.setCellValueFactory(new PropertyValueFactory<>("item1count"));
    this.item2name.setCellValueFactory(new PropertyValueFactory<>("item2name"));
    this.item2count.setCellValueFactory(new PropertyValueFactory<>("item2count"));

    // 集計
    SortedList<MissionAggregate> sortedList2 = new SortedList<>(this.aggregates);
    this.aggregate.setItems(this.aggregates);
    sortedList2.comparatorProperty().bind(this.aggregate.comparatorProperty());
    this.aggregate.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    this.aggregate.setOnKeyPressed(TableTool::defaultOnKeyPressedHandler);
    this.resource.setCellValueFactory(new PropertyValueFactory<>("resource"));
    this.count.setCellValueFactory(new PropertyValueFactory<>("count"));
    this.average.setCellValueFactory(new PropertyValueFactory<>("average"));

    this.readLog();
    this.setCollect();

    // 選択された時のリスナーを設定
    this.collect.getSelectionModel()
            .selectedItemProperty()
            .addListener(this::detail);
    this.aggregate.getSelectionModel()
            .selectedItemProperty()
            .addListener(this::chart);
}