use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class Node method merge.
/**
* Flattens attributes in provided arrays into a single Attribute[] array.
* @param arrs
* @return
*/
protected static final Attribute[] merge(Attribute[]... arrs) {
int outerLen = arrs.length;
int totalLen = 0;
for (int i = 0; i < outerLen; i++) {
Attribute[] atts = arrs[i];
int innerLen = atts.length;
totalLen += innerLen;
}
Attribute[] out = new Attribute[totalLen];
int i = 0;
for (Attribute[] atts : arrs) {
for (Attribute att : atts) {
out[i++] = att;
}
}
return out;
}
use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class Node method createPropertySelector.
/**
* Creates a property selector on the given entity using (in order of decreasing precedence):
*
* 1. A {@link PropertyNode} attribute on the node.
* 2. A {@link Tags} attribute on the node.
* 3. A {@link PropertySelectorAttribute} on the node.
*
* @param entity The entity on which the property selector should be created.
* @return The property selector.
*/
public PropertySelector createPropertySelector(Entity entity) {
PropertyNode prop = findAttribute(PropertyNode.class);
if (prop != null) {
return new PropertySelector(entity, prop.getValue());
}
Tags tags = findAttribute(Tags.class);
if (tags != null) {
return new PropertySelector(entity, tags.toArray());
}
PropertySelectorAttribute att = (PropertySelectorAttribute) findAttribute(PropertySelectorAttribute.class);
if (att != null) {
return att.getValue(entity);
}
return null;
}
use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class TableColumns method setAttributes.
@Override
public void setAttributes(Attribute... atts) {
if (fields == null) {
fields = new ArrayList<>();
}
for (Attribute att : atts) {
if (att instanceof FieldNode) {
FieldNode fn = (FieldNode) att;
fn = fn.createProxy(this);
fields.add(fn);
} else {
super.setAttributes(att);
}
}
}
use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class UI method switchListY.
public static FieldNode switchListY(Attribute... atts) {
FieldNode fieldNode = switchList(atts);
fieldNode.setAttributes(buttonListY());
return fieldNode;
}
use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class UI method toggleSwitch.
public static FieldNode toggleSwitch(Attribute... atts) {
FieldNode fieldNode = new FieldNode(atts);
fieldNode.setAttributes(SWITCH);
return fieldNode;
}
Aggregations