Java Code Examples for javafx.beans.property.ObjectProperty

The following examples show how to use javafx.beans.property.ObjectProperty. These examples are extracted from open source projects. 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 Project: tilesfx   Author: HanSolo   File: AlarmBuilder.java    License: Apache License 2.0 6 votes vote down vote up
public final Alarm build() {
    final Alarm SECTION = new Alarm();
    for (String key : properties.keySet()) {
        if ("repetition".equals(key)) {
            SECTION.setRepetition(((ObjectProperty<Repetition>) properties.get(key)).get());
        } else if("time".equals(key)) {
            SECTION.setTime(((ObjectProperty<ZonedDateTime>) properties.get(key)).get());
        } else if("armed".equals(key)) {
            SECTION.setArmed(((BooleanProperty) properties.get(key)).get());
        } else if("text".equals(key)) {
            SECTION.setText(((StringProperty) properties.get(key)).get());
        } else if ("command".equals(key)) {
            SECTION.setCommand(((ObjectProperty<Command>) properties.get(key)).get());
        } else if ("color".equals(key)) {
            SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
        }
    }
    return SECTION;
}
 
Example #2
Source Project: tilesfx   Author: HanSolo   File: SunburstChart.java    License: Apache License 2.0 6 votes vote down vote up
public ObjectProperty<Color> darkTextColorProperty() {
    if (null == darkTextColor) {
        darkTextColor = new ObjectPropertyBase<Color>(_darkTextColor) {
            @Override protected void invalidated() {
                if (isAutoTextColor()) {
                    adjustTextColors();
                    redraw();
                }
            }
            @Override public Object getBean() { return SunburstChart.this; }
            @Override public String getName() { return "darkTextColor"; }
        };
        _darkTextColor = null;
    }
    return darkTextColor;
}
 
Example #3
Source Project: desktoppanefx   Author: kordamp   File: InternalWindow.java    License: Apache License 2.0 6 votes vote down vote up
public final ObjectProperty<EventHandler<InternalWindowEvent>>
onCloseRequestProperty() {
    if (onCloseRequest == null) {
        onCloseRequest = new ObjectPropertyBase<EventHandler<InternalWindowEvent>>() {
            @Override
            protected void invalidated() {
                setEventHandler(InternalWindowEvent.WINDOW_CLOSE_REQUEST, get());
            }

            @Override
            public Object getBean() {
                return InternalWindow.this;
            }

            @Override
            public String getName() {
                return "onCloseRequest";
            }
        };
    }
    return onCloseRequest;
}
 
Example #4
Source Project: charts   Author: HanSolo   File: SankeyPlot.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Color> itemColorProperty() {
    if (null == itemColor) {
        itemColor = new ObjectPropertyBase<Color>(_itemColor) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return SankeyPlot.this; }
            @Override public String getName() { return "itemColor"; }
        };
    }
    return itemColor;
}
 
Example #5
Source Project: charts   Author: HanSolo   File: MatrixChartItem.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Color> strokeProperty() {
    if (null == stroke) {
        stroke = new ObjectPropertyBase<Color>(_stroke) {
            @Override protected void invalidated() { fireItemEvent(ITEM_EVENT); }
            @Override public Object getBean() { return MatrixChartItem.this; }
            @Override public String getName() { return "stroke"; }
        };
        _stroke = null;
    }
    return stroke;
}
 
Example #6
Source Project: Enzo   Author: HanSolo   File: SimpleLineChart.java    License: Apache License 2.0 5 votes vote down vote up
public final ObjectProperty<Paint> sectionFill0Property() {
    if (null == sectionFill0) {
        sectionFill0 = new StyleableObjectProperty<Paint>(DEFAULT_SECTION_FILL_0) {
            @Override public CssMetaData getCssMetaData() { return StyleableProperties.SECTION_FILL_0; }
            @Override public Object getBean() { return this; }
            @Override public String getName() { return "sectionFill0"; }
        };
    }
    return sectionFill0;
}
 
Example #7
Source Project: charts   Author: HanSolo   File: Axis.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Color> axisBackgroundColorProperty() {
    if (null == axisBackgroundColor) {
        axisBackgroundColor = new ObjectPropertyBase<Color>(_axisBackgroundColor) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return Axis.this; }
            @Override public String getName() { return "axisBackgroundColor"; }
        };
        _axisBackgroundColor = null;
    }
    return axisBackgroundColor;
}
 
