Search in sources :

Example 11 with ColumnConfig

use of com.extjs.gxt.ui.client.widget.grid.ColumnConfig in project activityinfo by bedatadriven.

the class MonthlyGrid method createColumnModel.

private static ColumnModel createColumnModel() {
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
    ColumnConfig indicator = new ColumnConfig("indicatorName", I18N.CONSTANTS.indicators(), ROW_HEADER_WIDTH);
    indicator.setSortable(false);
    indicator.setMenuDisabled(true);
    columns.add(indicator);
    for (int i = 0; i != MONTHS_TO_SHOW; ++i) {
        NumberField indicatorField = new NumberField();
        indicatorField.getPropertyEditor().setFormat(IndicatorNumberFormat.INSTANCE);
        ColumnConfig valueColumn = new ColumnConfig("month" + i, "", MONTH_COLUMN_WIDTH);
        valueColumn.setNumberFormat(IndicatorNumberFormat.INSTANCE);
        valueColumn.setEditor(new CellEditor(indicatorField));
        valueColumn.setSortable(false);
        valueColumn.setMenuDisabled(true);
        columns.add(valueColumn);
    }
    return new ColumnModel(columns);
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) CellEditor(com.extjs.gxt.ui.client.widget.grid.CellEditor) ArrayList(java.util.ArrayList) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField)

Example 12 with ColumnConfig

use of com.extjs.gxt.ui.client.widget.grid.ColumnConfig in project activityinfo by bedatadriven.

the class ColumnModelBuilder method createIndicatorColumn.

public ColumnConfig createIndicatorColumn(IndicatorDTO indicator, String header) {
    NumberField indicatorField = new NumberField();
    indicatorField.getPropertyEditor().setFormat(IndicatorNumberFormat.INSTANCE);
    ColumnConfig indicatorColumn = new ColumnConfig(indicator.getPropertyName(), header, 50);
    indicatorColumn.setToolTip(indicator.getName());
    indicatorColumn.setNumberFormat(IndicatorNumberFormat.INSTANCE);
    indicatorColumn.setEditor(new CellEditor(indicatorField));
    indicatorColumn.setAlignment(Style.HorizontalAlignment.RIGHT);
    if (indicator.getType() == FieldTypeClass.QUANTITY) {
        // (it looks better if we don't)
        if (indicator.getAggregation() == IndicatorDTO.AGGREGATE_SUM) {
            indicatorColumn.setRenderer(new QuantityCellRenderer());
        } else if (indicator.getAggregation() == IndicatorDTO.AGGREGATE_SITE_COUNT) {
            indicatorColumn.setRenderer(new SiteCountCellRenderer());
        }
    } else if (indicator.getType() == FieldTypeClass.FREE_TEXT || indicator.getType() == FieldTypeClass.NARRATIVE) {
        indicatorColumn.setRenderer(new TextIndicatorCellRenderer());
    }
    return indicatorColumn;
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig) CellEditor(com.extjs.gxt.ui.client.widget.grid.CellEditor) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField)

Example 13 with ColumnConfig

use of com.extjs.gxt.ui.client.widget.grid.ColumnConfig in project activityinfo by bedatadriven.

the class ColumnModelBuilder method addAdminLevelColumns.

public ColumnModelBuilder addAdminLevelColumns(List<AdminLevelDTO> adminLevels) {
    for (AdminLevelDTO level : adminLevels) {
        ColumnConfig column = new ColumnConfig(AdminLevelDTO.getPropertyName(level.getId()), level.getName(), 100);
        column.setToolTip(level.getName());
        columns.add(column);
    }
    return this;
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig)

Example 14 with ColumnConfig

use of com.extjs.gxt.ui.client.widget.grid.ColumnConfig in project activityinfo by bedatadriven.

the class ColumnModelBuilder method addDatabaseColumn.

public ColumnModelBuilder addDatabaseColumn(final SchemaDTO schema) {
    ColumnConfig config = new ColumnConfig("activityId", I18N.CONSTANTS.database(), 100);
    config.setToolTip(I18N.CONSTANTS.database());
    config.setRenderer(new DatabaseCellRenderer(schema));
    columns.add(config);
    return this;
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig)

Example 15 with ColumnConfig

use of com.extjs.gxt.ui.client.widget.grid.ColumnConfig in project activityinfo by bedatadriven.

the class ColumnModelBuilder method addPartnerColumn.

public ColumnModelBuilder addPartnerColumn() {
    ColumnConfig column = new ColumnConfig("partner.name", I18N.CONSTANTS.partner(), 100);
    column.setToolTip(I18N.CONSTANTS.partner());
    columns.add(column);
    return this;
}
Also used : ColumnConfig(com.extjs.gxt.ui.client.widget.grid.ColumnConfig)

Aggregations

ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)15 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)5 ArrayList (java.util.ArrayList)5 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)2 CellEditor (com.extjs.gxt.ui.client.widget.grid.CellEditor)2 GridEvent (com.extjs.gxt.ui.client.event.GridEvent)1 EditorGrid (com.extjs.gxt.ui.client.widget.grid.EditorGrid)1 VBoxLayoutData (com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData)1 EditColorColumn (org.activityinfo.ui.client.page.common.columns.EditColorColumn)1 ReadTextColumn (org.activityinfo.ui.client.page.common.columns.ReadTextColumn)1