private void initChangeListeners() { overlayCloseProperty().addListener((o, oldVal, newVal) -> { if (newVal) { this.addEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler); } else { this.removeEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler); } }); }
DocumentPropertyCell(ProjectTreeComponent projectTreeComponent) { this.projectTreeComponent = requireNonNull(projectTreeComponent); // Listener should be initiated with a listener attached // that removes enabled-listeners attached to the previous // node when a new node is selected. itemProperty().addListener((ob, o, n) -> { if (o != null && o instanceof HasEnabledProperty) { final HasEnabledProperty hasEnabled = (HasEnabledProperty) o; hasEnabled.enabledProperty().removeListener(change); } if (n != null && n instanceof HasEnabledProperty) { final HasEnabledProperty hasEnabled = (HasEnabledProperty) n; hasEnabled.enabledProperty().addListener(change); } }); }
@Override public void prepareProjectTree(SplitPane parent, Node projectTree) { if (!projectTreeVisible.get()) { parent.getItems().remove(projectTree); } projectTreeVisible.addListener((ob, o, visible) -> { if (visible) { parent.getItems().add(0, projectTree); } else { parent.getItems().remove(projectTree); } }); }
@Override public void prepareWorkspace(SplitPane parent, Node workspace) { if (!workspaceVisible.get()) { parent.getItems().remove(workspace); } workspaceVisible.addListener((ob, o, visible) -> { if (visible) { parent.getItems().add(0, workspace); } else { parent.getItems().remove(workspace); } }); }
@Override public void prepareOutput(SplitPane parent, Node output) { if (!outputVisible.get()) { parent.getItems().remove(output); } outputVisible.addListener((ob, o, visible) -> { if (visible) { parent.getItems().add(output); } else { parent.getItems().remove(output); } }); }
node.expandedProperty().addListener((o, oldVal, newVal) -> { getSelectionModel().clearSelection(); });
booleanProperty.addListener(new ChangeListener<Boolean>() {
private void initializeViewAnimation() { // gets captured in the closure final double defaultMainHorizontalSplitPaneDividerPosition = mainHorizontalSplitPane.getDividerPositions()[0]; // show/ hide bottom pane bottomTabsToggle.selectedProperty().addListener((observable, wasExpanded, isNowExpanded) -> { KeyValue keyValue = null; DoubleProperty divPosition = mainHorizontalSplitPane.getDividers().get(0).positionProperty(); if (wasExpanded && !isNowExpanded) { keyValue = new KeyValue(divPosition, 1); } else if (!wasExpanded && isNowExpanded) { keyValue = new KeyValue(divPosition, defaultMainHorizontalSplitPaneDividerPosition); } if (keyValue != null) { Timeline timeline = new Timeline(new KeyFrame(Duration.millis(200), keyValue)); timeline.play(); } }); }
getSkinnable().selectedProperty().addListener((o, oldVal, newVal) -> { rippler.setRipplerFill(newVal ? control.getUnCheckedColor() : control.getCheckedColor()); transition.setRate(newVal ? 1 : -1);
control.selectedProperty().addListener( observable -> { updateRippleColor(); playSelectAnimation(control.isSelected(), true); }); control.indeterminateProperty().addListener(observable -> { updateRippleColor(); playIndeterminateAnimation(control.isIndeterminate(), true);
errorContainer.visibleProperty().addListener((o, oldVal, newVal) -> {
getSkinnable().selectedProperty().addListener(observable -> {
overLayVisibleProperty().addListener(observable -> { final boolean overLayVisible = isOverLayVisible(); overlayPane.setStyle(!overLayVisible ? "-fx-background-color : transparent;" : "");
PreferenceRadioButton(BooleanUserPreference preference, String label, boolean selected, UserContext userContext) { super(label); requireNotNull(preference, "Preference cannot be null"); requireNotNull(userContext, "UserContext cannot be null"); setSelected(selected); this.preference = preference; selectedProperty().addListener((ov, oldVal, newVal) -> { userContext.setBooleanPreference(PreferenceRadioButton.this.preference, newVal); LOG.trace("Preference {} set to {}", PreferenceRadioButton.this.preference, newVal); }); } }
PreferenceCheckBox(BooleanUserPreference preference, String label, boolean selected, UserContext userContext) { super(label); requireNotNull(preference, "Preference cannot be null"); requireNotNull(userContext, "UserContext cannot be null"); setSelected(selected); this.preference = preference; selectedProperty().addListener((ov, oldVal, newVal) -> { userContext.setBooleanPreference(PreferenceCheckBox.this.preference, newVal); LOG.trace("Preference {} set to {}", PreferenceCheckBox.this.preference, newVal); }); } }
expandedProperty.addListener((o, oldVal, newVal) -> { if (newVal) { new Timeline(new KeyFrame(Duration.millis(160),
public ExpandButton() { getStyleClass().add("quickbar-expand-button"); toggle.getStyleClass().addAll("pdfsam-toolbar-button", "quickbar-expand-toggle"); expand.setContent("M0,-5L5,0L0,5Z"); expand.getStyleClass().add("quickbar-button-arrow"); collapse.setContent("M0,-5L-5,0L0,5Z"); collapse.getStyleClass().add("quickbar-button-arrow"); toggle.setGraphic(expand); toggle.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { toggle.setGraphic(collapse); } else { toggle.setGraphic(expand); } }); HBox.setMargin(toggle, new Insets(0, 7, 0, 7)); getChildren().add(toggle); }
getSkinnable().selectedProperty().addListener(observable -> { if (!toggleButton.isDisableAnimation()) { timer.reverseAndContinue();
public PdfVersionConstrainedCheckBox(PdfVersion constraint, String ownerModule) { requireNotNull(constraint, "PdfVersion cannot be null"); this.ownerModule = defaultString(ownerModule); this.constraint = constraint; this.setGraphic(helpIcon(DefaultI18nContext.getInstance().i18n("PDF version required: {0}", this.constraint.getVersionString()))); this.getStyleClass().addAll(Style.WITH_HELP.css()); selectedProperty().addListener((o, oldVal, newVal) -> { if (newVal) { eventStudio().broadcast(new AddPdfVersionConstraintEvent(constraint), ownerModule); } else { eventStudio().broadcast(new RemovePdfVersionConstraintEvent(constraint), ownerModule); } }); }
public void addRow(RadioButton radio, Region field, Text helpIcon) { requireNotNull(radio, "Cannot add a null radio"); requireNotNull(field, "Cannot add a null field"); GridPane.setValignment(radio, VPos.BOTTOM); GridPane.setValignment(field, VPos.BOTTOM); GridPane.setHalignment(radio, HPos.LEFT); GridPane.setHalignment(field, HPos.LEFT); GridPane.setFillWidth(field, true); field.setPrefWidth(300); field.setDisable(true); radio.selectedProperty().addListener((o, oldVal, newVal) -> { field.setDisable(!newVal); if (newVal) { field.requestFocus(); } }); radio.setToggleGroup(group); add(radio, 0, rows); add(field, 1, rows); if (nonNull(helpIcon)) { add(helpIcon, 2, rows); } rows++; }