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;
}
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();
}
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);
}
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);
}
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);
}
Aggregations