Package javango.forms.widgets

Examples of javango.forms.widgets.Widget


    assertTrue(errors.isEmpty());
    assertEquals(new Double(.12), value);
  }

  public void testHtmlNull() throws Exception {
    Widget w = injector.getInstance(PercentInputWidget.class);
    Double value = null;
    String output = w.render("field", value, new LinkedHashMap<String, Object>());
    String html = "<input type=\"text\" name=\"field\" />";
    assertEquals(html, output);
   
    assertEquals("", w.asText(value));   
  }
View Full Code Here


    return null;
  }

  @Override
  public Widget getWidget() {
    Widget w = super.getWidget();
    if (getDecimalPlaces() != null && w instanceof DecimalInputWidget) {
      ((DecimalInputWidget)w).setDecimalPlaces(getDecimalPlaces());
    }
    return w;
  }
View Full Code Here

public class TextAreaWidgetTest extends InjectedTestCaseBase {

  private Log log = LogFactory.getLog(TextAreaWidgetTest.class);
 
  public void testEmptyValueHtml() {
    Widget w = new TextAreaWidget();
    String value = "";
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }

  public void testNullValueHtml() {
    Widget w = new TextAreaWidget();
    String value = null;
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }
 
  public void testEmptyArrayValueHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{};
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\"></textarea>";
    assertEquals(html, output);
  }

  public void testStringHtml() {
    Widget w = new TextAreaWidget();
    String value = "hello";
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
 
  public void testStringArrayHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{"hello"};
    String output = w.render("field", value, new HashMap<String, Object>());
    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }

  public void testIdAttrHtml() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{"hello"};
    Map<String, Object> attrs = new HashMap<String, Object>();
    attrs.put("id", "id_%s");
    String output = w.render("field", value, attrs);
    String html = "<textarea id=\"id_field\" name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
View Full Code Here

    String html = "<textarea id=\"id_field\" name=\"field\" rows=\"10\" cols=\"40\">hello</textarea>";
    assertEquals(html, output);
  }
 
  public void testWithRowsColsAttrs() {
    Widget w = new TextAreaWidget();
    String[] value = new String[]{"hello"};
    Map<String, Object> attrs = new LinkedHashMap<String, Object>();
    attrs.put("id", "id_%s");
   
    attrs.put("rows", "5");
    attrs.put("cols", "20");
   
    String output = w.render("field", value, attrs);
    String html = "<textarea id=\"id_field\" rows=\"5\" cols=\"20\" name=\"field\">hello</textarea>";
    assertEquals(html, output);
  }
View Full Code Here

public class DecimalInputWidgetTest extends InjectedTestCaseBase {

  private Log log = LogFactory.getLog(DecimalInputWidgetTest.class);
 
  public void testEmptyValueHtml() {
    Widget w = new DecimalInputWidget();
    Double value = null;
    String output = w.render("field", value, new LinkedHashMap<String, Object>());
    String html = "<input type=\"text\" name=\"field\" />";
    assertEquals(html, output);
   
    assertEquals("", w.asText(value));
  }
View Full Code Here

TOP

Related Classes of javango.forms.widgets.Widget

Copyright © 2018 www.massapicom. 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.