java类javafx.collections.WeakMapChangeListener的实例源码

AllVariablesController.java 文件源码 项目:StreamSis 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void initialize(URL location, ResourceBundle resources) {
    // Set style.
    GUIManager.manageWindowStyleOfRootNode(root);
    // Set readOnlyCurrentVarsList to UserVars entry set.
    readOnlyCurrentVarsList.setAll(UserVars.getUserVarsMap().entrySet());
    // Subscribe to UserVars changes.
    UserVars.getUserVarsMap()
            .addListener(new WeakMapChangeListener<String, String>(currentVarsListener));
    // Initialize tables.
    initializeInitialVarsTable();
    initializeCurrentVarsTable();
}
AllVariablesController.java 文件源码 项目:StreamSis 阅读 18 收藏 0 点赞 0 评论 0
public void bindToProject(CuteProject project) {
    this.project = project;
    // Set readOnlyInitialVarsList to project's initial UserVars entry set.
    readOnlyInitialVarsList.setAll(project.getInitialUserVars().entrySet());
    // Subscribe to project initial UserVars changes.
    project.getInitialUserVars()
            .addListener(new WeakMapChangeListener<String, String>(initialVarsListener));
    initialVarsTableView.setItems(readOnlyInitialVarsList);
    currentVarsTableView.disableProperty().bind(project.startedProperty().not());
    initialVarsTableView.disableProperty().bind(project.startedProperty());
}
ObservableMapBuffering.java 文件源码 项目:reta 阅读 16 收藏 0 点赞 0 评论 0
/**
 * @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();
}


问题


面经


文章

微信
公众号

扫码关注公众号