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)); }
/** * Configures the passed text field to fail validation when having empty string values.<br/> Additionally, * configures the passed field to be validated when rendered. * * @param field */ public void configTextFieldForNonEmptyValues(TextField<String> field) { field.setAllowBlank(false); field.setAutoValidate(true); field.setValidator(nonEmptyStringValidator); field.addListener(Events.Render, validatorListener); field.addListener(Events.OnKeyUp, validatorListener); field.addListener(Events.Change, validatorListener); }
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); }
public FolderForm() { super(); binding = new FormBinding(this); UiConstants constants = GWT.create(UiConstants.class); nameField = new TextField<String>(); nameField.setFieldLabel(constants.name()); nameField.setMaxLength(PROJECT_MAX_LENGTH); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator()); binding.addFieldBinding(new FieldBinding(nameField, "name")); this.add(nameField); }
instanceName.setAllowBlank(false); instanceName.setFieldLabel("name"); fieldSet.add(instanceName); instanceDescription.setAllowBlank(false); instanceDescription.setFieldLabel("description"); fieldSet.add(instanceDescription); instanceBaseURL.setAllowBlank(false); instanceBaseURL.setFieldLabel("base url"); fieldSet.add(instanceBaseURL); instanceUsername.setAllowBlank(false); instanceUsername.setFieldLabel("username"); fieldSet.add(instanceUsername); instancePassword.setAllowBlank(false); instancePassword.setPassword(true); instancePassword.setFieldLabel("password");
/** * Configures the text field as required: blank/empty strings not allowed, validates on render, and "Required field" * messages are shown when blank/empty.<br/> * @param field */ @SuppressWarnings("unchecked") public void configRequired(TextField<?> field) { field.setAllowBlank(false); field.setValidator(nonEmptyStringsValidator); field.addListener(Events.Render, validatorListener); TextFieldMessages fieldMessages = field.getMessages(); fieldMessages.setInvalidText(messages.vmRequired()); fieldMessages.setBlankText(messages.vmRequired()); }
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; }
private void setNewFormActive(boolean active) { axeField.setVisible(active); coordinateFields.setVisible(active); newFormButtonContainer.setVisible(active); newFormButtonContainer.layout(true); comboBoxes.setMode(active ? EditMode.NEW_LOCATION : EditMode.SEARCH); nameField.setAllowBlank(!active); nameField.setEmptyText(active ? null : I18N.CONSTANTS.typeToFilter()); layout(true); }
userName.setAllowBlank(false); userName.setFieldLabel("User name"); fieldSet.add(userName); password.setAllowBlank(false); password.setFieldLabel("Password"); fieldSet.add(password); fullName.setAllowBlank(false); fullName.setFieldLabel("Full name"); fieldSet.add(fullName); eMail.setAllowBlank(false); eMail.setFieldLabel("e-mail"); fieldSet.add(eMail);
@Override public void addComponentToForm() { fieldSet = new FieldSet(); fieldSet.setHeading("Role Information"); FormLayout layout = new FormLayout(); layout.setLabelWidth(80); fieldSet.setLayout(layout); profileName = new TextField<String>(); profileName.setAllowBlank(false); profileName.setFieldLabel("Role name"); fieldSet.add(profileName); this.formPanel.add(fieldSet); addOtherComponents(); }
private void setState() { if (typeCombo.getValue() != null) { FieldTypeClass selectedType = TypeRegistry.get().getTypeClass(typeCombo.getValue().getWrappedValue()); unitsField.setVisible(selectedType == FieldTypeClass.QUANTITY); unitsField.setAllowBlank(selectedType != FieldTypeClass.QUANTITY); if (selectedType != FieldTypeClass.QUANTITY) { unitsField.setValue(""); } calculatedExpressionLabelDesc.setEnabled(selectedType == FieldTypeClass.QUANTITY); calculateAutomatically.setEnabled(selectedType == FieldTypeClass.QUANTITY); expressionField.setEnabled(selectedType == FieldTypeClass.QUANTITY && calculateAutomatically.getValue()); aggregationCombo.setVisible(selectedType == FieldTypeClass.QUANTITY); } }
propKey.setAllowBlank(false); propKey.setValue(model.getPropKey());
public PartnerForm(Set<String> existingPartnerName) { super(); binding = new FormBinding(this); UiConstants constants = GWT.create(UiConstants.class); nameField = new TextField<>(); nameField.setFieldLabel(constants.name()); nameField.setMaxLength(PartnerDTO.NAME_MAX_LENGTH); nameField.setAllowBlank(false); nameField.setValidator(new UniqueNameValidator(existingPartnerName)); binding.addFieldBinding(new FieldBinding(nameField, "name")); this.add(nameField); TextField<String> fullField = new TextField<>(); fullField.setFieldLabel(constants.description()); fullField.setMaxLength(64); binding.addFieldBinding(new FieldBinding(fullField, "fullName")); this.add(fullField); }
public ProjectForm() { super(); binding = new FormBinding(this); UiConstants constants = GWT.create(UiConstants.class); nameField = new TextField<String>(); nameField.setFieldLabel(constants.name()); nameField.setMaxLength(PROJECT_MAX_LENGTH); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator()); binding.addFieldBinding(new FieldBinding(nameField, "name")); this.add(nameField); TextArea descriptionTextArea = new TextArea(); descriptionTextArea.setFieldLabel(constants.description()); descriptionTextArea.setMaxLength(250); binding.addFieldBinding(new FieldBinding(descriptionTextArea, "description")); this.add(descriptionTextArea); }
public AttributeForm() { binding = new FormBinding(this); final NumberField idField = new NumberField(); idField.setFieldLabel("ID"); idField.setReadOnly(true); binding.addFieldBinding(new FieldBinding(idField, "id")); add(idField); TextField<String> nameField = new TextField<String>(); nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setMaxLength(AttributeDTO.NAME_MAX_LENGTH); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator()); binding.addFieldBinding(new OnlyValidFieldBinding(nameField, "name")); add(nameField); hideFieldWhenNull(idField); }
public DatabaseForm(final Dispatcher dispatcher) { binding = new FormBinding(this); TextField<String> nameField = new TextField<String>(); nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator()); nameField.setMaxLength(UserDatabaseDTO.MAX_NAME_LENGTH); binding.addFieldBinding(new FieldBinding(nameField, "name")); add(nameField); TextField<String> fullNameField = new TextField<String>(); fullNameField.setFieldLabel(I18N.CONSTANTS.description()); fullNameField.setMaxLength(50); binding.addFieldBinding(new FieldBinding(fullNameField, "fullName")); add(fullNameField); countryField = new RemoteComboBox<CountryDTO>(); countryField.setStore(createCountryStore(dispatcher, countryField)); countryField.setFieldLabel(I18N.CONSTANTS.country()); countryField.setValueField("id"); countryField.setDisplayField("name"); countryField.setAllowBlank(false); countryField.setEnabled(true); countryField.setTriggerAction(TriggerAction.ALL); binding.addFieldBinding(new FieldBinding(countryField, "country") { @Override public void updateModel() { ((UserDatabaseDTO) model).setCountry((CountryDTO) field.getValue()); } }); add(countryField); }
nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setMaxLength(LocationTypeDTO.NAME_MAX_LENGTH); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator());
nameField.setFieldLabel(constants.name()); nameField.setMaxLength(255); nameField.setAllowBlank(false); nameField.setValidator(new BlankValidator()); binding.addFieldBinding(new FieldBinding(nameField, "name"));
nameField.setAllowBlank(false); nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setMaxLength(50);
nameField.setAllowBlank(false); nameField.setFieldLabel(I18N.CONSTANTS.name()); nameField.setMaxLength(ActivityFormDTO.NAME_MAX_LENGTH);