Java 类javafx.beans.property.ReadOnlyProperty 实例源码

项目:openjfx-8u-dev-tests    文件:PropertyValueListener.java   
public <ValueType> PropertyValueListener(String labelDescription, ReadOnlyProperty listenedProperty, String textFieldId, Object owningObject, Boolean showCounters) {
    this.owningObject = owningObject;
    receivedValueTF.setId(textFieldId);
    receivedValueTF.setTooltip(new Tooltip());
    if (listenedProperty.getName().contains("BOUNDS")) {
        //Make text field width, because bounds - big.
        receivedValueTF.setMinWidth(500);
    }
    this.listenedProperty = listenedProperty;
    counter = new PropertyValueCounter(listenedProperty);
    getChildren().add(LabelBuilder.create().text(labelDescription).prefWidth(100).build());
    if (showCounters) {
        getChildren().add(counter.getVisualRepresentation());
    }
    getChildren().add(receivedValueTF);

    listenedProperty.addListener(new ChangeListener() {
        public void changed(ObservableValue ov, Object t, Object t1) {
            processNewValue(t1);
        }
    });
    processNewValue(listenedProperty.getValue());
}
项目:reduxfx    文件:DialogModalityAccessor.java   
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    final Object bean = property.getBean();
    if (bean instanceof Stage) {
        final Stage stage = (Stage) bean;
        if (stage.isShowing()) {
            stage.hide();
            stage.initModality((Modality) value);
            stage.show();
        } else {
            stage.initModality((Modality) value);
        }
    } else {
        LOG.warn("Unsupported Dialog-type encountered: {}", bean.getClass());
    }
}
项目:FX-Map-Control    文件:MapItemsControl.java   
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
    if (!selectionChanging) {
        selectionChanging = true;

        ReadOnlyProperty<? extends Boolean> property = (ReadOnlyProperty<? extends Boolean>) observable;
        MapItem mapItem = (MapItem) property.getBean();
        T item = (T) mapItem.getItem();

        if (item == null) {
            item = (T) mapItem;
        }

        if (newValue) {
            addSelectedItem(item);
        } else {
            removeSelectedItem(item);
        }

        selectionChanging = false;
    }
}
项目:lttng-scope    文件:ModelConfigDialog.java   
public LineThicknessMenuButton(TimeGraphWidget widget,
        ConfigOption<LineThickness> option,
        ReadOnlyProperty<? extends Paint> colorSource) {
    fOption = option;
    fColorSource = colorSource;

    ToggleGroup tg = new ToggleGroup();
    List<LineThicknessMenuButtonItem> items = Arrays.stream(LineThickness.values())
            .map(lt -> {
                LineThicknessMenuButtonItem rmi = new LineThicknessMenuButtonItem(lt);
                rmi.setGraphic(getRectangleForThickness(lt));
                rmi.setToggleGroup(tg);

                LineThickness currentThickness = option.get();
                rmi.setSelected(lt == currentThickness);

                rmi.setOnAction(e -> {
                    option.set(lt);
                    LineThicknessMenuButton.this.setGraphic(getRectangleForThickness(lt));
                    repaintAllRectangles(widget);
                });
                return rmi;
            })
            .collect(Collectors.toList());

    /* Initial value shown in the button */
    setGraphic(getRectangleForThickness(option.get()));
    getItems().addAll(items);
}
项目:reduxfx    文件:WindowShowingAccessor.java   
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    final Stage stage = (Stage) property.getBean();
    if (Boolean.TRUE.equals(value)) {
        stage.show();
    } else {
        stage.hide();
    }
}
项目:reduxfx    文件:PropertyAccessor.java   
@SuppressWarnings("unchecked")
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty readOnlyProperty, Object value) {
    final Property property = (Property) readOnlyProperty;
    if (property.getValue() == null? value != null : ! property.getValue().equals(value)) {
        property.setValue(value);
    }
}
项目:reduxfx    文件:ListenerHandlingAccessor.java   
@SuppressWarnings("unchecked")
protected void clearListeners(Object node, ReadOnlyProperty property) {
    final ChangeListener changeListener = (ChangeListener) getProperties(node).get(property.getName() + ".change");
    if (changeListener != null) {
        property.removeListener(changeListener);
    }

    final InvalidationListener invalidationListener = (InvalidationListener) getProperties(node).get(property.getName() + ".invalidation");
    if (invalidationListener != null) {
        property.removeListener(invalidationListener);
    }
}
项目:reduxfx    文件:ListenerHandlingAccessor.java   
@SuppressWarnings("unchecked")
protected void setChangeListener(Consumer<Object> dispatcher, Object node, ReadOnlyProperty property, VChangeListener listener) {
    final ChangeListener newListener = (source, oldValue, newValue) -> {
        final Object action = listener.onChange(fxToV(oldValue), fxToV(newValue));
        if (action != null) {
            dispatcher.accept(action);
        }
    };
    property.addListener(newListener);
    getProperties(node).put(property.getName() + ".change", newListener);
}
项目:reduxfx    文件:ListenerHandlingAccessor.java   
protected void setInvalidationListener(Consumer<Object> dispatcher, Object node, ReadOnlyProperty property, VInvalidationListener listener) {
    final InvalidationListener newListener = source -> {
        final Object action = listener.onInvalidation();
        if (action != null) {
            dispatcher.accept(action);
        }
    };
    property.addListener(newListener);
    getProperties(node).put(property.getName() + ".invalidation", newListener);
}
项目:reduxfx    文件:ToggleGroupAccessor.java   
@SuppressWarnings("unchecked")
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    if (value instanceof ToggleGroup) {
        ((Property) property).setValue(value);
        return;
    }
    throw new IllegalStateException(String.format("Unable to set the value %s of property %s in class %s",
            value, property.getName(), property.getBean().getClass()));
}
项目:JXTN    文件:PropertyReference.java   
/**
 * 取得屬性本身
 *
 * @param bean 要取得屬性本身的物件
 * @return 屬性本身
 * @throws IllegalStateException 屬性不提供{@link ReadOnlyProperty}
 */
