Search in sources :

Example 1 with EntityViewFactory

use of com.codename1.rad.ui.EntityViewFactory in project CodeRAD by shannah.

the class DefaultEntityViewFactory method createView.

@Override
public EntityView createView(Entity entity, ViewNode node) {
    ViewType type = (ViewType) node.findAttribute(ViewType.class);
    if (type == null) {
        type = ViewType.MULTIBUTTON;
    }
    EntityViewFactory f = registry.get(type);
    if (f == null) {
        throw new IllegalArgumentException("Factory doesn't know how to build view " + type);
    }
    EntityView out = f.createView(entity, node);
    return makeSwipeable(entity, node, (Component) out);
}
Also used : WrapperEntityView(com.codename1.rad.ui.entityviews.WrapperEntityView) MultiButtonEntityView(com.codename1.rad.ui.entityviews.MultiButtonEntityView) ViewType(com.codename1.rad.attributes.ViewType)

Example 2 with EntityViewFactory

use of com.codename1.rad.ui.EntityViewFactory in project CodeRAD by shannah.

the class TabsEntityView method createViewTab.

private EntityView createViewTab(ViewNode vn) {
    EntityViewFactory factory = vn.getViewFactory(null);
    if (factory == null) {
        return null;
    }
    Entity tabEntity = null;
    PropertySelector sel = vn.createPropertySelector(getEntity());
    if (sel == null) {
        return null;
    }
    tabEntity = sel.getEntity(null);
    if (tabEntity == null) {
        return null;
    }
    return factory.createView(tabEntity, vn);
}
Also used : EntityViewFactory(com.codename1.rad.ui.EntityViewFactory) Entity(com.codename1.rad.models.Entity) PropertySelector(com.codename1.rad.models.PropertySelector)

Aggregations

ViewType (com.codename1.rad.attributes.ViewType)1 Entity (com.codename1.rad.models.Entity)1 PropertySelector (com.codename1.rad.models.PropertySelector)1 EntityViewFactory (com.codename1.rad.ui.EntityViewFactory)1 MultiButtonEntityView (com.codename1.rad.ui.entityviews.MultiButtonEntityView)1 WrapperEntityView (com.codename1.rad.ui.entityviews.WrapperEntityView)1