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

下面列出了怎么用javafx.scene.control.cell.CheckBoxTreeCell的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: 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);
}
 
源代码2 项目: 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;
}
 
源代码3 项目: MyBox   文件: ConditionTreeView.java
public ConditionTreeView() {
    finalConditions = null;
    finalTitle = "";
    selectedTitles = new ArrayList();
    selectedConditions = new ArrayList();
    expandedNodes = new ArrayList();

    setCellFactory(p -> new CheckBoxTreeCell<ConditionNode>() {
        @Override
        public void updateItem(ConditionNode item, boolean empty) {
            super.updateItem(item, empty);
            if (empty || item == null) {
                setText(null);
                setGraphic(null);
                return;
            }
            setText(item.getText());
            Node node = getGraphic();
            if (node != null && node instanceof CheckBox) {
                CheckBox checkBox = (CheckBox) node;
                if (item.getCondition() != null && !item.getCondition().isBlank()) {
                    FxmlControl.setTooltip(checkBox, item.getTitle() + "\n" + item.getCondition());
                } else {
                    FxmlControl.removeTooltip(checkBox);
                }
            }
        }
    });
}
 
源代码4 项目: 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, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxListCell.class, JavaFXComboBoxCellElement.class);
    add(CheckBoxTreeCell.class, JavaFXCheckBoxTreeCellElement.class);
    add(ChoiceBoxTreeCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTreeCell.class, JavaFXComboBoxCellElement.class);
    add(TableCell.class, JavaFXTableViewCellElement.class);
    add(CheckBoxTableCell.class, JavaFXCheckBoxTableCellElement.class);
    add(ChoiceBoxTableCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTableCell.class, JavaFXComboBoxCellElement.class);
    add(TreeTableCell.class, JavaFXTreeTableCellElement.class);
    add(CheckBoxTreeTableCell.class, JavaFXCheckBoxTreeTableCell.class);
    add(ChoiceBoxTreeTableCell.class, JavaFXChoiceBoxCellElement.class);
    add(ComboBoxTreeTableCell.class, JavaFXComboBoxCellElement.class);
    add(WebView.class, JavaFXWebViewElement.class);
    add(GenericStyledArea.GENERIC_STYLED_AREA_CLASS, RichTextFXGenericStyledAreaElement.class);
}
 
@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;
}
 
源代码6 项目: 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);
}
 
源代码7 项目: BowlerStudio   文件: PluginManager.java
public Node getBowlerBrowser(){

		CheckBoxTreeItem<String> rpc = new CheckBoxTreeItem<> ("Bowler RPC"); 
		TreeView<String> treeView =new  TreeView<>(rpc);
		treeView.setCellFactory(CheckBoxTreeCell.forTreeView());
		
		if(dev.getConnection()!=null){
			rpc.setExpanded(true);
			ArrayList<String> nameSpaceList = dev.getNamespaces();
			for(String namespace:nameSpaceList){
				CheckBoxTreeItem<String> ns = new CheckBoxTreeItem<> (namespace); 
				ns.setExpanded(false);
				rpc.getChildren().add(ns);
				ArrayList<RpcEncapsulation> rpcList = dev.getRpcList(namespace);
				CheckBoxTreeItem<String> get = new CheckBoxTreeItem<> ("GET"); 
				CheckBoxTreeItem<String> post = new CheckBoxTreeItem<> ("POST"); 
				CheckBoxTreeItem<String> async = new CheckBoxTreeItem<> ("ASYNC"); 
				CheckBoxTreeItem<String> crit = new CheckBoxTreeItem<> ("CRITICAL");
				get.setExpanded(false);
				ns.getChildren().add(get);
				post.setExpanded(false);
				ns.getChildren().add(post);
				async.setExpanded(false);
				ns.getChildren().add(async);
				crit.setExpanded(false);
				ns.getChildren().add(crit);
				for(RpcEncapsulation rpcEnc:rpcList){
					CheckBoxTreeItem<String> rc = new CheckBoxTreeItem<> (rpcEnc.getRpc()); 
					rc.setExpanded(false);
					switch(rpcEnc.getDownstreamMethod()){
					case ASYNCHRONOUS:
						async.getChildren().add(rc);
						break;
					case CRITICAL:
						crit.getChildren().add(rc);
						break;
					case GET:
						get.getChildren().add(rc);
						break;
					case POST:
						post.getChildren().add(rc);
						break;
					default:
						break;
					
					}
					RpcCommandPanel panel =new RpcCommandPanel(rpcEnc, dev,rc);

//					Platform.runLater(()->{
//						SwingNode sn = new SwingNode();
//						Stage dialog = new Stage();
//						dialog.setHeight(panel.getHeight());
//						dialog.setWidth(panel.getWidth());
//						dialog.initStyle(StageStyle.UTILITY);
//					    sn.setContent(panel);
//						Scene scene = new Scene(new Group(sn));
//						dialog.setScene(scene);
//						dialog.setOnCloseRequest(event -> {
//							rc.setSelected(false);
//						});
//						rc.selectedProperty().addListener(b ->{
//							 if(rc.isSelected()){
//								 dialog.show();
//							 }else{
//								 dialog.hide();
//							 }
//				        });
//					});
					
				}
			}
		}
		
		return treeView;
		
	}
 
 类所在包
 同包方法