use of com.codename1.rad.ui.table.EntityListTableModel 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);
}
use of com.codename1.rad.ui.table.EntityListTableModel 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);
}
use of com.codename1.rad.ui.table.EntityListTableModel in project CodeRAD by shannah.
the class TablePropertyView method commit.
@Override
public void commit() {
EntityListTableModel model = (EntityListTableModel) getComponent().getModel();
EntityList list = model.getEntityList();
EntityList ePropertyVal = getPropertyAsEntityList();
if (ePropertyVal == list) {
return;
}
getEntity().getEntity().set(getProperty(), list);
}
use of com.codename1.rad.ui.table.EntityListTableModel in project CodeRAD by shannah.
the class EntityListTableCellRenderer method getTableCellRendererComponent.
@Override
public Component getTableCellRendererComponent(Table table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
EntityListTableModel model = (EntityListTableModel) table.getModel();
FieldNode field = model.getColumnField(column);
FieldNode fieldCopy = field.copy();
fieldCopy.setAttributes(new Editable(false));
Entity entity = model.getEntity(row);
if (entity == null) {
if (parent != null) {
return parent.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
} else {
return new com.codename1.ui.Label();
}
}
return viewFactory.createPropertyView(entity, fieldCopy);
}
Aggregations