javafx.beans.value.WritableValue Java Examples

The following examples show how to use javafx.beans.value.WritableValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChoosePane.java    From oim-fx with MIT License 6 votes vote down vote up
private void initialize() {
	getStyleClass().setAll(DEFAULT_STYLE_CLASS);
	setAccessibleRole(AccessibleRole.TOGGLE_BUTTON);
	// alignment is styleable through css. Calling setAlignment
	// makes it look to css like the user set the value and css will not
	// override. Initializing alignment by calling set on the
	// CssMetaData ensures that css will be able to override the value.
	((StyleableProperty<Pos>) (WritableValue<Pos>) alignmentProperty()).applyStyle(null, Pos.CENTER);

	this.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() {

		@Override
		public void handle(MouseEvent event) {
			doSelected();
		}
	});
}
 
Example #2
Source File: JFXDrawer.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void partialOpen() {
    for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
        currentValue.put(entry.getKey(), entry.getValue().getOpenValueSupplier());
    }
    translateTo = 0;
    resizeTo = tempDrawerSize = getDefaultDrawerSize();
    overlayPane.setMouseTransparent(!isOverLayVisible());
    translateTimer.setOnFinished(() -> fireEvent(new JFXDrawerEvent(JFXDrawerEvent.OPENED)));
    getCachePolicy().cache(contentHolder);
    translateTimer.start();
}
 
Example #3
Source File: JFXDrawer.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
private void partialClose() {
    for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
        currentValue.put(entry.getKey(), entry.getValue().getCloseValueSupplier());
    }
    translateTo = initTranslate.get();
    resizeTo = getMiniDrawerSize();
    translateTimer.setOnFinished(() -> {
        overlayPane.setMouseTransparent(true);
        fireEvent(new JFXDrawerEvent(JFXDrawerEvent.CLOSED));
    });
    getCachePolicy().cache(contentHolder);
    translateTimer.start();
}
 
Example #4
Source File: JFXDrawer.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * Starts the animation to transition this drawer to open.
 */
public void open() {
    for (Map.Entry<WritableValue<?>, JFXDrawerKeyValue<?>> entry : initValues.entrySet()) {
        currentValue.put(entry.getKey(), entry.getValue().getOpenValueSupplier());
    }
    translateTo = 0;
    resizeTo = getDefaultDrawerSize();
    overlayPane.setMouseTransparent(!isOverLayVisible());
    translateTimer.setOnFinished(() -> fireEvent(new JFXDrawerEvent(JFXDrawerEvent.OPENED)));
    getCachePolicy().cache(contentHolder);
    translateTimer.reverseAndContinue();
}
 
Example #5
Source File: JFXAnimationTimer.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
public void applyEndValues() {
    for (JFXKeyValue keyValue : keyValues) {
        if (keyValue.isValid()) {
            final WritableValue target = keyValue.getTarget();
            if (target != null) {
                final Object endValue = keyValue.getEndValue();
                if (endValue != null && !target.getValue().equals(endValue)) {
                    target.setValue(endValue);
                }
            }
        }
    }
}
 
Example #6
Source File: Detail.java    From scenic-view with GNU General Public License v3.0 5 votes vote down vote up
void setSerializer(final WritableValue<String> serializer, final EditionType defaultEditionType) {
    this.serializer = serializer;
    this.editionType = defaultEditionType;
    if (serializer != null) {
        realValue = serializer.getValue();
        // Probably this should be an interface...
        if (serializer instanceof SimpleSerializer) {
            final org.fxconnector.details.SimpleSerializer.EditionType type = ((SimpleSerializer) serializer).getEditionType();
            switch (type) {
                case COMBO: {
                    editionType = EditionType.COMBO;
                    validItems = ((SimpleSerializer) serializer).getValidValues();
                    break;
                }
                case SLIDER: {
                    editionType = EditionType.SLIDER;
                    maxValue = ((SimpleSerializer) serializer).getMaxValue();
                    minValue = ((SimpleSerializer) serializer).getMinValue();
                    break;
                }
                case COLOR_PICKER: {
                    valueType = ValueType.COLOR;
                    editionType = EditionType.COLOR_PICKER;
                    break;
                }
                default: {
                    editionType = EditionType.TEXT;
                    break;
                }
            }
        } else {
            editionType = EditionType.TEXT;
        }
    }
}
 
Example #7
Source File: JFXAnimationTimer.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
void reverse(double now) {
    finished = animationCondition == null ? false : !animationCondition.get();
    currentDuration = duration - (currentDuration - now);
    // update initial values
    for (JFXKeyValue keyValue : keyValues) {
        final WritableValue target = keyValue.getTarget();
        if (target != null) {
            initialValuesMap.put(target, target.getValue());
            endValuesMap.put(target, keyValue.getEndValue());
        }
    }
}
 
