Package org.camunda.bpm.engine.impl.form

Examples of org.camunda.bpm.engine.impl.form.FormFieldImpl


  protected Expression defaultValueExpression;
  protected Map<String, String> properties = new HashMap<String, String>();
  protected List<FormFieldValidationConstraintHandler> validationHandlers = new ArrayList<FormFieldValidationConstraintHandler>();

  public FormField createFormField(ExecutionEntity executionEntity) {
    FormFieldImpl formField = new FormFieldImpl();

    // set id
    formField.setId(id);

    // set label (evaluate expression)
    VariableScope variableScope = executionEntity != null ? executionEntity : StartProcessVariableScope.getSharedInstance();
    Object labelValueObject = label.getValue(variableScope);
    if(labelValueObject != null) {
      formField.setLabel(labelValueObject.toString());
    }

    // set type
    formField.setType(type);

    // set default value (evaluate expression)
    Object defaultValue = null;
    if(defaultValueExpression != null) {
      defaultValue = defaultValueExpression.getValue(variableScope);
      if(defaultValue != null) {
        formField.setDefaultValue(type.convertFormValueToModelValue(defaultValue));
      } else {
        formField.setDefaultValue(null);
      }
    }

    // value
    TypedValue value = variableScope.getVariableTyped(id);
    if(value != null) {
      formField.setValue(type.convertToFormValue(value));
    }
    else {
      // first, need to convert to model value since the default value may be a String Constant specified in the model xml.
      TypedValue typedDefaultValue = type.convertToModelValue(Variables.untypedValue(defaultValue));
      // now convert to form value
      formField.setValue(type.convertToFormValue(typedDefaultValue));
    }

    // properties
    formField.setProperties(properties);

    // validation
    List<FormFieldValidationConstraint> validationConstraints = formField.getValidationConstraints();
    for (FormFieldValidationConstraintHandler validationHandler : validationHandlers) {
      // do not add custom validators
      if(!"validator".equals(validationHandler.name)) {
        validationConstraints.add(validationHandler.createValidationConstraint(executionEntity));
      }
View Full Code Here


  protected Expression defaultValueExpression;
  protected Map<String, String> properties = new HashMap<String, String>();
  protected List<FormFieldValidationConstraintHandler> validationHandlers = new ArrayList<FormFieldValidationConstraintHandler>();

  public FormField createFormField(ExecutionEntity executionEntity) {
    FormFieldImpl formField = new FormFieldImpl();

    // set id
    formField.setId(id);

    // set label (evaluate expression)
    VariableScope<?> variableScope = executionEntity != null ? executionEntity : StartProcessVariableScope.getSharedInstance();
    Object labelValueObject = label.getValue(variableScope);
    if(labelValueObject != null) {
      formField.setLabel(labelValueObject.toString());
    }

    // set type
    formField.setType(type);

    // set default value (evaluate expression)
    if(defaultValueExpression != null) {
      Object defaultValue = defaultValueExpression.getValue(variableScope);
      if(defaultValue != null) {
        formField.setDefaultValue(type.convertFormValueToModelValue(defaultValue));
      } else {
        formField.setDefaultValue(null);
      }
    }

    // properties
    formField.setProperties(properties);

    // validation
    List<FormFieldValidationConstraint> validationConstraints = formField.getValidationConstraints();
    for (FormFieldValidationConstraintHandler validationHandler : validationHandlers) {
      // do not add custom validators
      if(!"validator".equals(validationHandler.name)) {
        validationConstraints.add(validationHandler.createValidationConstraint(executionEntity));
      }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.form.FormFieldImpl

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.