Search in sources :

Example 11 with FieldNode

use of com.codename1.rad.nodes.FieldNode in project CodeRAD by shannah.

the class EntityListTableCellEditor method getTableCellEditorComponent.

@Override
public Component getTableCellEditorComponent(Table table, Object value, boolean isSelected, int row, int column) {
    EntityListTableModel model = (EntityListTableModel) table.getModel();
    FieldNode field = model.getColumnField(column);
    Entity entity = model.getEntity(row);
    if (entity == null) {
        if (parent != null) {
            return parent.getTableCellEditorComponent(table, value, isSelected, row, column);
        } else {
            return new com.codename1.ui.Label();
        }
    }
    return viewFactory.createPropertyView(entity, field);
}
Also used : Entity(com.codename1.rad.models.Entity) FieldNode(com.codename1.rad.nodes.FieldNode)

Example 12 with FieldNode

use of com.codename1.rad.nodes.FieldNode in project CodeRAD by shannah.

the class EntityListTableModel method getValueAt.

@Override
public Object getValueAt(int rowIndex, int columnIndex) {
    Entity e = entities.get(rowIndex);
    FieldNode column = columns.getColumn(columnIndex);
    PropertyNode prop = column.getProperty();
    if (prop != null) {
        return prop.getValue().getValue(e.getEntity());
    } else {
        return "";
    }
}
Also used : Entity(com.codename1.rad.models.Entity) FieldNode(com.codename1.rad.nodes.FieldNode) PropertyNode(com.codename1.rad.nodes.PropertyNode)

Example 13 with FieldNode

use of com.codename1.rad.nodes.FieldNode in project CodeRAD by shannah.

the class FieldNode method copy.

public FieldNode copy() {
    FieldNode out = new FieldNode();
    for (Attribute att : attributes) {
        out.setAttributes(att);
    }
    out.setProxying(getProxying());
    out.setParent(getParent());
    return out;
}
Also used : LabelStyleAttribute(com.codename1.rad.ui.EntityEditor.LabelStyleAttribute) PropertySelectorAttribute(com.codename1.rad.attributes.PropertySelectorAttribute) DescriptionStyleAttribute(com.codename1.rad.ui.EntityEditor.DescriptionStyleAttribute) PropertyImageRendererAttribute(com.codename1.rad.attributes.PropertyImageRendererAttribute) Attribute(com.codename1.rad.models.Attribute)

Example 14 with FieldNode

use of com.codename1.rad.nodes.FieldNode 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 15 with FieldNode

use of com.codename1.rad.nodes.FieldNode in project CodeRAD by shannah.

the class ButtonListPropertyView method decorateButtonList.

private static ButtonList decorateButtonList(FieldNode field, ButtonList bl) {
    ButtonListLayoutAttribute att = (ButtonListLayoutAttribute) field.findInheritedAttribute(ButtonListLayoutAttribute.class);
    if (att != null) {
        switch(att.getValue()) {
            case Flow:
                bl.setLayout(new FlowLayout());
                break;
            case Y:
                bl.setLayout(BoxLayout.y());
                break;
            case X:
                bl.setLayout(BoxLayout.x());
                break;
            case Grid:
                Columns cols = (Columns) field.findAttribute(Columns.class);
                int numCols = 2;
                if (cols != null) {
                    numCols = cols.getValue();
                }
                bl.setLayout(new GridLayout(numCols));
                break;
        }
    }
    String uiid = field.getUIID(null);
    if (uiid != null) {
        bl.setUIID(uiid);
        bl.setCellUIID(uiid + "Cell");
    }
    return bl;
}
Also used : GridLayout(com.codename1.ui.layouts.GridLayout) FlowLayout(com.codename1.ui.layouts.FlowLayout) Columns(com.codename1.rad.attributes.Columns)

Aggregations

FieldNode (com.codename1.rad.nodes.FieldNode)25 Attribute (com.codename1.rad.models.Attribute)3 Entity (com.codename1.rad.models.Entity)3 LabelPropertyView (com.codename1.rad.propertyviews.LabelPropertyView)2 SpanLabelPropertyView (com.codename1.rad.propertyviews.SpanLabelPropertyView)2 TextAreaPropertyView (com.codename1.rad.propertyviews.TextAreaPropertyView)2 TextFieldPropertyView (com.codename1.rad.propertyviews.TextFieldPropertyView)2 SpanLabel (com.codename1.components.SpanLabel)1 Columns (com.codename1.rad.attributes.Columns)1 PropertyImageRendererAttribute (com.codename1.rad.attributes.PropertyImageRendererAttribute)1 PropertySelectorAttribute (com.codename1.rad.attributes.PropertySelectorAttribute)1 PropertyViewDecoratorAttribute (com.codename1.rad.attributes.PropertyViewDecoratorAttribute)1 Property (com.codename1.rad.models.Property)1 Editable (com.codename1.rad.models.Property.Editable)1 Node (com.codename1.rad.nodes.Node)1 OptionsNode (com.codename1.rad.nodes.OptionsNode)1 PropertyNode (com.codename1.rad.nodes.PropertyNode)1 PropertyViewDecoratorNode (com.codename1.rad.nodes.PropertyViewDecoratorNode)1 PropertyViewFactoryNode (com.codename1.rad.nodes.PropertyViewFactoryNode)1 ButtonListPropertyView (com.codename1.rad.propertyviews.ButtonListPropertyView)1