Example #8
Source File: ZoneOverlay_Stage.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
public void hidePanel(){



        WritableValue<Double> writableWidth = new WritableValue<Double>() {
            @Override
            public Double getValue() {

                //return getHeight();
                return getY();
            }

            @Override
            public void setValue(Double value)
            {
                //setHeight(value);
                setY(value);
            }
        };
         
        Timeline timeline = new Timeline();
        KeyFrame endFrame = new KeyFrame(Duration.millis(500), new KeyValue(writableWidth, -256d));
        timeline.getKeyFrames().add(endFrame);
        timeline.setOnFinished(e -> Platform.runLater(() -> {
            //System.out.println("Ending");
            isVisible = false; this.hide();}));
        timeline.play();
    }
 
Example #9
Source File: AddGem_Controller.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
@FXML
private void toggleFilters(){
    WritableValue<Double> writableWidth = new WritableValue<Double>() {
        @Override
        public Double getValue() {

            //return getHeight();
            return AnchorPane.getTopAnchor(contentPanel);
        }

        @Override
        public void setValue(Double value)
        {
            //setHeight(value);
            AnchorPane.setTopAnchor(contentPanel, value);
        }
    };


    Timeline slideIn = new Timeline();

    KeyValue kv = new KeyValue(writableWidth, 43d);
    KeyFrame kf_slideIn = new KeyFrame(Duration.millis(400), kv);
    slideIn.getKeyFrames().addAll(kf_slideIn);

    slideIn.setOnFinished(e -> Platform.runLater(() -> {filtersPaneBig.setVisible(false);
        filtersPaneSmall.setVisible(true); setUpTabs();}));

    slideIn.play();

    bTransferringText = true;
    searchArea1.setText(searchArea.getText());
    bTransferringText = false;
}
 
Example #10
Source File: AddGem_Controller.java    From Path-of-Leveling with MIT License 5 votes vote down vote up
@FXML
private void toggleFiltersVisible(){
    WritableValue<Double> writableWidth = new WritableValue<Double>() {
        @Override
        public Double getValue() {

            //return getHeight();
            return AnchorPane.getTopAnchor(contentPanel);
        }

        @Override
        public void setValue(Double value)
        {
            //setHeight(value);
            AnchorPane.setTopAnchor(contentPanel, value);
        }
    };


    Timeline slideIn = new Timeline();

    KeyValue kv = new KeyValue(writableWidth, 153d);
    KeyFrame kf_slideIn = new KeyFrame(Duration.millis(400), kv);
    slideIn.getKeyFrames().addAll(kf_slideIn);

    slideIn.setOnFinished(e -> Platform.runLater(() -> {filtersPaneBig.setVisible(true);
        filtersPaneSmall.setVisible(false);}));

    slideIn.play();

    bTransferringText = true;
    searchArea.setText(searchArea1.getText());
    bTransferringText = false;
}
 
Example #11
Source File: JFXKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public WritableValue<T> getTarget() {
    return target == null ? targetSupplier.get() : target;
}
 
Example #12
Source File: JFXStyleableColor.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public StyleableProperty<Color> getStyleableProperty(JFXStyleableColor n) {
	return (StyleableProperty<Color>) (WritableValue<Color>) n.colorProperty();
}
 
Example #13
Source File: JFXKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public <T> JFXKeyValueBuilder<T> setTarget(WritableValue<T> target) {
    JFXKeyValueBuilder<T> builder = new JFXKeyValueBuilder<>();
    builder.setTarget(target);
    return builder;
}
 
Example #14
Source File: JFXKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public <T> JFXKeyValueBuilder<T> setTargetSupplier(Supplier<WritableValue<T>> targetSupplier) {
    JFXKeyValueBuilder<T> builder = new JFXKeyValueBuilder<>();
    builder.setTargetSupplier(targetSupplier);
    return builder;
}
 
Example #15
Source File: JFXKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public JFXKeyValueBuilder<T> setTarget(WritableValue<T> target) {
    this.target = target;
    return this;
}
 
Example #16
Source File: JFXKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public JFXKeyValueBuilder<T> setTargetSupplier(Supplier<WritableValue<T>> targetSupplier) {
    this.targetSupplier = targetSupplier;
    return this;
}
 
Example #17
Source File: DefaultJavaFXBinder.java    From dolphin-platform with Apache License 2.0 4 votes vote down vote up
public DefaultJavaFXBinder(final WritableValue<S> javaFxValue) {
    this.javaFxValue = Assert.requireNonNull(javaFxValue, "javaFxValue");
}
 
Example #18
Source File: EasyAnimation.java    From Cryogen with GNU General Public License v2.0 4 votes vote down vote up
public void push(WritableValue p, long time, Object value) {
    KeyValue kv = new KeyValue(p, value);
    KeyFrame kf = new KeyFrame(Duration.millis(time), kv);
    timeline.getKeyFrames().add(kf);
}
 
Example #19
Source File: JFXDrawerKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public JFXDrawerKeyValueBuilder setTarget(WritableValue<T> target) {
    this.target = target;
    return this;
}
 
Example #20
Source File: JFXDrawerKeyValue.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public WritableValue<T> getTarget() {
    return target;
}
 
