private static void setConstraint(Node node, Object key, Object value) { if (value == null) { node.getProperties().remove(key); } else { node.getProperties().put(key, value); } if (node.getParent() != null) { node.getParent().requestLayout(); } }
tab.getStyleClass().addListener(weakStyleClassListener); getProperties().put(Tab.class, tab);
/** * Convenience method for deviceSizes.put(device, size) */ public void setDeviceSize(String device, Size size) { deviceSizes.put(device, size); }
private Scene initScene() { MainPane mainPane = injector.instance(MainPane.class); NotificationsContainer notifications = injector.instance(NotificationsContainer.class); StackPane main = new StackPane(); StackPane.setAlignment(notifications, Pos.BOTTOM_RIGHT); StackPane.setAlignment(mainPane, Pos.TOP_LEFT); main.getChildren().addAll(mainPane, notifications); StylesConfig styles = injector.instance(StylesConfig.class); Scene mainScene = new Scene(main); mainScene.getStylesheets().addAll(styles.styles()); mainScene.getAccelerators().put(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN), () -> eventStudio().broadcast(ShowStageRequest.INSTANCE, "LogStage")); mainScene.getAccelerators().put(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN), () -> Platform.exit()); return mainScene; }
public static MapPropertyEntity invalidMapKey() { ObservableMap<String, String> innerMap = FXCollections.observableHashMap(); innerMap.put( "app", "apple@example.com" ); innerMap.put( "pear", "pear@example.com" ); innerMap.put( "cherry", "cherry@example.com" ); return new MapPropertyEntity( innerMap ); }
/** * Set control's required flag * @param c control * @param required flag */ public static void setRequired( Control c, boolean required ) { c.getProperties().put(CTRL_REQUIRED_FLAG, required); }
private void clearMap() { for (EWare ware : MATERIALS) { availableMap.put(ware, new SimpleIntegerProperty(0)); } }
/** called from the subnodes in FXML via MigPane.cc="..." */ public static void setCc(Node node, CC cc) { node.getProperties().put(FXML_CC_KEY, cc); }
/** * Convenience method for setting a single Object property that can be * retrieved at a later date. This is functionally equivalent to calling * the getProperties().put(Object key, Object value) method. This can later * be retrieved by calling {@link #getUserData()}. * * @param value The value to be stored - this can later be retrieved by calling * {@link #getUserData()}. */ public void setUserData(Object value) { getProperties().put(USER_DATA_KEY, value); }
public void setup(final BrowserFXController controller) { final ObservableMap<KeyCombination, Runnable> accelerators = scene.getAccelerators(); accelerators.put(new KeyCodeCombination(KeyCode.F6), controller::focusAddressBar); accelerators.put(new KeyCodeCombination(KeyCode.LEFT, KeyCombination.ALT_DOWN), controller::back); accelerators.put(new KeyCodeCombination(KeyCode.RIGHT, KeyCombination.ALT_DOWN), controller::forward); accelerators.put( new KeyCodeCombination(KeyCode.T, KeyCombination.SHORTCUT_DOWN), controller::newTab); accelerators.put( new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN), controller::closeTab); accelerators.put( new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN), this::promptToQuit); }
@Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { getSkinnable().getProperties().put("plusminusslidervalue", //$NON-NLS-1$ newValue.doubleValue()); } });
/** * Creates a function which sets the applied boolean to {@link SnapshotView#selectionChangingProperty()}. * * @return a Boolean {@link Consumer} */ private Consumer<Boolean> createSetSelectionChanging() { return changing -> getNode().getProperties().put(SnapshotView.SELECTION_CHANGING_PROPERTY_KEY, changing); }
private static Stack<InputMap<?>> getStack(Node node) { ObservableMap<Object, Object> nodeProperties = getProperties(node); if (nodeProperties.get(P_STACK) == null) { Stack<InputMap<?>> stackedInputMaps = new Stack<>(); nodeProperties.put(P_STACK, stackedInputMaps); return stackedInputMaps; } return (Stack<InputMap<?>>) nodeProperties.get(P_STACK); }
@Override public void run() { tavernState.talkingToProperty().get().put(showingPerson, player); super.run(); } }
private EventHandler<MouseEvent> createNextAction(EWare ware) { return evt -> { try { office.move(ware, -1); IntegerProperty donated = availableMap.get(ware); availableMap.put(ware, new SimpleIntegerProperty(donated.add(1).intValue())); } catch (RuntimeException e) { logger.error("Failed to move wares", e); } }; }
private void sendOnControlEnter() { tweetTextArea.sceneProperty().addListener((o, prev, cur) -> cur.getAccelerators().put( new KeyCodeCombination(KeyCode.ENTER, KeyCombination.CONTROL_DOWN), sendButton::fire )); }
@Override public void configure(T control) { super.configure(control); control.getProperties().put(PrefixSelectionFeature.ENABLED, ""); new PrefixSelectionFeature<>(control, () -> !control.isEditable(), control::getItems, control.getConverter(), index -> control.getSelectionModel().select(index)) .configure(); }
private static void updateManagedProperty(Node n, DeviceType type) { // first time we've set this invisible => store the preset if (!n.getProperties().containsKey(PROP_MANAGED_STATE)) { n.getProperties().put(PROP_MANAGED_STATE, n.isManaged()); } // don't track changes through this n.managedProperty().removeListener(MANAGED_LISTENER); // If it's visible we use the stored value for "managed" property n.setManaged(n.isVisible() ? (Boolean) n.getProperties().get(PROP_MANAGED_STATE) : false); // need to track changes through API n.managedProperty().addListener(MANAGED_LISTENER); }