Search in sources :

Example 1 with XMLFieldConfigVendorOption

use of com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption in project sldeditor by robward-scisys.

the class ReadPanelConfig method parseGroup.

/**
 * Parses the group if fields.
 *
 * @param localisationClass the localisation class
 * @param panelId the panel id
 * @param xmlGroupObj the xml group object
 * @return the group config
 */
private GroupConfig parseGroup(Class<?> localisationClass, Class<?> panelId, XMLGroupConfig xmlGroupObj) {
    GroupConfig groupConfig = new GroupConfig();
    groupConfig.setId(xmlGroupObj.getId());
    groupConfig.setLabel(groupTitle(getLocalisedText(localisationClass, xmlGroupObj.getLabel())));
    groupConfig.setShowLabel(xmlGroupObj.getShowLabel());
    groupConfig.setOptional(xmlGroupObj.getOption());
    for (Object obj : xmlGroupObj.getFieldList()) {
        if (obj instanceof XMLFieldConfigData) {
            addField(localisationClass, panelId, groupConfig, (XMLFieldConfigData) obj);
        } else if (obj instanceof XMLGroupConfig) {
            GroupConfig subGroup = parseGroup(localisationClass, panelId, (XMLGroupConfig) obj);
            groupConfig.addGroup(subGroup);
        } else if (obj instanceof XMLMultiOptionGroup) {
            MultiOptionGroup subGroup = parseMultiOptionGroup(localisationClass, panelId, (XMLMultiOptionGroup) obj);
            groupConfig.addGroup(subGroup);
        } else if (obj instanceof XMLFieldConfigVendorOption) {
            XMLFieldConfigVendorOption vendorOption = (XMLFieldConfigVendorOption) obj;
            FieldIdEnum id = vendorOption.getId();
            String label = null;
            boolean valueOnly = true;
            FieldConfigCommonData commonData = new FieldConfigCommonData(panelId, id, label, valueOnly);
            List<VendorOptionInterface> veList = null;
            veList = vendorOptionFactory.getVendorOptionList(vendorOption.getClazz());
            if ((veList == null) || veList.isEmpty()) {
                ConsoleManager.getInstance().error(this, Localisation.getField(FieldConfigBase.class, "FieldConfigVendorOption.missingVendorOptionClass") + vendorOption.getClazz());
            }
            FieldConfigVendorOption placeHolder = new FieldConfigVendorOption(commonData, veList);
            groupConfig.addField(placeHolder);
        }
    }
    return groupConfig;
}
Also used : XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) XMLFieldConfigVendorOption(com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption) XMLFieldConfigString(com.sldeditor.common.xml.ui.XMLFieldConfigString) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLFieldConfigVendorOption(com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption) GroupConfig(com.sldeditor.ui.detail.config.base.GroupConfig) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLFieldConfigData(com.sldeditor.common.xml.ui.XMLFieldConfigData) List(java.util.List) ArrayList(java.util.ArrayList) FieldList(com.sldeditor.common.xml.ui.XMLFieldConfigEnumValue.FieldList) XMLFieldConfigEnumValueList(com.sldeditor.common.xml.ui.XMLFieldConfigEnumValueList) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Aggregations

FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)1 XMLFieldConfigData (com.sldeditor.common.xml.ui.XMLFieldConfigData)1 FieldList (com.sldeditor.common.xml.ui.XMLFieldConfigEnumValue.FieldList)1 XMLFieldConfigEnumValueList (com.sldeditor.common.xml.ui.XMLFieldConfigEnumValueList)1 XMLFieldConfigString (com.sldeditor.common.xml.ui.XMLFieldConfigString)1 XMLFieldConfigVendorOption (com.sldeditor.common.xml.ui.XMLFieldConfigVendorOption)1 XMLGroupConfig (com.sldeditor.common.xml.ui.XMLGroupConfig)1 XMLMultiOptionGroup (com.sldeditor.common.xml.ui.XMLMultiOptionGroup)1 GroupConfig (com.sldeditor.ui.detail.config.base.GroupConfig)1 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1