Search in sources :

Example 1 with TextField

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));
}
Also used : TextField(com.extjs.gxt.ui.client.widget.form.TextField) FieldTypeClass(org.activityinfo.model.type.FieldTypeClass) NumberField(com.extjs.gxt.ui.client.widget.form.NumberField)

Example 2 with TextField

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;
}
Also used : TextArea(com.extjs.gxt.ui.client.widget.form.TextArea) TextField(com.extjs.gxt.ui.client.widget.form.TextField)

Example 3 with TextField

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);
            }
        }
    }
}
Also used : IndicatorDTO(org.activityinfo.legacy.shared.model.IndicatorDTO) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) HBoxLayout(com.extjs.gxt.ui.client.widget.layout.HBoxLayout) TextField(com.extjs.gxt.ui.client.widget.form.TextField) Text(com.extjs.gxt.ui.client.widget.Text)

Example 4 with TextField

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);
}
Also used : TreeGridCellRenderer(com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer) ArrayList(java.util.ArrayList) TextField(com.extjs.gxt.ui.client.widget.form.TextField)

Aggregations

TextField (com.extjs.gxt.ui.client.widget.form.TextField)4 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 Text (com.extjs.gxt.ui.client.widget.Text)1 NumberField (com.extjs.gxt.ui.client.widget.form.NumberField)1 TextArea (com.extjs.gxt.ui.client.widget.form.TextArea)1 HBoxLayout (com.extjs.gxt.ui.client.widget.layout.HBoxLayout)1 TreeGridCellRenderer (com.extjs.gxt.ui.client.widget.treegrid.TreeGridCellRenderer)1 ArrayList (java.util.ArrayList)1 IndicatorDTO (org.activityinfo.legacy.shared.model.IndicatorDTO)1 FieldTypeClass (org.activityinfo.model.type.FieldTypeClass)1