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);
}
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;
}
Aggregations