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

项目:marathonv5    文件:CheckBoxTreeViewSample.java   
public CheckBoxTreeViewSample() {
    final CheckBoxTreeItem<String> treeRoot = new CheckBoxTreeItem<String>("Root node");
    treeRoot.getChildren().addAll(Arrays.asList(new CheckBoxTreeItem<String>("Child Node 1"),
            new CheckBoxTreeItem<String>("Child Node 2"), new CheckBoxTreeItem<String>("Child Node 3")));

    treeRoot.getChildren().get(2).getChildren()
            .addAll(Arrays.asList(new CheckBoxTreeItem<String>("Child Node 4"), new CheckBoxTreeItem<String>("Child Node 5"),
                    new CheckBoxTreeItem<String>("Child Node 6"), new CheckBoxTreeItem<String>("Child Node 7"),
                    new TreeItem<String>("Child Node 8"), new CheckBoxTreeItem<String>("Child Node 9"),
                    new CheckBoxTreeItem<String>("Child Node 10"), new CheckBoxTreeItem<String>("Child Node 11"),
                    new CheckBoxTreeItem<String>("Child Node 12")));

    final TreeView treeView = new TreeView();
    treeView.setCellFactory(CheckBoxTreeCell.forTreeView());
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);

    getChildren().add(treeView);
}
项目:marathonv5    文件:RFXCheckBoxTreeCell.java   
@Override public String _getValue() {
    @SuppressWarnings("rawtypes")
    CheckBoxTreeCell cell = (CheckBoxTreeCell) node;
    @SuppressWarnings("unchecked")
    ObservableValue<Boolean> call = (ObservableValue<Boolean>) cell.getSelectedStateCallback().call(cell.getTreeItem());
    String cbText;
    if (call != null) {
        int selection = call.getValue() ? 2 : 0;
        cbText = JavaFXCheckBoxElement.states[selection];
    } else {
        Node cb = cell.getGraphic();
        RFXComponent comp = getFinder().findRawRComponent(cb, null, null);
        cbText = comp._getValue();
    }
    return cbText;
}
项目:Scout2017    文件:ScoutAnalyzerController.java   
public void initialize(){
    //Generate List of teams from db
    genTeamList();

    //Generate table options
    genTreeItems();

    //Settings for gear graph
    gpmGraphX.setAutoRanging(false);
    gpmGraphX.setLowerBound(1.0);
    gpmGraphX.setTickUnit(1.0);
    gpmGraphY.setAutoRanging(true);

    //Settings for ball graph
    bpmGraphX.setAutoRanging(false);
    bpmGraphX.setLowerBound(1.0);
    bpmGraphX.setTickUnit(1.0);
    bpmGraphY.setAutoRanging(true);

    //Set format for table options
    tableOptionsTreeView.setCellFactory(CheckBoxTreeCell.<String>forTreeView());

}
项目:Gargoyle    文件:CheckBoxFxControlsTreeItem.java   
public CheckBoxFxControlsTreeItem(CheckTreeView<Node> tv) {
    this.tv = tv;

    tv.setCellFactory(param -> {
        CheckBoxTreeCell<Node> treeCell = new CheckBoxTreeCell<Node>();
        treeCell.setConverter(new StringConverter<TreeItem<Node>>() {

            @Override
            public String toString(TreeItem<Node> n) {
                return getName(n.getValue());
            }

            @Override
            public TreeItem<Node> fromString(String string) {
                // TODO Auto-generated method stub
                return null;
            }
        });
        return treeCell;
    });

}
项目:marathonv5    文件:JavaFXElementFactory.java   
public static void reset() {
    add(Node.class, JavaFXElement.class);
    add(TextInputControl.class, JavaFXTextInputControlElement.class);
    add(HTMLEditor.class, JavaFXHTMLEditor.class);
    add(CheckBox.class, JavaFXCheckBoxElement.class);
    add(ToggleButton.class, JavaFXToggleButtonElement.class);
    add(Slider.class, JavaFXSliderElement.class);
    add(Spinner.class, JavaFXSpinnerElement.class);
    add(SplitPane.class, JavaFXSplitPaneElement.class);
    add(ProgressBar.class, JavaFXProgressBarElement.class);
    add(ChoiceBox.class, JavaFXChoiceBoxElement.class);
    add(ColorPicker.class, JavaFXColorPickerElement.class);
    add(ComboBox.class, JavaFXComboBoxElement.class);
    add(DatePicker.class, JavaFXDatePickerElement.class);
    add(TabPane.class, JavaFXTabPaneElement.class);
    add(ListView.class, JavaFXListViewElement.class);
    add(TreeView.class, JavaFXTreeViewElement.class);
    add(TableView.class, JavaFXTableViewElement.class);
    add(TreeTableView.class, JavaFXTreeTableViewElement.class);
    add(CheckBoxListCell.class, JavaFXCheckBoxListCellElement.class);
    add(ChoiceBoxListCell.class, JavaFXChoiceBoxListCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxListCellElemnt.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxTreeCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxTreeCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxTableCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxTableCellElemnt.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxTreeTableCell.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxTreeTableCell.class);
}
项目:marathonv5    文件:JavaFXCheckBoxTreeCellElement.java   
@Override public String _getValue() {
    @SuppressWarnings("rawtypes")
    CheckBoxTreeCell cell = (CheckBoxTreeCell) getComponent();
    @SuppressWarnings("unchecked")
    ObservableValue<Boolean> call = (ObservableValue<Boolean>) cell.getSelectedStateCallback().call(cell.getTreeItem());
    int selection = call.getValue() ? 2 : 0;
    String cellText = cell.getText();
    if (cellText == null) {
        cellText = "";
    }
    String text = cellText + ":" + JavaFXCheckBoxElement.states[selection];
    return text;
}
项目:marathonv5    文件:TreeViewSample.java   
public TreeViewSample() {
    String dir = "./src";
    final CheckBoxTreeItem<File> treeRoot = buildRoot(dir);

    treeView = new TreeView<File>();
    treeView.setCellFactory(CheckBoxTreeCell.<File> forTreeView());
    treeView.setShowRoot(true);
    treeView.setRoot(treeRoot);
    treeRoot.setExpanded(true);

    getChildren().add(treeView);
}
项目:CORNETTO    文件:LoadedData.java   
/**
 * <h1>Initializes the TreeView FXML element.</h1>
 * The TreeView is divided into CheckBoxTreeItems as representation of samples
 * and TreeItems as representation of Taxa and information concerning those Taxa
 * @param treeViewFiles
 */
