private static Object getConstraint(Node node, Object key) { if (node.hasProperties()) { Object value = node.getProperties().get(key); if (value != null) { return value; } } return null; }
/** * Convienience method for getDeviceSize(device) */ public Size getDeviceSize(String device) { return deviceSizes.get(device); }
/** * {@inheritDoc} */ @Override public ServiceTask<?> getPendingTask(final String taskKey) { return this.pendingTasks.get(taskKey); }
/** * Check control's required flag * @param c control * @return true if required */ public static boolean isRequired( Control c ) { Object value = c.getProperties().get(CTRL_REQUIRED_FLAG); return value instanceof Boolean? (Boolean)value: false; }
/** * Convenience method for addLayout(Size, Orientation, Node) */ public void addLayout(String device, Orientation orientation, Node root) { addLayout(deviceSizes.get(device), orientation, root); }
/** * Convenience method for addSceneStylesheet(Size sizeAtLeast, String file) */ public void addSceneStylesheet(String device, String file) { addSceneStylesheet(deviceSizes.get(device), file); }
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); }
/** * Convenience method for addMyStylesheet(Size sizeAtLeast, String file) */ public void addMyStylesheet(String device, String file) { addMyStylesheet(deviceSizes.get(device), file); }
/** * Returns optional highest severity message for a control * @param target control * @return Optional highest severity message for a control */ public Optional<ValidationMessage> getHighestMessage(Control target) { return Optional.ofNullable(validationResults.get(target)).flatMap( result -> result.getMessages().stream().max(ValidationMessage.COMPARATOR) ); } }
/** * Convenience method for addLayout(Size, Node) */ public void addLayout(String device, Node root) { addLayout(deviceSizes.get(device), root); }
@Override public final Optional<String> getAsString(String key) { final StringProperty prop = (StringProperty) properties.get(key); if (prop == null) { return Optional.empty(); } else { return Optional.ofNullable(prop.getValue()); } }
@Override public final OptionalBoolean getAsBoolean(String key) { final BooleanProperty prop = (BooleanProperty) properties.get(key); if (prop == null) { return OptionalBoolean.empty(); } else { return OptionalBoolean.ofNullable(prop.getValue()); } }
@Override public final OptionalDouble getAsDouble(String key) { final DoubleProperty prop = (DoubleProperty) properties.get(key); if (prop == null) { return OptionalDouble.empty(); } else { return OptionalUtil.ofNullable(prop.getValue()); } }
public Optional<Bounds> getSelectionBoundsOnScreen(Selection<PS, SEG, S> selection) { if(selection.getLength() == 0) { return Optional.empty(); } else { layout(); // ensure layout, is a no-op if not dirty SelectionPath selectionShape = selections.get(selection); checkWithinParagraph(selectionShape); Bounds localBounds = selectionShape.getBoundsInLocal(); return Optional.ofNullable(selectionShape.localToScreen(localBounds)); } }
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 EventHandler<MouseEvent> createPreviousAction(EWare ware) { return evt -> { try { office.move(ware, 1); IntegerProperty donated = availableMap.get(ware); availableMap.put(ware, new SimpleIntegerProperty(donated.subtract(1).intValue())); } catch (RuntimeException e) { logger.error("Failed to move wares", e); } }; }
@Override public void executeOnCloseButtonClicked() { for (IWare ware : availableMap.keySet()) { IntegerProperty amount = availableMap.get(ware); office.move(ware, amount.intValue(), 0); } availableMap.clear(); ViewChangeCityPlayerProxyJFX proxy = new ViewChangeCityPlayerProxyJFX(viewState.getCurrentCityProxy().get(), EViewChangeEvent.MAIN_VIEW_CHURCH); clientEventBus.post(new NoticeBoardUpdate(proxy)); super.executeOnCloseButtonClicked(); } @VisibleForTesting
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); }