当前位置: 首页>>代码示例>>Java>>正文


Java ReadOnlyProperty类代码示例

本文整理汇总了Java中javafx.beans.property.ReadOnlyProperty的典型用法代码示例。如果您正苦于以下问题:Java ReadOnlyProperty类的具体用法?Java ReadOnlyProperty怎么用?Java ReadOnlyProperty使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReadOnlyProperty类属于javafx.beans.property包,在下文中一共展示了ReadOnlyProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PropertyValueListener

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
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());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:PropertyValueListener.java

示例2: setValue

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:17,代码来源:DialogModalityAccessor.java

示例3: changed

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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;
    }
}
 
开发者ID:ClemensFischer,项目名称:FX-Map-Control,代码行数:23,代码来源:MapItemsControl.java

示例4: LineThicknessMenuButton

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
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);
}
 
开发者ID:lttng,项目名称:lttng-scope,代码行数:30,代码来源:ModelConfigDialog.java

示例5: setValue

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:10,代码来源:WindowShowingAccessor.java

示例6: setValue

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:9,代码来源:PropertyAccessor.java

示例7: clearListeners

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:13,代码来源:ListenerHandlingAccessor.java

示例8: setChangeListener

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:12,代码来源:ListenerHandlingAccessor.java

示例9: setInvalidationListener

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
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);
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:11,代码来源:ListenerHandlingAccessor.java

示例10: setValue

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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()));
}
 
开发者ID:netopyr,项目名称:reduxfx,代码行数:11,代码来源:ToggleGroupAccessor.java

示例11: getProperty

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
/**
 * 取得屬性本身
 *
 * @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);
}
 
开发者ID:SkyLandTW,项目名称:JXTN,代码行数:15,代码来源:PropertyReference.java

示例12: connectionStatusProperty

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public final ReadOnlyProperty<ConnectionStatus> connectionStatusProperty() {
  return connectionStatus;
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:4,代码来源:SourceType.java

示例13: currentPlaybackProperty

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public static ReadOnlyProperty<Playback> currentPlaybackProperty() {
  return currentPlayback;
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:4,代码来源:Playback.java

示例14: getObservedProperty

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public ReadOnlyProperty getObservedProperty() {
    return observedProperty;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:4,代码来源:PropertyValueCounter.java

示例15: addSimpleListener

import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
@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());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:7,代码来源:PropertiesTable.java


注:本文中的javafx.beans.property.ReadOnlyProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。