Java Code Examples for javafx.beans.property.Property#getValue()
The following examples show how to use
javafx.beans.property.Property#getValue() .
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: AreaShareChart.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
public AreaShareChart(@Nonnull ModularFeatureListRow row, AtomicDouble progress) { Float sum = row.streamFeatures().map(ModularFeature::getArea).filter(p -> p.getValue() != null) .map(Property<Float>::getValue).reduce(0f, Float::sum); List<Rectangle> all = new ArrayList<>(); int i = 0; int size = row.getFeatures().size(); for (Entry<RawDataFile, ModularFeature> entry : row.getFeatures().entrySet()) { Property<Float> areaProperty = entry.getValue().get(AreaType.class); if (areaProperty.getValue() != null) { // color from sample Color color = entry.getValue().get(RawColorType.class).getValue(); if (color == null) color = Color.DARKORANGE; float ratio = areaProperty.getValue() / sum; Rectangle rect = new Rectangle(); rect.setFill(color); // bind width rect.widthProperty().bind(this.widthProperty().multiply(ratio)); rect.setHeight(i % 2 == 0 ? 20 : 25); all.add(rect); i++; if (progress != null) progress.addAndGet(1.0 / size); } } HBox box = new HBox(0, all.toArray(Rectangle[]::new)); box.setPrefWidth(100); box.setAlignment(Pos.CENTER_LEFT); this.getChildren().add(box); }
Example 2
Source File: DoubleType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override @Nonnull public String getFormattedString(@Nonnull Property<Double> value) { if (value.getValue() == null) return ""; return getFormatter().format(value.getValue().doubleValue()); }
Example 3
Source File: IntegerType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override @Nonnull public String getFormattedString(@Nonnull Property<Integer> value) { if (value.getValue() == null) return ""; return getFormatter().format(value.getValue().intValue()); }
Example 4
Source File: FloatType.java From mzmine3 with GNU General Public License v2.0 | 5 votes |
@Override @Nonnull public String getFormattedString(@Nonnull Property<Float> value) { if (value.getValue() == null) return ""; return getFormatter().format(value.getValue().floatValue()); }
Example 5
Source File: SimpleSerializer.java From scenic-view with GNU General Public License v3.0 | 5 votes |
public SimpleSerializer(final Property property) { this.property = property; if (property instanceof BooleanProperty) { editionType = EditionType.COMBO; } else if (property instanceof ObjectProperty && property.getValue() instanceof Color) { editionType = EditionType.COLOR_PICKER; } else { editionType = EditionType.TEXT_FIELD; } }
Example 6
Source File: VisualizerPresenter.java From HdrHistogramVisualizer with Apache License 2.0 | 5 votes |
void bindChartAxisLabelWithDefault(final Property<String> property, final StringProperty textField) { // Default to the text that has been loaded from resources. Alternatively we could use // resources.getString("<name>"), but that would unnecessarily duplicate the resource strings. final String defaultText = property.getValue(); checkState(defaultText != null && !defaultText.isEmpty(), "Expected non-empty default"); property.bind(Bindings.createStringBinding( () -> !textField.get().isEmpty() ? textField.get() : defaultText, textField )); }
Example 7
Source File: DragSupport.java From scenic-view with GNU General Public License v3.0 | 4 votes |
public DragSupport(Node target, final KeyCode modifier, final MouseButton mouseButton, final Orientation orientation, final Property<Number> property, final double factor) { this.target = target; mouseEventHandler = new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (t.getEventType() != MouseEvent.MOUSE_ENTERED_TARGET && t.getEventType() != MouseEvent.MOUSE_EXITED_TARGET) { lastMouseEvent = t; } if (t.getEventType() == MouseEvent.MOUSE_PRESSED) { if (t.getButton() == mouseButton && isModifierCorrect(t, modifier)) { anchor = property.getValue(); dragAnchor = getCoord(t, orientation); t.consume(); } } else if (t.getEventType() == MouseEvent.MOUSE_DRAGGED) { if (t.getButton() == mouseButton && isModifierCorrect(t, modifier)) { property.setValue(anchor.doubleValue() + (getCoord(t, orientation) - dragAnchor) * factor); t.consume(); } } } }; keyboardEventHandler = (KeyEvent t) -> { if (t.getEventType() == KeyEvent.KEY_PRESSED) { if (t.getCode() == modifier) { anchor = property.getValue(); if (lastMouseEvent != null) { dragAnchor = getCoord(lastMouseEvent, orientation); } t.consume(); } } else if (t.getEventType() == KeyEvent.KEY_RELEASED) { if (t.getCode() != modifier && isModifierCorrect(t, modifier)) { anchor = property.getValue(); if (lastMouseEvent != null) { dragAnchor = getCoord(lastMouseEvent, orientation); } t.consume(); } } }; target.addEventHandler(MouseEvent.ANY, mouseEventHandler); target.addEventHandler(KeyEvent.ANY, keyboardEventHandler); }
Example 8
Source File: PropertyVisitor.java From SynchronizeFX with GNU Lesser General Public License v3.0 | 4 votes |
private void handle(final Property<?> property) throws IllegalAccessException { if (visitSingleValueProperty(property)) { Object value = property.getValue(); visit(value); } }
Example 9
Source File: ModularFeatureListRow.java From mzmine3 with GNU General Public License v2.0 | 2 votes |
/** * Row ID or -1 if not present * * @return */ public int getID() { Property<Integer> idProp = get(IDType.class); return idProp == null || idProp.getValue() == null ? -1 : get(IDType.class).getValue(); }
Example 10
Source File: ConfigurationDialog.java From diirt with MIT License | 2 votes |
/** * Adds the given interpolation scheme property as something the user may * configure. In the dialog, this property will have a label containing the * name of the property and a combobox which the user can use to modify * this property. * * @param name the textual name of the property (e.g. "X Column") * @param p the interpolation scheme property that the user may modify * @param allowedInterpolations the list of allowed interpolation schemes */ public void addInterpolationSchemeListProperty( String name , Property< InterpolationScheme > p , InterpolationScheme[] allowedInterpolations ) { InterpolationSchemeField newField = new InterpolationSchemeField( name , p , allowedInterpolations ); ConfigurationData data = new ConfigurationData( newField , new SimpleObjectProperty< InterpolationScheme >( p.getValue() ) ); addPropertyField( newField.getComponents() , data ); }
Example 11
Source File: ConfigurationDialog.java From diirt with MIT License | 2 votes |
/** * Adds the given number-color mapping property as something the user may * configure. In the dialog, this property will have a label containing the * name of the property and a combobox which the user can use to modify * this property. * * @param name the textual name of the property (e.g. "X Column") * @param p the number-color mapping property that the user may modify * @param allowedMappings the list of allowed number-color mappings */ public void addNumberColorMapListProperty( String name , Property< NumberColorMap > p , NumberColorMap[] allowedMappings ) { NumberColorMapField newField = new NumberColorMapField( name , p , allowedMappings ); ConfigurationData data = new ConfigurationData( newField , new SimpleObjectProperty< NumberColorMap >( p.getValue() ) ); addPropertyField( newField.getComponents() , data ); }