Example #21
Source File: CssToColorHelper.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public StyleableProperty<Color> getStyleableProperty(CssToColorHelper n) {
    return (StyleableProperty<Color>) (WritableValue<Color>) n.namedColorProperty();
}
 
Example #22
Source File: DirtyState.java    From tornadofx-controls with Apache License 2.0 4 votes vote down vote up
public void undo() {
	initialValues.forEach(WritableValue::setValue);
	setValue(false);
}
 
Example #23
Source File: ToggleSwitchSkin.java    From mdict-java with GNU General Public License v3.0 4 votes vote down vote up
@Override
public StyleableProperty<Number> getStyleableProperty(ToggleSwitch toggleSwitch) {
    final ToggleSwitchSkin skin = (ToggleSwitchSkin) toggleSwitch.getSkin();
    return (StyleableProperty<Number>) (WritableValue<Number>) skin.thumbMoveAnimationTimeProperty();
}
 
Example #24
Source File: GemOverlay_Stage.java    From Path-of-Leveling with MIT License 4 votes vote down vote up
public void fade(){
    if (betaUI) {
        controller_beta.show();
    } else {
        show();
    }
    //apply fade

    WritableValue<Double> opacity = new WritableValue<Double>() {
        @Override
        public Double getValue() {
            if (betaUI) {
                return controller_beta.getOpacity();
            } else {
                return getOpacity();
            }
        }

        @Override
        public void setValue(Double value) {
            if (betaUI) {
                controller_beta.fade(value);
            } else {
                setOpacity(value);
            }
        }
    };

    Timeline fadeIn = new Timeline();
    Timeline delay = new Timeline();
    Timeline fadeOut = new Timeline();

    KeyValue kv = new KeyValue(opacity, 1d);
    KeyFrame kf_slideIn = new KeyFrame(Duration.millis(1000), kv);

    fadeIn.getKeyFrames().add(kf_slideIn);
    fadeIn.setOnFinished(e -> Platform.runLater(() -> delay.play()));

    KeyFrame kf_delay = new KeyFrame(Duration.millis(Preferences_Controller.level_slider * 1000));
    delay.getKeyFrames().addAll(kf_delay);


    delay.setOnFinished(e -> Platform.runLater(() -> fadeOut.play()));

    KeyValue kv2 = new KeyValue(opacity, 0d);
    KeyFrame kf_slideIn2 = new KeyFrame(Duration.millis(1000), kv2);

    fadeOut.getKeyFrames().add(kf_slideIn2);
    fadeOut.setOnFinished(e -> Platform.runLater(() -> {
        //System.out.println("Ending");
        isPlaying = false;
        if (betaUI) {
            controller_beta.hide();
            controller_beta.defaultTitle();
        } else {
            this.hide();
        }
    }));

    fadeIn.play();
    isPlaying = true;
}
 
Example #25
Source File: ZoneOverlay_Stage.java    From Path-of-Leveling with MIT License 4 votes vote down vote up
public void showPanel(){
    isVisible = true;
    this.show();
    this.setX(prefX);
    //this.setY(prefY);
    //this.setHeight(0);

    this.setY(prefY-256.0);



    WritableValue<Double> writableWidth = new WritableValue<Double>() {
        @Override
        public Double getValue() {

            //return getHeight();
            return getY();
        }

        @Override
        public void setValue(Double value)
        {
            //setHeight(value);
            setY(value);
        }
    };


    Timeline slideIn = new Timeline();
   
    KeyValue kv = new KeyValue(writableWidth, 0d);
    KeyFrame kf_slideIn = new KeyFrame(Duration.millis(500), kv);
    slideIn.getKeyFrames().addAll(kf_slideIn);
    if(Preferences_Controller.zones_slider>=1){
        KeyFrame kf_delay = new KeyFrame(Duration.millis(Preferences_Controller.zones_slider * 1000));
        slideIn.getKeyFrames().addAll(kf_slideIn,kf_delay);

        slideIn.setOnFinished(e -> Platform.runLater(() -> hidePanel()));
    }else{
        slideIn.getKeyFrames().addAll(kf_slideIn);
    }
    slideIn.play();
}
 
Example #26
Source File: Detail.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
void setSerializer(final WritableValue<String> serializer) {
    setSerializer(serializer, EditionType.NONE);
}
 
Example #27
Source File: GDetail.java    From scenic-view with GNU General Public License v3.0 4 votes vote down vote up
public void setSerializer(final WritableValue<String> serializer) {
    this.serializer = serializer;
}
 
Example #28
Source File: Chart.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public StyleableProperty<Side> getStyleableProperty(final Chart node) {
    return (StyleableProperty<Side>) (WritableValue<Side>) node.legendSideProperty();
}
 
Example #29
Source File: Chart.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public StyleableProperty<Side> getStyleableProperty(final Chart node) {
    return (StyleableProperty<Side>) (WritableValue<Side>) node.toolBarSideProperty();
}
 
Example #30
Source File: Chart.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
@Override
public StyleableProperty<Side> getStyleableProperty(final Chart node) {
    return (StyleableProperty<Side>) (WritableValue<Side>) node.measurementBarSideProperty();
}