javafx.beans.property.BooleanPropertyBase Java Examples

The following examples show how to use javafx.beans.property.BooleanPropertyBase. 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: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Controls whether lines are displayed to show in the magnifier viewer. Default is {@code false}.
 * 
 * @see #setScopeLinesVisible(boolean)
 * @see #isScopeLinesVisible()
 */
public final BooleanProperty scopeLinesVisibleProperty() {
	if (this.scopeLinesVisible == null) {
		this.scopeLinesVisible = new BooleanPropertyBase(DEFAULT_SCOPELINE_VISIBLE) {

			@Override
			public String getName() {
				return "scopeLinesVisible";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.scopeLinesVisible;
}
 
Example #2
Source File: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Controls the magnifier whether to activate or not.
 * <ul>
 * <li> {@code true} Shows the magnified viewer on mouse over and does not allow to access the content inside the control.</li>
 * <li> {@code false} Does not show the magnified viewer on mouse over and can access the content inside the control.</li>
 * </ul>
 * <p>Default value is {@code true}</p>.
 * 
 * @see #setActive(boolean)
 * @see #isActive()
 */
public final BooleanProperty activeProperty() {
	if (this.active == null) {
		this.active = new BooleanPropertyBase(DEFAULT_ACTIVE) {

			@Override
			public String getName() {
				return "active";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.active;
}
 
Example #3
Source File: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Controls the magnifier whether to scale the content on mouse scroll or not. Content is scaled only when the mouse is scrolled in
 * combination with CTRL key press.
 * <ul>
 * <li> {@code true} Allows the content to scale when mouse is scrolled in combination with CTRL key press.</li>
 * <li> {@code false} Does not allow the content to scale when mouse is scrolled.</li>
 * </ul>
 * <p>Default value is {@code false}</p>.
 * 
 * @see #setScalableOnScroll(boolean)
 * @see #isScalableOnScroll()
 */
public final BooleanProperty scalableOnScrollProperty() {
	if (this.scalableOnScroll == null) {
		this.scalableOnScroll = new BooleanPropertyBase(DEFAULT_SCALABLE_ONSCROLL) {

			@Override
			public String getName() {
				return "scalableOnScroll";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.scalableOnScroll;
}
 
Example #4
Source File: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Controls the magnifier whether to resize the viewer on mouse scroll or not. The viewer is resized only when the mouse is scrolled in
 * combination with ALT key press.
 * <ul>
 * <li> {@code true} Allows the viewer to resize when mouse is scrolled in combination with ALT key press.</li>
 * <li> {@code false} Does not allow the viewer to resize when mouse is scrolled.</li>
 * </ul>
 * <p>Default value is {@code false}</p>.
 * 
 * @see #setResizableOnScroll(boolean)
 * @see #isResizableOnScroll()
 */
public final BooleanProperty resizableOnScrollProperty() {
	if (this.resizableOnScroll == null) {
		this.resizableOnScroll = new BooleanPropertyBase(DEFAULT_RESIZABLE_ONSCROLL) {

			@Override
			public String getName() {
				return "resizableOnScroll";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.resizableOnScroll;
}
 
Example #5
Source File: QualityGauge.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public QualityGauge() {
    aspectRatio     = PREFERRED_HEIGHT / PREFERRED_WIDTH;
    backgroundPaint = Color.TRANSPARENT;
    borderPaint     = Color.TRANSPARENT;
    borderWidth     = 0d;
    model           = GaugeBuilder.create()
                                  .minValue(0)
                                  .maxValue(10)
                                  .startAngle(0)
                                  .angleRange(180)
                                  .sectionsVisible(true)
                                  .sections(NORMAL_ORDER)
                                  .build();
    reverseOrder = new BooleanPropertyBase(false) {
        @Override protected void invalidated() { model.setSections(get() ? REVERSE_ORDER : NORMAL_ORDER); }
        @Override public Object getBean() { return QualityGauge.this; }
        @Override public String getName() { return "reverseOrder"; }
    };
    init();
    initGraphics();
    registerListeners();
}
 
Example #6
Source File: UiUtils.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Add binding pseudo focus of the pane to focus state of the controls.
 *
 * @param pane   the pane.
 * @param controls  the controls.
 */
@FxThread
public static @NotNull BooleanProperty addFocusBinding(@NotNull Pane pane, @NotNull Control... controls) {

    var focused = new BooleanPropertyBase(true) {

        @Override
        public void invalidated() {
            pane.pseudoClassStateChanged(FOCUSED_PSEUDO_CLASS, get());
        }

        @Override
        public Object getBean() {
            return pane;
        }

        @Override
        public String getName() {
            return "focused";
        }
    };

    ChangeListener<Boolean> listener = (observable, oldValue, newValue) -> {
        focused.setValue(newValue || Arrays.stream(controls)
                .anyMatch(Node::isFocused));
    };

    for (var control : controls) {
        control.focusedProperty().addListener(listener);
        control.addEventHandler(MouseEvent.MOUSE_RELEASED, event -> control.requestFocus());
    }

    focused.setValue(Arrays.stream(controls)
            .anyMatch(Node::isFocused));

    return focused;
}
 
Example #7
Source File: MenuController.java    From zest-writer with GNU General Public License v3.0 4 votes vote down vote up
public BooleanPropertyBase isOnReadingTabProperty() {
    return isOnReadingTab;
}
 
Example #8
Source File: MdTextController.java    From zest-writer with GNU General Public License v3.0 4 votes vote down vote up
public BooleanPropertyBase currentSavedProperty() {
    return currentSaved;
}
 
Example #9
Source File: ColorRegulator.java    From regulators with Apache License 2.0 4 votes vote down vote up
public ColorRegulator() {
    scaleFactor    = 1.0;
    baseColor      = Color.YELLOW;
    targetValue    = new DoublePropertyBase(0) {
        @Override protected void invalidated() { setOn(Double.compare(get(), 0) != 0); }
        @Override public void set(final double VALUE) {
            super.set(clamp(MIN_VALUE, MAX_VALUE, VALUE));
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "targetValue"; }
    };
    targetColor    = new ObjectPropertyBase<Color>(baseColor) {
        @Override protected void invalidated() {
            super.set(null == get() ? Color.BLACK : get());
            currentColorCircle.setFill(get());
            indicatorRotate.setAngle(((gradientLookup.getValueFrom(baseColor) * 100.0) - MIN_VALUE) * angleStep - ANGLE_RANGE * 0.5);
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "targetColor"; }
    };
    textColor      = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override protected void invalidated() {
            super.set(null == get() ? Color.WHITE:  get());
            redraw();
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "textColor"; }
    };
    color          = new ObjectPropertyBase<Color>(DEFAULT_COLOR) {
        @Override protected void invalidated() {
            super.set(null == get() ? DEFAULT_COLOR : get());
            redraw();
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "color"; }
    };
    indicatorColor = new ObjectPropertyBase<Color>(Color.WHITE) {
        @Override protected void invalidated() { indicatorGlow.setColor(get()); }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "indicatorColor"; }
    };
    selected       = new BooleanPropertyBase(false) {
        @Override protected void invalidated() {
            if (get()) {
                indicator.setFill(getIndicatorColor());
                indicator.setStroke(getIndicatorColor().darker().darker());
                indicator.setEffect(indicatorGlow);
            } else {
                indicator.setFill(getColor().darker());
                indicator.setStroke(getColor().darker().darker());
                indicator.setEffect(null);
            }
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "selected"; }
    };
    on             = new BooleanPropertyBase(false) {
        @Override protected void invalidated() { currentColorCircle.setVisible(get()); }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "on"; }
    };
    brightness     = new DoublePropertyBase(1.0) {
        @Override protected void invalidated() {
            set(clamp(0.0, 1.0, get()));
            targetColor.set(baseColor.deriveColor(0, 1, get(), 1));
        }
        @Override public Object getBean() { return ColorRegulator.this; }
        @Override public String getName() { return "brightness"; }
    };
    angleStep      = ANGLE_RANGE / (MAX_VALUE - MIN_VALUE);

    init();
    initGraphics();
    registerListeners();
}
 
Example #10
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public CircularProgressIndicator() {
    getStylesheets().add(CircularProgressIndicator.class.getResource("/fxui/css/circular-progress-indicator.css").toExternalForm());
    getStyleClass().add("circular-progress");
    progress      = new DoublePropertyBase(0) {
        @Override public void invalidated() {
            if (get() < 0) {
                startIndeterminate();
            } else {
                stopIndeterminate();
                set(clamp(0d,1d, get()));
                redraw();
            }
        }
        @Override public Object getBean() { return CircularProgressIndicator.this;}
        @Override public String getName() { return "progress"; }
    };
    indeterminate = new BooleanPropertyBase(false) {
        @Override public Object getBean() { return CircularProgressIndicator.this; }
        @Override public String getName() { return "indeterminate"; }
    };
    roundLineCap  = new BooleanPropertyBase(false) {
        @Override public void invalidated() {
            if (get()) {
                circle.setStrokeLineCap(StrokeLineCap.ROUND);
                arc.setStrokeLineCap(StrokeLineCap.ROUND);
            } else {
                circle.setStrokeLineCap(StrokeLineCap.SQUARE);
                arc.setStrokeLineCap(StrokeLineCap.SQUARE);
            }
        }
        @Override public Object getBean() { return CircularProgressIndicator.this; }
        @Override public String getName() { return "roundLineCap"; }
    };
    isRunning     = false;
    timeline      = new Timeline();
    listener      = observable -> {
        circle.setStrokeDashOffset(dashOffset.get());
        circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);
    };
    init();
    initGraphics();
    registerListeners();
}
 
Example #11
Source File: CircularProgressIndicator.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public CircularProgressIndicator() {
    getStylesheets().add(CircularProgressIndicator.class.getResource("/fxui/css/circular-progress-indicator.css").toExternalForm());
    getStyleClass().add("circular-progress");
    progress      = new DoublePropertyBase(0) {
        @Override public void invalidated() {
            if (get() < 0) {
                startIndeterminate();
            } else {
                stopIndeterminate();
                set(clamp(0d,1d, get()));
                redraw();
            }
        }
        @Override public Object getBean() { return CircularProgressIndicator.this;}
        @Override public String getName() { return "progress"; }
    };
    indeterminate = new BooleanPropertyBase(false) {
        @Override public Object getBean() { return CircularProgressIndicator.this; }
        @Override public String getName() { return "indeterminate"; }
    };
    roundLineCap  = new BooleanPropertyBase(false) {
        @Override public void invalidated() {
            if (get()) {
                circle.setStrokeLineCap(StrokeLineCap.ROUND);
                arc.setStrokeLineCap(StrokeLineCap.ROUND);
            } else {
                circle.setStrokeLineCap(StrokeLineCap.SQUARE);
                arc.setStrokeLineCap(StrokeLineCap.SQUARE);
            }
        }
        @Override public Object getBean() { return CircularProgressIndicator.this; }
        @Override public String getName() { return "roundLineCap"; }
    };
    isRunning     = false;
    timeline      = new Timeline();
    listener      = observable -> {
        circle.setStrokeDashOffset(dashOffset.get());
        circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);
    };
    init();
    initGraphics();
    registerListeners();
}