Search in sources :

Example 1 with PanelConfig

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

the class ReadPanelConfig method read.

/**
 * Read configuration file and store the configuration in the object.
 *
 * @param panelId the panel id
 * @param resourceString the resource string
 * @return true, if successful
 */
public boolean read(Class<?> panelId, String resourceString) {
    groupList = new ArrayList<GroupConfigInterface>();
    PanelConfig panelConfig = (PanelConfig) ParseXML.parseUIFile(resourceString, SCHEMA_RESOURCE, PanelConfig.class);
    if (panelConfig == null) {
        return false;
    }
    Class<?> localisationClass = ReadPanelConfig.class;
    if (panelConfig.getLocalisation() != null) {
        try {
            localisationClass = Class.forName(panelConfig.getLocalisation());
        } catch (ClassNotFoundException e) {
            ConsoleManager.getInstance().exception(ReadPanelConfig.class, e);
        }
    }
    panelTitle = getLocalisedText(localisationClass, panelConfig.getPanelTitle());
    vendorOptionVersion = getVendorOptionVersion(panelConfig);
    for (Object groupObj : panelConfig.getGroupOrMultiOptionGroup()) {
        if (groupObj instanceof XMLGroupConfig) {
            GroupConfig groupConfig = parseGroup(localisationClass, panelId, (XMLGroupConfig) groupObj);
            groupList.add(groupConfig);
        } else if (groupObj instanceof XMLMultiOptionGroup) {
            MultiOptionGroup groupConfig = parseMultiOptionGroup(localisationClass, panelId, (XMLMultiOptionGroup) groupObj);
            groupList.add(groupConfig);
        }
    }
    return true;
}
Also used : XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) GroupConfig(com.sldeditor.ui.detail.config.base.GroupConfig) XMLGroupConfig(com.sldeditor.common.xml.ui.XMLGroupConfig) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) PanelConfig(com.sldeditor.common.xml.ui.PanelConfig) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) XMLMultiOptionGroup(com.sldeditor.common.xml.ui.XMLMultiOptionGroup) MultiOptionGroup(com.sldeditor.ui.detail.config.base.MultiOptionGroup)

Aggregations

PanelConfig (com.sldeditor.common.xml.ui.PanelConfig)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 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)1 MultiOptionGroup (com.sldeditor.ui.detail.config.base.MultiOptionGroup)1