{
return;
}
// This is an attribute change event ... see if it is one we are concerned about
final AttributeChange attributeChange = (AttributeChange) event.getParameter();
final ReportElement reportElement = (ReportElement) event.getElement();
final AttributeMetaData attributeDescription = reportElement.getMetaData().getAttributeDescription(attributeChange.getNamespace(), attributeChange.getName());
if (attributeDescription == null ||
AttributeMetaData.VALUEROLE_RESOURCE.equals(attributeDescription.getValueRole()) == false)
{
return;
}
// See if we need to load the resource's value into the resource key
final Object newValue = attributeChange.getNewValue();
if (newValue instanceof ResourceKey && shouldBeLoaded((ResourceKey) newValue))
{
try
{
// Embed the file and swap in the key which refers to the embedded resource
final ResourceKey newKey = loadResourceIntoKey((ResourceKey) newValue);
if (newKey != null)
{
// Swap out the old key with the new key (the new key has the resource loaded)
reportElement.setAttribute(attributeChange.getNamespace(), attributeChange.getName(), newKey);
}
}
catch (Exception e)
{
reportElement.setAttribute(attributeChange.getNamespace(), attributeChange.getName(), null);
UncaughtExceptionsModel.getInstance().addException(e);
}
}
}