Search in sources :

Example 21 with Tag

use of com.codename1.rad.models.Tag in project CodeRAD by shannah.

the class FieldNode method getPropertySelector.

/**
 * Gets a property selector for this field node.  If the field contained
 * a PropertyNode or a Tags node, then it will construct a selector from those.
 *
 * Otherwise it will check for a {@link ProeprtySelectorAttribute}, and return
 * a selector constructed form that, with the provided entity root.
 * @param context
 * @return A property selector, or null if no property or tag is set, and no property selector is set.
 */
public PropertySelector getPropertySelector(Entity context) {
    if (context == null) {
        return null;
    }
    Property prop = getProperty(context.getEntity().getEntityType());
    if (prop != null) {
        return new PropertySelector(context, prop);
    }
    Tags tags = getTags();
    if (tags != null) {
        return new PropertySelector(context, tags.toArray());
    }
    PropertySelectorAttribute selectorProvider = (PropertySelectorAttribute) findAttribute(PropertySelectorAttribute.class);
    if (selectorProvider != null) {
        return selectorProvider.getValue(context);
    }
    return null;
}
Also used : PropertySelector(com.codename1.rad.models.PropertySelector) PropertySelectorAttribute(com.codename1.rad.attributes.PropertySelectorAttribute) Property(com.codename1.rad.models.Property) Tags(com.codename1.rad.models.Tags)

Example 22 with Tag

use of com.codename1.rad.models.Tag in project CodeRAD by shannah.

the class Properties method getName.

public static String getName(Property p) {
    Name n = (Name) p.getAttribute(Name.class);
    String nameStr = null;
    if (n != null) {
        nameStr = n.getValue();
        if (nameStr != null && !nameStr.isEmpty()) {
            return nameStr;
        }
    }
    Tags tags = (Tags) p.getAttribute(Tags.class);
    if (tags != null) {
        for (Tag t : tags) {
            String tname = t.getName();
            if (tname != null && !tname.isEmpty()) {
                return tname;
            }
        }
    }
    return p.toString();
}
Also used : Name(com.codename1.rad.models.Property.Name)

Example 23 with Tag

use of com.codename1.rad.models.Tag in project CodeRAD by shannah.

the class UIBuilder method textField.

public TextFieldPropertyView textField(Tag... tags) {
    FieldNode fn = new FieldNode(UI.tags(tags));
    fn.setParent(parentNode);
    return new TextFieldPropertyView(new TextField(), entity, fn);
}
Also used : FieldNode(com.codename1.rad.nodes.FieldNode) TextFieldPropertyView(com.codename1.rad.propertyviews.TextFieldPropertyView) TextField(com.codename1.ui.TextField)

Example 24 with Tag

use of com.codename1.rad.models.Tag in project CodeRAD by shannah.

the class UIBuilder method image.

public LabelPropertyView image(Tag... tags) {
    FieldNode fn = new FieldNode(UI.tags(tags));
    fn.setParent(parentNode);
    return LabelPropertyView.createIconLabel(new com.codename1.ui.Label(), entity, fn);
}
Also used : FieldNode(com.codename1.rad.nodes.FieldNode)

Example 25 with Tag

use of com.codename1.rad.models.Tag in project CodeRAD by shannah.

the class UIBuilder method label.

public LabelPropertyView label(Tag... tags) {
    FieldNode fn = new FieldNode(UI.tags(tags));
    fn.setParent(parentNode);
    return new LabelPropertyView(new com.codename1.ui.Label(), entity, fn);
}
Also used : LabelPropertyView(com.codename1.rad.propertyviews.LabelPropertyView) SpanLabelPropertyView(com.codename1.rad.propertyviews.SpanLabelPropertyView) FieldNode(com.codename1.rad.nodes.FieldNode)

Aggregations

FieldNode (com.codename1.rad.nodes.FieldNode)6 Label (com.codename1.ui.Label)6 Container (com.codename1.ui.Container)5 BorderLayout (com.codename1.ui.layouts.BorderLayout)5 BoxLayout (com.codename1.ui.layouts.BoxLayout)5 Log (com.codename1.io.Log)4 ResultParser (com.codename1.rad.io.ResultParser)4 Entity (com.codename1.rad.models.Entity)4 Thing (com.codename1.rad.schemas.Thing)4 Hashtable (java.util.Hashtable)4 RAD (com.codename1.rad.annotations.RAD)3 Component (com.codename1.ui.Component)3 Dialog (com.codename1.ui.Dialog)3 TextArea (com.codename1.ui.TextArea)3 Element (com.codename1.xml.Element)3 XMLParser (com.codename1.xml.XMLParser)3 IOException (java.io.IOException)3 NetworkEvent (com.codename1.io.NetworkEvent)2 ParseException (com.codename1.l10n.ParseException)2 SimpleDateFormat (com.codename1.l10n.SimpleDateFormat)2