private static void generateTreeViewStructure(TreeView<String> treeViewFiles) {
    treeViewFiles.setRoot(new TreeItem<>("root"));
    //The classic treeview only has one root item, but you can work around this by just setting it to invisible
    treeViewFiles.setShowRoot(false);
    treeViewFiles.setCellFactory(new Callback<TreeView<String>, TreeCell<String>>() {
        @Override
        public TreeCell<String> call(TreeView<String> param) {
            return new CheckBoxTreeCell<String>() {
                @Override
                public void updateItem(String item, boolean empty) {
                    super.updateItem(item, empty);
                    //If there is no information for the Cell, make it empty
                    if (empty) {
                        setGraphic(null);
                        setText(null);
                        //Otherwise if it's not representation as an item of the tree
                        //is not a CheckBoxTreeItem, remove the checkbox item
                    } else if (!(getTreeItem() instanceof CheckBoxTreeItem)) {
                        setGraphic(null);
                        //If the TreeItem is a CheckBoxItem (that is the case for every TreeItem representing a sample)
                        //add the function that the user is able to delete the entire TreeItem with all its children
                    } else if (getTreeItem() instanceof CheckBoxTreeItem) {
                        MenuItem removeSample = new MenuItem("remove");
                        removeSample.setOnAction(event -> {
                            int indexOfTreeItem = treeViewFiles.getRoot().getChildren().indexOf(getTreeItem());
                            removeSampleFromDatabase(getTreeItem().getValue(), treeViewFiles, indexOfTreeItem);
                        });
                        setContextMenu(new ContextMenu(removeSample));
                    }
                }
            };
        }
    });
}
项目:openjfx-8u-dev-tests    文件:CheckBoxTreeApp.java   
public CheckBoxTreeItemScene() {
    super(new HBox(), 800, 400);

    final HBox box = (HBox) getRoot();

    VBox subbox = new VBox();

    treeView.setEditable(true);
    treeView.setId(TREE_VIEW_ID);

    treeView.setCellFactory(CheckBoxTreeCell.<String>forTreeView());

    Button resetButton = new Button("Reset");
    resetButton.setId(RESET_SCENE_BTN_ID);
    resetButton.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
            reset();
        }
    });

    subbox.getChildren().add(treeView);
    subbox.getChildren().add(resetButton);

    box.getChildren().add(subbox);

    reset();
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetTreeCheckBoxCellAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(CheckBoxTreeCell.class);

    assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
项目:Elegit    文件:WorkingTreePanelView.java   
/**
 * @return the cell from CheckBoxTreeCell's implementation of a TreeView factory, with
 * an added context menu for the given RepoFile
 */
@Override
protected Callback<TreeView<RepoFile>, TreeCell<RepoFile>> getTreeCellFactory() {
    return arg -> {
        TreeCell<RepoFile> cell = CheckBoxTreeCell.<RepoFile>forTreeView().call(arg);
        cell.setOnContextMenuRequested(event -> {
            if(cell.getTreeItem()!= null) cell.getTreeItem().getValue().showContextMenu(cell, event.getScreenX(), event.getScreenY());
        });
        return cell;
    };
}
项目:efiscen    文件:OutputController.java   
/**
 * Initializer for OutputController. Call constructor before initializing.
 * Initializes elements and loads settings.
 * @param url not in use
 * @param rb the given resource bundle
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    this.rb=rb;
    //type.getItems().addAll("ODBC","MySQL","PostgreSQL");
    for(DriverType driver : DriverType.values()) {
        type.getItems().add(driver.toString());
    }
    CheckBoxTreeItem<String> rootItem = new CheckBoxTreeItem<>(rb.getString("key.alloutputs"));
    rootItem.setExpanded(true);
    outputselection.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    outputselection.setCellFactory(CheckBoxTreeCell.<String>forTreeView());    
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.base")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carboncountry")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carbonsoil")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingmatrix")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingresidues")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.naturalmortality")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningmatrix")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningresidues")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.treecarbon")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.generalregions")));
    rootItem.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.generalspecies")));
    rootItem.selectedProperty().set(true);

    outputselection.setRoot(rootItem);
    CheckBoxTreeItem<String> rootItem2 = new CheckBoxTreeItem<>(rb.getString("key.alloutputs"));
    rootItem2.setExpanded(true);
    databaseTree.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    databaseTree.setCellFactory(CheckBoxTreeCell.<String>forTreeView());    
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.base")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carboncountry")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.carbonsoil")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.deadwood")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingmatrix")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.fellingresidues")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.naturalmortality")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningmatrix")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.thinningresidues")));
    rootItem2.getChildren().add(new CheckBoxTreeItem<>(rb.getString("key.treecarbon")));
    rootItem2.selectedProperty().set(true);

    databaseTree.setRoot(rootItem2);
    rootItem.selectedProperty().set(true);
    update();
    chooser = new DirectoryChooser();
    chooser.setTitle(rb.getString("key.outputpath"));
}