Ejemplo n.º 1
0
  /**
   * This will attach a Dynamic JS RenderElement to dynamic property at the field level. If there
   * are no 'fields' then we end.
   */
  @Trace
  public RenderElement compile(
      GenericCompiler compiler,
      TemplateRenderMold templateMold,
      Template template,
      TemplateElement element) {
    RenderElement ret = null; // We don't do children as only attached to props

    // Attach fields
    if (element instanceof DynamicProperty) {
      if (ret == null) ret = new EmptyElement();

      if (element.getType().endsWith("date-prop")) {
        ret.addElement(addDateField(compiler, template, element));
      } else if (element.getType().endsWith("number-prop")) {
        ret.addElement(addNumberField(compiler, template, element));
      } else if (element.getType().endsWith("choice-prop")) {
        ret.addElement(addChoiceField(compiler, template, element));
      } else if (element.getType().endsWith("bool-prop")) {
        ret.addElement(addBoolField(compiler, template, element));
      } else if (element.getType().endsWith("command-prop")) {
        ret.addElement(addCommandField(compiler, template, element));
      } else if (element.getType().endsWith("memo-prop")) {
        ret.addElement(addMemoField(compiler, template, element));
      } else if (element.getType().endsWith("text-prop")) {
        ret.addElement(addValidationField(compiler, template, element));
      } else if (element.getType().equals("prop")) {
        ret.addElement(addTextField(compiler, template, element));
      }
    }

    return ret;
  }