public void onActionSelectAll(ActionEvent ae) { if (!triggerOnActionSelectAll) { return; } LoggerFacade.getDefault().info(this.getClass(), "On action select all"); // NOI18N if (!(ae.getSource() instanceof CheckBox)) { return; } final CheckBox checkBox = (CheckBox) ae.getSource(); final Boolean isSelected = checkBox.isSelected(); lvEntities.getItems().stream() .filter((item) -> (item instanceof CheckBoxListCellModel)) .forEach((item) -> { final CheckBoxListCellModel model = (CheckBoxListCellModel) item; model.setSelected(isSelected); }); }
@Override @FXThread protected void processOk() { final NodeTree<?> nodeTree = getNodeTree(); final TreeNode<?> node = getNode(); final Geometry geometry = (Geometry) node.getElement(); final Mesh newMesh = geometry.getMesh(); final Mesh oldMesh = newMesh.deepClone(); final ComboBox<AlgorithmType> algorithmTypeComboBox = getAlgorithmTypeComboBox(); final AlgorithmType algorithmType = algorithmTypeComboBox.getSelectionModel().getSelectedItem(); if (algorithmType == AlgorithmType.STANDARD) { final CheckBox splitMirroredCheckBox = getSplitMirroredCheckBox(); TangentGenerator.useStandardGenerator(geometry, splitMirroredCheckBox.isSelected()); } else { TangentGenerator.useMikktspaceGenerator(geometry); } final ChangeConsumer changeConsumer = notNull(nodeTree.getChangeConsumer()); changeConsumer.execute(new ChangeMeshOperation(newMesh, oldMesh, geometry)); super.processOk(); }
public VBoxSample() { super(400, 100); CheckBox cb1 = new CheckBox("Breakfast"); CheckBox cb2 = new CheckBox("Lunch"); CheckBox cb3 = new CheckBox("Dinner"); VBox vboxMeals = new VBox(5); vboxMeals.getChildren().addAll(cb1, cb2, cb3); Label label = new Label("Select one or more meals:"); VBox vboxOuter = new VBox(10); vboxOuter.getChildren().addAll(label, vboxMeals); vboxOuter.setAlignment(Pos.CENTER_LEFT); getChildren().add(vboxOuter); }
private Node getMessageBar(VBox vbox) { HBox hb = new HBox(10); hb.setPrefHeight(32); hb.setStyle("-fx-padding: 0 5px 0 5px; -fx-background-color: " + _message_bg + ";"); CheckBox cb = new CheckBox("Do Not Show Again"); cb.setStyle("-fx-text-fill: " + _message_fg + ";-fx-fill: " + _message_fg + ";"); Text b = FXUIUtils.getIconAsText("close"); b.setOnMouseClicked((e) -> { JSONObject preferences = Preferences.instance().getSection("display"); preferences.put("_doNotShowMessage", cb.isSelected()); Preferences.instance().save("display"); vbox.getChildren().remove(0); }); Text t = new Text(_message); hb.setAlignment(Pos.CENTER_LEFT); HBox.setHgrow(t, Priority.ALWAYS); t.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold; -fx-font-family: Tahoma;"); b.setStyle("-fx-fill: " + _message_fg + "; -fx-font-size: 14px; -fx-font-weight:bold;"); Region spacer = new Region(); HBox.setHgrow(spacer, Priority.ALWAYS); hb.getChildren().addAll(t, spacer, b); return hb; }
private void setFormConstraints(Node field) { if (field instanceof ISetConstraints) { ((ISetConstraints) field).setFormConstraints(this); } else if (field instanceof Button) { _setFormConstraints((Button) field); } else if (field instanceof TextField) { _setFormConstraints((TextField) field); } else if (field instanceof TextArea) { _setFormConstraints((TextArea) field); } else if (field instanceof ComboBox<?>) { _setFormConstraints((ComboBox<?>) field); } else if (field instanceof ChoiceBox<?>) { _setFormConstraints((ChoiceBox<?>) field); } else if (field instanceof CheckBox) { _setFormConstraints((CheckBox) field); } else if (field instanceof Spinner<?>) { _setFormConstraints((Spinner<?>) field); } else if (field instanceof VBox) { _setFormConstraints((VBox) field); } else if (field instanceof Label) { _setFormConstraints((Label) field); } else { LOGGER.info("FormPane.setFormConstraints(): unknown field type: " + field.getClass().getName()); } }
@Override public String _getValue() { TableCell<?, ?> cell = (TableCell<?, ?>) node; Node graphic = cell.getGraphic(); JavaFXElement component = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window); if (graphic != null && component != null) { if (graphic instanceof CheckBox) { String cellText = cell.getText() == null ? "" : cell.getText(); return cellText + ":" + component._getValue(); } return component._getValue(); } return super._getValue(); }
@Test public void getText() throws Throwable { CheckBox checkBox = findCheckbox("Simple checkbox"); LoggingRecorder lr = new LoggingRecorder(); List<String> text = new ArrayList<>(); Platform.runLater(new Runnable() { @Override public void run() { checkBox.setSelected(true); RFXCheckBox rfxCheckBox = new RFXCheckBox(checkBox, null, null, lr); rfxCheckBox.mouseClicked(null); text.add(rfxCheckBox._getText()); } }); new Wait("Waiting for checkbox text") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("Simple checkbox", text.get(0)); }
private Node executionOnNonInstructionMemorySelection( SimulatorSettingDetails settingDetails ) { HBox hBox = new HBox(); //TODO ensure numerical values only CheckBox executionOfNonInstructionMemoryCheckBox = new CheckBox("Allow execution of non-instruction memory"); executionOfNonInstructionMemoryCheckBox.setAllowIndeterminate(false); executionOfNonInstructionMemoryCheckBox .setSelected(Boolean.valueOf(settingDetails.getAllowExecutionOfNonInstructionMemory())); allowExecutionOfNonInstructionMemoryModel = executionOfNonInstructionMemoryCheckBox.selectedProperty(); hBox.getChildren().add(executionOfNonInstructionMemoryCheckBox); return hBox; }
private Node zeroOnReadsFromUninitializedMemorySelection( SimulatorSettingDetails settingDetails ) { HBox hBox = new HBox(); //TODO ensure numerical values only CheckBox zeroOnReadsFromUninitializedMemoryCheckBox = new CheckBox("Assume zero on reads from uninitialized memory"); zeroOnReadsFromUninitializedMemoryCheckBox.setAllowIndeterminate(false); zeroOnReadsFromUninitializedMemoryCheckBox .setSelected(Boolean.valueOf(settingDetails.getAssumeZeroOnReadsFromUninitializedMemory())); assumeZeroOnReadsFromUninitializedMemoryModel = zeroOnReadsFromUninitializedMemoryCheckBox.selectedProperty(); hBox.getChildren().add(zeroOnReadsFromUninitializedMemoryCheckBox); return hBox; }
private Node buildConfigurationUI() { VBox box = new VBox(); box.setPadding(new Insets(10)); CheckBox cb = new CheckBox(MessageBundle.getInstance().getString("homeTimelineCB")); cb.selectedProperty().addListener((ObservableValue<? extends Boolean> ov, Boolean oldVal, Boolean newVal) -> { showHomeTimeline = newVal; }); Label label = new Label(MessageBundle.getInstance().getString("userListLabel") + ":"); ListView<SelectableItem<UserList>> lv = new ListView<>(); lv.setItems(itemList); lv.setCellFactory(CheckBoxListCell.forListView(item -> item.getSelected())); VBox.setVgrow(lv, Priority.ALWAYS); box.getChildren().addAll(cb, label, lv); showTwitterListSelection(); return box; }
public CheckBoxListCell( final Callback<T, ObservableValue<Boolean>> getSelectedProperty, final BooleanProperty disableProperty, final StringConverter<T> converter ) { this.getStyleClass().add("check-box-list-cell"); setSelectedStateCallback(getSelectedProperty); setConverter(converter); checkBox = new CheckBox(); checkBox.disableProperty().bind(disableProperty); setAlignment(Pos.CENTER_LEFT); setContentDisplay(ContentDisplay.LEFT); // by default the graphic is null until the cell stops being empty setGraphic(null); }
public CheckBoxControl(String name) { super(name, FlashboardSendableType.CHECKBOX); checkBox = new CheckBox(name); checkBox.selectedProperty().addListener((obs, o, n)->{ if(localChange) return; synchronized (valueMutex) { lChanged = true; value = n.booleanValue(); send[0] = (byte) (value? 1: 0); } }); root = new VBox(); root.setAlignment(Pos.CENTER); root.getChildren().add(checkBox); }
@Override @FXThread protected void processOpen(@NotNull final ResourceElement element) { super.processOpen(element); final ComboBox<String> textureParamNameBox = getTextureParamNameComboBox(); final SingleSelectionModel<String> selectionModel = textureParamNameBox.getSelectionModel(); final String textureParamName = selectionModel.getSelectedItem(); final CheckBox transformBox = getApplyLightingTransformCheckBox(); final AssetManager assetManager = EDITOR.getAssetManager(); final Path file = element.getFile(); final Path assetFile = getAssetFile(file); if (assetFile == null) { throw new RuntimeException("AssetFile can't be null."); } final Material material = assetManager.loadAsset(new MaterialKey(toAssetPath(assetFile))); final Consumer<ParticlesMaterial> consumer = getConsumer(); consumer.accept(new ParticlesMaterial(material, textureParamName, transformBox.isSelected())); }
/** * When user interacts with the show lane borders {@link CheckBox}. * * @param actionEvent the {@link ActionEvent} */ @FXML void showLaneBordersClicked(final ActionEvent actionEvent) { settings.addRunnable(() -> { final boolean newValue = ((CheckBox) actionEvent.getSource()).isSelected(); graphVisualizer.getDisplayBordersProperty().setValue(newValue); LOGGER.info("Displaying lane borders has now been " + (newValue ? "enabled." : "disabled.")); }); }
public CheckBoxTableCell() { this.checkBox = new CheckBox(); this.checkBox.setAlignment(Pos.CENTER); setAlignment(Pos.CENTER); setGraphic(checkBox); }
public CheckBoxes() { VBox vbox = new VBox(); vbox.setSpacing(10); CheckBox cb1 = new CheckBox("Simple checkbox"); CheckBox cb2 = new CheckBox("Three state checkbox"); cb2.setAllowIndeterminate(true); cb2.setIndeterminate(false); CheckBox cb3 = new CheckBox("Disabled"); cb3.setSelected(true); cb3.setDisable(true); vbox.getChildren().add(cb1); vbox.getChildren().add(cb2); vbox.getChildren().add(cb3); getChildren().add(vbox); }
public int getSelection(CheckBox cb) { int selection; if (cb.isAllowIndeterminate() && cb.isIndeterminate()) { selection = 1; } else { selection = cb.isSelected() ? 2 : 0; } return selection; }
protected boolean onCheckBox(Node target) { Node parent = target; while (parent != null) { if (parent instanceof CheckBox) return true; parent = parent.getParent(); } return false; }
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); }
@Override public boolean marathon_select(String value) { CheckBox cb = (CheckBox) node; if (!isValidState(value)) { throw new JavaAgentException(value + " is not a valid state for CheckBox.", null); } int selection = 0; for (String state : states) { if (state.equalsIgnoreCase(value)) { break; } selection++; } int current = getSelection(cb); if (cb.isAllowIndeterminate()) { if (current != selection) { int nclicks = selection - current; if (nclicks < 0) { nclicks += 3; } for (int i = 0; i < nclicks; i++) { click(); } } } else { if (current != selection) { click(); } } return true; }
@Override protected @NotNull Region buildSecondPart(@NotNull final HBox container) { final Region preview = super.buildSecondPart(container); textureParamNameLabel = new Label(Messages.PARTICLE_ASSET_EDITOR_DIALOG_TEXTURE_PARAM_LABEL + ":"); textureParamNameLabel.prefWidthProperty().bind(container.widthProperty().multiply(0.25)); applyLightingTransformLabel = new Label(Messages.PARTICLE_ASSET_EDITOR_DIALOG_LIGHTING_TRANSFORM_LABEL + ":"); applyLightingTransformLabel.prefWidthProperty().bind(container.widthProperty().multiply(0.25)); textureParamNameComboBox = new ComboBox<>(); textureParamNameComboBox.prefWidthProperty().bind(container.widthProperty().multiply(0.25)); applyLightingTransformCheckBox = new CheckBox(); applyLightingTransformCheckBox.prefWidthProperty().bind(container.widthProperty().multiply(0.25)); final GridPane settingsContainer = new GridPane(); settingsContainer.add(textureParamNameLabel, 0, 0); settingsContainer.add(textureParamNameComboBox, 1, 0); settingsContainer.add(applyLightingTransformLabel, 0, 1); settingsContainer.add(applyLightingTransformCheckBox, 1, 1); settingsContainer.add(preview, 0, 2, 2, 1); FXUtils.addClassTo(settingsContainer, CSSClasses.DEF_GRID_PANE); return settingsContainer; }
@Override public String _getValue() { TreeTableCell<?, ?> cell = (TreeTableCell<?, ?>) node; Node graphic = cell.getGraphic(); JavaFXElement component = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window); if (graphic != null && component != null) { if (graphic instanceof CheckBox) { String cellText = cell.getText() == null ? "" : cell.getText(); return cellText + ":" + component._getValue(); } return component._getValue(); } return super._getValue(); }
@Override public String _getText() { ListCell<?> cell = (ListCell<?>) getPseudoComponent(); Node graphic = cell.getGraphic(); JavaFXElement graphicElement = (JavaFXElement) JavaFXElementFactory.createElement(graphic, driver, window); if (graphic != null && graphicElement != null) { if (graphic instanceof CheckBox) { return cell.getText(); } else { return graphicElement._getValue(); } } JavaFXElement cellElement = (JavaFXElement) JavaFXElementFactory.createElement(cell, driver, window); return cellElement._getValue(); }
@Test public void selectCheckboxNotSelectedSelected() throws Throwable { CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box"); AssertJUnit.assertEquals(false, checkBoxNode.isSelected()); checkBox.marathon_select("checked"); new Wait("Waiting for the check box selection.") { @Override public boolean until() { return checkBoxNode.isSelected(); } }; }
@Test public void selectCheckboxSelectedSelected() throws Throwable { CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box"); checkBoxNode.setSelected(true); AssertJUnit.assertEquals(true, checkBoxNode.isSelected()); checkBox.marathon_select("checked"); new Wait("Waiting for the check box selection.") { @Override public boolean until() { return checkBoxNode.isSelected(); } }; }
@Test public void selectCheckboxSelectedNotSelected() throws Throwable { CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box"); checkBoxNode.setSelected(true); AssertJUnit.assertEquals(true, checkBoxNode.isSelected()); checkBox.marathon_select("unchecked"); new Wait("Waiting for the check box deselect.") { @Override public boolean until() { return !checkBoxNode.isSelected(); } }; }
@Test public void selectCheckboxNotSelectedNotSelected() throws Throwable { CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box"); AssertJUnit.assertEquals(false, checkBoxNode.isSelected()); checkBox.marathon_select("unchecked"); new Wait("Waiting for the check box deselect.") { @Override public boolean until() { return !checkBoxNode.isSelected(); } }; }
@Test public void undefinedCheckboxNotSelectedNotSelected() throws Throwable { CheckBox checkBoxNode = findCheckbox("Three state checkbox"); AssertJUnit.assertEquals(false, checkBoxNode.isSelected()); triStateCheckBox.marathon_select("indeterminate"); new Wait("Waiting for the check box deselect.") { @Override public boolean until() { return checkBoxNode.isIndeterminate(); } }; }
@Test public void checkedCheckboxNotSelectedNotSelected() throws Throwable { CheckBox checkBoxNode = findCheckbox("Three state checkbox"); AssertJUnit.assertEquals(false, checkBoxNode.isSelected()); triStateCheckBox.marathon_select("checked"); new Wait("Waiting for the check box deselect.") { @Override public boolean until() { return !checkBoxNode.isIndeterminate() && checkBoxNode.isSelected(); } }; }
@Test public void getText() throws Throwable { CheckBox checkBoxNode = (CheckBox) getPrimaryStage().getScene().getRoot().lookup(".check-box"); AssertJUnit.assertEquals(false, checkBoxNode.isSelected()); checkBox.marathon_select("checked"); List<String> text = new ArrayList<>(); Platform.runLater(() -> text.add(checkBox.getAttribute("text"))); new Wait("Waiting for the check box text.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("Simple checkbox", text.get(0)); }
@Override @FXThread protected void createComponents(@NotNull final HBox container) { super.createComponents(container); checkBox = new CheckBox(); checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> updateValue()); checkBox.prefWidthProperty().bind(widthProperty().multiply(CONTROL_WIDTH_PERCENT)); FXUtils.addToPane(checkBox, container); FXUtils.addClassTo(checkBox, CSSClasses.ABSTRACT_PARAM_CONTROL_CHECK_BOX); }
private void instantiate(){ box=new HBox(); checkbox=new CheckBox(); checkbox.setAllowIndeterminate(false); box.getChildren().add(checkbox); this.getChildren().add(box); }
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Tooltip Sample"); stage.setWidth(330); stage.setHeight(150); total.setFont(new Font("Arial", 20)); for (int i = 0; i < rooms.length; i++) { final CheckBox cb = cbs[i] = new CheckBox(rooms[i]); final Integer rate = rates[i]; final Tooltip tooltip = new Tooltip("$" + rates[i].toString()); tooltip.setFont(new Font("Arial", 16)); cb.setTooltip(tooltip); cb.selectedProperty().addListener( (ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) -> { if (cb.isSelected()) { sum = sum + rate; } else { sum = sum - rate; } total.setText("Total: $" + sum.toString()); } ); } VBox vbox = new VBox(); vbox.getChildren().addAll(cbs); vbox.setSpacing(5); HBox root = new HBox(); root.getChildren().add(vbox); root.getChildren().add(total); root.setSpacing(40); root.setPadding(new Insets(20, 10, 10, 20)); ((Group) scene.getRoot()).getChildren().add(root); stage.setScene(scene); stage.show(); }
@Override protected void mouseClicked(MouseEvent me) { int selection = getSelection((CheckBox) node); if (prevSelection == null || selection != prevSelection) { recorder.recordSelect(this, JavaFXCheckBoxElement.states[selection]); } prevSelection = selection; }
@Test public void selectCheckBoxSelected() throws Throwable { CheckBox checkBox = findCheckbox("Simple checkbox"); LoggingRecorder lr = new LoggingRecorder(); Platform.runLater(new Runnable() { @Override public void run() { checkBox.setSelected(true); RFXCheckBox rfxCheckBox = new RFXCheckBox(checkBox, null, null, lr); rfxCheckBox.mouseClicked(null); } }); List<Recording> recordings = lr.waitAndGetRecordings(1); Recording select = recordings.get(0); AssertJUnit.assertEquals("recordSelect", select.getCall()); AssertJUnit.assertEquals("checked", select.getParameters()[0]); }
private CheckBox findCheckbox(String text) { Set<Node> checkBox = getPrimaryStage().getScene().getRoot().lookupAll(".check-box"); for (Node node : checkBox) { if (((CheckBox) node).getText().equals(text)) { return (CheckBox) node; } } return null; }
/** * Create settings of slope control. */ private void createSlopeControlSettings() { final Label smoothlyLabel = new Label(Messages.EDITING_COMPONENT_SMOOTHLY + ":"); smoothlyLabel.prefWidthProperty().bind(widthProperty().multiply(LABEL_PERCENT)); slopeControlSmoothly = new CheckBox(); slopeControlSmoothly.prefWidthProperty().bind(widthProperty().multiply(FIELD_PERCENT)); slopeControlSmoothly.selectedProperty() .addListener((observable, oldValue, newValue) -> changeSlopeControlSmoothly(newValue)); final Label limitedLabel = new Label(Messages.EDITING_COMPONENT_LIMITED + ":"); limitedLabel.prefWidthProperty().bind(widthProperty().multiply(LABEL_PERCENT)); slopeControlLimited = new CheckBox(); slopeControlLimited.prefWidthProperty().bind(widthProperty().multiply(FIELD_PERCENT)); slopeControlLimited.selectedProperty() .addListener((observable, oldValue, newValue) -> changeSlopeControlLimited(newValue)); slopeControlSettings = new GridPane(); slopeControlSettings.add(smoothlyLabel, 0, 0); slopeControlSettings.add(slopeControlSmoothly, 1, 0); slopeControlSettings.add(limitedLabel, 0, 1); slopeControlSettings.add(slopeControlLimited, 1, 1); FXUtils.addClassTo(slopeControlSettings, CSSClasses.DEF_GRID_PANE); FXUtils.addClassTo(smoothlyLabel, limitedLabel, CSSClasses.ABSTRACT_PARAM_CONTROL_PARAM_NAME_SINGLE_ROW); FXUtils.addClassTo(slopeControlSmoothly, slopeControlLimited, CSSClasses.ABSTRACT_PARAM_CONTROL_CHECK_BOX); }
private Node createCheckBox () { CheckBox checkBox = new CheckBox(); checkBox.setSelected(getController().isSpriteInLevel(getProfilable())); checkBox.selectedProperty() .addListener( (observable, oldValue, newValue) -> checkBoxChange(oldValue, newValue)); addToolTip(checkBox); return checkBox; }