本文整理汇总了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());
}
示例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());
}
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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()));
}
示例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);
}
示例12: connectionStatusProperty
import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public final ReadOnlyProperty<ConnectionStatus> connectionStatusProperty() {
return connectionStatus;
}
示例13: currentPlaybackProperty
import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public static ReadOnlyProperty<Playback> currentPlaybackProperty() {
return currentPlayback;
}
示例14: getObservedProperty
import javafx.beans.property.ReadOnlyProperty; //导入依赖的package包/类
public ReadOnlyProperty getObservedProperty() {
return observedProperty;
}
示例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());
}