Search in sources :

Example 1 with InputTypeName

use of com.enonic.xp.inputtype.InputTypeName in project xp by enonic.

the class XmlFormMapper method buildInputItem.

private Input buildInputItem(final DomElement root) {
    final Input.Builder builder = Input.create();
    final InputTypeName inputTypeName = InputTypeName.from(root.getAttribute("type"));
    builder.inputType(inputTypeName);
    builder.name(root.getAttribute("name"));
    final String labelI18n = getLabelI18n(root);
    builder.label(getLabel(root, labelI18n));
    builder.labelI18nKey(labelI18n);
    builder.customText(root.getChildValue("custom-text"));
    final String helpTextI18n = getHelpTextI18n(root);
    builder.helpText(getHelpText(root, helpTextI18n));
    builder.helpTextI18nKey(helpTextI18n);
    builder.occurrences(buildOccurrence(root.getChild("occurrences")));
    builder.immutable(root.getChildValueAs("immutable", Boolean.class, false));
    builder.indexed(root.getChildValueAs("indexed", Boolean.class, false));
    builder.validationRegexp(root.getChildValueTrimmed("validation-regexp"));
    builder.maximizeUIInputWidth(root.getChildValueAs("maximize", Boolean.class, true));
    if (root.getChild("default") != null) {
        builder.defaultValue(this.defaultMapper.build(root.getChild("default")));
    }
    builder.inputTypeConfig(new XmlInputTypeConfigMapper(this.currentApplication, inputTypeName).build(root.getChild("config")));
    return builder.build();
}
Also used : Input(com.enonic.xp.form.Input) InputTypeName(com.enonic.xp.inputtype.InputTypeName)

Aggregations

Input (com.enonic.xp.form.Input)1 InputTypeName (com.enonic.xp.inputtype.InputTypeName)1