當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeTableColumn類代碼示例

本文整理匯總了Java中javafx.scene.control.TreeTableColumn的典型用法代碼示例。如果您正苦於以下問題:Java TreeTableColumn類的具體用法?Java TreeTableColumn怎麽用?Java TreeTableColumn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TreeTableColumn類屬於javafx.scene.control包,在下文中一共展示了TreeTableColumn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupGroupView

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
private void setupGroupView() {
	groupList = new JFXTreeTableView<>();

	TreeTableColumn<GroupTreeObject, String> nameColumn = new JFXTreeTableColumn<>("Name");
	nameColumn.setPrefWidth(150);
	nameColumn.setCellValueFactory((TreeTableColumn.CellDataFeatures<GroupTreeObject, String> param) -> {
		Group group = fromItem(param.getValue());
		if (group == null) {
			return new SimpleStringProperty();
		}
		return new SimpleStringProperty(group.getDisplayName());
	});
	groupList.getColumns().add(nameColumn);
	TreeItem treeItem = new TreeItem<>();
	treeItem.setExpanded(true);
	groupList.setRoot(treeItem);
	groupList.setShowRoot(false);
	groupList.setPrefHeight(Short.MAX_VALUE);
}
 
開發者ID:MakerTim,項目名稱:LuckPermsUI,代碼行數:20,代碼來源:GroupListManager.java