@SuppressWarnings("unchecked")
public ReadOnlyProperty<T> getProperty(Object bean)
{
    if (!this.hasProperty())
        throw new IllegalStateException("Cannot get property " + this.name);
    return (ReadOnlyProperty<T>) this.reflectedInfo.getProperty.apply(bean);
}
项目:shuffleboard    文件:SourceType.java   
public final ReadOnlyProperty<ConnectionStatus> connectionStatusProperty() {
  return connectionStatus;
}
项目:shuffleboard    文件:Playback.java   
public static ReadOnlyProperty<Playback> currentPlaybackProperty() {
  return currentPlayback;
}
项目:openjfx-8u-dev-tests    文件:PropertyValueCounter.java   
public ReadOnlyProperty getObservedProperty() {
    return observedProperty;
}
项目:openjfx-8u-dev-tests    文件:PropertiesTable.java   
@Override
public void addSimpleListener(ReadOnlyProperty<? extends Object> bindableProperty, Object owningObject) {
    AbstractPropertyValueListener listener = new PropertyValueListener(bindableProperty, owningObject);
    readonlyPropertyListeners.put(bindableProperty.getName().toUpperCase(), listener);
    listenersFlowPane.getChildren().add(listener.getVisualRepresentation());
}
项目:openjfx-8u-dev-tests    文件:PropertyValueListener.java   
public <ValueType> PropertyValueListener(ReadOnlyProperty bindableProperty, Object owningObject) {
    this(bindableProperty, owningObject, true);
}
项目:openjfx-8u-dev-tests    文件:PropertyValueListener.java   
public <ValueType> PropertyValueListener(ReadOnlyProperty bindableProperty, Object owningObject, Boolean showCounters) {
    this(bindableProperty.getName().toLowerCase() + " : ", bindableProperty, bindableProperty.getName().toUpperCase() + LISTENER_SUFFIX, owningObject, showCounters);
}
项目:openjfx-8u-dev-tests    文件:PropertyValueListener.java   
public <ValueType> PropertyValueListener(String labelDescription, ReadOnlyProperty listenedProperty, String textFieldId, Object owningObject) {
    this(labelDescription, listenedProperty, textFieldId, owningObject, true);
}
项目:Simulizer    文件:EventManager.java   
public synchronized <T> void addPropertyListener(ReadOnlyProperty<T> property, ChangeListener<? super T> listener) {
    addPropertyListener(property.getName(), listener);
}
项目:Simulizer    文件:EventManager.java   
public synchronized <T> void removePropertyListener(ReadOnlyProperty<T> property, ChangeListener<? super T> listener) {
    removePropertyListener(property.getName(), listener);
}
项目:reduxfx    文件:ReadOnlyPropertyAccessor.java   
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    LOG.warn("Tried to set read-only property {} to {}", property, value);
}
项目:reduxfx    文件:FocusedAccessor.java   
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    if (Boolean.TRUE.equals(value)) {
        ((Node) property.getBean()).requestFocus();
    }
}
项目:reduxfx    文件:ListAccessor.java   
@SuppressWarnings("unchecked")
@Override
protected void setValue(Consumer<Object> dispatcher, ReadOnlyProperty property, Object value) {
    ((ObservableList) property.getValue()).setAll(value == null? Collections.emptyList() : ((Seq) value).toJavaList());
}
项目:FxDock    文件:FxDockEmptyPane.java   
public final ReadOnlyProperty<Node> dockParentProperty()
{
    return parent.getReadOnlyProperty();
}
项目:FxDock    文件:FxDockSplitPane.java   
public final ReadOnlyProperty<Node> dockParentProperty()
{
    return parent.getReadOnlyProperty();
}
项目:FxDock    文件:FxDockBorderPane.java   
public final ReadOnlyProperty<Node> dockParentProperty()
{
    return parent.getReadOnlyProperty();
}
项目:FxDock    文件:FxDockTabPane.java   
public final ReadOnlyProperty<Node> dockParentProperty()
{
    return parent.getReadOnlyProperty();
}
项目:aomrolemapper    文件:PropertyView.java   
public ReadOnlyProperty<String> nameProperty() {
    return mName;
}
项目:ISAAC    文件:UserProfileBindings.java   
/**
 * @return the viewCoordinatePath
 */