Example #8
Source Project: gluon-samples   Author: gluonhq   File: SettingsPresenter.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void initialize() {
    settings.setShowTransitionFactory(BounceInUpTransition::new);
    settings.showingProperty().addListener((obs, oldValue, newValue) -> {
        if (newValue) {
            AppBar appBar = getApp().getAppBar();
            appBar.setNavIcon(MaterialDesignIcon.MENU.button(e -> 
                    getApp().getDrawer().open()));
            appBar.setTitleText("Settings");
            appBar.getActionItems().add(MaterialDesignIcon.CLOSE.button(e -> getApp().goHome()));
        }
    });
    
    config = new Settings();
    updateSettings(service.settingsProperty().get());
    service.settingsProperty().addListener((obs, ov, nv) -> updateSettings(nv));
    
    config.showDateProperty().addListener((obs, ov, nv) -> updateService());
    config.sortingProperty().addListener((obs, ov, nv) -> updateService());
    config.ascendingProperty().addListener((obs, ov, nv) -> updateService());
    config.fontSizeProperty().addListener((obs, ov, nv) -> updateService());
    
    final Option<BooleanProperty> dateOption = new DefaultOption<>(MaterialDesignIcon.DATE_RANGE.graphic(),
            "Show Date", "Show the note's date", null, config.showDateProperty(), true);
    
    final DefaultOption<ObjectProperty<SORTING>> sortOption = new DefaultOption<>(MaterialDesignIcon.SORT_BY_ALPHA.graphic(),
            "Sort Notes", "Sort the notes by", null, config.sortingProperty(), true);
    
    final DefaultOption<BooleanProperty> ascendingOption = new DefaultOption<>(MaterialDesignIcon.SORT.graphic(),
            "Asc./Des.", "Sort in ascending or descending order", null, config.ascendingProperty(), true);
    
    final Option<Number> fontOption = new SliderOption(MaterialDesignIcon.NETWORK_CELL.graphic(), 
            "Size of Text", "Set the text size", null, config.fontSizeProperty(), true, 8, 12);
    
    settingsPane.getOptions().addAll(dateOption, sortOption, ascendingOption, fontOption);
    settingsPane.setSearchBoxVisible(false);
}
 
Example #9
Source Project: tilesfx   Author: HanSolo   File: RadarChart.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Color> thresholdColorProperty() {
    if (null == thresholdColor) {
        thresholdColor  = new ObjectPropertyBase<Color>(_thresholdColor) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return RadarChart.this; }
            @Override public String getName() { return "thresholdColor"; }
        };
        _thresholdColor = null;
    }
    return thresholdColor;
}
 
Example #10
Source Project: Enzo   Author: HanSolo   File: SimpleLineChart.java    License: Apache License 2.0 5 votes vote down vote up
public final ObjectProperty<Paint> sectionFill4Property() {
    if (null == sectionFill4) {
        sectionFill4 = new StyleableObjectProperty<Paint>(DEFAULT_SECTION_FILL_4) {
            @Override public CssMetaData getCssMetaData() { return StyleableProperties.SECTION_FILL_4; }
            @Override public Object getBean() { return this; }
            @Override public String getName() { return "sectionFill4"; }
        };
    }
    return sectionFill4;
}
 
Example #11
Source Project: charts   Author: HanSolo   File: ParetoPanel.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Font> fontProperty(){
    if(null == labelingFont){
        labelingFont = new SimpleObjectProperty<>(_labelingFont);
        labelingFont.addListener(observable -> drawParetoChart());
    }
    return labelingFont;
}
 
