Examples of BoundField


Examples of javango.forms.fields.BoundField

    assertEquals(SelectWidget.class, f.getWidget().getClass());
  }

  public void testSelectedValue() throws Exception {
    TestForm form = new TestForm();
    BoundField bf = new BoundField(form.getFields().get("f"), form, "f");
   
    Map<String, String[]> params = new HashMap<String, String[]>();
    params.put("f", new String[] {"1"});
    form.bind(params);
   
View Full Code Here

Examples of javango.forms.fields.BoundField

  }
 

  public void testInitialValue() throws Exception {
    TestForm form = new TestForm();
    BoundField bf = new BoundField(form.getFields().get("f"), form, "f");
   
    Map<String, Object> initial = new HashMap<String, Object>();
    initial.put("f", 1);
    form.setInitial(initial);
   
View Full Code Here

Examples of javango.forms.fields.BoundField

    StringBuilder hidden_fields = new StringBuilder();

    for (Entry<String, Field<?>> entry : getFields().entrySet()) {
      Field<?> field = entry.getValue();
      String fieldName = field.getName() == null ? entry.getKey() : field.getName();
      BoundField bf = new BoundField(field, this, fieldName);

      // any class attributes that should be applied to the table row.
      String cssClasses = bf.getCssClasses();
      String htmlClassAttr = cssClasses == null ? "" : String.format(" class=\"%s\"", cssClasses);
     
      if (bf.isHidden()) {
        hidden_fields.append(bf.toString());
        hidden_fields.append("\n");
      } else {
        StringBuilder errors = new StringBuilder();
        if (this.getErrors().get(fieldName) != null) {
          errors.append("<ul class=\"errorlist\">");
          errors.append("<li>");
          errors.append(this.getErrors().get(fieldName)); // when this goes to a list,  use bf.geterorrs instead of this.
          errors.append("</li>");
          errors.append("</ul>");
        }
        b.append(String.format("<tr%s><th>%s</th><td>%s%s%s</td></tr>\n", htmlClassAttr, bf.getLabelHtml(), errors.toString(), bf.toString(), bf.getHelpText()));
      }
    }
    if (hidden_fields.length() ==0 ) { // no hidden fields
      return b.toString();
    } else if (b.length() > 11) { // insert hidden field into the last cell of the table.
View Full Code Here

Examples of javango.forms.fields.BoundField

    Field f = getFields().get(field);
    if (f.getName() == null) {
      f.setName(field);
    }

    return new BoundField(f, this, f.getName());
  }
View Full Code Here

Examples of javango.forms.fields.BoundField

  public Iterator<BoundField> iterator() {
    List<BoundField> boundFields = new ArrayList<BoundField>();
    for (Entry<String, Field<?>> e : getFields().entrySet()) {
      Field<?> field = e.getValue();
      String fieldName = field.getName() == null ? e.getKey() : field.getName();
      BoundField bf = new BoundField(field, this, fieldName);

      boundFields.add(bf);
    }
    return boundFields.iterator();
  }
View Full Code Here

Examples of javango.forms.fields.BoundField

    for (Entry<String, Field<?>> entry : getFields().entrySet()) {
      Field<?> field = entry.getValue();
      if (field.isHidden()) {
        String fieldName = field.getName() == null ? entry.getKey() : field.getName();
        BoundField bf = new BoundField(field, this, fieldName);
        hidden_fields.append(bf.toString());
        hidden_fields.append("\n");
      }
    }
    return hidden_fields.toString();
  }
View Full Code Here

Examples of javango.forms.fields.BoundField

    assertEquals(SelectWidget.class, f.getWidget().getClass());
  }

  public void testSelectedValue() throws Exception {
    TestForm form = injector.getInstance(TestForm.class);
    BoundField bf = new BoundField(form.getFields().get("f"), form, "f");
   
    Map<String, String[]> params = new HashMap<String, String[]>();
    params.put("f", new String[] {"1"});
    form.bind(params);
   
View Full Code Here

Examples of javango.forms.fields.BoundField

    assertEquals("Select a valid choice. That choice is not one of the available choices.", errors.get("choice_field"));   
  }
 
  public void testSelectedValueAnnotated() throws Exception {
    AnnotatedTestForm form = injector.getInstance(AnnotatedTestForm.class);
    BoundField bf = new BoundField(form.getFields().get("f"), form, "f");
   
    Map<String, String[]> params = new HashMap<String, String[]>();
    params.put("f", new String[] {"1"});
    form.bind(params);
   
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.