Search in sources :

Example 1 with TableData

use of com.extjs.gxt.ui.client.widget.layout.TableData in project activityinfo by bedatadriven.

the class IndicatorSection method addQuantityTable.

private void addQuantityTable(IndicatorGroup group) {
    // Layout in three columns
    // Label | Field | Units
    TableData fieldLayout = new TableData();
    fieldLayout.setWidth(NUMBER_FIELD_WIDTH + "px");
    fieldLayout.setVerticalAlign(Style.VerticalAlignment.TOP);
    TableData unitLayout = new TableData();
    unitLayout.setWidth(UNITS_FIELD_WIDTH + "px");
    unitLayout.setVerticalAlign(Style.VerticalAlignment.TOP);
    TableLayout layout = new TableLayout();
    layout.setWidth("100%");
    layout.setColumns(3);
    layout.setCellPadding(5);
    LayoutContainer table = new LayoutContainer();
    table.setLayout(layout);
    table.setAutoHeight(true);
    for (IndicatorDTO indicator : group.getIndicators()) {
        if (!indicator.isCalculated() && indicator.isVisible()) {
            Text fieldLabel = createLabel(indicator);
            Field field = createField(indicator);
            field.setWidth(NUMBER_FIELD_WIDTH);
            Text unitLabel = new Text(indicator.getUnits());
            unitLabel.setWidth(UNITS_FIELD_WIDTH);
            unitLabel.setStyleAttribute("fontSize", "9pt");
            table.add(fieldLabel);
            table.add(field, fieldLayout);
            table.add(unitLabel, unitLayout);
        }
    }
    add(table);
}
Also used : TextField(com.extjs.gxt.ui.client.widget.form.TextField) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField) Field(com.extjs.gxt.ui.client.widget.form.Field) IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Text(com.extjs.gxt.ui.client.widget.Text) TableData(com.extjs.gxt.ui.client.widget.layout.TableData) TableLayout(com.extjs.gxt.ui.client.widget.layout.TableLayout)

Aggregations

LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 Text (com.extjs.gxt.ui.client.widget.Text)1 Field (com.extjs.gxt.ui.client.widget.form.Field)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 TextField (com.extjs.gxt.ui.client.widget.form.TextField)1 TableData (com.extjs.gxt.ui.client.widget.layout.TableData)1 TableLayout (com.extjs.gxt.ui.client.widget.layout.TableLayout)1 IndicatorDTO (org.activityinfo.legacy.shared.model.IndicatorDTO)1