@Override public void changed(ObservableValue<? extends Bounds> observable, Bounds oldValue, Bounds newValue) { targetNode.layoutBoundsProperty().removeListener(this); updateGraphicPosition(targetNode); } });
@Override public void invalidated(Observable o) { control.sceneProperty().removeListener(this); modifyTableMenu(control, consumer); } });
@Override public void invalidated(Observable o) { if (target.getScene() != null) { target.sceneProperty().removeListener(this); sceneConsumer.accept(target.getScene()); } } };
private boolean checkValid() { final String crnt = view.getEngine().getLocation(); if (previous != null && !previous.equals(crnt)) { w.stateProperty().removeListener(this); return false; } previous = crnt; return true; }
private boolean checkValid() { final String crnt = webView.getEngine().getLocation(); if (previous != null && !previous.equals(crnt)) { w.stateProperty().removeListener(this); return false; } previous = crnt; return true; } });
@Override public void changed(final ObservableValue<? extends Node> observable, final Node oldValue, final Node newValue) { if (newValue != null) { AbstractBaseModel.this.hasBeenAttached = true; } if (newValue == null && AbstractBaseModel.this.hasBeenAttached) { AbstractBaseModel.this.hasBeenAttached = false; release(); node().parentProperty().removeListener(this); } }
private void removeChildListeners(DockingSplitPaneChildBase child) { child.layoutConstraintsProperty().removeListener(layoutConstraintsChangeListener); child.getLayoutConstraints().removePropertyChangeListener(PREF_WIDTH, layoutConstraintsDimensionChangeListener); child.getLayoutConstraints().removePropertyChangeListener(PREF_HEIGHT, layoutConstraintsDimensionChangeListener); }
private void removeChildListeners(DockingSplitPaneChildBase child) { child.layoutConstraintsProperty().removeListener(layoutConstraintsChangeListener); child.getLayoutConstraints().removePropertyChangeListener(PREF_WIDTH, layoutConstraintsDimensionChangeListener); child.getLayoutConstraints().removePropertyChangeListener(PREF_HEIGHT, layoutConstraintsDimensionChangeListener); }
/** * Resizes the {@link #nodeClip} to the specified new node's {@link Node#boundsInParentProperty() * boundsInParent} (or to an empty rectangle if it is {@code null}) and moves the * {@link #updateNodeClipToNewBoundsListener} from the old to the new node's {@code boundInParents} property. * <p> * Designed to be used as a lambda method reference. * * @param o * the {@link ObservableValue} which changed its value * @param oldNode * the old node * @param newNode * the new node */ private void updateNodeClipToChangingNode( @SuppressWarnings("unused") ObservableValue<? extends Node> o, Node oldNode, Node newNode) { // resize the rectangle to match the new node resizeRectangleToNodeBounds(nodeClip, newNode); // move the listener from one node to the next if (oldNode != null) { oldNode.boundsInParentProperty().removeListener(updateNodeClipToNewBoundsListener); } if (newNode != null) { newNode.boundsInParentProperty().addListener(updateNodeClipToNewBoundsListener); } }
@Override public void dispose() { control.getDockables().removeListener(dockableEntrySetChangeListener); control.getDockingAreaDescriptors().removeListener(dockingAreaDescriptorSetChangeListener); control.getScene().focusOwnerProperty().removeListener(focusOwnerChangeListener); control = null; pane = null; rootSplitPane = null; }
@Override public void dispose() { control.getDockables().removeListener(dockableEntrySetChangeListener); control.getDockingAreaDescriptors().removeListener(dockingAreaDescriptorSetChangeListener); control.getScene().focusOwnerProperty().removeListener(focusOwnerChangeListener); control = null; pane = null; rootSplitPane = null; }
@Override public void close() { dockingSplitPane.getDockingSplitPaneChildren().removeListener(dockingSplitPaneChildrenListener); dockingSplitPane.widthProperty().removeListener(sizeChangeListener); dockingSplitPane.heightProperty().removeListener(sizeChangeListener); dockingSplitPane.layoutConstraintsProperty().removeListener(sizeChangeListener); } }
public final void setWorker(final Worker<?> newWorker) { if (newWorker != worker) { if (worker != null) { worker.stateProperty().removeListener(stateListener); end(); } worker = newWorker; if (newWorker != null) { newWorker.stateProperty().addListener(stateListener); if (newWorker.getState() == Worker.State.RUNNING || newWorker.getState() == Worker.State.SCHEDULED) { // It is already running begin(); } } } }
/** * Get the window property of a node * * @param n * the node the window property to observe * @return the property */ public static ObservableValue<Window> windowProperty(Node n) { ObjectProperty<Window> w = new SimpleObjectProperty<Window>(); ChangeListener<Window> l = (o, oldV, newV) -> w.set(newV); n.sceneProperty().addListener((o, oldV, newV) -> { if (oldV != null) { oldV.windowProperty().removeListener(l); } if (newV != null) { newV.windowProperty().addListener(l); } }); return w; }
/** * Get the window property of a node * * @param n * the node the window property to observe * @return the property */ public static ObservableValue<Window> windowProperty(Node n) { ObjectProperty<Window> w = new SimpleObjectProperty<Window>(); ChangeListener<Window> l = (o, oldV, newV) -> w.set(newV); n.sceneProperty().addListener((o, oldV, newV) -> { if (oldV != null) { oldV.windowProperty().removeListener(l); } if (newV != null) { newV.windowProperty().addListener(l); } }); return w; }
/** * Enables resizing if the {@link SnapshotView#selectionAreaBoundary selectionAreaBoundary} is * {@link Boundary#CONTROL CONTROL}. */ private void enableResizingForControl() { // remove listeners for node and its bounds node.removeListener(updateSelectionToNodeListener); if (getNode() != null) { getNode().boundsInParentProperty().removeListener(resizeSelectionToNewNodeBoundsListener); } // add listener for the control's size widthProperty().addListener(resizeSelectionToNewControlWidthListener); heightProperty().addListener(resizeSelectionToNewControlHeightListener); resizeSelectionFromNodeToControl(); }
public DockingPaneSkin(DockingPane control) { this.control = control; pane.setCenter(rootSplitPane); this.control.getDockingAreaDescriptors().addListener(dockingAreaDescriptorSetChangeListener); this.control.getDockables().addListener(dockableEntrySetChangeListener); this.control.getDockingAreaDescriptors().forEach(dockingAreaDescriptor -> addDockingArea(dockingAreaDescriptor)); this.control.getDockables().forEach(dockableEntry -> addDockable(dockableEntry)); this.control.sceneProperty().addListener((ov, oldValue, newValue) -> { if (oldValue != null) { oldValue.focusOwnerProperty().removeListener(focusOwnerChangeListener); } if (newValue != null) { newValue.focusOwnerProperty().addListener(focusOwnerChangeListener); } }); this.control.getScene().focusOwnerProperty().addListener(focusOwnerChangeListener); }
public static void bindToStageTitle(Node n, StringProperty property) { ChangeListener<Window> windowListener = (observable, oldValue, newValue) -> { if (oldValue != null && oldValue instanceof Stage) { ((Stage) oldValue).titleProperty().unbindBidirectional(property); } if (newValue != null && newValue instanceof Stage) { ((Stage) newValue).titleProperty().bindBidirectional(property); } }; n.sceneProperty().addListener((observable, oldValue, newValue) -> { if (oldValue != null) { oldValue.windowProperty().removeListener(windowListener); } if (newValue != null) { newValue.windowProperty().addListener(windowListener); if (newValue.getWindow() != null && newValue.getWindow() instanceof Stage) { ((Stage) newValue.getWindow()).titleProperty().bindBidirectional(property); } } }); if (n.getScene() != null) { n.getScene().windowProperty().addListener(windowListener); } }
public static void registerListenerForWindowFocus(Node n, InvalidationListener l) { ChangeListener<Window> windowListener = (observable, oldValue, newValue) -> { if (oldValue != null) { oldValue.focusedProperty().removeListener(l); } if (newValue != null) { newValue.focusedProperty().addListener(l); } }; n.sceneProperty().addListener((observable, oldValue, newValue) -> { if (oldValue != null) { oldValue.windowProperty().removeListener(windowListener); } if (newValue != null) { newValue.windowProperty().addListener(windowListener); if (newValue.getWindow() != null) { newValue.getWindow().focusedProperty().addListener(l); l.invalidated(newValue.getWindow().focusedProperty()); } } }); if (n.getScene() != null) { n.getScene().windowProperty().addListener(windowListener); } }
public static void registerListenerForStageFullscreen(Node n, InvalidationListener l) { ChangeListener<Window> windowListener = (observable, oldValue, newValue) -> { if (oldValue != null && oldValue instanceof Stage) { ((Stage) oldValue).fullScreenProperty().removeListener(l); } if (newValue != null && newValue instanceof Stage) { ((Stage) newValue).fullScreenProperty().addListener(l); } }; n.sceneProperty().addListener((observable, oldValue, newValue) -> { if (oldValue != null) { oldValue.windowProperty().removeListener(windowListener); } if (newValue != null) { newValue.windowProperty().addListener(windowListener); if (newValue.getWindow() != null && newValue.getWindow() instanceof Stage) { ((Stage) newValue.getWindow()).fullScreenProperty().addListener(l); l.invalidated(((Stage) newValue.getWindow()).fullScreenProperty()); } } }); if (n.getScene() != null) { n.getScene().windowProperty().addListener(windowListener); } }