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;
}
Aggregations