Package org.activiti.workflow.simple.definition.form

Examples of org.activiti.workflow.simple.definition.form.FormPropertyDefinition


        assertEquals(originalStep.getForm().getFormPropertyDefinitions().size(),
            humanStep.getForm().getFormPropertyDefinitions().size());
       
        // Check form-fields, generic fields
        for(int i=0; i<originalStep.getForm().getFormPropertyDefinitions().size(); i++) {
          FormPropertyDefinition origDef = originalStep.getForm().getFormPropertyDefinitions().get(i);
          FormPropertyDefinition parsedDef = humanStep.getForm().getFormPropertyDefinitions().get(i);
         
          assertEquals(origDef.getName(), parsedDef.getName());
          assertEquals(origDef.isMandatory(), parsedDef.isMandatory());
          assertEquals(origDef.isWritable(), parsedDef.isWritable());
          assertEquals(origDef.getClass(), parsedDef.getClass());
         
          if(parsedDef instanceof TextPropertyDefinition) {
            assertTrue(parsedDef.getParameters() != null);
            assertEquals(1L, parsedDef.getParameters().size());
            assertEquals("This is a test", parsedDef.getParameters().get("custom-parameter"));
          }
         
          if(parsedDef instanceof ListPropertyDefinition) {
              ListPropertyDefinition parsed = (ListPropertyDefinition) parsedDef;
              assertEquals(2L, parsed.getEntries().size());
View Full Code Here


  public FormDefinition createForm() {
    FormDefinition formDefinition = new FormDefinition();
    for (Object itemId : propertyTable.getItemIds()) {
     
      Item item = propertyTable.getItem(itemId);
      FormPropertyDefinition formPropertyDefinition = getFormPropertyDefinition(item);
      formDefinition.addFormProperty(formPropertyDefinition);
    }
    return formDefinition;
  }
View Full Code Here

  }

  protected FormPropertyDefinition getFormPropertyDefinition(Item item) {
    String type = (String) ((ComboBox) item.getItemProperty(PropertyTable.ID_PROPERTY_TYPE).getValue()).getValue();
   
    FormPropertyDefinition result = null;
    if(type.equals("number")) {
      result = new NumberPropertyDefinition();
    } else if(type.equals("date")) {
      result = new DatePropertyDefinition();
    } else {
      result = new TextPropertyDefinition();
    }
   
    // Set generic properties
    result.setName((String) item.getItemProperty(PropertyTable.ID_PROPERTY_NAME).getValue());
    result.setMandatory((Boolean) ((CheckBox) item.getItemProperty(PropertyTable.ID_PROPERTY_REQUIRED).getValue()).getValue());
   
    return result;
  }
View Full Code Here

TOP

Related Classes of org.activiti.workflow.simple.definition.form.FormPropertyDefinition

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.