Ejemplo n.º 1
0
    @Test
    public void shouldReturnFalseStringWhenFalseBooleanIsSupplied() throws Exception {
      BooleanField field =
          new BooleanField(new HashMap<String, Object>(), _spanishLocale, _usLocale);

      assertEquals("false", field.convertToData(false));
    }
Ejemplo n.º 2
0
    @Test
    public void shouldReturnBooleanWhenFalseStringIsSupplied() throws Exception {
      BooleanField field =
          new BooleanField(new HashMap<String, Object>(), _spanishLocale, _usLocale);

      assertFalse(field.convertFromString("false"));
    }
Ejemplo n.º 3
0
    @Test
    public void shouldReturnNullWhenNullBooleanIsSupplied() throws Exception {
      BooleanField field =
          new BooleanField(new HashMap<String, Object>(), _spanishLocale, _usLocale);

      assertNull(field.convertToData(null));
    }
Ejemplo n.º 4
0
    @Test
    public void shouldReturnNullWhenNullBooleanIsSupplied() throws Exception {
      BooleanField field = new BooleanField(new HashMap<String, Object>(), _usLocale, _usLocale);
      field.setCurrentValue(null);

      assertNull(field.toFormattedString());
    }
Ejemplo n.º 5
0
    @Test
    public void shouldReturnFalseStringWhenFalseBooleanIsSupplied() throws Exception {
      BooleanField field = new BooleanField(new HashMap<String, Object>(), _usLocale, _usLocale);
      field.setCurrentValue(false);

      assertEquals("No", field.toFormattedString());
    }
Ejemplo n.º 6
0
    @Test
    public void shouldReturnTrueStringWhenTrueBooleanIsSupplied() throws Exception {
      BooleanField field =
          new BooleanField(new HashMap<String, Object>(), _spanishLocale, _usLocale);
      field.setCurrentValue(true);

      assertEquals("true", field.toData());
    }
Ejemplo n.º 7
0
    @Test
    public void shouldUseFalseAsDefaultValueWhenNoPredefinedValue() throws Exception {
      String xsd =
          "<root available-locales=\"en_US\" default-locale=\"en_US\"> "
              + "<dynamic-element "
              + "dataType=\"boolean\" "
              + "type=\"checkbox\" "
              + "name=\"A_Bool\" > "
              + "</dynamic-element>"
              + "</root>";

      List<Field> resultList = new XSDParser().parse(xsd, _usLocale);

      BooleanField booleanField = (BooleanField) resultList.get(0);

      assertFalse(booleanField.getCurrentValue());
    }
  private void createFields() {
    chargeField = new CurrencyField();
    chargeField.setCaption("Charge");
    chargeField.setSimpleName("proccharge");

    unitsField = new IntegerField("procunits", "Units");
    unitsField.setMinValue(1);
    unitsField.setSize(6);
    //		unitsField.setDefaultValue();
    unitsField.setFlag(DialogField.FLDFLAG_REQUIRED);

    emgField = new BooleanField();
    emgField.setSimpleName("emg");
    emgField.setCaption("EMG");
    emgField.setStyle(BooleanField.BOOLSTYLE_CHECK);

    /* Add fields to the composite */
    addChildField(chargeField);
    addChildField(unitsField);
    addChildField(emgField);
  }
Ejemplo n.º 9
0
    @Test
    public void shouldReturnStringFieldObject() throws Exception {
      String xsd =
          "<root available-locales=\"en_US\" default-locale=\"en_US\"> "
              + "<dynamic-element "
              + "dataType=\"boolean\" "
              + "type=\"checkbox\" "
              + "name=\"A_Bool\" > "
              + "<meta-data locale=\"en_US\"> "
              + "<entry name=\"predefinedValue\"><![CDATA[false]]></entry> "
              + "</meta-data> "
              + "</dynamic-element>"
              + "</root>";

      List<Field> resultList = new XSDParser().parse(xsd, _usLocale);

      assertNotNull(resultList);
      assertEquals(1, resultList.size());

      Field resultField = resultList.get(0);
      assertTrue(resultField instanceof BooleanField);
      BooleanField booleanField = (BooleanField) resultField;

      assertEquals(Field.DataType.BOOLEAN.getValue(), booleanField.getDataType().getValue());
      assertEquals(Field.EditorType.CHECKBOX.getValue(), booleanField.getEditorType().getValue());
      assertEquals("A_Bool", booleanField.getName());
      assertFalse(booleanField.getCurrentValue());
      assertFalse(booleanField.getPredefinedValue());
    }
Ejemplo n.º 10
0
    @Test
    public void shouldReturnTrueStringWhenTrueBooleanIsSupplied() throws Exception {
      BooleanField field = new BooleanField(new HashMap<String, Object>(), _usLocale, _usLocale);

      assertEquals("Yes", field.convertToFormattedString(true));
    }
Ejemplo n.º 11
0
 public Object getData() {
   return (Boolean) fld.getValue();
 }
Ejemplo n.º 12
0
 public void setProperty(Object val) {
   Boolean v = (Boolean) val;
   fld.setField(v);
 }