Java 类javafx.scene.control.cell.TreeItemPropertyValueFactory 实例源码

项目:honest-profiler    文件:TreeViewController.java   
/**
 * Initializes the {@link TreeTableView} which displays the {@link Tree} {@link Aggregation}.
 */
@Override
protected void initializeTable()
{
    methodColumn.setCellFactory(column -> new MethodNameTreeTableCell<>(appCtx()));
    methodColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("key"));

    percentColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("totalCntPct"));
    percentColumn.setCellFactory(param -> new GraphicalShareTreeTableCell());

    // The column configuration methods should (for now) be called in the same order as the columns are declared in
    // the FXML.
    // The only reason is the column view context menu, which collects its menu items in the order of these
    // declarations. If the order is out of sync, the column view context menu will not have its items in the
    // correct order.
    // This will probably, eventually, be remedied by reordering but for now this comment will have to do.
    cfgPctCol(selfCntPct, "selfCntPct", prfCtx(), COLUMN_SELF_CNT_PCT);
    cfgPctCol(totalCntPct, "totalCntPct", prfCtx(), COLUMN_TOTAL_CNT_PCT);
    cfgNrCol(selfCnt, "selfCnt", prfCtx(), COLUMN_SELF_CNT);
    cfgNrCol(totalCnt, "totalCnt", prfCtx(), COLUMN_TOTAL_CNT);
    cfgPctCol(selfTimePct, "selfTimePct", prfCtx(), COLUMN_SELF_TIME_PCT);
    cfgPctCol(totalTimePct, "totalTimePct", prfCtx(), COLUMN_TOTAL_TIME_PCT);
    cfgTimeCol(selfTime, "selfTime", prfCtx(), COLUMN_SELF_TIME);
    cfgTimeCol(totalTime, "totalTime", prfCtx(), COLUMN_TOTAL_TIME);
}
项目:xframium-java    文件:DefaultTreeTable.java   
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;");
}
项目:xframium-java    文件:DefaultTreeTable.java   
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;");
}
项目:certmgr    文件:CertImportController.java   
@Override
protected void setupStage(Stage stage) {
    stage.getIcons().addAll(PlatformHelper.stageIcons(Images.IMPORT32, Images.IMPORT16));
    stage.setTitle(CertImportI18N.formatSTR_STAGE_TITLE());
    this.ctlFileSourceInput.disableProperty().bind(Bindings.not(this.ctlFileSourceOption.selectedProperty()));
    this.cmdChooseFileSourceButton.disableProperty()
            .bind(Bindings.not(this.ctlFileSourceOption.selectedProperty()));
    this.ctlDirectorySourceInput.disableProperty()
            .bind(Bindings.not(this.ctlDirectorySourceOption.selectedProperty()));
    this.cmdChooseDirectorySourceButton.disableProperty()
            .bind(Bindings.not(this.ctlDirectorySourceOption.selectedProperty()));
    this.ctlURLSourceInput.disableProperty().bind(Bindings.not(this.ctlURLSourceOption.selectedProperty()));
    this.ctlServerSourceInput.disableProperty().bind(Bindings.not(this.ctlServerSourceOption.selectedProperty()));
    this.ctlServerSourceProtocolInput.disableProperty()
            .bind(Bindings.not(this.ctlServerSourceOption.selectedProperty()));
    this.ctlServerSourceProtocolInput.getItems().addAll(SSLPeer.Protocol.values());
    this.ctlPlatformSourceInput.disableProperty()
            .bind(Bindings.not(this.ctlPlatformSourceOption.selectedProperty()));
    setupPlatformSourceInput();
    this.ctlImportEntryViewSelected
            .setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(this.ctlImportEntryViewSelected));
    this.ctlImportEntryViewSelected.setCellValueFactory(new TreeItemPropertyValueFactory<>("selected"));
    this.ctlImportEntryViewDN.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
    this.ctlImportEntryViewCRT.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(this.ctlImportEntryViewCRT));
    this.ctlImportEntryViewCRT.setCellValueFactory(new TreeItemPropertyValueFactory<>("hasCRT"));
    this.ctlImportEntryViewKey.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(this.ctlImportEntryViewKey));
    this.ctlImportEntryViewKey.setCellValueFactory(new TreeItemPropertyValueFactory<>("hasKey"));
    this.ctlImportEntryViewCSR.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(this.ctlImportEntryViewCSR));
    this.ctlImportEntryViewCSR.setCellValueFactory(new TreeItemPropertyValueFactory<>("hasCSR"));
    this.ctlImportEntryViewCRL.setCellFactory(CheckBoxTreeTableCell.forTreeTableColumn(this.ctlImportEntryViewCRL));
    this.ctlImportEntryViewCRL.setCellValueFactory(new TreeItemPropertyValueFactory<>("hasCRL"));
    this.ctlImportEntryView.setTreeColumn(this.ctlImportEntryViewDN);
    this.ctlFileSourceOption.setSelected(true);
    this.ctlServerSourceProtocolInput.setValue(SSLPeer.Protocol.SSL);
}
项目:dm3270    文件:DefaultTreeTable.java   
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;");
}
项目:dm3270    文件:DefaultTreeTable.java   
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;");
}
项目:jfx-torrent    文件:TreeTableUtils.java   
private static TreeTableColumn<TorrentFileEntry, Long> buildSimpleLongValueColumn(
        final String columnName, final String propertyName, final String style, final Insets padding,
        final Function<TorrentFileEntry, String> valueGetter) {
    final TreeTableColumn<TorrentFileEntry, Long> longValueColumn = new TreeTableColumn<TorrentFileEntry, Long>(columnName);
    longValueColumn.setId(columnName);
    longValueColumn.setGraphic(TableUtils.buildColumnHeader(longValueColumn, style));
    longValueColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    longValueColumn.setCellFactory(column -> new TreeTableCell<TorrentFileEntry, Long>() {
        final Label valueLabel = new Label();           

        @Override
        protected final void updateItem(final Long value, final boolean empty) {
            super.updateItem(value, empty);
            if(empty) {
                setText(null);
                setGraphic(null);
            }
            else {
                final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();

                if(fileContent == null) {
                    return;
                }

                final String formattedValue = valueGetter.apply(fileContent);                   
                valueLabel.setText(formattedValue);
                this.setGraphic(valueLabel);
                this.setAlignment(Pos.CENTER_RIGHT);
                super.setPadding(padding);
            }
        }           
    });
    return longValueColumn;
}
项目:jfx-torrent    文件:TreeTableUtils.java   
private static TreeTableColumn<TorrentFileEntry, FilePriority> buildPriorityColumn() {
    final TreeTableColumn<TorrentFileEntry, FilePriority> priorityColumn =
            new TreeTableColumn<>(PRIORITY_COLUMN_NAME);
    priorityColumn.setId(PRIORITY_COLUMN_NAME);
    priorityColumn.setGraphic(TableUtils.buildColumnHeader(priorityColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));
    priorityColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("priority"));
    priorityColumn.setCellFactory(column -> new TreeTableCell<TorrentFileEntry, FilePriority>() {
        final Label valueLabel = new Label();           
        @Override
        protected final void updateItem(final FilePriority value, final boolean empty) {
            super.updateItem(value, empty);
            if(empty) {
                setText(null);
                setGraphic(null);
            }
            else {
                final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();

                if(fileContent == null) {
                    return;
                }

                valueLabel.setText(fileContent.getPriority().toString());
                this.setGraphic(valueLabel);
                this.setAlignment(Pos.BASELINE_LEFT);
                super.setPadding(GuiUtils.leftPadding());
            }
        }       
    });
    return priorityColumn;
}
项目:jfx-torrent    文件:TreeTableUtils.java   
private static TreeTableColumn<TorrentFileEntry, String> buildPathColumn() {
    final TreeTableColumn<TorrentFileEntry, String> pathColumn =
            new TreeTableColumn<TorrentFileEntry, String>(PATH_COLUMN_NAME);
    pathColumn.setId(PATH_COLUMN_NAME);     
    pathColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("path"));
    pathColumn.setGraphic(TableUtils.buildColumnHeader(pathColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));     

    return pathColumn;
}
项目:jfx-torrent    文件:TreeTableUtils.java   
private static TreeTableColumn<TorrentFileEntry, Double> buildProgressColumn(
        final TreeTableView<TorrentFileEntry> treeTableView) {
    final TreeTableColumn<TorrentFileEntry, Double> progressColumn = 
            new TreeTableColumn<TorrentFileEntry, Double>(PROGRESS_COLUMN_NAME);
    progressColumn.setId(PROGRESS_COLUMN_NAME);
    progressColumn.setCellValueFactory(new TreeItemPropertyValueFactory<>("progress"));
    progressColumn.setGraphic(TableUtils.buildColumnHeader(progressColumn, GuiUtils.LEFT_ALIGNED_COLUMN_HEADER_TYPE_NAME));
    progressColumn.setCellFactory(column -> new ProgressBarTreeTableCell<TorrentFileEntry>() {          
        @Override
        public final void updateItem(final Double value, final boolean empty) {
            super.updateItem(value, empty);
            if(empty) {
                super.setText(null);
                super.setGraphic(null);
            }
            else {
                final TorrentFileEntry fileContent = this.getTreeTableRow().getItem();

                if(fileContent == null) {
                    return;
                }

                super.addEventFilter(MouseEvent.MOUSE_CLICKED, evt ->
                    treeTableView.getSelectionModel().select(super.getTreeTableRow().getIndex()));

                super.getStyleClass().add(CssProperties.PROGRESSBAR_STOPPED);
                super.setItem(fileContent.progressProperty().doubleValue());
                super.setPadding(GuiUtils.noPadding());
            }
        }       
    }); 

    return progressColumn;
}
项目:Moduro-Toolbox    文件:SettingController.java   
/**
 * Creates Tree Table View.
 */
