}
protected void initSegmentAttribute(IMetaclass metaclass, String propertyName,
Object target, Element element, String namespace, String attrName)
throws Exception {
Attribute attribute = namespace == null ? element
.getAttribute(attrName) : element.getAttribute(namespace,
attrName);
if (attribute == null) {
attribute = element.getAttribute(attrName);
}
IProperty property = null;
boolean isAttached = false;
{
String namePrefix = attribute.getNamePrefix();
if (namePrefix == null) {
property = metaclass.findProperty(propertyName);
} else {
//
IMetaclass metaclassAttached = loader.getMetaclass(namePrefix,
attribute.getNamespace());
if (metaclassAttached != null) {
property = metaclassAttached.findProperty(propertyName);
isAttached = true;
} else {
LoggerManager.log(attribute.getNamespace() + " -> "
+ namePrefix + " is not found.");
return;
}
}
}
if (propertyName.equals(IConstants.XAML_DATA_CONTEXT)) {
property = null;
}
if (IConstants.XAML_COMMAND.equalsIgnoreCase(propertyName)
&& ICommand.class.isAssignableFrom(property.getType())
&& (target instanceof Widget)) {
addCommandExecuteListener(attribute.getContent(), (Widget) target);
}
if (property == null) {
if (options.get(IXWTLoader.DESIGN_MODE_PROPERTY) == Boolean.TRUE) {
return;
}
// prepare event
IEvent event = metaclass.findEvent(attrName);
if (event == null) {
return;
}
// add events for controls and items.
if (!(target instanceof Widget)) {
return;
}
loadData.updateEvent(context, (Widget) target, event, attribute
.getContent());
return;
}
String contentValue = attribute.getContent();
if ("MenuItem".equalsIgnoreCase(element.getName())
&& "Text".equalsIgnoreCase(attrName)) {
Attribute attributeAccelerator = element
.getAttribute("Accelerator");
if (attributeAccelerator != null) {
contentValue = contentValue + '\t'
+ getContentValue(attributeAccelerator.getContent());
}
}
if (contentValue != null && "Accelerator".equalsIgnoreCase(attrName)) {
contentValue = XWTMaps.getCombAccelerator(contentValue);