javafx.beans.property.DoublePropertyBase Java Examples

The following examples show how to use javafx.beans.property.DoublePropertyBase. 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 10 votes vote down vote up
/**
 * Property for setting the scale factor to which the content need to be magnified. The default value is 3.0D.
 * 
 * @see #setScaleFactor(double)
 * @see #getScaleFactor()
 */
public final DoubleProperty scaleFactorProperty() {
	if (this.scaleFactor == null) {
		this.scaleFactor = new DoublePropertyBase(DEFAULT_SCALE_FACTOR) {
			@Override
			public String getName() {
				return "scaleFactor";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.scaleFactor;
}
 
Example #2
Source File: Magnifier.java    From oim-fx with MIT License 10 votes vote down vote up
/**
 * Property for setting the width of the scope lines that are visible in the circular viewer. The default value is 1.5px.
 * 
 * @see #setScopeLineWidth(double)
 * @see #getScopeLineWidth()
 */
public final DoubleProperty scopeLineWidthProperty() {
	if (this.scopeLineWidth == null) {
		this.scopeLineWidth = new DoublePropertyBase(DEFAULT_SCOPELINE_WIDTH) {
			@Override
			public String getName() {
				return "scopeLineWidth";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.scopeLineWidth;
}
 
Example #3
Source File: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Property for setting the radius of the circular viewer. The default value is 86.0D.
 * 
 * @see #setRadius(double)
 * @see #getRadius()
 */
public final DoubleProperty radiusProperty() {
	if (this.radius == null) {
		this.radius = new DoublePropertyBase(DEFAULT_RADIUS) {
			@Override
			public String getName() {
				return "radius";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.radius;
}
 
Example #4
Source File: Magnifier.java    From oim-fx with MIT License 6 votes vote down vote up
/**
 * Property for setting the frame width of the circular viewer. The default value is 5.5D.
 * 
 * @see #setFrameWidth(double)
 * @see #getFrameWidth()
 */
public final DoubleProperty frameWidthProperty() {
	if (this.frameWidth == null) {
		this.frameWidth = new DoublePropertyBase(DEFAULT_FRAME_WIDTH) {
			@Override
			public String getName() {
				return "frameWidth";
			}

			@Override
			public Object getBean() {
				return Magnifier.this;
			}
		};
	}
	return this.frameWidth;
}
 
Example #5
Source File: ChartData.java    From OEE-Designer with MIT License 6 votes vote down vote up
public ChartData(final String NAME, final double VALUE, final Color FILL_COLOR, final Color STROKE_COLOR, final Color TEXT_COLOR, final Instant TIMESTAMP, final boolean ANIMATED, final long ANIMATION_DURATION) {
    name              = NAME;
    value             = VALUE;
    oldValue          = 0;
    fillColor         = FILL_COLOR;
    strokeColor       = STROKE_COLOR;
    textColor         = TEXT_COLOR;
    timestamp         = TIMESTAMP;
    currentValue      = new DoublePropertyBase(value) {
        @Override protected void invalidated() {
            oldValue = value;
            value    = get();
            fireChartDataEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartData.this; }
        @Override public String getName() { return "currentValue"; }
    };
    timeline          = new Timeline();
    animated          = ANIMATED;
    animationDuration = ANIMATION_DURATION;

    timeline.setOnFinished(e -> fireChartDataEvent(FINISHED_EVENT));
}
 
Example #6
Source File: ChartItem.java    From charts with Apache License 2.0 5 votes vote down vote up
public ChartItem(final String NAME, final double VALUE, final Color FILL, final Color STROKE, final Color TEXT_FILL, final Instant TIMESTAMP, final boolean ANIMATED, final long ANIMATION_DURATION) {
    _name             = NAME;
    _unit             = "";
    _value            = VALUE;
    oldValue          = 0;
    _fill             = FILL;
    _stroke           = STROKE;
    _textFill         = TEXT_FILL;
    _timestamp        = TIMESTAMP;
    _symbol           = Symbol.NONE;
    _animated         = ANIMATED;
    _x                = 0;
    _y                = 0;
    currentValue      = new DoublePropertyBase(_value) {
        @Override protected void invalidated() {
            oldValue = ChartItem.this.getValue();
            ChartItem.this.setValue(get());
            fireItemEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartItem.this; }
        @Override public String getName() { return "currentValue"; }
    };
    timeline          = new Timeline();
    animationDuration = ANIMATION_DURATION;

    timeline.setOnFinished(e -> fireItemEvent(FINISHED_EVENT));
}
 
Example #7
Source File: Section.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public Section(final double START, final double STOP, final String TEXT, final Image ICON, final Color COLOR, final Color HIGHLIGHT_COLOR, final Color TEXT_COLOR, final String STYLE_CLASS) {
    _start          = START;
    _stop           = STOP;
    range           = new DoublePropertyBase(Math.abs(_stop - _start)) {
        @Override public Object getBean() { return Section.this; }
        @Override public String getName() { return "range"; }
    };
    _text           = TEXT;
    _icon           = ICON;
    _color          = COLOR;
    _highlightColor = HIGHLIGHT_COLOR;
    _textColor      = TEXT_COLOR;
    checkedValue    = -Double.MAX_VALUE;
    styleClass      = STYLE_CLASS;
}
 
Example #8
Source File: MinimalClockSkin.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public MinimalClockSkin(Clock clock) {
    super(clock);

    minuteAngle         = new DoublePropertyBase(-1) {
        @Override public Object getBean() { return clock; }
        @Override public String getName() { return "minuteAngle"; }
    };
    timeline            = new Timeline();
    minuteAngleListener = o -> moveMinute(minuteAngle.get());
    dateTextFormatter   = DateTimeFormatter.ofPattern("ccc., dd. MMM.").withLocale(clock.getLocale());

    initGraphics();
    registerListeners();
}
 
Example #9
Source File: HeatControl.java    From Enzo with Apache License 2.0 5 votes vote down vote up
public HeatControl() {
    getStyleClass().add("heat-control");
    value             = new DoublePropertyBase(0) {
        @Override protected void invalidated() {
            set(clamp(getMinValue(), getMaxValue(), get()));
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "value"; }
    };
    minValue          = new DoublePropertyBase(0) {
        @Override protected void invalidated() {
            if (getValue() < get()) setValue(get());
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "minValue"; }
    };
    maxValue          = new DoublePropertyBase(40) {
        @Override protected void invalidated() {
            if (getValue() > get()) setValue(get());
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "maxValue"; }
    };
    oldValue          = 0;
    target            = new DoublePropertyBase(20) {
        @Override protected void invalidated() {
            set(clamp(getMinValue(), getMaxValue(), get()));
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "target"; }
    };
    _minMeasuredValue = maxValue.getValue();
    _maxMeasuredValue = 0;
    _decimals         = 0;
    _infoText         = "";
    targetEnabled     = new SimpleBooleanProperty(this, "targetEnabled", false);
    _startAngle       = 325;
    _angleRange       = 290;                
}
 
Example #10
Source File: ParetoPanel.java    From charts with Apache License 2.0 4 votes vote down vote up
private void init() {
    modelStack = new Stack<>();
    dataDots = new ArrayList<>();
    popup = new ParetoInfoPopup();
    mouseHandler       = this::handleMouseEvents;
    modelStack.push(paretoModel);

    _labelingColor = Color.BLACK;

    _singelSubBarCentered = true;

    initGraphics();
    registerListeners();

    colorThemes = new HashMap<>();
    ArrayList<Color> defaultColorTheme = new ArrayList<>();
    defaultColorTheme.add(Color.BLUE);
    colorThemes.putIfAbsent("Default", defaultColorTheme);

    _valueFontYPosition         = 20;
    _identifierFontYPosition    = 40;
    _pathFontYPositon           = 65;
    _percentageLineDataDotColor = Color.BLACK;
    _percentageLineColor        = Color.BLACK;
    _useCalculatedSubBarColors  = true;
    _smoothPercentageCurve      = false;
    _showSubBars                = true;

    textPane   = new AnchorPane();

    yAxisLeft  = Helper.createLeftAxis(0, paretoModel.getTotal(), false, 80d);
    yAxisRight = Helper.createRightAxis(0,100,true,80d);

    maxValue   = new DoublePropertyBase(paretoModel.getTotal()) {
        @Override public Object getBean() { return ParetoPanel.this; }
        @Override public String getName() { return "maxValue"; }
    };

    yAxisLeft.setTitle(paretoModel.getTitle());
    yAxisLeft.setTitleFontSize(30);

    //yAxisRight.setTitle("Percentage"); //title written into the numbers of scale
    yAxisRight.setTitleFontSize(30);

    yAxisRight.setUnit("\\u0025");

    yAxisLeft.maxValueProperty().bindBidirectional(maxValue);

    yAxisRight.setPosition(Position.CENTER);
    bPane = new BorderPane();
    bPane.setPrefWidth(yAxisRight.getWidth()+ canvas.getWidth()+ yAxisRight.getWidth());
    bPane.setCenter(canvas);

    yAxisRightProperty = new ObjectPropertyBase<Axis>(yAxisRight) {
        @Override public Object getBean() { return ParetoPanel.this; }
        @Override public String getName() { return "yAxisRight"; }
    };
    yAxisLeftProperty  = new ObjectPropertyBase<Axis>(yAxisLeft) {
        @Override public Object getBean() { return ParetoPanel.this; }
        @Override public String getName() { return "yAxisLeft"; }
    };

    bPane.rightProperty().bind(yAxisRightProperty);
    bPane.leftProperty().bind(yAxisLeftProperty);

    _barSpacing = 5;

    width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    bPane.setMaxSize(width, height);
    bPane.setPrefSize(width, height);

    canvas.setWidth(width-yAxisRight.getWidth()-yAxisLeft.getWidth());

    textPane.setMaxHeight(80);
    textPane.setMinHeight(80);

    StackPane test = new StackPane();
    test.setPrefHeight(80d);
    labelingCanvas = new Canvas();

    labelingCanvas.setHeight(80);
    labelingCtx = labelingCanvas.getGraphicsContext2D();

    delayRedraw = false;

    bPane.setBottom(labelingCanvas);

    getChildren().setAll(bPane);

    drawParetoChart();
}
 
Example #11
Source File: ChartData.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public ChartData(final Image IMAGE, final String NAME, final double VALUE, final Color FILL_COLOR, final Color STROKE_COLOR, final Color TEXT_COLOR, final Instant TIMESTAMP, final
                 java.time.Duration DURATION, final boolean ANIMATED, final long ANIMATION_DURATION) {
    image              = IMAGE;
    name               = NAME;
    value              = VALUE;
    oldValue           = 0;
    fillColor          = FILL_COLOR;
    strokeColor        = STROKE_COLOR;
    textColor          = TEXT_COLOR;
    timestamp          = TIMESTAMP;
    duration           = DURATION;
    currentValue       = new DoublePropertyBase(value) {
        @Override protected void invalidated() {
            oldValue = value;
            value    = get();
            fireChartDataEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartData.this; }
        @Override public String getName() { return "currentValue"; }
    };
    currentDuration    = new ObjectPropertyBase<>(duration) {
        @Override protected void invalidated() {
            oldDuration = duration;
            duration    = get();
            fireChartDataEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartData.this; }
        @Override public String getName() { return "currentDuration"; }
    };
    currentTimestamp   = new ObjectPropertyBase<>(timestamp) {
        @Override protected void invalidated() {
            oldTimestamp = timestamp;
            timestamp    = get();
            fireChartDataEvent(UPDATE_EVENT);
        }
        @Override public Object getBean() { return ChartData.this; }
        @Override public String getName() { return "currentTimestamp"; }
    };
    timeline           = new Timeline();
    animated           = ANIMATED;
    animationDuration  = ANIMATION_DURATION;
    formatString       = "";
    minValue           = 0;
    maxValue           = 100;
    useChartDataColors = false;

    timeline.setOnFinished(e -> fireChartDataEvent(FINISHED_EVENT));
}
 
Example #12
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 #13
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 #14
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 #15
Source File: SimpleGauge.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public SimpleGauge() {
    getStyleClass().add("simple-gauge");        
    value                 = new DoublePropertyBase(0) {
        @Override protected void invalidated() {                
            set(clamp(getMinValue(), getMaxValue(), get()));    
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "value"; }
    };                
    minValue              = new DoublePropertyBase(0) {
        @Override protected void invalidated() {                 
            if (getValue() < get()) setValue(get());                
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "minValue"; }
    };
    maxValue              = new DoublePropertyBase(100) {
        @Override protected void invalidated() {                 
            if (getValue() > get()) setValue(get());
        }
        @Override public Object getBean() { return this; }
        @Override public String getName() { return "maxValue"; }
    };
    oldValue              = 0;
    _decimals             = 0;
    _unit                 = "";
    _animated             = true;
    _startAngle           = 315;
    _angleRange           = 270;
    _clockwise            = true;
    _autoScale            = false;
    _needleColor          = Color.web("#5a615f");
    _sectionTextVisible   = false;
    _sectionIconVisible   = false;
    _measuredRangeVisible = false;
    sections              = FXCollections.observableArrayList();
    _majorTickSpace       = 10;
    _minorTickSpace       = 1;
    _title                = "";
    animationDuration     = 3000;        
}