Search in sources :

Example 36 with StringProperty

use of javafx.beans.property.StringProperty in project VocabHunter by VocabHunter.

the class SettingsController method initialiseField.

private void initialiseField(final TextField field, final Supplier<Object> settingGetter) {
    StringProperty textProperty = field.textProperty();
    ReadOnlyBooleanProperty focusedProperty = field.focusedProperty();
    field.setText(settingGetter.get().toString());
    textProperty.addListener((o, oldValue, newValue) -> cleanNonNegativeInteger(field::setText, newValue, oldValue));
    focusedProperty.addListener((o, old, isFocused) -> applyDefaultIfEmpty(field::setText, field::getText, settingGetter));
}
Also used : ReadOnlyBooleanProperty(javafx.beans.property.ReadOnlyBooleanProperty) StringProperty(javafx.beans.property.StringProperty)

Example 37 with StringProperty

use of javafx.beans.property.StringProperty in project Frankenstein by olir.

the class ConfigurationSceneController method initialize.

/**
 * Initialize method, automatically called by @{link FXMLLoader}
 */
public void initialize() {
    configuration = new Configuration(new Configuration.ConfigHelper() {

        @Override
        public File getFFmpegPath() {
            DirectoryChooser dirChooser = new DirectoryChooser();
            dirChooser.setTitle("Select FFmpeg Home Path");
            return dirChooser.showDialog(stage);
        }

        @Override
        public File getTempPath() {
            DirectoryChooser dirChooser = new DirectoryChooser();
            dirChooser.setTitle("Select Temp Path");
            return dirChooser.showDialog(stage);
        }
    });
    removeTab(tabVideoFileInput);
    addTab(tabTestVideoGenerator);
    removeTab(tabSlideshow);
    removeTab(tabAnaglyph);
    removeTab(tabDelay);
    removeTab(tabOverUnder);
    addTab(tabClone);
    removeTab(tabSwap);
    removeTab(tabVRConverter);
    addTab(tabVideoFileOutput);
    removeTab(tabPostProcessing);
    rTestVideoGenerator.setSelected(true);
    rCloneLR.setSelected(true);
    rNoAlignment.setSelected(true);
    rNoVR.setSelected(true);
    rVideoFileOutput.setSelected(true);
    tfPropertyInputDir.setText(configuration.getInputDir());
    tfPropertyTestScreenWidth.setText(String.valueOf(configuration.testScreenWidth));
    tfPropertyTestScreenHeight.setText(String.valueOf(configuration.testScreenHeight));
    if (configuration.anaglyphKeepWidth)
        rPropertyAnaglyphKeepWidth.setSelected(true);
    else
        rPropertyAnaglyphDoubleWidth.setSelected(true);
    tfPropertyTestScreenWidth.textProperty().addListener(new ChangeListener<String>() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            if (!tfActionChangeTestScreenWidth(oldValue, newValue))
                ((StringProperty) observable).setValue(oldValue);
        }
    });
    tfPropertyTestScreenHeight.textProperty().addListener(new ChangeListener<String>() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            if (!tfActionChangeTestScreenHeight(oldValue, newValue))
                ((StringProperty) observable).setValue(oldValue);
        }
    });
    if (configuration.ouAdjustSize)
        rPropertyOUAdjustSize.setSelected(true);
    else
        rPropertyOUReduceSize.setSelected(true);
    if (configuration.delayLeft)
        rDelayLeft.setSelected(true);
    else
        rDelayRight.setSelected(true);
    sliderVRShrink.setValue(configuration.vrModeShrinkFactor * 100.0);
    sliderVRShrink.valueProperty().addListener((observable, oldvalue, newvalue) -> {
        int newFactor = newvalue.intValue();
        configuration.vrModeShrinkFactor = ((float) newFactor) / 100.0f;
        lVRShrinkDisplay.setText(String.valueOf(newFactor) + '%');
    });
    if (configuration.vrModeShrinkOnly)
        vrModeFromVR.setSelected(true);
    else
        vrModeFromSBS.setSelected(true);
    configuration.setInputStreamURL(tfPropertyInputStream.getText());
    tfPropertyInputStream.textProperty().addListener((observable, oldValue, newValue) -> {
        configuration.setInputStreamURL(tfPropertyInputStream.getText());
    });
}
Also used : Configuration(de.serviceflow.frankenstein.Configuration) StringProperty(javafx.beans.property.StringProperty) DirectoryChooser(javafx.stage.DirectoryChooser)

