Examples of FormWidget


Examples of org.araneaframework.uilib.form.FormWidget

  private static Logger log = Logger.getLogger(FormRWTest.class);

  private FormWidget makeVoForm() throws Exception {

    //Creating form :-)
    FormWidget voForm = new FormWidget();
    voForm._getComponent().init(new MockEnviroment());
   
    //Adding elements to form
    voForm.addElement("booleanValue", "vo checkbox", new CheckboxControl(), new BooleanData(), true);
    voForm.addElement("stringValue", "vo text", new TextControl(), new StringData(), true);
    voForm.addElement("longValue", "vo long", new TextControl(), new LongData(), true);

    //Adding a composite element
    FormWidget subTestVO = voForm.addSubForm("subTestVO");
    subTestVO.addElement("booleanValue", "vo checkbox", new CheckboxControl(), new BooleanData(), true);
    subTestVO.addElement("stringValue", "vo text", new TextControl(), new StringData(), true);
    subTestVO.addElement("longValue", "vo long", new TextControl(), new LongData(), true);

    return voForm;
  }
View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests basic Value Object reading.
   */
  public void testFormBasicVoReading() throws Exception {

    FormWidget voForm = makeVoForm();
    TestVO test = new TestVO();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    voForm.setValueByFullName("booleanValue", Boolean.TRUE);
    voForm.setValueByFullName("stringValue", LIFE_IS_BEAUTIFUL);
    voForm.setValueByFullName("longValue", TEN);

    BeanFormReader voReader = new BeanFormReader(voForm);

    voReader.readFormBean(test);

View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests hierarchical Value Object reading.
   */
  public void testFormHierarchicalVoReading() throws Exception {

    FormWidget voForm = makeVoForm();
    TestVO test = new TestVO();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);  

    voForm.setValueByFullName("subTestVO.booleanValue", Boolean.TRUE);
    voForm.setValueByFullName("subTestVO.stringValue", LIFE_IS_BEAUTIFUL);
    voForm.setValueByFullName("subTestVO.longValue", TEN);

    BeanFormReader voReader = new BeanFormReader(voForm);

    voReader.readFormBean(test);

View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests basic Value Object writing.
   */
  public void testFormBasicVoWriting() throws Exception {

    FormWidget voForm = makeVoForm();
    TestVO test = new TestVO();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    test.setBooleanValue(Boolean.TRUE);
    test.setStringValue(LIFE_IS_BEAUTIFUL);
    test.setLongValue(TEN);

    BeanFormWriter voWriter = new BeanFormWriter(test.getClass());

    voWriter.writeFormBean(voForm, test);

    assertTrue("Boolean value written properly", voForm.getValueByFullName("booleanValue").equals(Boolean.TRUE));
    assertTrue("String value written properly", voForm.getValueByFullName("stringValue").equals(LIFE_IS_BEAUTIFUL));
    assertTrue("Long value written properly", voForm.getValueByFullName("longValue").equals(TEN));
  }
View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests hierarchical Value Object writing.
   */
  public void testFormHierarchicalVoWriting() throws Exception {

    FormWidget voForm = makeVoForm();
    TestVO test = new TestVO();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    test.setSubTestVO(new TestVO());

    test.getSubTestVO().setBooleanValue(Boolean.TRUE);
    test.getSubTestVO().setStringValue(LIFE_IS_BEAUTIFUL);
    test.getSubTestVO().setLongValue(TEN);

    BeanFormWriter voWriter = new BeanFormWriter(test.getClass());

    voWriter.writeFormBean(voForm, test);

    assertTrue("Boolean value written properly", voForm.getValueByFullName("subTestVO.booleanValue").equals(Boolean.TRUE));
    assertTrue("String value written properly", voForm.getValueByFullName("subTestVO.stringValue").equals(LIFE_IS_BEAUTIFUL));
    assertTrue("Long value written properly", voForm.getValueByFullName("subTestVO.longValue").equals(TEN))}
View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests basic Map reading.
   */
  public void testFormBasicMapReading() throws Exception {

    FormWidget mapForm = makeVoForm();   

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    mapForm.setValueByFullName("booleanValue", Boolean.TRUE);
    mapForm.setValueByFullName("stringValue", LIFE_IS_BEAUTIFUL);
    mapForm.setValueByFullName("longValue", TEN);

    MapFormReader mapReader = new MapFormReader(mapForm);

    Map readMap = mapReader.getMap();

View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests hierarchical Map reading.
   */
  public void testFormHierarchicalMapReading() throws Exception {

    FormWidget mapForm = makeVoForm();   

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    mapForm.setValueByFullName("subTestVO.booleanValue", Boolean.TRUE);
    mapForm.setValueByFullName("subTestVO.stringValue", LIFE_IS_BEAUTIFUL);
    mapForm.setValueByFullName("subTestVO.longValue", TEN);
   
    MapFormReader mapReader = new MapFormReader(mapForm);

    Map readMap = mapReader.getMap();

View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests basic Map writing.
   */
  public void testFormBasicMapWriting() throws Exception {

    FormWidget mapForm = makeVoForm();
    Map testMap = new HashMap();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    testMap.put("booleanValue", Boolean.TRUE);
    testMap.put("stringValue", LIFE_IS_BEAUTIFUL);
    testMap.put("longValue", TEN);

    MapFormWriter mapWriter = new MapFormWriter();

    mapWriter.writeForm(mapForm, testMap);

    assertTrue("Boolean value written properly", mapForm.getValueByFullName("booleanValue").equals(Boolean.TRUE));
    assertTrue("String value written properly", mapForm.getValueByFullName("stringValue").equals(LIFE_IS_BEAUTIFUL));
    assertTrue("Long value written properly", mapForm.getValueByFullName("longValue").equals(TEN));
 
View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  /**
   * Tests hierarchical Map writing.
   */
  public void testFormHierarchicalMapWriting() throws Exception {

    FormWidget mapForm = makeVoForm();
    Map testMap = new HashMap();

    final String LIFE_IS_BEAUTIFUL = "Life is beautiful";
    final Long TEN = new Long(10);

    testMap.put("booleanValue", Boolean.TRUE);
    testMap.put("stringValue", LIFE_IS_BEAUTIFUL);
    testMap.put("longValue", TEN);
   
   
    Map topTestMap = new HashMap();
    topTestMap.put("subTestVO", testMap);   

    MapFormWriter mapWriter = new MapFormWriter();

    mapWriter.writeForm(mapForm, topTestMap);

    assertTrue("Boolean value written properly", mapForm.getValueByFullName("subTestVO.booleanValue").equals(Boolean.TRUE));
    assertTrue("String value written properly", mapForm.getValueByFullName("subTestVO.stringValue").equals(LIFE_IS_BEAUTIFUL));
    assertTrue("Long value written properly", mapForm.getValueByFullName("subTestVO.longValue").equals(TEN));
  }   
View Full Code Here

Examples of org.araneaframework.uilib.form.FormWidget

  boolean eventsWork = false;

  private FormWidget makeUsualForm() throws Exception {

    //Creating form :-)
    FormWidget testForm = new FormWidget();
    testForm._getComponent().init(new MockEnviroment());
   
    //Adding elements to form
    testForm.addElement("myCheckBox", "my checkbox", new CheckboxControl(), new BooleanData(), true);
    testForm.addElement("myLongText", "my long text", new TextControl(), new LongData(), true);
    testForm.addElement("myDateTime", "my date and time", new DateTimeControl(), new DateData(), false);
    testForm.addElement("myButton", "my button", new ButtonControl(), null, false);

    //Adding a composite element
    FormWidget hierarchyTest = testForm.addSubForm("hierarchyTest");
    hierarchyTest.addElement("myTextarea", "my text area", new TextareaControl(), new StringData(), true);

    //Filling in select control (which is under a composite element)
    FormElement mySelectElement = hierarchyTest.addElement("mySelect", "my drop down", new SelectControl(), new LongData(), true);
    SelectControl mySelect = (SelectControl) mySelectElement.getControl();
    mySelect.addItem(new DisplayItem("1", "one"));
    mySelect.addItem(new DisplayItem("2", "two"));
    mySelect.addItem(new DisplayItem("3", "three"));
    mySelect.addItem(new DisplayItem("4", "four"));
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.