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


Java StateSync类代码示例

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


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

示例1: sortContactsByName

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
private void sortContactsByName() {
  binder.pause();
  final Function<Contact, String> nickGetter = c -> (c.getNickname() == null ? "" : c.getNickname());
  Collections.sort(binder.getModel(), (a,b) -> {
    return nickGetter.apply(a).compareTo(nickGetter.apply(b));
  });
  binder.resume(StateSync.FROM_MODEL);
}
 
开发者ID:mbarkley,项目名称:errai-crud,代码行数:9,代码来源:ContactListPage.java

示例2: registerInput

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
@Override
public void registerInput(FormField formField, Converter valueConverter) {
    Assert.notNull("FormHandler isn't correctly initialized, please run any of the setUp methods before use", binder);
    Assert.notNull("FormField cannot be null!", formField);

    String fieldName = formField.getFieldName();
    IsWidget widget = formField.getWidget();

    formFields.add(formField);

    if (handlerHelper.supportsInputBinding() && formField.isBindable()) {

        BindableProxy proxy = (BindableProxy) binder.getModel();

        Object modelValue = readPropertyValue(proxy, formField.getFieldBinding());

        StateSync stateSync = Optional.ofNullable(modelValue).isPresent() ? StateSync.FROM_MODEL : StateSync.FROM_UI;

        binder.bind(widget, formField.getFieldBinding(), valueConverter, stateSync);
    }

    fieldChangeManager.registerField(formField.getFieldName(), formField.isValidateOnChange());

    formField.getChangeListeners().forEach(listener -> fieldChangeManager.addFieldChangeHandler(listener.getFieldToListen(), listener.getChangeHandler()));

    /**
     * if field isn't bindable we cannot listen to field value changes.
     */
    if (!formField.isBindable()) {
        return;
    }

    if (widget instanceof IsNestedModel) {
        IsNestedModel nestedModelWidget = (IsNestedModel) widget;
        nestedModelWidget.addFieldChangeHandler((childFieldName, newValue) -> fieldChangeManager.notifyFieldChange(fieldName + "." + childFieldName, newValue));
    } else {
        PropertyChangeUnsubscribeHandle unsubscribeHandle = binder.addPropertyChangeHandler(formField.getFieldBinding(), event -> fieldChangeManager.processFieldChange(fieldName, event.getNewValue(), binder.getModel()));
        unsubscribeHandlers.add(unsubscribeHandle);
    }
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:41,代码来源:FormHandlerImpl.java

示例3: setValuePaused

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
/**
 * Sets the given model as the model for this component but pauses data-binding. Any changes made to the UI or model
 * will not be synchronized until {@link #syncStateFromUI()} is called.
 */
public void setValuePaused(final Contact model) {
  binder.setModel(model, StateSync.FROM_MODEL);
  binder.pause();
}
 
开发者ID:mbarkley,项目名称:errai-crud,代码行数:9,代码来源:ContactEditor.java

示例4: syncStateFromUI

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
/**
 * If binding is paused, overwrite the state of the model with the state from the UI.
 */
public void syncStateFromUI() {
  // Does nothing if already resumed.
  binder.resume(StateSync.FROM_UI);
}
 
开发者ID:mbarkley,项目名称:errai-crud,代码行数:8,代码来源:ContactEditor.java

示例5: setValuePaused

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
/**
 * Sets the given model as the model for this component but pauses data binding. Any changes made to the UI or model
 * will not be synchronized until {@link #syncStateFromUI()} is called.
 */
public void setValuePaused(final Contact model) {
  binder.setModel(model, StateSync.FROM_MODEL);
  binder.pause();
}
 
开发者ID:errai,项目名称:errai-tutorial,代码行数:9,代码来源:ContactEditor.java

示例6: sortContactsByName

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
private void sortContactsByName() {
  binder.pause();
  binder.getModel().sort(Comparator.comparing(Contact::getNickname));
  binder.resume(StateSync.FROM_MODEL);
}
 
开发者ID:errai,项目名称:errai-tutorial,代码行数:6,代码来源:ContactListPage.java

示例7: forceModelSynchronization

import org.jboss.errai.databinding.client.api.StateSync; //导入依赖的package包/类
@Override
public void forceModelSynchronization() {
    formFields.stream().filter(formField -> formField.getWidget() instanceof IsNestedModel).map(formField1 -> (IsNestedModel) formField1.getWidget()).forEach(IsNestedModel::forceModelSynchronization);
    binder.setModel(getModel(), StateSync.FROM_UI);
}
 
开发者ID:kiegroup,项目名称:kie-wb-common,代码行数:6,代码来源:FormHandlerImpl.java


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