Example #12
Source Project: tilesfx   Author: HanSolo   File: SectionBuilder.java    License: Apache License 2.0 5 votes vote down vote up
public final Section build() {
    final Section SECTION = new Section();
    for (String key : properties.keySet()) {
        if ("start".equals(key)) {
            SECTION.setStart(((DoubleProperty) properties.get(key)).get());
        } else if("stop".equals(key)) {
            SECTION.setStop(((DoubleProperty) properties.get(key)).get());
        } else if("text".equals(key)) {
            SECTION.setText(((StringProperty) properties.get(key)).get());
        } else if("icon".equals(key)) {
            SECTION.setIcon(((ObjectProperty<Image>) properties.get(key)).get());
        } else if ("color".equals(key)) {
            SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("highlightColor".equals(key)) {
            SECTION.setHighlightColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("textColor".equals(key)) {
            SECTION.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if("active".equals(key)) {
            SECTION.setActive(((BooleanProperty) properties.get(key)).get());
        } else if ("onSectionEntered".equals(key)) {
            SECTION.setOnSectionEntered(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("onSectionLeft".equals(key)) {
            SECTION.setOnSectionLeft(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            SECTION.setStyleClass(((StringProperty) properties.get(key)).get());
        }
    }
    return SECTION;
}
 
Example #13
Source Project: charts   Author: HanSolo   File: SunburstChart.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<VisibleData> visibleDataProperty() {
    if (null == visibleData) {
        visibleData = new ObjectPropertyBase<VisibleData>(_visibleData) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return SunburstChart.this; }
            @Override public String getName() { return "visibleData"; }
        };
        _visibleData = null;
    }
    return visibleData;
}
 
Example #14
Source Project: jsilhouette   Author: kordamp   File: AbstractSilhouette.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public ObjectProperty<StrokeLineJoin> strokeLineJoinProperty() {
    if (strokeLineJoin == null) {
        strokeLineJoin = new SimpleObjectProperty<>(this, "strokeLineJoin", DEFAULT_STROKE_LINE_JOIN);
        strokeLineJoin.addListener((v, o, n) -> forwardShapeProperty(s -> setStrokeLineJoin(n)));
    }
    return strokeLineJoin;
}
 
Example #15
Source Project: pikatimer   Author: PikaTimer   File: TimingLocation.java    License: GNU General Public License v3.0 5 votes vote down vote up
public TimingLocationInput getInputByID(Integer id){
    ObjectProperty<TimingLocationInput> tmp = new SimpleObjectProperty();
    timingInputs.forEach(i -> {
            if (i.getID().equals(id)) tmp.set(i);
    });
    return tmp.getValue();
}
 
Example #16
Source Project: RichTextFX   Author: FXMisc   File: ParagraphText.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Java Quirk! Using {@code t.get[border/underline]DashArray()} throws a ClassCastException
 * "Double cannot be cast to Number". However, using {@code t.getDashArrayProperty().get()}
 * works without issue
 */
LineAttributesBase(Paint color, Number width, ObjectProperty<Number[]> dashArrayProp) {
    this.color = color;
    if (color == null || width == null || width.doubleValue() <= 0) {
        // null value
        this.width = -1;
        dashArray = null;
    } else {
        // real value
        this.width = width.doubleValue();

        // get the dash array - JavaFX CSS parser seems to return either a Number[] array
        // or a single value, depending on whether only one or more than one value has been
        // specified in the CSS
        Object dashArrayProperty = dashArrayProp.get();
        if (dashArrayProperty != null) {
            if (dashArrayProperty.getClass().isArray()) {
                Number[] numberArray = (Number[]) dashArrayProperty;
                dashArray = new Double[numberArray.length];
                int idx = 0;
                for (Number d : numberArray) {
                    dashArray[idx++] = (Double) d;
                }
            } else {
                dashArray = new Double[1];
                dashArray[0] = ((Double) dashArrayProperty).doubleValue();
            }
        } else {
            dashArray = null;
        }
    }
}
 
Example #17
Source Project: charts   Author: HanSolo   File: Grid.java    License: Apache License 2.0 5 votes vote down vote up
public ObjectProperty<Paint> mediumVGridLinePaintProperty() {
    if (null == mediumVGridLinePaint) {
        mediumVGridLinePaint = new ObjectPropertyBase<Paint>(_mediumVGridLinePaint) {
            @Override protected void invalidated() { drawGrid(); }
            @Override public Object getBean() { return Grid.this; }
            @Override public String getName() { return "mediumVGridLinePaint"; }
        };
        _mediumVGridLinePaint = null;
    }
    return mediumVGridLinePaint;
}
 
Example #18
Source Project: OEE-Designer   Author: point85   File: RadarChart.java    License: MIT License 5 votes vote down vote up
public ObjectProperty<Color> chartBackgroundColorProperty() {
    if (null == chartBackgroundColor) {
        chartBackgroundColor = new ObjectPropertyBase<Color>(_chartBackgroundColor) {
            @Override protected void invalidated() { redraw(); }
            @Override public Object getBean() { return RadarChart.this; }
            @Override public String getName() { return "chartBackgroundColor"; }
        };
        _chartBackgroundColor = null;
    }
    return chartBackgroundColor;
}
 
Example #19
Source Project: phoenicis   Author: PhoenicisOrg   File: DetailsPanel.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Constructor
 *
 * @param title The title of the details panel
 * @param content The content of the details panel
 * @param onClose Callback for close button clicks
 */
public DetailsPanel(StringProperty title, ObjectProperty<Node> content, ObjectProperty<Runnable> onClose) {
    super();

    this.title = title;
    this.content = content;
    this.onClose = onClose;
}
 
Example #20
Source Project: PreferencesFX   Author: dlsc-software-consulting-gmbh   File: Setting.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a custom color picker control.
 *
 * @param description   the title of this setting
 * @param colorProperty the current selected color value
 * @return the constructed setting
 */
public static Setting of(String description, ObjectProperty<Color> colorProperty) {
  StringProperty stringProperty = new SimpleStringProperty();
  stringProperty.bindBidirectional(
      colorProperty, new StringConverter<Color>() {
        @Override
        public String toString(Color color) {
          return color.toString();
        }

        @Override
        public Color fromString(String value) {
          return Color.valueOf(value);
        }
      }
  );

  return new Setting<>(
      description,
      Field.ofStringType(stringProperty)
          .label(description)
          .render(new SimpleColorPickerControl(
              Objects.isNull(colorProperty.get()) ? Color.BLACK : colorProperty.get())
          ),
      stringProperty
  );
}
 
Example #21
Source Project: Medusa   Author: HanSolo   File: SectionBuilder.java    License: Apache License 2.0 5 votes vote down vote up
public final Section build() {
    final Section SECTION = new Section();
    for (String key : properties.keySet()) {
        if ("start".equals(key)) {
            SECTION.setStart(((DoubleProperty) properties.get(key)).get());
        } else if("stop".equals(key)) {
            SECTION.setStop(((DoubleProperty) properties.get(key)).get());
        } else if("text".equals(key)) {
            SECTION.setText(((StringProperty) properties.get(key)).get());
        } else if("icon".equals(key)) {
            SECTION.setIcon(((ObjectProperty<Image>) properties.get(key)).get());
        } else if ("color".equals(key)) {
            SECTION.setColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("highlightColor".equals(key)) {
            SECTION.setHighlightColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("textColor".equals(key)) {
            SECTION.setTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("onSectionEntered".equals(key)) {
            SECTION.setOnSectionEntered(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("onSectionLeft".equals(key)) {
            SECTION.setOnSectionLeft(((ObjectProperty<EventHandler>) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            SECTION.setStyleClass(((StringProperty) properties.get(key)).get());
        }
    }
    return SECTION;
}
 
Example #22
Source Project: phoenicis   Author: PhoenicisOrg   File: LibraryFeaturePanel.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public ObjectProperty<OpenDetailsPanel> openedDetailsPanelProperty() {
    return this.openedDetailsPanel;
}
 
Example #23
Source Project: OpenLabeler   Author: kinhong   File: BorderedTitledPane.java    License: Apache License 2.0 4 votes vote down vote up
public ObjectProperty<Pos> titleAlignmentProperty() {
   return titleAlignment;
}
 
Example #24
Source Project: Enzo   Author: HanSolo   File: RadialBargraph.java    License: Apache License 2.0 4 votes vote down vote up
public final ObjectProperty<NumberFormat> numberFormatProperty() {
    if (null == numberFormat) {
        numberFormat = new SimpleObjectProperty<>(this, "numberFormat", _numberFormat);
    }
    return numberFormat;
}
 
Example #25
Source Project: latexdraw   Author: latexdraw   File: CircleArcImpl.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull ObjectProperty<ArcStyle> arcStyleProperty() {
	return style;
}
 
Example #26
Source Project: latexdraw   Author: latexdraw   File: ShapeBase.java    License: GNU General Public License v3.0 4 votes vote down vote up
@Override
public @NotNull ObjectProperty<Color> gradColStartProperty() {
	return gradColStart;
}
 
Example #27
Source Project: mzmine3   Author: mzmine   File: Fx3DAbstractDataset.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ObjectProperty<Color> colorProperty() {
  return color;
}
 
Example #28
Source Project: phoenicis   Author: PhoenicisOrg   File: LibraryFeaturePanel.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
public ObjectProperty<ConsoleController> consoleControllerProperty() {
    return this.consoleController;
}
 
Example #29
Source Project: green_android   Author: Blockstream   File: ClickableBitcoinAddress.java    License: GNU General Public License v3.0 4 votes vote down vote up
public ObjectProperty<Address> addressProperty() {
    return address;
}
 
Example #30
Source Project: paintera   Author: saalfeldlab   File: ImagePane.java    License: GNU General Public License v2.0 4 votes vote down vote up
public ObjectProperty<Image> imageProperty()
{
	return this.imageView.imageProperty();
}