當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。