public ReadOnlyProperty<UUID> getViewCoordinatePath()
{
    return viewCoordinatePath.getReadOnlyProperty();
}
项目:ISAAC    文件:UserProfileBindings.java   
/**
 * @return the editCoordinatePath
 */
public ReadOnlyProperty<UUID> getEditCoordinatePath()
{
    return editCoordinatePath.getReadOnlyProperty();
}
项目:reta    文件:ObservableSetBuffering.java   
/**
 * @param newBeanType
 *            bean type
 * @param newPropertyName
 *            bean property name
 * @param newSubject
 *            property value
 */
public ObservableSetBuffering(final Class<?> newBeanType, final String newPropertyName,
        final ObservableSet<E> newSubject)
{
    super(FXCollections.observableSet(new HashSet<>(newSubject != null ? newSubject.size() : 0)));

    if (newBeanType != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        beanType = newBeanType;
    }
    else
    {
        final Object bean = ((ReadOnlyProperty<?>) newSubject).getBean();
        beanType = (bean != null ? bean.getClass() : null);
    }

    if (newPropertyName != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        propertyName = newPropertyName;
    }
    else
    {
        propertyName = ((ReadOnlyProperty<?>) newSubject).getName();
    }

    subject = Objects.requireNonNull(newSubject);

    addAll(subject);

    thisListener = c -> {
        if (equalsBuffering)
        {
            buffering.setValue(!equalsSubject());
        }
        else
        {
            buffering.setValue(true);
        }
        validate();
    };

    subjectListener = c -> {
        if (!buffering.getValue())
        {
            revert();
        }
    };

    addListener(thisListener);

    weakSubjectListener = new WeakSetChangeListener<E>(subjectListener);
    subject.addListener(weakSubjectListener);

    validate();
}
项目:reta    文件:ObservableListBuffering.java   
/**
 * @param newBeanType
 *            bean type
 * @param newPropertyName
 *            bean property name
 * @param newSubject
 *            property value
 */
