javafx.scene.control.cell.CheckBoxTreeCell Java Examples

The following examples show how to use javafx.scene.control.cell.CheckBoxTreeCell. 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: RFXCheckBoxTreeCell.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
@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;
}
 
Example #2
Source File: CheckBoxTreeViewSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: ConditionTreeView.java    From MyBox with Apache License 2.0 5 votes vote down vote up
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);
                }
            }
        }
    });
}
 
Example #4
Source File: JavaFXElementFactory.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #5
Source File: JavaFXCheckBoxTreeCellElement.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #6
Source File: TreeViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #7
Source File: PluginManager.java    From BowlerStudio with GNU General Public License v3.0 4 votes vote down vote up
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;
		
	}