private void createTable() {

    TreeItem<ProjectSetting> root = new TreeItem<>(new ProjectSetting());
    TreeItem<ProjectSetting> treeItem;

    for (ProjectSetting projectSettingItem : setting) {
        treeItem = new TreeItem<>(projectSettingItem);
        root.getChildren().add(treeItem);
    }


    treeTable.setRoot(root);
    root.setExpanded(true);
    treeTable.setShowRoot(false);

    TreeTableColumn<ProjectSetting, String> columnProject = new TreeTableColumn<ProjectSetting, String>("ProjectName");
    columnProject.setCellValueFactory(new TreeItemPropertyValueFactory<ProjectSetting, String>("name"));

    TreeTableColumn<ProjectSetting, String> columnNode = new TreeTableColumn<ProjectSetting, String>("Node");
    columnNode.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<ProjectSetting, String>, ObservableValue<String>>() {
        @Override
        public ObservableValue<String> call(TreeTableColumn.CellDataFeatures<ProjectSetting, String> param) {
            return new SimpleStringProperty(param.getValue().getValue().getNode().get(0).getName());
        }
    });

    TreeTableColumn<ProjectSetting, String> columnPath = new TreeTableColumn<ProjectSetting, String>("Path");
    columnPath.setCellValueFactory(new TreeItemPropertyValueFactory<ProjectSetting, String>("path"));


    treeTable.getColumns().addAll(columnProject, columnNode, columnPath);
    treeTable.setColumnResizePolicy(TreeTableView.CONSTRAINED_RESIZE_POLICY);
}
项目:logbook-kai    文件:AirBaseController.java   
@FXML
void initialize() {
    try {
        TableTool.setVisible(this.planeTable, this.getClass() + "#" + "planeTable");

        this.areaTable.setShowRoot(false);
        this.airBase.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
        this.actionKind.setCellValueFactory(new TreeItemPropertyValueFactory<>("actionKind"));
        this.seiku.setCellValueFactory(new TreeItemPropertyValueFactory<>("seiku"));
        this.distance.setCellValueFactory(new TreeItemPropertyValueFactory<>("distance"));

        this.slot.setCellValueFactory(new PropertyValueFactory<>("slot"));
        this.slot.setCellFactory(p -> new ItemImageCell());
        this.count.setCellValueFactory(new PropertyValueFactory<>("count"));
        this.count.setCellFactory(p -> new CountImageCell());
        this.maxCount.setCellValueFactory(new PropertyValueFactory<>("maxCount"));
        this.cond.setCellValueFactory(new PropertyValueFactory<>("cond"));
        this.cond.setCellFactory(p -> new CondImageCell());

        SortedList<Plane> sortedList2 = new SortedList<>(this.planes);
        this.planeTable.setItems(this.planes);
        sortedList2.comparatorProperty().bind(this.planeTable.comparatorProperty());
        this.planeTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        this.planeTable.setOnKeyPressed(TableTool::defaultOnKeyPressedHandler);

        this.areaTable.getSelectionModel()
                .selectedItemProperty()
                .addListener(this::plane);

        this.timeline = new Timeline();
        this.timeline.setCycleCount(Timeline.INDEFINITE);
        this.timeline.getKeyFrames().add(new KeyFrame(
                javafx.util.Duration.seconds(1),
                this::update));
        this.timeline.play();

        this.setAirBase();
    } catch (Exception e) {
        LoggerHolder.get().error("FXMLの初期化に失敗しました", e);
    }
}
项目:logbook-kai    文件:MissionLogController.java   
@FXML
void initialize() {
    TableTool.setVisible(this.detail, this.getClass() + "#" + "detail");
    TableTool.setVisible(this.aggregate, this.getClass() + "#" + "aggregate");

    // 集計
    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);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TreeTableColumn} containing percentages calculated for a single profile.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param profileContext the {@link ProfileContext} for the profile whose data is shown
 * @param title the column title
 */
