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

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

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

Property.bind介绍

暂无

代码示例

代码示例来源:origin: pmd/pmd

/** Like rewireInit, with no initialisation. */
public static <T> void rewire(Property<T> underlying, ObservableValue<? extends T> source) {
  underlying.unbind();
  underlying.bind(source); // Bindings are garbage collected after the popup dies
}

代码示例来源:origin: com.speedment.tool/tool-config

@Override
public void bind(ObservableValue<? extends Number> observable) {
  wrapped.bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends T> observable) {
  delegate.bind(observable);
}

代码示例来源:origin: org.fxmisc.easybind/easybind

@Override
public void bind(ObservableValue<? extends U> other) {
  Property<U> target = getTargetObservable();
  if(target != null) {
    target.bind(other);
  }
  boundTo = other;
  resetOnUnbind = false;
  resetTo = null;
}

代码示例来源:origin: org.fxmisc.easybind/easybind

@Override
public void bind(ObservableValue<? extends U> other, U resetToOnUnbind) {
  Property<U> target = getTargetObservable();
  if(target != null) {
    target.bind(other);
  }
  boundTo = other;
  resetOnUnbind = true;
  resetTo = resetToOnUnbind;
}

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

@Override
public void bind(ObservableValue<? extends Double> observable) {
  getDelegate().bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends String> observable) {
  getDelegate().bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends Integer> observable) {
  getDelegate().bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends Long> observable) {
  getDelegate().bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends Float> observable) {
  getDelegate().bind(observable);
}

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

@Override
public void bind(ObservableValue<? extends Boolean> observable) {
  getDelegate().bind(observable);
}

代码示例来源:origin: org.fxmisc.easybind/easybind

@Override
public void changed(ObservableValue<? extends Boolean> cond,
    Boolean wasTrue, Boolean isTrue) {
  Property<T> tgt = this.target.get();
  if(tgt == null) {
    condition.removeListener((ChangeListener<Boolean>) this);
  } else if(isTrue) {
    tgt.bind(source);
  } else {
    tgt.unbind();
  }
}

代码示例来源:origin: org.fxmisc.easybind/easybind

/**
 * Sets up automatic binding and unbinding of {@code target} to/from
 * {@code source}, based on the changing value of the encapsulated
 * condition. In other words, whenever the encapsulated condition is
 * {@code true}, {@code target} is bound to {@code source}. Whenever the
 * encapsulated condition is {@code false}, {@code target} is unbound.
 * This keeps happening until {@code unsubscribe()} is called on the
 * returned subscription. Unsubscribing the returned subscription may be
 * skipped safely only when the lifetimes of all the encapsulated condition,
 * {@code source} and {@code target} are the same.
 * @param target target of the conditional binding
 * @param source source of the conditional binding
 * @return a subscription that can be used to dispose the conditional
 * binding set up by this method, i.e. to stop observing the encapsulated
 * condition and, if the last observed value of the encapsulated condition
 * was {@code true}, unbind {@code target} from {@code source}.
 */
public <T> Subscription bind(
    Property<T> target,
    ObservableValue<? extends T> source) {
  return bind(() -> {
    target.bind(source);
    return target::unbind;
  });
}

代码示例来源:origin: org.fxmisc.easybind/easybind

public ConditionalBinding(
    Property<T> target,
    ObservableValue<? extends T> source,
    ObservableValue<Boolean> condition) {
  this.target = new WeakReference<>(target);
  this.source = source;
  this.condition = condition;
  // add an empty listener to target just to maintain a strong reference
  // to this object for the lifetime of target
  target.addListener(this);
  condition.addListener((ChangeListener<Boolean>) this);
  if(condition.getValue()) {
    target.bind(source);
  }
}

代码示例来源:origin: org.fxmisc.easybind/easybind

@Override
protected Subscription observeTargetObservable(Property<U> mapped) {
  if(boundTo != null) {
    mapped.bind(boundTo);
  }
  Subscription s1 = super.observeTargetObservable(mapped);
  Subscription s2 = () -> {
    if(boundTo != null) {
      mapped.unbind();
      if(resetOnUnbind) {
        mapped.setValue(resetTo);
      }
    }
  };
  return s1.and(s2);
}

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

private void setUpInteractionButtons() {
  interactionBox.visibleProperty().bind(embeddedProperty.not());
  interactionBox.managedProperty().bind(embeddedProperty.not());
  easyFxml.loadNode(TWEET_INTERACTION_BOX, Pane.class, TweetInteractionPaneController.class)
      .afterControllerLoaded(tipc -> tipc.targetStatusProperty().bind(currentStatus))
      .getNode()
      .recover(ExceptionHandler::fromThrowable)
      .onSuccess(interactionBox::setCenter);
}

代码示例来源:origin: org.fxmisc.richtext/richtextfx

box.highlightTextFillProperty().bind(highlightTextFill);
box.wrapTextProperty().bind(wrapTextProperty());
box.graphicFactoryProperty().bind(paragraphGraphicFactoryProperty());

相关文章