public static void updateBackground(Background newBackground, Region nodeToUpdate, Paint fill) { if (newBackground != null && !newBackground.getFills().isEmpty()) { final BackgroundFill[] fills = new BackgroundFill[newBackground.getFills().size()]; for (int i = 0; i < newBackground.getFills().size(); i++) { BackgroundFill bf = newBackground.getFills().get(i); fills[i] = new BackgroundFill(fill, bf.getRadii(), bf.getInsets()); } nodeToUpdate.setBackground(new Background(fills)); } }
public void updateSelectionBackground() { CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground() .getFills() .get(0) .getRadii(); Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground() .getFills() .get(0) .getInsets(); selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable()) .getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets))); }
Color.valueOf(webColor), fill.getRadii(), fill.getInsets()))); }; lookupConsumer.accept(THUMB);
protected void starting() { // init animation values if (start == null) { oldCache = region.get().isCache(); oldCacheHint = region.get().getCacheHint(); radii = region.get().getBackground() == null ? null : region.get() .getBackground() .getFills() .get(0) .getRadii(); insets = region.get().getBackground() == null ? null : region.get() .getBackground() .getFills() .get(0) .getInsets(); start = fromValue.get(); end = toValue.get(); region.get().setCache(true); region.get().setCacheHint(CacheHint.SPEED); } }
private StackPane createMask() { StackPane mask = new StackPane(); mask.shapeProperty().bind(getSkinnable().shapeProperty()); mask.backgroundProperty().bind(Bindings.createObjectBinding(() -> { return new Background(new BackgroundFill(Color.WHITE, getSkinnable().getBackground() != null && getSkinnable().getBackground().getFills().size() > 0 ? getSkinnable().getBackground().getFills().get(0).getRadii() : CornerRadii.EMPTY, getSkinnable().getBackground() != null && getSkinnable().getBackground().getFills().size() > 0 ? getSkinnable().getBackground().getFills().get(0).getInsets() : Insets.EMPTY)); }, getSkinnable().backgroundProperty())); mask.resize(getWidth() - snappedRightInset() - snappedLeftInset(), getHeight() - snappedBottomInset() - snappedTopInset()); return mask; } };
private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) { if (indeterminate == null) { indeterminate = false; } indeterminateTransition.setRate(indeterminate ? 1 : -1); if (playAnimation) { indeterminateTransition.play(); } else { if (indeterminate) { CornerRadii radii = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getRadii(); Insets insets = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getInsets(); indeterminateMark.setOpacity(1); indeterminateMark.setScaleY(1); indeterminateMark.setScaleX(1); indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets))); indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration()); } else { indeterminateMark.setOpacity(0); indeterminateMark.setScaleY(0); indeterminateMark.setScaleX(0); indeterminateTransition.playFrom(Duration.ZERO); } } if(getSkinnable().isSelected()){ playSelectAnimation(!indeterminate, playAnimation); } }
.getFills() .get(0) .getInsets() : Insets.EMPTY)); }, colorBox.backgroundProperty())); colorBox.setClip(pickerColorClip);
null : box.getBackground().getFills().get(0).getRadii(); Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets(); if (selection) { mark.setScaleY(1);
public static void updateBackground(Background newBackground, Region nodeToUpdate, Paint fill) { if (newBackground != null && !newBackground.getFills().isEmpty()) { final BackgroundFill[] fills = new BackgroundFill[newBackground.getFills().size()]; for (int i = 0; i < newBackground.getFills().size(); i++) { BackgroundFill bf = newBackground.getFills().get(i); fills[i] = new BackgroundFill(fill, bf.getRadii(), bf.getInsets()); } nodeToUpdate.setBackground(new Background(fills)); } }
public void updateSelectionBackground() { CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground() .getFills() .get(0) .getRadii(); Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground() .getFills() .get(0) .getInsets(); selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable()) .getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets))); }
protected void starting() { // init animation values if (start == null) { oldCache = region.get().isCache(); oldCacheHint = region.get().getCacheHint(); radii = region.get().getBackground() == null ? null : region.get() .getBackground() .getFills() .get(0) .getRadii(); insets = region.get().getBackground() == null ? null : region.get() .getBackground() .getFills() .get(0) .getInsets(); start = fromValue.get(); end = toValue.get(); region.get().setCache(true); region.get().setCacheHint(CacheHint.SPEED); } }
private StackPane createMask() { StackPane mask = new StackPane(); mask.shapeProperty().bind(getSkinnable().shapeProperty()); mask.backgroundProperty().bind(Bindings.createObjectBinding(() -> { return new Background(new BackgroundFill(Color.WHITE, getSkinnable().getBackground() != null && getSkinnable().getBackground().getFills().size() > 0 ? getSkinnable().getBackground().getFills().get(0).getRadii() : CornerRadii.EMPTY, getSkinnable().getBackground() != null && getSkinnable().getBackground().getFills().size() > 0 ? getSkinnable().getBackground().getFills().get(0).getInsets() : Insets.EMPTY)); }, getSkinnable().backgroundProperty())); mask.resize(getWidth() - snappedRightInset() - snappedLeftInset(), getHeight() - snappedBottomInset() - snappedTopInset()); return mask; } };
private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) { if (indeterminate == null) { indeterminate = false; } indeterminateTransition.setRate(indeterminate ? 1 : -1); if (playAnimation) { indeterminateTransition.play(); } else { if (indeterminate) { CornerRadii radii = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getRadii(); Insets insets = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getInsets(); indeterminateMark.setOpacity(1); indeterminateMark.setScaleY(1); indeterminateMark.setScaleX(1); indeterminateMark.setBackground(new Background(new BackgroundFill(((JFXCheckBox) getSkinnable()).getCheckedColor(), radii, insets))); indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration()); } else { indeterminateMark.setOpacity(0); indeterminateMark.setScaleY(0); indeterminateMark.setScaleX(0); indeterminateTransition.playFrom(Duration.ZERO); } } if (getSkinnable().isSelected()) { playSelectAnimation(!indeterminate, playAnimation); } }
.getFills() .get(0) .getInsets() : Insets.EMPTY)); }, colorBox.backgroundProperty())); colorBox.setClip(pickerColorClip);
null : box.getBackground().getFills().get(0).getRadii(); Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets(); if (selection) { mark.setScaleY(1);