Search in sources :

Example 31 with Table

use of com.codename1.ui.table.Table in project CodeRAD by shannah.

the class UI method table.

public static FieldNode table(Attribute... atts) {
    FieldNode fieldNode = new FieldNode(atts);
    fieldNode.setAttributes(TABLE);
    return fieldNode;
}
Also used : FieldNode(com.codename1.rad.nodes.FieldNode)

Example 32 with Table

use of com.codename1.ui.table.Table in project CodeRAD by shannah.

the class AbstractTableCellRenderer method createCellConstraint.

@Override
public TableLayout.Constraint createCellConstraint(Table table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    TableLayout tl = (TableLayout) table.getLayout();
    TableLayout.Constraint cnst = tl.createConstraint(row, column);
    return cnst;
}
Also used : TableLayout(com.codename1.ui.table.TableLayout)

Example 33 with Table

use of com.codename1.ui.table.Table in project CodeRAD by shannah.

the class DefaultTableCellEditor method getTableCellEditorComponent.

@Override
public Component getTableCellEditorComponent(Table table, Object value, boolean isSelected, int row, int column) {
    TextField tf = new TextField();
    TableModel model = table.getModel();
    ContentType contentType = model.getCellContentType(row, column);
    String strVal = value == null ? "" : String.valueOf(value);
    tf.setText(strVal);
    tf.addDataChangedListener((type, index) -> {
        table.getModel().setValueAt(ContentType.convert(Text, tf.getText(), contentType), row, column);
    });
    return tf;
}
Also used : ContentType(com.codename1.rad.models.ContentType) TextField(com.codename1.ui.TextField)

Example 34 with Table

use of com.codename1.ui.table.Table 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);
}
Also used : Entity(com.codename1.rad.models.Entity) FieldNode(com.codename1.rad.nodes.FieldNode) Editable(com.codename1.rad.models.Property.Editable)

Aggregations

Component (com.codename1.ui.Component)7 Hashtable (java.util.Hashtable)7 BorderLayout (com.codename1.ui.layouts.BorderLayout)5 Cursor (com.codename1.db.Cursor)4 Form (com.codename1.ui.Form)4 TableLayout (com.codename1.ui.table.TableLayout)4 ArrayList (java.util.ArrayList)4 Database (com.codename1.db.Database)3 FieldNode (com.codename1.rad.nodes.FieldNode)3 Container (com.codename1.ui.Container)3 Label (com.codename1.ui.Label)3 TextArea (com.codename1.ui.TextArea)3 IOException (java.io.IOException)3 Vector (java.util.Vector)3 Entity (com.codename1.rad.models.Entity)2 ActionEvent (com.codename1.ui.events.ActionEvent)2 BoxLayout (com.codename1.ui.layouts.BoxLayout)2 Border (com.codename1.ui.plaf.Border)2 Style (com.codename1.ui.plaf.Style)2 UIBuilderOverride (com.codename1.ui.util.UIBuilderOverride)2