Search in sources :

Example 26 with Attribute

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;
}
Also used : ViewPropertyParameterAttribute(com.codename1.rad.attributes.ViewPropertyParameterAttribute) NodeDecoratorAttribute(com.codename1.rad.attributes.NodeDecoratorAttribute) PropertySelectorAttribute(com.codename1.rad.attributes.PropertySelectorAttribute)

Example 27 with Attribute

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;
}
Also used : PropertySelectorAttribute(com.codename1.rad.attributes.PropertySelectorAttribute)

Example 28 with Attribute

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);
        }
    }
}
Also used : Attribute(com.codename1.rad.models.Attribute)

Example 29 with Attribute

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;
}
Also used : FieldNode(com.codename1.rad.nodes.FieldNode)

Example 30 with Attribute

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;
}
Also used : FieldNode(com.codename1.rad.nodes.FieldNode)

Aggregations

FieldNode (com.codename1.rad.nodes.FieldNode)14 PropertySelectorAttribute (com.codename1.rad.attributes.PropertySelectorAttribute)6 Attribute (com.codename1.rad.models.Attribute)6 NodeDecoratorAttribute (com.codename1.rad.attributes.NodeDecoratorAttribute)4 ViewPropertyParameterAttribute (com.codename1.rad.attributes.ViewPropertyParameterAttribute)4 Label (com.codename1.ui.Label)3 BorderLayout (com.codename1.ui.layouts.BorderLayout)3 ActionNode (com.codename1.rad.nodes.ActionNode)2 Container (com.codename1.ui.Container)2 Hashtable (java.util.Hashtable)2 Switch (com.codename1.components.Switch)1 CharArrayReader (com.codename1.io.CharArrayReader)1 Log (com.codename1.io.Log)1 NetworkEvent (com.codename1.io.NetworkEvent)1 DateFormat (com.codename1.l10n.DateFormat)1 RAD (com.codename1.rad.annotations.RAD)1 RADDoc (com.codename1.rad.annotations.RADDoc)1 ActionStyleAttribute (com.codename1.rad.attributes.ActionStyleAttribute)1 PropertyImageRendererAttribute (com.codename1.rad.attributes.PropertyImageRendererAttribute)1 Entity (com.codename1.rad.models.Entity)1