public ObservableListBuffering(final Class<?> newBeanType, final String newPropertyName,
        final ObservableList<E> newSubject)
{
    super(FXCollections.observableArrayList());

    if (newBeanType != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        beanType = newBeanType;
    }
    else
    {
        final Object bean = ((ReadOnlyProperty<?>) newSubject).getBean();
        beanType = (bean != null ? bean.getClass() : null);
    }

    if (newPropertyName != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        propertyName = newPropertyName;
    }
    else
    {
        propertyName = ((ReadOnlyProperty<?>) newSubject).getName();
    }

    subject = Objects.requireNonNull(newSubject);

    addAll(subject);

    thisListener = c -> {
        if (equalsBuffering)
        {
            buffering.setValue(!equalsSubject());
        }
        else
        {
            buffering.setValue(true);
        }
        validate();
    };

    subjectListener = c -> {
        if (!buffering.getValue())
        {
            revert();
        }
    };

    addListener(thisListener);

    weakSubjectListener = new WeakListChangeListener<E>(subjectListener);
    subject.addListener(weakSubjectListener);

    validate();
}
项目:reta    文件:SimpleObjectPropertyBuffering.java   
/**
 * @param newBeanType
 *            bean type
 * @param newPropertyName
 *            bean property name
 * @param newSubject
 *            property value
 */
public SimpleObjectPropertyBuffering(final Class<?> newBeanType, final String newPropertyName,
        final Property<T> newSubject)
{
    if (newBeanType != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        beanType = newBeanType;
    }
    else
    {
        final Object bean = ((ReadOnlyProperty<?>) newSubject).getBean();
        beanType = (bean != null ? bean.getClass() : null);
    }

    if (newPropertyName != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        propertyName = newPropertyName;
    }
    else
    {
        propertyName = ((ReadOnlyProperty<?>) newSubject).getName();
    }

    subject = java.util.Objects.requireNonNull(newSubject);

    setValue(subject.getValue());

    thisListener = (observable, oldValue, value) -> {
        if (equalsBuffering)
        {
            buffering.setValue(!Objects.equals(getValue(), subject.getValue()));
        }
        else
        {
            buffering.setValue(true);
        }
        validate();
    };

    subjectListener = (observable, oldValue, value) -> {
        if (!buffering.getValue())
        {
            revert();
        }
    };

    addListener(thisListener);

    weakSubjectListener = new WeakChangeListener<T>(subjectListener);
    subject.addListener(weakSubjectListener);

    validate();
}
项目:reta    文件:ObservableMapBuffering.java   
/**
 * @param newBeanType
 *            bean type
 * @param newPropertyName
 *            bean property name
 * @param newSubject
 *            property value
 */
public ObservableMapBuffering(final Class<?> newBeanType, final String newPropertyName,
        final ObservableMap<K, E> newSubject)
{
    super(FXCollections.observableHashMap());

    if (newBeanType != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        beanType = newBeanType;
    }
    else
    {
        final Object bean = ((ReadOnlyProperty<?>) newSubject).getBean();
        beanType = (bean != null ? bean.getClass() : null);
    }

    if (newPropertyName != null || !(newSubject instanceof ReadOnlyProperty<?>))
    {
        propertyName = newPropertyName;
    }
    else
    {
        propertyName = ((ReadOnlyProperty<?>) newSubject).getName();
    }

    subject = Objects.requireNonNull(newSubject);

    putAll(subject);

    thisListener = c -> {
        // TODO: Workaround for https://bugs.openjdk.java.net/browse/JDK-8136465
        if (!reverting)
        {
            if (equalsBuffering)
            {
                buffering.setValue(!equalsSubject());
            }
            else
            {
                buffering.setValue(true);
            }
            validate();
        }
    };

    subjectListener = c -> {
        // TODO: Workaround for https://bugs.openjdk.java.net/browse/JDK-8136465
        if (!committing)
        {
            if (!buffering.getValue())
            {
                revert();
            }
        }
    };

    addListener(thisListener);

    weakSubjectListener = new WeakMapChangeListener<K, E>(subjectListener);
    subject.addListener(weakSubjectListener);

    validate();
}
项目:reta    文件:MapTableView.java   
/**
 * @return key property
 */
public ReadOnlyProperty<K> keyProperty()
{
    return key;
}
项目:fx-player    文件:MediaInfo.java   
public ReadOnlyProperty<String> titleProperty() {
    return titleProperty;
}
项目:fx-player    文件:MediaInfo.java   
public ReadOnlyProperty<String> titleDescProperty() {
    return titleDescProperty;
}
项目:fx-player    文件:MediaInfo.java   
public ReadOnlyProperty<String> artistProperty() {
    return artistProperty;
}
项目:fx-player    文件:MediaInfo.java   
public ReadOnlyProperty<String> albumProperty() {
    return albumProperty;
}
项目:fx-player    文件:MediaInfo.java   
public ReadOnlyProperty<String> infoProperty() {
    return infoProperty;
}