use of com.extjs.gxt.ui.client.widget.form.TextField 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.TextField in project activityinfo by bedatadriven.
the class IndicatorSection method createField.
private TextField createField(IndicatorDTO indicator) {
TextField field;
if (indicator.getType() == FieldTypeClass.NARRATIVE) {
field = new TextArea();
} else if (indicator.getType() == FieldTypeClass.QUANTITY) {
field = createQuantityField();
} else {
field = new TextField();
}
field.setName(indicator.getPropertyName());
field.setAllowBlank(!indicator.isMandatory());
field.setToolTip(toolTip(indicator));
indicatorFields.add(field);
return field;
}
use of com.extjs.gxt.ui.client.widget.form.TextField in project activityinfo by bedatadriven.
the class IndicatorSection method addMixedGroup.
private void addMixedGroup(IndicatorGroup group) {
for (IndicatorDTO indicator : group.getIndicators()) {
if (!indicator.isCalculated() && indicator.isVisible()) {
Text fieldLabel = createLabel(indicator);
fieldLabel.setStyleAttribute("marginTop", "8px");
fieldLabel.setStyleAttribute("marginBottom", "3px");
add(fieldLabel);
TextField field = createField(indicator);
if (indicator.getType() == FieldTypeClass.QUANTITY) {
HBoxLayout rowLayout = new HBoxLayout();
rowLayout.setHBoxLayoutAlign(HBoxLayout.HBoxLayoutAlign.MIDDLE);
Text unitsLabel = new Text(indicator.getUnits());
unitsLabel.setStyleAttribute("paddingLeft", "5px");
LayoutContainer row = new LayoutContainer();
row.setLayout(rowLayout);
row.add(field);
row.add(unitsLabel);
add(row);
} else {
field.setWidth(TEXT_FIELD_WIDTH);
add(field);
}
}
}
}
use of com.extjs.gxt.ui.client.widget.form.TextField in project activityinfo by bedatadriven.
the class TargetIndicatorView method createColumnModel.
private ColumnModel createColumnModel() {
List<ColumnConfig> columns = new ArrayList<>();
ColumnConfig nameColumn = new ColumnConfig("name", I18N.CONSTANTS.indicator(), 250);
nameColumn.setRenderer(new TreeGridCellRenderer());
columns.add(nameColumn);
TextField<String> valueField = new TextField<String>();
valueField.setAllowBlank(true);
ColumnConfig valueColumn = new ColumnConfig("value", I18N.CONSTANTS.targetValue(), 150);
valueColumn.setEditor(new CellEditor(valueField));
valueColumn.setRenderer(new TargetValueCellRenderer());
columns.add(valueColumn);
return new ColumnModel(columns);
}
Aggregations