protected <U> void cfgPctCol(TreeTableColumn<U, Number> column, String propertyName,
    ProfileContext profileContext, String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new PercentageTreeTableCell<>(null));
    configureHeader(column, title, profileContext);
    addColumnMenuItem(column, title, profileContext);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TreeTableColumn} containing the percentage difference comparing two profiles.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param title the column title
 */
protected <U> void cfgPctDiffCol(TreeTableColumn<U, Number> column, String propertyName,
    String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new PercentageTreeTableCell<>(doubleDiffStyler));
    configureHeader(column, title, null);
    addColumnMenuItem(column, title, null);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TreeTableColumn} containing numbers calculated for a single profile.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param profileContext the {@link ProfileContext} for the profile whose data is shown
 * @param title the column title
 */
protected <U> void cfgNrCol(TreeTableColumn<U, Number> column, String propertyName,
    ProfileContext profileContext, String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new CountTreeTableCell<>(null));
    configureHeader(column, title, profileContext);
    addColumnMenuItem(column, title, profileContext);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TreeTableColumn} containing the number difference comparing two profiles.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param title the column title
 */
protected <U> void cfgNrDiffCol(TreeTableColumn<U, Number> column, String propertyName,
    String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new CountTreeTableCell<>(intDiffStyler));
    configureHeader(column, title, null);
    addColumnMenuItem(column, title, null);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TreeTableColumn} containing durations calculated for a single profile.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param profileContext the {@link ProfileContext} for the profile whose data is shown
 * @param title the column title
 */
protected <U> void cfgTimeCol(TreeTableColumn<U, Number> column, String propertyName,
    ProfileContext profileContext, String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new TimeTreeTableCell<>(null));
    configureHeader(column, title, profileContext);
    addColumnMenuItem(column, title, profileContext);
}
项目:honest-profiler    文件:AbstractViewController.java   
/**
 * Configures a {@link TableColumn} containing the duration difference comparing two profiles.
 * <p>
 *
 * @param <U> the type of the items in the {@link TableView} containing the {@link TableColumn}
 * @param column the column being configured
 * @param propertyName the name of the property containing the value for this column
 * @param title the column title
 */
protected <U> void cfgTimeDiffCol(TreeTableColumn<U, Number> column, String propertyName,
    String title)
{
    column.setCellValueFactory(new TreeItemPropertyValueFactory<>(propertyName));
    column.setCellFactory(col -> new TimeTreeTableCell<>(longDiffStyler));
    configureHeader(column, title, null);
    addColumnMenuItem(column, title, null);
}