Example 38 with StringProperty

use of javafx.beans.property.StringProperty in project tilesfx by HanSolo.

the class TileBuilder method build.

public final Tile build() {
    final Tile CONTROL;
    if (properties.containsKey("skinType")) {
        SkinType skinType = ((ObjectProperty<SkinType>) properties.get("skinType")).get();
        CONTROL = new Tile(skinType);
        switch(skinType) {
            case SMOOTHED_CHART:
                break;
            case BAR_CHART:
                break;
            case CLOCK:
                break;
            case GAUGE:
                CONTROL.setAnimated(true);
                CONTROL.setTickLabelDecimals(0);
                CONTROL.setBarColor(Tile.FOREGROUND);
                CONTROL.setThresholdColor(Tile.BLUE);
                CONTROL.setThresholdVisible(true);
                break;
            case HIGH_LOW:
                CONTROL.setMaxValue(Double.MAX_VALUE);
                CONTROL.setDecimals(2);
                CONTROL.setTickLabelDecimals(1);
                break;
            case PERCENTAGE:
                CONTROL.setAnimated(true);
                CONTROL.setThresholdColor(Tile.GRAY);
                CONTROL.setTickLabelDecimals(0);
                break;
            case PLUS_MINUS:
                break;
            case SLIDER:
                CONTROL.setBarBackgroundColor(Tile.FOREGROUND);
                break;
            case SPARK_LINE:
                CONTROL.setTextVisible(false);
                CONTROL.setAnimated(false);
                CONTROL.setAveragingEnabled(true);
                CONTROL.setAveragingPeriod(10);
                CONTROL.setDecimals(0);
                CONTROL.setTickLabelDecimals(0);
                break;
            case SWITCH:
                break;
            case WORLDMAP:
                CONTROL.setPrefSize(380, 250);
                break;
            case TIMER_CONTROL:
                CONTROL.setSectionsVisible(true);
                CONTROL.setHighlightSections(true);
                CONTROL.setCheckSectionsForValue(true);
                break;
            case NUMBER:
                break;
            case TEXT:
                break;
            case WEATHER:
                break;
            case TIME:
                break;
            case CUSTOM:
                break;
            case LEADER_BOARD:
                break;
            case MAP:
                break;
            case RADIAL_CHART:
                CONTROL.setAnimated(true);
                break;
            case DONUT_CHART:
                CONTROL.setAnimated(true);
                break;
            case CIRCULAR_PROGRESS:
                CONTROL.setBarBackgroundColor(CONTROL.getBackgroundColor().brighter());
                CONTROL.setAnimated(true);
                break;
            case STOCK:
                CONTROL.setAnimated(false);
                CONTROL.setAveragingPeriod(720);
                CONTROL.setAveragingEnabled(true);
                CONTROL.setDecimals(2);
                CONTROL.setTickLabelDecimals(2);
                CONTROL.setThresholdColor(Tile.GRAY);
                CONTROL.setTextVisible(false);
                break;
            case GAUGE_SPARK_LINE:
                CONTROL.setBarColor(Tile.BLUE);
                CONTROL.setAngleRange(270);
                break;
            case SMOOTH_AREA_CHART:
                CONTROL.setSmoothing(true);
                CONTROL.setChartType(ChartType.AREA);
                break;
            case RADAR_CHART:
                break;
            case COUNTRY:
                break;
            case EPHEMERIS:
                break;
            case CHARACTER:
                break;
            case FLIP:
                break;
            case SWITCH_SLIDER:
                CONTROL.setBarBackgroundColor(Tile.FOREGROUND);
                break;
            case DATE:
                CONTROL.setTitleAlignment(TextAlignment.CENTER);
                CONTROL.setTextAlignment(TextAlignment.CENTER);
                break;
            case CALENDAR:
                CONTROL.setTitleAlignment(TextAlignment.CENTER);
                CONTROL.setTextAlignment(TextAlignment.CENTER);
                break;
            case SUNBURST:
                break;
            case MATRIX:
                break;
            case RADIAL_PERCENTAGE:
                CONTROL.setBarBackgroundColor(CONTROL.getBackgroundColor().brighter());
                CONTROL.setAnimated(true);
                break;
            default:
                break;
        }
    } else {
        CONTROL = new Tile();
    }
    // Make sure that sections, areas and markers will be added first
    if (properties.keySet().contains("sectionsArray")) {
        CONTROL.setSections(((ObjectProperty<Section[]>) properties.get("sectionsArray")).get());
    }
    if (properties.keySet().contains("sectionsList")) {
        CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get("sectionsList")).get());
    }
    if (properties.keySet().contains("characterArray")) {
        CONTROL.setCharacters(((ObjectProperty<String[]>) properties.get("characterArray")).get());
    }
    if (properties.keySet().contains("foregroundBaseColor")) {
        CONTROL.setForegroundBaseColor(((ObjectProperty<Color>) properties.get("foregroundBaseColor")).get());
    }
    if (properties.keySet().contains("minValue")) {
        CONTROL.setMinValue(((DoubleProperty) properties.get("minValue")).get());
    }
    if (properties.keySet().contains("maxValue")) {
        CONTROL.setMaxValue(((DoubleProperty) properties.get("maxValue")).get());
    }
    if (properties.keySet().contains("alarmsArray")) {
        CONTROL.setAlarms(((ObjectProperty<Alarm[]>) properties.get("alarmsArray")).get());
    }
    if (properties.keySet().contains("alarmsList")) {
        CONTROL.setAlarms(((ObjectProperty<List<Alarm>>) properties.get("alarmsList")).get());
    }
    if (properties.keySet().contains("timeSectionsArray")) {
        CONTROL.setTimeSections(((ObjectProperty<TimeSection[]>) properties.get("timeSectionsArray")).get());
    }
    if (properties.keySet().contains("timeSectionsList")) {
        CONTROL.setTimeSections(((ObjectProperty<List<TimeSection>>) properties.get("timeSectionsList")).get());
    }
    if (properties.keySet().contains("seriesArray")) {
        CONTROL.setSeries(((ObjectProperty<Series<String, Number>[]>) properties.get("seriesArray")).get());
    }
    if (properties.keySet().contains("seriesList")) {
        CONTROL.setSeries(((ObjectProperty<List<Series<String, Number>>>) properties.get("seriesList")).get());
    }
    if (properties.keySet().contains("tilesFxSeriesArray")) {
        CONTROL.setTilesFXSeries(((ObjectProperty<TilesFXSeries<String, Number>[]>) properties.get("tilesFxSeriesArray")).get());
    }
    if (properties.keySet().contains("tilesFxSeriesList")) {
        CONTROL.setTilesFXSeries(((ObjectProperty<List<TilesFXSeries<String, Number>>>) properties.get("tilesFxSeriesList")).get());
    }
    if (properties.keySet().contains("barChartItemsArray")) {
        CONTROL.setBarChartItems(((ObjectProperty<BarChartItem[]>) properties.get("barChartItemsArray")).get());
    }
    if (properties.keySet().contains("barChartItemsList")) {
        CONTROL.setBarChartItems(((ObjectProperty<List<BarChartItem>>) properties.get("barChartItemsList")).get());
    }
    if (properties.keySet().contains("leaderBoardItemsArray")) {
        CONTROL.setLeaderBoardItems(((ObjectProperty<LeaderBoardItem[]>) properties.get("leaderBoardItemsArray")).get());
    }
    if (properties.keySet().contains("leaderBoardItemsList")) {
        CONTROL.setLeaderBoardItems(((ObjectProperty<List<LeaderBoardItem>>) properties.get("leaderBoardItemsList")).get());
    }
    if (properties.keySet().contains("gradientStopsArray")) {
        CONTROL.setGradientStops(((ObjectProperty<Stop[]>) properties.get("gradientStopsArray")).get());
    }
    if (properties.keySet().contains("gradientStopsList")) {
        CONTROL.setGradientStops(((ObjectProperty<List<Stop>>) properties.get("gradientStopsList")).get());
    }
    if (properties.keySet().contains("chartDataArray")) {
        CONTROL.setChartData(((ObjectProperty<ChartData[]>) properties.get("chartDataArray")).get());
    }
    if (properties.keySet().contains("chartDataList")) {
        CONTROL.setChartData(((ObjectProperty<List<ChartData>>) properties.get("chartDataList")).get());
    }
    if (properties.keySet().contains("poiArray")) {
        CONTROL.setPoiLocations(((ObjectProperty<Location[]>) properties.get("poiArray")).get());
    }
    if (properties.keySet().contains("poiList")) {
        CONTROL.setPoiList(((ObjectProperty<List<Location>>) properties.get("poiList")).get());
    }
    if (properties.keySet().contains("trackArray")) {
        CONTROL.setTrack(((ObjectProperty<Location[]>) properties.get("trackArray")).get());
    }
    if (properties.keySet().contains("trackList")) {
        CONTROL.setTrack(((ObjectProperty<List<Location>>) properties.get("trackList")).get());
    }
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setMinSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setMaxSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("padding".equals(key)) {
            CONTROL.setPadding(((ObjectProperty<Insets>) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("tile");
            CONTROL.getStyleClass().addAll(((ObjectProperty<String[]>) properties.get(key)).get());
        } else if ("autoScale".equals(key)) {
            CONTROL.setAutoScale(((BooleanProperty) properties.get(key)).get());
        } else if ("value".equals(key)) {
            CONTROL.setValue(((DoubleProperty) properties.get(key)).get());
        } else if ("decimals".equals(key)) {
            CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get());
        } else if ("tickLabelDecimals".equals(key)) {
            CONTROL.setTickLabelDecimals(((IntegerProperty) properties.get(key)).get());
        } else if ("title".equals(key)) {
            CONTROL.setTitle(((StringProperty) properties.get(key)).get());
        } else if ("titleAlignment".equals(key)) {
            CONTROL.setTitleAlignment(((ObjectProperty<TextAlignment>) properties.get(key)).get());
        } else if ("description".equals(key)) {
            CONTROL.setDescription(((StringProperty) properties.get(key)).get());
        } else if ("descriptionAlignment".equals(key)) {
            CONTROL.setDescriptionAlignment(((ObjectProperty<Pos>) properties.get(key)).get());
        } else if ("unit".equals(key)) {
            CONTROL.setUnit(((StringProperty) properties.get(key)).get());
        } else if ("selected".equals(key)) {
            CONTROL.setActive(((BooleanProperty) properties.get(key)).get());
        } else if ("averagingEnabled".equals(key)) {
            CONTROL.setAveragingEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("averagingPeriod".equals(key)) {
            CONTROL.setAveragingPeriod(((IntegerProperty) properties.get(key)).get());
        } else if ("startFromZero".equals(key)) {
            CONTROL.setStartFromZero(((BooleanProperty) properties.get(key)).get());
        } else if ("returnToZero".equals(key)) {
            CONTROL.setReturnToZero(((BooleanProperty) properties.get(key)).get());
        } else if ("minMeasuredValueVisible".equals(key)) {
            CONTROL.setMinMeasuredValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("maxMeasuredValueVisible".equals(key)) {
            CONTROL.setMaxMeasuredValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("oldValueVisible".equals(key)) {
            CONTROL.setOldValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("valueVisible".equals(key)) {
            CONTROL.setValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("foregroundColor".equals(key)) {
            CONTROL.setForegroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("backgroundColor".equals(key)) {
            CONTROL.setBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("borderColor".equals(key)) {
            CONTROL.setBorderColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("borderWidth".equals(key)) {
            CONTROL.setBorderWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("knobColor".equals(key)) {
            CONTROL.setKnobColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("animated".equals(key)) {
            CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if ("animationDuration".equals(key)) {
            CONTROL.setAnimationDuration(((LongProperty) properties.get(key)).get());
        } else if ("startAngle".equals(key)) {
            CONTROL.setStartAngle(((DoubleProperty) properties.get(key)).get());
        } else if ("angleRange".equals(key)) {
            CONTROL.setAngleRange(((DoubleProperty) properties.get(key)).get());
        } else if ("needleColor".equals(key)) {
            CONTROL.setNeedleColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("barColor".equals(key)) {
            CONTROL.setBarColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("barBackgroundColor".equals(key)) {
            CONTROL.setBarBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("locale".equals(key)) {
            CONTROL.setLocale(((ObjectProperty<Locale>) properties.get(key)).get());
        } else if ("numberFormat".equals(key)) {
            CONTROL.setNumberFormat(((ObjectProperty<NumberFormat>) properties.get(key)).get());
        } else if ("shadowsEnabled".equals(key)) {
            CONTROL.setShadowsEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("style".equals(key)) {
            CONTROL.setStyle(((StringProperty) properties.get(key)).get());
        } else if ("innerShadowEnabled".equals(key)) {
            CONTROL.setInnerShadowEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("thresholdVisible".equals(key)) {
            CONTROL.setThresholdVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("averageVisible".equals(key)) {
            CONTROL.setAverageVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionsVisible".equals(key)) {
            CONTROL.setSectionsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionsAlwaysVisible".equals(key)) {
            CONTROL.setSectionsAlwaysVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionTextVisible".equals(key)) {
            CONTROL.setSectionTextVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionIconsVisible".equals(key)) {
            CONTROL.setSectionIconsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("highlightSections".equals(key)) {
            CONTROL.setHighlightSections(((BooleanProperty) properties.get(key)).get());
        } else if ("titleColor".equals(key)) {
            CONTROL.setTitleColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("descriptionColor".equals(key)) {
            CONTROL.setDescriptionColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("unitColor".equals(key)) {
            CONTROL.setUnitColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("valueColor".equals(key)) {
            CONTROL.setValueColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("thresholdColor".equals(key)) {
            CONTROL.setThresholdColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("orientation".equals(key)) {
            CONTROL.setOrientation(((ObjectProperty<Orientation>) properties.get(key)).get());
        } else if ("checkSectionsForValue".equals(key)) {
            CONTROL.setCheckSectionsForValue(((BooleanProperty) properties.get(key)).get());
        } else if ("checkThreshold".equals(key)) {
            CONTROL.setCheckThreshold(((BooleanProperty) properties.get(key)).get());
        } else if ("onValueChanged".equals(key)) {
            CONTROL.currentValueProperty().addListener(((ObjectProperty<InvalidationListener>) properties.get(key)).get());
        } else if ("keepAspect".equals(key)) {
            CONTROL.setKeepAspect(((BooleanProperty) properties.get(key)).get());
        } else if ("threshold".equals(key)) {
            CONTROL.setThreshold(((DoubleProperty) properties.get(key)).get());
        } else if ("referenceValue".equals(key)) {
            CONTROL.setReferenceValue(((DoubleProperty) properties.get(key)).get());
        } else if ("autoReferenceValue".equals(key)) {
            CONTROL.setAutoReferenceValue(((BooleanProperty) properties.get(key)).get());
        } else if ("customFontEnabled".equals(key)) {
            CONTROL.setCustomFontEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("customFont".equals(key)) {
            CONTROL.setCustomFont(((ObjectProperty<Font>) properties.get(key)).get());
        } else if ("alertMessage".equals(key)) {
            CONTROL.setAlertMessage(((StringProperty) properties.get(key)).get());
        } else if ("smoothing".equals(key)) {
            CONTROL.setSmoothing(((BooleanProperty) properties.get(key)).get());
        } else if ("time".equals(key)) {
            CONTROL.setTime(((ObjectProperty<ZonedDateTime>) properties.get(key)).get());
        } else if ("text".equals(key)) {
            CONTROL.setText(((StringProperty) properties.get(key)).get());
        } else if ("textAlignment".equals(key)) {
            CONTROL.setTextAlignment(((ObjectProperty<TextAlignment>) properties.get(key)).get());
        } else if ("discreteSeconds".equals(key)) {
            CONTROL.setDiscreteSeconds(((BooleanProperty) properties.get(key)).get());
        } else if ("discreteMinutes".equals(key)) {
            CONTROL.setDiscreteMinutes(((BooleanProperty) properties.get(key)).get());
        } else if ("discreteHours".equals(key)) {
            CONTROL.setDiscreteHours(((BooleanProperty) properties.get(key)).get());
        } else if ("secondsVisible".equals(key)) {
            CONTROL.setSecondsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("textVisible".equals(key)) {
            CONTROL.setTextVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("dateVisible".equals(key)) {
            CONTROL.setDateVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("textColor".equals(key)) {
            CONTROL.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("dateColor".equals(key)) {
            CONTROL.setDateColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("hourTickMarkColor".equals(key)) {
            CONTROL.setHourTickMarkColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("minuteTickMarkColor".equals(key)) {
            CONTROL.setMinuteTickMarkColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("alarmColor".equals(key)) {
            CONTROL.setAlarmColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("hourTickMarksVisible".equals(key)) {
            CONTROL.setHourTickMarksVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("minuteTickMarksVisible".equals(key)) {
            CONTROL.setMinuteTickMarksVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("hourColor".equals(key)) {
            CONTROL.setHourColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("minuteColor".equals(key)) {
            CONTROL.setMinuteColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("secondColor".equals(key)) {
            CONTROL.setSecondColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("onAlarm".equals(key)) {
            CONTROL.setOnAlarm(((ObjectProperty<AlarmEventListener>) properties.get(key)).get());
        } else if ("onTimeEvent".equals(key)) {
            CONTROL.setOnTimeEvent(((ObjectProperty<TimeEventListener>) properties.get(key)).get());
        } else if ("alarmsEnabled".equals(key)) {
            CONTROL.setAlarmsEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("alarmsVisible".equals(key)) {
            CONTROL.setAlarmsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("running".equals(key)) {
            CONTROL.setRunning(((BooleanProperty) properties.get(key)).get());
        } else if ("increment".equals(key)) {
            CONTROL.setIncrement(((DoubleProperty) properties.get(key)).get());
        } else if ("activeColor".equals(key)) {
            CONTROL.setActiveColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("darkSky".equals(key)) {
            CONTROL.setDarkSky(((ObjectProperty<DarkSky>) properties.get(key)).get());
        } else if ("duration".equals(key)) {
            CONTROL.setDuration(((ObjectProperty<LocalTime>) properties.get(key)).get());
        } else if ("strokeWithGradient".equals(key)) {
            CONTROL.setStrokeWithGradient(((BooleanProperty) properties.get(key)).get());
        } else if ("fillWithGradient".equals(key)) {
            CONTROL.setFillWithGradient(((BooleanProperty) properties.get(key)).get());
        } else if ("graphic".equals(key)) {
            CONTROL.setGraphic(((ObjectProperty<Node>) properties.get(key)).get());
        } else if ("roundedCorners".equals(key)) {
            CONTROL.setRoundedCorners(((BooleanProperty) properties.get(key)).get());
        } else if ("textSize".equals(key)) {
            CONTROL.setTextSize(((ObjectProperty<TextSize>) properties.get(key)).get());
        } else if ("currentLocation".equals(key)) {
            CONTROL.setCurrentLocation(((ObjectProperty<Location>) properties.get(key)).get());
        } else if ("trackColor".equals(key)) {
            CONTROL.setTrackColor(((ObjectProperty<TileColor>) properties.get(key)).get());
        } else if ("mapProvider".equals(key)) {
            CONTROL.setMapProvider(((ObjectProperty<MapProvider>) properties.get(key)).get());
        } else if ("tooltipText".equals(key)) {
            CONTROL.setTooltipText(((StringProperty) properties.get(key)).get());
        } else if ("xAxis".equals(key)) {
            CONTROL.setXAxis(((ObjectProperty<Axis>) properties.get(key)).get());
        } else if ("yAxis".equals(key)) {
            CONTROL.setYAxis(((ObjectProperty<Axis>) properties.get(key)).get());
        } else if ("radarChartMode".equals(key)) {
            CONTROL.setRadarChartMode(((ObjectProperty<RadarChart.Mode>) properties.get(key)).get());
        } else if ("chartGridColor".equals(key)) {
            CONTROL.setChartGridColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("country".equals(key)) {
            CONTROL.setCountry(((ObjectProperty<Country>) properties.get(key)).get());
        } else if ("countryGroup".equals(key)) {
            CONTROL.setCountryGroup(((ObjectProperty<CountryGroup>) properties.get(key)).get());
        } else if ("sortedData".equals(key)) {
            CONTROL.setSortedData(((BooleanProperty) properties.get(key)).get());
        } else if ("flipTimeInMS".equals(key)) {
            CONTROL.setFlipTimeInMS(((LongProperty) properties.get(key)).get());
        } else if ("flipText".equals(key)) {
            CONTROL.setFlipText(((StringProperty) properties.get(key)).get());
        } else if ("dataPointsVisible".equals(key)) {
            CONTROL.setDataPointsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sunburstTree".equals(key)) {
            CONTROL.getSunburstChart().setTree(((ObjectProperty<TreeNode>) properties.get(key)).get());
        } else if ("sunburstBackgroundColor".equals(key)) {
            CONTROL.getSunburstChart().setBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sunburstTextColor".equals(key)) {
            CONTROL.getSunburstChart().setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sunburstUseColorFromParent".equals(key)) {
            CONTROL.getSunburstChart().setUseColorFromParent(((BooleanProperty) properties.get(key)).get());
        } else if ("sunburstTextOrientation".equals(key)) {
            CONTROL.getSunburstChart().setTextOrientation(((ObjectProperty<TextOrientation>) properties.get(key)).get());
        } else if ("sunburstVisibleData".equals(key)) {
            CONTROL.getSunburstChart().setVisibleData(((ObjectProperty<VisibleData>) properties.get(key)).get());
        } else if ("sunburstInteractive".equals(key)) {
            CONTROL.getSunburstChart().setInteractive(((BooleanProperty) properties.get(key)).get());
        } else if ("sunburstAutoTextColor".equals(key)) {
            CONTROL.getSunburstChart().setAutoTextColor(((BooleanProperty) properties.get(key)).get());
        } else if ("sunburstUseChartDataTextColor".equals(key)) {
            CONTROL.getSunburstChart().setUseChartDataTextColor(((BooleanProperty) properties.get(key)).get());
        } else if ("snapToTicks".equals(key)) {
            CONTROL.setSnapToTicks(((BooleanProperty) properties.get(key)).get());
        } else if ("minorTickCount".equals(key)) {
            CONTROL.setMinorTickCount(((IntegerProperty) properties.get(key)).get());
        } else if ("majorTickUnit".equals(key)) {
            CONTROL.setMajorTickUnit(((DoubleProperty) properties.get(key)).get());
        } else if ("matrixSize".equals(key)) {
            final int COLS = ((IntegerProperty) properties.get("matrixColumns")).get();
            final int ROWS = ((IntegerProperty) properties.get("matrixRows")).get();
            CONTROL.setMatrixSize(COLS, ROWS);
        } else if ("chartType".equals(key)) {
            CONTROL.setChartType(((ObjectProperty<ChartType>) properties.get(key)).get());
        } else if ("tooltipTimeout".equals(key)) {
            CONTROL.setTooltipTimeout(((DoubleProperty) properties.get(key)).get());
        } else if ("notificationBackgroundColor".equals(key)) {
            CONTROL.setNotificationBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("notificationForegroundColor".equals(key)) {
            CONTROL.setNotificationForegroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("showNotifier".equals(key)) {
            CONTROL.showNotifier(((BooleanProperty) properties.get(key)).get());
        }
    }
    properties.clear();
    return CONTROL;
}
Also used : TreeNode(eu.hansolo.tilesfx.tools.TreeNode) Node(javafx.scene.Node) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) DarkSky(eu.hansolo.tilesfx.weather.DarkSky) TimeEventListener(eu.hansolo.tilesfx.events.TimeEventListener) ZonedDateTime(java.time.ZonedDateTime) RadarChart(eu.hansolo.tilesfx.chart.RadarChart) List(java.util.List) TileColor(eu.hansolo.tilesfx.Tile.TileColor) Axis(javafx.scene.chart.Axis) ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) IntegerProperty(javafx.beans.property.IntegerProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) TileColor(eu.hansolo.tilesfx.Tile.TileColor) Color(javafx.scene.paint.Color) Dimension2D(javafx.geometry.Dimension2D) SkinType(eu.hansolo.tilesfx.Tile.SkinType) TextSize(eu.hansolo.tilesfx.Tile.TextSize) ChartType(eu.hansolo.tilesfx.Tile.ChartType) TextOrientation(eu.hansolo.tilesfx.chart.SunburstChart.TextOrientation) Orientation(javafx.geometry.Orientation) CountryGroup(eu.hansolo.tilesfx.tools.CountryGroup) Pos(javafx.geometry.Pos) VisibleData(eu.hansolo.tilesfx.chart.SunburstChart.VisibleData) TextAlignment(javafx.scene.text.TextAlignment) SimpleLongProperty(javafx.beans.property.SimpleLongProperty) LongProperty(javafx.beans.property.LongProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) DoubleProperty(javafx.beans.property.DoubleProperty) NumberFormat(java.text.NumberFormat)

Example 39 with StringProperty

use of javafx.beans.property.StringProperty in project dolphin-platform by canoo.

the class FXBinderTest method testJavaFXStringBidirectionalWithConverter.

@Test
public void testJavaFXStringBidirectionalWithConverter() {
    Property<Double> doubleDolphinProperty = new MockedProperty<>();
    StringProperty stringJavaFXProperty = new SimpleStringProperty();
    Converter<String, Double> doubleStringConverter = s -> s == null ? null : Double.parseDouble(s);
    Converter<Double, String> stringDoubleConverter = d -> d == null ? null : d.toString();
    BidirectionalConverter<Double, String> doubleStringBidirectionalConverter = new DefaultBidirectionalConverter<>(stringDoubleConverter, doubleStringConverter);
    doubleDolphinProperty.set(0.1);
    assertNotEquals(stringJavaFXProperty.get(), "0.1");
    Binding binding = FXBinder.bind(stringJavaFXProperty).bidirectionalTo(doubleDolphinProperty, doubleStringBidirectionalConverter);
    assertEquals(stringJavaFXProperty.get(), "0.1");
    doubleDolphinProperty.set(0.2);
    assertEquals(stringJavaFXProperty.get(), "0.2");
    doubleDolphinProperty.set(null);
    assertEquals(stringJavaFXProperty.get(), null);
    stringJavaFXProperty.set("0.1");
    assertEquals(doubleDolphinProperty.get(), 0.1);
    stringJavaFXProperty.setValue("0.2");
    assertEquals(doubleDolphinProperty.get(), 0.2);
    binding.unbind();
    doubleDolphinProperty.set(0.3);
    assertEquals(stringJavaFXProperty.get(), "0.2");
}
Also used : Binding(com.canoo.platform.core.functional.Binding) Arrays(java.util.Arrays) WritableBooleanValue(javafx.beans.value.WritableBooleanValue) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) FXCollections(javafx.collections.FXCollections) Assert.assertEquals(org.testng.Assert.assertEquals) DoubleProperty(javafx.beans.property.DoubleProperty) Test(org.testng.annotations.Test) FXBinder(com.canoo.platform.remoting.client.javafx.FXBinder) DefaultBidirectionalConverter(com.canoo.dp.impl.client.javafx.DefaultBidirectionalConverter) Property(com.canoo.platform.remoting.Property) IntegerProperty(javafx.beans.property.IntegerProperty) ArrayList(java.util.ArrayList) WritableStringValue(javafx.beans.value.WritableStringValue) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) ObservableArrayList(com.canoo.dp.impl.remoting.collections.ObservableArrayList) Assert.assertNotEquals(org.testng.Assert.assertNotEquals) ObservableList(com.canoo.platform.remoting.ObservableList) Converter(com.canoo.platform.remoting.client.javafx.Converter) BidirectionalConverter(com.canoo.platform.remoting.client.javafx.BidirectionalConverter) BooleanProperty(javafx.beans.property.BooleanProperty) List(java.util.List) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) WritableIntegerValue(javafx.beans.value.WritableIntegerValue) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Assert.assertTrue(org.testng.Assert.assertTrue) StringProperty(javafx.beans.property.StringProperty) WritableDoubleValue(javafx.beans.value.WritableDoubleValue) Binding(com.canoo.platform.core.functional.Binding) MockedProperty(com.canoo.dp.impl.remoting.MockedProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) DefaultBidirectionalConverter(com.canoo.dp.impl.client.javafx.DefaultBidirectionalConverter) Test(org.testng.annotations.Test)

Example 40 with StringProperty

use of javafx.beans.property.StringProperty in project dolphin-platform by canoo.

the class FXWrapper method wrapStringProperty.

/**
 * Create a JavaFX {@link javafx.beans.property.StringProperty} as a wrapper for a dolphin platform property
 *
 * @param dolphinProperty the dolphin platform property
 * @return the JavaFX property
 */
public static StringProperty wrapStringProperty(final Property<String> dolphinProperty) {
    Assert.requireNonNull(dolphinProperty, "dolphinProperty");
    StringProperty property = new SimpleStringProperty();
    FXBinder.bind(property).bidirectionalTo(dolphinProperty);
    return property;
}
Also used : SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty)

Aggregations

StringProperty (javafx.beans.property.StringProperty)40 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)37 DoubleProperty (javafx.beans.property.DoubleProperty)26 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)25 ObjectProperty (javafx.beans.property.ObjectProperty)24 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)24 Dimension2D (javafx.geometry.Dimension2D)23 BooleanProperty (javafx.beans.property.BooleanProperty)20 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)20 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)14 Color (javafx.scene.paint.Color)14 IntegerProperty (javafx.beans.property.IntegerProperty)11 List (java.util.List)8 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 Section (eu.hansolo.enzo.common.Section)4 IOException (java.io.IOException)4 Test (org.testng.annotations.Test)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3