javafx.beans.property.Property.addListener()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中javafx.beans.property.Property.addListener()方法的一些代码示例,展示了Property.addListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.addListener()方法的具体详情如下:
包路径:javafx.beans.property.Property
类名称:Property
方法名:addListener

Property.addListener介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

@Override
public void addListener(InvalidationListener listener) {
  delegate.addListener(listener);
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

@Override
public void addListener(InvalidationListener listener) {
  if (listener instanceof UIThreadAware) {
    getDelegate().addListener(listener);
  } else {
    getDelegate().addListener(new UIThreadAwareInvalidationListener(listener));
  }
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

@Override
public void addListener(ChangeListener<? super T> listener) {
  if (listener instanceof UIThreadAware) {
    getDelegate().addListener(listener);
  } else {
    getDelegate().addListener(new UIThreadAwareChangeListener<>(listener));
  }
}

代码示例来源:origin: com.dlsc.formsfx/formsfx-core

/**
 * {@inheritDoc}
 */
public void setBindingMode(BindingMode newValue) {
  if (BindingMode.CONTINUOUS.equals(newValue)) {
    value.addListener(bindingModeListener);
  } else {
    value.removeListener(bindingModeListener);
  }
}

代码示例来源:origin: org.graniteds/granite-client-javafx

public void afterChange(T newSource, P oldValue) {
  targetProperty = newSource != null ? targetPropertyGetter.getProperty(newSource) : null;
  
  P newValue = targetProperty != null ? targetProperty.getValue() : null;
  
  if (targetProperty != null) {
    targetProperty.addListener(targetChangeListener);
    targetProperty.addListener(targetInvalidationListener);
    
    if (newValue != oldValue) {
      targetInvalidationListener.invalidated(ChainedProperty.this);
      targetChangeListener.changed(ChainedProperty.this, oldValue, newValue);
    }
  }
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

protected void bindFieldBidirectionalToNumberProperty(Property<? extends Number> property, Field field)
{
 NumberBidirectionalBind binding = new NumberBidirectionalBind(property, field);
 setNumberValue(property, field);
 property.addListener(binding);
 field.addListener(binding);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

public <T> void bindBidirectionalModule(Topic<T> topic, Property<T> property)
{
 MessageBidirectionalBinding<T, T> bind = MessageBidirectionalBinding.createSingleTypedBinding(messageContent -> submitMessageToModule(topic,
                                                                    messageContent),
                                                property);
 property.addListener(bind);
 reaMessagerToModule.registerTopicListener(topic, bind);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

protected void bindFieldBidirectionalToConditionalNumberProperty(Condition condition, Property<? extends Number> property, Field field)
{
 ConditionalNumberBidirectionalBind binding = new ConditionalNumberBidirectionalBind(condition, property, field);
 setNumberValue(property, field);
 property.addListener(binding);
 field.addListener(binding);
}

代码示例来源:origin: no.tornado/tornadofx-controls

private void monitorChanges() {
  properties.addListener((ListChangeListener<Property>) change -> {
    while (change.next()) {
      if (change.wasAdded()) change.getAddedSubList().forEach(p -> p.addListener(dirtyListener));
      if (change.wasRemoved()) change.getRemoved().forEach(p -> p.removeListener(dirtyListener));
    }
  });
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

public <M, P> void bindBidirectionalGlobal(Topic<M> topic, Property<P> property, PropertyToMessageTypeConverter<M, P> converterToMessageType)
{
 MessageBidirectionalBinding<M, P> bind = new MessageBidirectionalBinding<>(messageContent -> broadcastMessage(topic, messageContent), property,
                                       converterToMessageType);
 property.addListener(bind);
 internalMessager.registerTopicListener(topic, bind);
 reaMessagerToModule.registerTopicListener(topic, bind);
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  if (statusProp.getValue() != null) {
    statusReady();
  }
  statusProp.addListener((observable, oldValue, newValue) -> statusReady());
  VBox.setVgrow(tweetContent, Priority.ALWAYS);
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

public <T> void bindBidirectionalInternal(Topic<T> topic, Property<T> property, boolean pushValue)
{
 MessageBidirectionalBinding<T, T> bind = MessageBidirectionalBinding.createSingleTypedBinding(messageContent -> submitMessageInternal(topic,
                                                                    messageContent),
                                                property);
 property.addListener(bind);
 internalMessager.registerTopicListener(topic, bind);
 if (pushValue)
   internalMessager.submitMessage(topic, property.getValue());
}

代码示例来源:origin: com.canoo.dolphin-platform/dolphin-platform-client-javafx

@Override
public <T> Binding bidirectionalTo(final Property<T> property, BidirectionalConverter<T, S> converter) {
  final Binding unidirectionalBinding = to(property, converter);
  final ChangeListener<S> listener = (obs, oldVal, newVal) -> property.set(converter.convertBack(newVal));
  javaFxProperty.addListener(listener);
  return () -> {
    javaFxProperty.removeListener(listener);
    unidirectionalBinding.unbind();
  };
}

代码示例来源:origin: com.canoo.dolphin-platform/dolphin-platform-client-javafx

@Override
public <T> Binding bidirectionalTo(final Property<T> property, BidirectionalConverter<T, Number> converter) {
  final Binding unidirectionalBinding = to(property, converter);
  final ChangeListener<Number> listener = (obs, oldVal, newVal) -> property.set(converter.convertBack(newVal));
  javaFxProperty.addListener(listener);
  return () -> {
    javaFxProperty.removeListener(listener);
    unidirectionalBinding.unbind();
  };
}

代码示例来源:origin: dev.rico/rico-remoting-client-javafx

@Override
public <T> Binding bidirectionalTo(final Property<T> property, BidirectionalConverter<T, Number> converter) {
  final Binding unidirectionalBinding = to(property, converter);
  final ChangeListener<Number> listener = (obs, oldVal, newVal) -> property.set(converter.convertBack(newVal));
  javaFxProperty.addListener(listener);
  return () -> {
    javaFxProperty.removeListener(listener);
    unidirectionalBinding.unbind();
  };
}

代码示例来源:origin: dev.rico/rico-remoting-client-javafx

@Override
  public <T> Binding bidirectionalToNumeric(final Property<T> property, final BidirectionalConverter<T, S> converter) {
    final Binding unidirectionalBinding = to(property, converter);

    final ChangeListener<Number> listener = (obs, oldVal, newVal) -> property.set(converter.convertBack(convertNumber(newVal)));
    javaFxProperty.addListener(listener);
    return () -> {
      javaFxProperty.removeListener(listener);
      unidirectionalBinding.unbind();
    };
  }
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  notificationPane.visibleProperty().bind(shouldDisplay);
  notificationPane.managedProperty().bind(shouldDisplay);
  notificationPane.setOnMouseClicked(e -> shouldDisplay.setValue(false));
  notificationContent.textProperty().addListener((observable, oldValue, newValue) -> {
    notificationContent.visibleProperty().setValue(!newValue.isEmpty());
    notificationContent.managedProperty().setValue(!newValue.isEmpty());
  });
  LOG.debug("Starting internal notification system. Listening on new notification requests.");
  internalNotificationSystem.notificationProperty().addListener((o, prev, cur) -> this.handleChange(cur));
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

public <M, P> void bindBidirectionalInternal(Topic<M> topic, Property<P> property, PropertyToMessageTypeConverter<M, P> converterToMessageType,
                      boolean pushValue)
{
 MessageBidirectionalBinding<M, P> bind = new MessageBidirectionalBinding<>(messageContent -> submitMessageInternal(topic, messageContent), property,
                                       converterToMessageType);
 property.addListener(bind);
 internalMessager.registerTopicListener(topic, bind);
 if (pushValue)
   internalMessager.submitMessage(topic, converterToMessageType.convert(property.getValue()));
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  LOG.debug("New tweet stage ready.");
  enableTweetLengthCheck();
  Buttons.setOnClick(sendButton, this::send);
  Buttons.setOnClick(pickMediaButton, this::openMediaAttachmentsFilePicker);
  final BooleanBinding mediasNotEmpty = mediasToUpload.emptyProperty().not();
  mediaPreviewBox.visibleProperty().bind(mediasNotEmpty);
  mediaPreviewBox.managedProperty().bind(mediasNotEmpty);
  inReplyStatus.addListener((o, prev, cur) -> prefillMentionsForReply());
  sendOnControlEnter();
}

代码示例来源:origin: Tristan971/Lyrebird

@Override
public void initialize() {
  setUpInteractionActions();
  targetStatus.addListener((o, prev, cur) -> {
    updateRetweetVisual(cur.isRetweet() ? cur.getRetweetedStatus().isRetweeted() : cur.isRetweeted());
    updateLikeVisual(cur.isFavorited());
  });
}

相关文章