Search in sources :

Example 1 with CellEditor

use of com.extjs.gxt.ui.client.widget.grid.CellEditor 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 2 with CellEditor

use of com.extjs.gxt.ui.client.widget.grid.CellEditor 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)

Aggregations

NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)2 CellEditor (com.extjs.gxt.ui.client.widget.grid.CellEditor)2 ColumnConfig (com.extjs.gxt.ui.client.widget.grid.ColumnConfig)2 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)1 ArrayList (java.util.ArrayList)1