Search in sources :

Example 1 with XMLNode

use of org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode in project kie-wb-common by kiegroup.

the class FormSerializationManagerImpl method generateDataHolderXML.

public void generateDataHolderXML(DataHolder dataHolder, XMLNode parent) {
    XMLNode rootNode = new XMLNode(NODE_DATA_HOLDER, parent);
    rootNode.addAttribute(ATTR_ID, dataHolder.getUniqeId());
    rootNode.addAttribute(ATTR_INPUT_ID, dataHolder.getInputId());
    rootNode.addAttribute(ATTR_OUT_ID, dataHolder.getOuputId());
    rootNode.addAttribute(ATTR_TYPE, dataHolder.getType());
    rootNode.addAttribute(ATTR_VALUE, dataHolder.getClassName());
    rootNode.addAttribute(ATTR_NAME, dataHolder.getRenderColor());
    if (!StringUtils.isEmpty(dataHolder.getSupportedType())) {
        rootNode.addAttribute(ATTR_SUPPORTED_TYPE, dataHolder.getSupportedType());
    }
    parent.addChild(rootNode);
}
Also used : XMLNode(org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode)

Example 2 with XMLNode

use of org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode in project kie-wb-common by kiegroup.

the class FormSerializationManagerImpl method generateFieldXML.

public void generateFieldXML(Field field, XMLNode parent) {
    XMLNode rootNode = new XMLNode(NODE_FIELD, parent);
    rootNode.addAttribute(ATTR_ID, String.valueOf(field.getId()));
    rootNode.addAttribute(ATTR_POSITION, String.valueOf(field.getPosition()));
    rootNode.addAttribute(ATTR_NAME, field.getFieldName());
    if (field.getFieldType() != null) {
        rootNode.addAttribute(ATTR_TYPE, field.getFieldType().getCode());
    }
    if (!StringUtils.isEmpty(field.getBag())) {
        rootNode.addAttribute(ATTR_BAG_TYPE, field.getBag());
    }
    addXMLNode("fieldRequired", (field.getFieldRequired() != null ? String.valueOf(field.getFieldRequired()) : null), rootNode);
    addXMLNode("groupWithPrevious", (field.getGroupWithPrevious() != null ? String.valueOf(field.getGroupWithPrevious()) : null), rootNode);
    addXMLNode("height", field.getHeight(), rootNode);
    addXMLNode("labelCSSClass", field.getLabelCSSClass(), rootNode);
    addXMLNode("labelCSSStyle", field.getLabelCSSStyle(), rootNode);
    addXMLNode("label", (field.getLabel() != null ? serializeI18nSet(field.getLabel()) : null), rootNode);
    addXMLNode("errorMessage", (field.getErrorMessage() != null ? serializeI18nSet(field.getErrorMessage()) : null), rootNode);
    addXMLNode("title", (field.getTitle() != null ? serializeI18nSet(field.getTitle()) : null), rootNode);
    addXMLNode("readonly", (field.getReadonly() != null ? String.valueOf(field.getReadonly()) : null), rootNode);
    addXMLNode("size", (field.getSize() != null ? String.valueOf(field.getSize()) : null), rootNode);
    addXMLNode("formula", field.getFormula(), rootNode);
    addXMLNode("rangeFormula", field.getRangeFormula(), rootNode);
    addXMLNode("pattern", field.getPattern(), rootNode);
    addXMLNode("maxlength", (field.getMaxlength() != null ? String.valueOf(field.getMaxlength()) : null), rootNode);
    addXMLNode("styleclass", field.getStyleclass(), rootNode);
    addXMLNode("cssStyle", field.getCssStyle(), rootNode);
    addXMLNode("tabindex", (field.getTabindex() != null ? String.valueOf(field.getTabindex()) : null), rootNode);
    addXMLNode("accesskey", field.getAccesskey(), rootNode);
    addXMLNode("isHTML", (field.getIsHTML() != null ? String.valueOf(field.getIsHTML()) : null), rootNode);
    addXMLNode("hideContent", (field.getHideContent() != null ? String.valueOf(field.getHideContent()) : null), rootNode);
    addXMLNode("defaultValueFormula", field.getDefaultValueFormula(), rootNode);
    addXMLNode("inputBinding", field.getInputBinding(), rootNode);
    addXMLNode("outputBinding", field.getOutputBinding(), rootNode);
    addXMLNode("htmlContent", (field.getHtmlContent() != null ? serializeI18nSet(field.getHtmlContent()) : null), rootNode);
    addXMLNode("defaultSubform", field.getDefaultSubform(), rootNode);
    addXMLNode("previewSubform", field.getPreviewSubform(), rootNode);
    addXMLNode("tableSubform", field.getTableSubform(), rootNode);
    addXMLNode("newItemText", (field.getNewItemText() != null ? serializeI18nSet(field.getNewItemText()) : null), rootNode);
    addXMLNode("addItemText", (field.getAddItemText() != null ? serializeI18nSet(field.getAddItemText()) : null), rootNode);
    addXMLNode("cancelItemText", (field.getCancelItemText() != null ? serializeI18nSet(field.getCancelItemText()) : null), rootNode);
    addXMLNode("deleteItems", (field.getDeleteItems() != null ? String.valueOf(field.getDeleteItems()) : null), rootNode);
    addXMLNode("updateItems", (field.getUpdateItems() != null ? String.valueOf(field.getUpdateItems()) : null), rootNode);
    addXMLNode("visualizeItems", (field.getVisualizeItem() != null ? String.valueOf(field.getVisualizeItem()) : null), rootNode);
    addXMLNode("hideCreateItem", (field.getHideCreateItem() != null ? String.valueOf(field.getHideCreateItem()) : null), rootNode);
    addXMLNode("expanded", (field.getExpanded() != null ? String.valueOf(field.getExpanded()) : null), rootNode);
    addXMLNode("enableTableEnterData", (field.getEnableTableEnterData() != null ? String.valueOf(field.getEnableTableEnterData()) : null), rootNode);
    addXMLNode("customFieldType", field.getCustomFieldType(), rootNode);
    addXMLNode("fieldClass", field.getFieldType().getFieldClass(), rootNode);
    addXMLNode("param1", field.getParam1(), rootNode);
    addXMLNode("param2", field.getParam2(), rootNode);
    addXMLNode("param3", field.getParam3(), rootNode);
    addXMLNode("param4", field.getParam4(), rootNode);
    addXMLNode("param5", field.getParam5(), rootNode);
    addXMLNode("onChangeScript", field.getOnChangeScript(), rootNode);
    if (field.getMovedToForm() != null) {
        addXMLNode("movedToForm", field.getMovedToForm(), rootNode);
    }
    if (field.getSourceLink() != null) {
        addXMLNode("sourceLink", field.getMovedToForm(), rootNode);
    }
    parent.addChild(rootNode);
}
Also used : XMLNode(org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode)

Example 3 with XMLNode

use of org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode in project kie-wb-common by kiegroup.

the class FormSerializationManagerImpl method addXMLNode.

private void addXMLNode(String propName, String value, XMLNode parent) {
    if (!StringUtils.isEmpty(value)) {
        XMLNode propertyNode = new XMLNode(NODE_PROPERTY, parent);
        propertyNode.addAttribute(ATTR_NAME, propName);
        propertyNode.addAttribute(ATTR_VALUE, value);
        parent.addChild(propertyNode);
    }
}
Also used : XMLNode(org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode)

Aggregations

XMLNode (org.kie.workbench.common.forms.migration.legacy.services.impl.util.XMLNode)3