/**
* @see org.swingml.xml.Mapper#mapModelAttributes(Node, Object, Object)
*/
public void mapModelAttributes(Node aNode, Object aModel, Object aParent) {
ExternalActionModel theActionModel = (ExternalActionModel) aModel;
Node theResultNode = null;
theResultNode = super.getAttribute(aNode, Constants.COMPONENT);
if (theResultNode != null) {
theActionModel.setComponent(theResultNode.getNodeValue());
}
theResultNode = super.getAttribute(aNode, Constants.EXTERNAL_CLASS);
if (theResultNode != null) {
Class externalClass = null;
String className = theResultNode.getNodeValue();
try {
externalClass = Class.forName(className);
} catch (Exception e) {
SwingMLLogger.getInstance().log("Syntax Error: Failed to load the class: [" + className + "]");
SwingMLLogger.getInstance().log(e);
externalClass = null;
} finally {
theActionModel.setExternalClass(externalClass);
}
}
theResultNode = super.getAttribute(aNode, Constants.EXTERNAL_FACTORY_CLASS);
if (theResultNode != null) {
Class externalFactoryClass = null;
String className = theResultNode.getNodeValue();
try {
externalFactoryClass = Class.forName(className);
if (externalFactoryClass.isAssignableFrom(InvokableEventHandlerFactory.class)) {
throw new IllegalArgumentException("The class " + className + " does not implement " + InvokableEventHandlerFactory.class.getName());
}
} catch (Exception e) {
SwingMLLogger.getInstance().log("Syntax Error: Failed to load the class: [" + className + "]");
SwingMLLogger.getInstance().log(e);
externalFactoryClass = null;
} finally {
theActionModel.setExternalFactoryClass(externalFactoryClass);
}
}
}