Examples of ChoiceField


Examples of javango.forms.fields.ChoiceField

    Map<String, String> choices = new LinkedHashMap<String, String>();
    choices.put("1", "One");
    choices.put("2", "Two");
    SelectWidget w = new SelectWidget();
    ChoiceField field = (ChoiceField) new SelectField(injector.getInstance(WidgetFactory.class)).setChoices(choices).setAllowNull(false).setName("pickme");
//    w.setField(field);
   
    String[] o = w.valueFromMap(postData, "pickme");
    assertEquals("2", o[0]);
   
    Map<String, String> errors = new HashMap<String, String>();
    Object cleaned = field.clean(o, errors);
    assertTrue(errors.isEmpty());
    assertEquals("2", cleaned);
  }
View Full Code Here

Examples of net.rim.device.api.ui.component.ChoiceField

   
    ObjectChoiceField categoryChoiceField = new ObjectChoiceField("", categories, 0, Field.FIELD_LEFT);
    categoryChoiceField.setChangeListener(new FieldChangeListener() {     
      public void fieldChanged(Field field, int context) {
        if (context == ChoiceField.CONTEXT_CHANGE_OPTION) {
          ChoiceField choiceField = (ChoiceField) field;
          int index = choiceField.getSelectedIndex();
          if (index >= 0) {
            Category category = (Category) choiceField.getChoice(index);
            displayCategory(category);
          }
        }
      }
    });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.