use of com.extjs.gxt.ui.client.widget.form.NumberField in project activityinfo by bedatadriven.
the class TargetIndicatorView method setValidatorForCellBeforeEdit.
private void setValidatorForCellBeforeEdit(TargetValueDTO targetValueDTO, int column) {
TextField field = new TextField<String>();
field.setAllowBlank(true);
IndicatorDTO indicatorById = presenter.getIndicatorById(targetValueDTO.getIndicatorId());
FieldTypeClass type = indicatorById.getType();
if (type == FieldTypeClass.QUANTITY) {
field = new NumberField();
((NumberField) field).setFormat(IndicatorNumberFormat.INSTANCE);
field.setAllowBlank(true);
}
tree.getColumnModel().getColumn(column).setEditor(new CellEditor(field));
}
use of com.extjs.gxt.ui.client.widget.form.NumberField in project activityinfo by bedatadriven.
the class IndicatorSection method createQuantityField.
private NumberField createQuantityField() {
NumberField numberField = new NumberField();
numberField.setFormat(IndicatorNumberFormat.INSTANCE);
numberField.setWidth(NUMBER_FIELD_WIDTH);
numberField.setStyleAttribute("textAlign", "right");
return numberField;
}
use of com.extjs.gxt.ui.client.widget.form.NumberField 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.form.NumberField 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