Example #1
0
  public StyleForm(final StyleFormModel model) {

    // bind our regular widgets for a start..
    binder.bind(model.title).to(title);
    binder.bind(model.name).to(name);
    binder.bind(model.hasNickName).to(hasNickName);
    binder.bind(model.nickName).to(nickName);

    // Now change the title style when the magic value is entered.  I'd normally
    // use this approach for boolean models, but it works with any type.
    style.style(title).with("LordVadar").when(valueOf(model.title).is("lord vadar"));

    // Here our nick name label has it's style configured from the metadata
    // of the nickName field.  Could have also used the withValue approach
    // above in this case as well.
    style.style(nickNameLabel).with("disabled").when(metadataOf(model.nickName).isDisabled());

    // Our name label gets styles 'validation-error', 'validation-warning'
    // and 'validation-info' based on the validation state of the model.
    validation.bindValidationOf(model.name).toStyleOf(nameLabel);

    addNote("Type in \"lord vadar\" to see what happens");
    addRow("Title", title);
    addGap();

    addNote("Clear this field and watch the label");
    addRow(nameLabel, name);
    addGap();

    addNote("Click the check box and watch the label");
    addRow("", hasNickName);
    addRow(nickNameLabel, nickName);
  }
Example #2
0
  public void unbind() {
    if (bound) {
      bound = false;

      unbindModels();

      onUnbind();

      dirty.setDelegate(provider.dirty());
      handlerRegistry.dispose();
      binder.dispose();
      validationBinder.dispose();
      validationTree.dispose();
    }
  }
Example #3
0
 public void bindValidationTo(ValidationDisplay validationDisplay) {
   validationBinder.bindValidationOf(validationTree).to(validationDisplay);
 }