Search in sources :

Example 1 with TablePropertyView

use of com.codename1.rad.propertyviews.TablePropertyView in project CodeRAD by shannah.

the class TablePropertyView method update.

@Override
public void update() {
    super.update();
    EntityListTableModel model = (EntityListTableModel) getComponent().getModel();
    EntityList list = model.getEntityList();
    EntityList ePropertyVal = getPropertyAsEntityList();
    if (ePropertyVal == list) {
        return;
    }
    TableColumns columns = (TableColumns) getField().findAttribute(TableColumns.class);
    if (columns == null) {
        throw new IllegalStateException("Cannot create TablePropertyView for field " + getField() + " because the field does not define any columns.  Add a ColumnsNode attribute to the field.");
    }
    EntityListTableModel newModel = new EntityListTableModel(list.getRowType(), ePropertyVal, columns);
    getComponent().setModel(newModel);
}
Also used : TableColumns(com.codename1.rad.nodes.TableColumns) EntityList(com.codename1.rad.models.EntityList) EntityListTableModel(com.codename1.rad.ui.table.EntityListTableModel)

Example 2 with TablePropertyView

use of com.codename1.rad.propertyviews.TablePropertyView in project CodeRAD by shannah.

the class TablePropertyView method getPropertyAsEntityList.

private EntityList getPropertyAsEntityList() {
    Object propertyVal = getEntity().getEntity().get(getProperty());
    if (!(propertyVal instanceof EntityList)) {
        throw new IllegalStateException("TablePropertyView only supports EntityList properties");
    }
    EntityList ePropertyVal = (EntityList) propertyVal;
    return ePropertyVal;
}
Also used : EntityList(com.codename1.rad.models.EntityList)

Aggregations

EntityList (com.codename1.rad.models.EntityList)2 TableColumns (com.codename1.rad.nodes.TableColumns)1 EntityListTableModel (com.codename1.rad.ui.table.EntityListTableModel)1