示例2: getTestContainer

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
protected Node getTestContainer() {
    treeOrTreeTableView = new TreeTableView<Data>();
    treeOrTreeTableView.setMinSize(300, 500);
    treeOrTreeTableView.setMaxSize(300, 500);
    treeOrTreeTableView.setPrefSize(300, 500);
    TreeTableColumn<Data, Node> column = new TreeTableColumn<Data, Node>("Items' name");
    column.setCellValueFactory(new Callback<TreeTableColumn.CellDataFeatures<Data, Node>, ObservableValue<Node>>() {
        @Override
        public ObservableValue<Node> call(final TreeTableColumn.CellDataFeatures<Data, Node> p) {
            SimpleObjectProperty<Node> text = new SimpleObjectProperty<Node>();
            text.setValue(new Label(p.getValue().getValue().getData()));
            return text;
        }
    });
    column.setPrefWidth(150);
    ((TreeTableView) treeOrTreeTableView).getColumns().add(column);
    reset(0);
    return treeOrTreeTableView;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:21,代碼來源:TreeTableAsOldTreeApp.java

示例3: testCollapsedNodeGraphicVisible

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
/**
 * 8158784: [TEST BUG] Need test for JDK-8157398
 */
@Test
public void testCollapsedNodeGraphicVisible() throws Exception {
    Color nodeColor = new Color(Math.random(), Math.random(), Math.random(), 1);
    TreeTableView treeTable = (TreeTableView) testedControl.getControl();
    TreeItem<String> root = new TreeItem<>("Root Node");
    TreeItem<String> child = new TreeItem<>("Child", new Rectangle(10, 10, nodeColor));
    TreeTableColumn<String, String> column = new TreeTableColumn<>("Column");
    column.setCellValueFactory(item -> new SimpleStringProperty("Whatever"));
    treeTable.getColumns().setAll(column);
    root.getChildren().add(child);
    root.setExpanded(true);
    treeTable.setShowRoot(true);
    runAndWait(() -> {
        treeTable.setRoot(root);
    });
    Wrap nodeGraphic = parent.lookup(node -> node == child.getGraphic()).wrap();
    Wrap sceneWrap = Root.ROOT.lookup().wrap();
    waitForColor(nodeGraphic, 1, 1, nodeColor);
    Bounds graphicBounds = child.getGraphic().localToScene(child.getGraphic().getBoundsInLocal());
    root.setExpanded(false);
    waitForColor(sceneWrap,
            (int) (graphicBounds.getMinX() + graphicBounds.getWidth() / 2),
            (int) (graphicBounds.getMinY() + graphicBounds.getHeight() / 2), Color.WHITE);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:28,代碼來源:CommonTreeTableTest.java

示例4: getTreeTableItemText

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@SuppressWarnings("unchecked") private String getTreeTableItemText(TreeTableView<?> treeTableView,
        TreeItem<?> lastPathComponent) {
    @SuppressWarnings("rawtypes")
    TreeTableColumn treeTableColumn = treeTableView.getTreeColumn();
    if (treeTableColumn == null) {
        treeTableColumn = treeTableView.getColumns().get(0);
    }
    ObservableValue<?> cellObservableValue = treeTableColumn.getCellObservableValue(lastPathComponent);
    String original = cellObservableValue.getValue().toString();
    String itemText = original;
    int suffixIndex = 0;
    TreeItem<?> parent = lastPathComponent.getParent();
    if (parent == null)
        return itemText;
    ObservableList<?> children = parent.getChildren();
    for (int i = 0; i < children.indexOf(lastPathComponent); i++) {
        TreeItem<?> child = (TreeItem<?>) children.get(i);
        cellObservableValue = treeTableColumn.getCellObservableValue(child);
        String current = cellObservableValue.getValue().toString();
        if (current.equals(original)) {
            itemText = String.format("%s(%d)", original, ++suffixIndex);
        }
    }
    return itemText;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:26,代碼來源:JavaFXElementPropertyAccessor.java

示例5: selectTreeTableCells

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@SuppressWarnings("unchecked") protected void selectTreeTableCells(TreeTableView<?> treeTableView, String value) {
    @SuppressWarnings("rawtypes")
    TreeTableViewSelectionModel selectionModel = treeTableView.getSelectionModel();
    JSONObject cells = new JSONObject(value);
    JSONArray object = (JSONArray) cells.get("cells");
    for (int i = 0; i < object.length(); i++) {
        JSONArray jsonArray = object.getJSONArray(i);
        int rowIndex = getTreeTableNodeIndex(treeTableView, jsonArray.getString(0));
        int columnIndex = getTreeTableColumnIndex(treeTableView, jsonArray.getString(1));
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = treeTableView.getColumns().get(columnIndex);
        if (getVisibleCellAt(treeTableView, rowIndex, columnIndex) == null) {
            treeTableView.scrollToColumn(column);
            treeTableView.scrollTo(rowIndex);
        }
        selectionModel.select(rowIndex, column);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:JavaFXElementPropertyAccessor.java

示例6: selectMultipleCells

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@SuppressWarnings("unchecked") @Test public void selectMultipleCells() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        selectionModel.setSelectionMode(SelectionMode.MULTIPLE);
        Point2D point = getPoint(treeTableView, 1, 0);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, point, lr);
        rfxTreeTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = getTreeTableColumnAt(treeTableView, 0);
        selectionModel.select(1, column);
        selectionModel.select(3, getTreeTableColumnAt(treeTableView, 1));
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals(
            "{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"],[\"/Sales Department/Michael Brown\",\"Email\"]]}",
            recording.getParameters()[0]);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:24,代碼來源:RFXTreeTableViewTest.java

示例7: selectACell

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@SuppressWarnings("unchecked") @Test public void selectACell() {
    TreeTableView<?> treeTableView = (TreeTableView<?>) getPrimaryStage().getScene().getRoot().lookup(".tree-table-view");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(() -> {
        TreeTableViewSelectionModel<?> selectionModel = treeTableView.getSelectionModel();
        selectionModel.setCellSelectionEnabled(true);
        Point2D point = getPoint(treeTableView, 1, 0);
        RFXTreeTableView rfxTreeTableView = new RFXTreeTableView(treeTableView, null, point, lr);
        rfxTreeTableView.focusGained(null);
        @SuppressWarnings("rawtypes")
        TreeTableColumn column = getTreeTableColumnAt(treeTableView, 0);
        selectionModel.select(1, column);
        rfxTreeTableView.focusLost(null);
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording recording = recordings.get(0);
    AssertJUnit.assertEquals("recordSelect", recording.getCall());
    AssertJUnit.assertEquals("{\"cells\":[[\"/Sales Department/Ethan Williams\",\"Employee\"]]}", recording.getParameters()[0]);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:RFXTreeTableViewTest.java

示例8: call

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
public TreeTableCell<ReferenceDescription, ReferenceDescription> call(TreeTableColumn<ReferenceDescription, ReferenceDescription> param) {
  return new TreeTableCell<ReferenceDescription, ReferenceDescription>() {

    @Override
    protected void updateItem(ReferenceDescription item, boolean empty) {
      super.updateItem(item, empty);
      if (!empty && item != null) {
        setText(item.getDisplayName().getText());
        setGraphic(createGraphicNode(item));
      } else {
        setText(null);
        setGraphic(null);
      }
    }
  };
}
 
開發者ID:comtel2000,項目名稱:opc-ua-client,代碼行數:18,代碼來源:DataTreeNodeCellFactory.java

示例9: resizeColumn

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
void resizeColumn(final int index, final double delta) {

        final double initialWidth = getColumnWidth(index);

        new GetAction<Void>() {
            @Override
            public void run(Object... os) throws Exception {
                if (isTableTests) {
                    TableView table = (TableView) testedControl.getControl();
                    table.resizeColumn((TableColumn) table.getColumns().get(index), delta);
                } else {
                    TreeTableView treeTable = (TreeTableView) testedControl.getControl();
                    treeTable.resizeColumn((TreeTableColumn) treeTable.getColumns().get(index), delta);
                }
            }
        }.dispatch(testedControl.getEnvironment());

        new Waiter(new Timeout("", 1000)).waitState(new State<Boolean>() {
            public Boolean reached() {
                return (Math.abs(getColumnWidth(index) - initialWidth - delta) <= 1e-7) ? Boolean.TRUE : null;
            }
        });
    }
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:24,代碼來源:TestBase.java

示例10: getNextColumn

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
/**
 * @param forward true gets the column to the right, false the column to the left of the current column
 * @return
 */
private TreeTableColumn<S, ?> getNextColumn(boolean forward) {
    List<TreeTableColumn<S, ?>> columns = new ArrayList<>();
    for (TreeTableColumn<S, ?> column : getTreeTableView().getColumns()) {
        columns.addAll(getLeaves(column));
    }
    //There is no other column that supports editing.
    if (columns.size() < 2) {
        return null;
    }
    int nextIndex = columns.indexOf(getTableColumn());
    if (forward) {
        nextIndex++;
        if (nextIndex > columns.size() - 1) {
            nextIndex = 0;
        }
    } else {
        nextIndex--;
        if (nextIndex < 0) {
            nextIndex = columns.size() - 1;
        }
    }
    return columns.get(nextIndex);
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:28,代碼來源:GenericEditableTreeTableCell.java

示例11: group

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
/**
 * this is a blocking method so it should not be called from the ui thread,
 * it will regroup the tree table view
 * @param treeTableColumns
 */
public void group(TreeTableColumn<S, ?>... treeTableColumns) {
    try{
        lock.lock();
        // init groups map
        if (groupOrder.size() == 0) {
            groups = new HashMap<>();
        }
        try {
            if (originalRoot == null) {
                originalRoot = getRoot();
            }
            for (TreeTableColumn<S, ?> treeTableColumn : treeTableColumns) {
                groups = group(treeTableColumn, groups, null, (RecursiveTreeItem<S>) originalRoot);
            }
            groupOrder.addAll(treeTableColumns);
            // update table ui
            buildGroupedRoot(groups, null, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }finally {
        lock.unlock();
    }
}
 
開發者ID:jfoenixadmin,項目名稱:JFoenix,代碼行數:30,代碼來源:JFXTreeTableView.java

示例12: call

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) {
  return new TreeTableCell<FeatureTableRow, Object>() {
    @Override
    public void updateItem(Object object, boolean empty) {
      super.updateItem(object, empty);
      setStyle("-fx-alignment: CENTER;"
          + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
      if (object == null) {
        setText(null);
      } else {
        NumberFormat formatter = MZmineCore.getConfiguration().getMZFormat();
        Double doubleValue = Double.parseDouble(object.toString());
        setText(formatter.format(doubleValue));
      }
    }
  };
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:19,代碼來源:MzRenderer.java

示例13: call

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) {
  return new TreeTableCell<FeatureTableRow, Object>() {
    @Override
    public void updateItem(Object object, boolean empty) {
      super.updateItem(object, empty);
      setStyle("-fx-alignment: CENTER;"
          + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
      if (object == null) {
        setText(null);
      } else {

        try {
          NumberFormat formatter = new DecimalFormat("#0.00");
          Double doubleValue = Double.parseDouble(object.toString());
          setText(formatter.format(doubleValue));
        } catch (NumberFormatException e) {
          setText(object.toString());
        }

      }
    }
  };
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:25,代碼來源:DefaultRenderer.java

示例14: call

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) {
  return new TreeTableCell<FeatureTableRow, Object>() {
    @Override
    public void updateItem(Object object, boolean empty) {
      super.updateItem(object, empty);
      setStyle("-fx-alignment: CENTER;"
          + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
      if (object == null) {
        setText(null);
      } else {
        Integer integerValue = Integer.parseInt(object.toString());
        setText(integerValue.toString());
      }
    }
  };
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:18,代碼來源:IntegerRenderer.java

示例15: call

import javafx.scene.control.TreeTableColumn; //導入依賴的package包/類
@Override
public TreeTableCell<FeatureTableRow, Object> call(TreeTableColumn<FeatureTableRow, Object> p) {
  return new TreeTableCell<FeatureTableRow, Object>() {
    @Override
    public void updateItem(Object object, boolean empty) {
      super.updateItem(object, empty);
      setStyle("-fx-alignment: CENTER;"
          + "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
      if (object == null) {
        setText(null);
      } else {
        Range rangeValue = (Range) object;
        NumberFormat formatter = MZmineCore.getConfiguration().getMZFormat();
        String value = formatter.format(rangeValue.lowerEndpoint()) + " - "
            + formatter.format(rangeValue.upperEndpoint());
        setText(value);
      }
    }
  };
}
 
開發者ID:mzmine,項目名稱:mzmine3,代碼行數:21,代碼來源:RtRangeRenderer.java


注:本文中的javafx.scene.control.TreeTableColumn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。