use of com.codename1.rad.attributes.NodeDecoratorAttribute in project CodeRAD by shannah.
the class Node method setAttributes.
/**
* Sets attributes on this node.
* @param atts The attributes to set.
*/
public void setAttributes(Attribute... atts) {
for (Attribute att : atts) {
if (att == null) {
continue;
}
if (att instanceof Node) {
Node n = (Node) att;
if (n.parent != null && n.parent != this) {
if (n.canProxy()) {
n = n.proxy(this);
} else {
throw new IllegalStateException("Node " + n + " already has parent " + n.parent + ". Cannot be added to " + this);
}
} else {
n.parent = this;
}
NodeDecoratorAttribute nodeDecorator = (NodeDecoratorAttribute) n.findAttribute(NodeDecoratorAttribute.class);
if (nodeDecorator != null) {
// System.out.println("Decorating node "+n+" with "+nodeDecorator.getValue());
nodeDecorator.getValue().decorate(n);
}
this.childNodes.add(n);
}
if (att.getClass() == ViewPropertyParameterAttribute.class) {
ViewPropertyParameterAttribute valueAtt = (ViewPropertyParameterAttribute) att;
ViewPropertyParameter val = (ViewPropertyParameter) valueAtt.getValue();
viewParameters.put(val.getProperty(), val);
}
if (att.getClass() == ActionsNode.class) {
ActionsNode actionsNode = (ActionsNode) att;
ActionNode.Category category = actionsNode.getCategory();
if (category != null) {
actions.put(category, actionsNode);
}
}
}
this.attributes.setAttributes(atts);
}
Aggregations