use of com.extjs.gxt.ui.client.widget.form.MultiField in project kapua by eclipse.
the class DeviceConfigPanel method getUpdatedConfiguration.
public GwtConfigComponent getUpdatedConfiguration() {
List<Component> fields = m_actionFieldSet.getItems();
for (int i = 0; i < fields.size(); i++) {
if (fields.get(i) instanceof Field<?>) {
Field<?> field = (Field<?>) fields.get(i);
String fieldName = field.getItemId();
GwtConfigParameter param = m_configComponent.getParameter(fieldName);
if (param == null) {
System.err.println(field);
}
if (!(field instanceof MultiField) || (field instanceof RadioGroup)) {
// get the updated values for the single field
String value = getUpdatedFieldConfiguration(param, field);
param.setValue(value);
} else {
// iterate over the subfields and extract each value
List<String> multiFieldValues = new ArrayList<String>();
MultiField<?> multiField = (MultiField<?>) field;
List<Field<?>> childFields = multiField.getAll();
for (int j = 0; j < childFields.size(); j++) {
Field<?> childField = (Field<?>) childFields.get(j);
String value = getUpdatedFieldConfiguration(param, childField);
if (value != null) {
multiFieldValues.add(value);
}
}
param.setValues(multiFieldValues.toArray(new String[] {}));
}
}
}
return m_configComponent;
}
use of com.extjs.gxt.ui.client.widget.form.MultiField in project kura by eclipse.
the class DeviceConfigPanel method getUpdatedConfiguration.
public GwtConfigComponent getUpdatedConfiguration() {
List<Component> fields = m_actionFieldSet.getItems();
for (int i = 0; i < fields.size(); i++) {
if (fields.get(i) instanceof Field<?>) {
Field<?> field = (Field<?>) fields.get(i);
String fieldName = field.getItemId();
GwtConfigParameter param = m_configComponent.getParameter(fieldName);
if (param == null) {
System.err.println(field);
}
if (!(field instanceof MultiField) || (field instanceof RadioGroup)) {
// get the updated values for the single field
String value = getUpdatedFieldConfiguration(param, field);
param.setValue(value);
} else {
// iterate over the subfields and extract each value
List<String> multiFieldValues = new ArrayList<String>();
MultiField<?> multiField = (MultiField<?>) field;
List<Field<?>> childFields = multiField.getAll();
for (int j = 0; j < childFields.size(); j++) {
Field<?> childField = (Field<?>) childFields.get(j);
String value = getUpdatedFieldConfiguration(param, childField);
if (value != null) {
multiFieldValues.add(value);
}
}
param.setValues(multiFieldValues.toArray(new String[] {}));
}
}
}
return m_configComponent;
}
use of com.extjs.gxt.ui.client.widget.form.MultiField in project geo-platform by geosdi.
the class UserPropertiesBinding method createFormPanel.
@Override
public FormPanel createFormPanel() {
FormPanel fp = new FormPanel();
fp.setHeaderVisible(false);
fp.setBodyBorder(Boolean.FALSE);
this.nameField = new GPSecureStringTextField();
this.nameField.setId(GPSimpleUserKeyValue.NAME.toString());
this.nameField.setFieldLabel(UserModuleConstants.INSTANCE.nameFieldText());
this.nameField.setEmptyText(UserModuleConstants.INSTANCE.UserPropertiesBinding_nameFieldEmptyText());
this.nameField.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_nameFieldToolTipText());
this.nameField.setAutoValidate(true);
this.emailField = new GPSecureStringTextField();
this.emailField.setId(GPSimpleUserKeyValue.EMAIL.toString());
this.emailField.setFieldLabel(UserModuleConstants.INSTANCE.emailFieldText());
this.emailField.setEmptyText(UserModuleConstants.INSTANCE.UserPropertiesBinding_emailFieldEmptyText());
this.emailField.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_emailFieldToolTipText());
this.emailField.setAutoValidate(true);
this.usernameField = new GPSecureStringTextField();
this.usernameField.setId(GPSimpleUserKeyValue.USERNAME.toString());
this.usernameField.setFieldLabel(UserModuleConstants.INSTANCE.usernameFieldText());
this.usernameField.setEmptyText(UserModuleConstants.INSTANCE.UserPropertiesBinding_usernameFieldEmptyText());
this.usernameField.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_usernameFieldToolTipText());
this.usernameField.setAllowBlank(false);
this.usernameField.setAutoValidate(true);
this.usernameField.setMinLength(4);
this.passwordField = new GPSecureStringTextField();
this.passwordField.setPassword(true);
this.passwordField.setFieldLabel(UserModuleConstants.INSTANCE.UserPropertiesBinding_passwordFieldText());
this.passwordField.setValidator(this.validatorPassword());
this.passwordRepeatField = new GPSecureStringTextField();
this.passwordRepeatField.setPassword(true);
this.passwordRepeatField.setFieldLabel(UserModuleConstants.INSTANCE.UserPropertiesBinding_repeatPasswordFieldText());
this.passwordRepeatField.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_repeatPasswordFieldTooltipText());
this.enabledField = new CheckBox();
this.enabledField.setId(GPUserManageDetailKeyValue.ENABLED.toString());
this.enabledField.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_enableFieldTooltipText());
this.enabledField.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
Boolean check = (Boolean) be.getValue();
if (check.booleanValue() != userOriginal.isEnabled()) {
updateEnabled(true);
} else {
updateEnabled(false);
}
}
});
this.creationDateLabelField = new LabelField();
MultiField enabledAndCreationFields = new MultiField();
enabledAndCreationFields.setFieldLabel(UserModuleConstants.INSTANCE.enabledFieldLabelText());
enabledAndCreationFields.add(enabledField);
enabledAndCreationFields.add(new LabelField("<span class='spacer'> </span>"));
enabledAndCreationFields.add(creationDateLabelField);
this.temporaryField = new CheckBox();
this.temporaryField.setId(GPUserManageDetailKeyValue.TEMPORARY.toString());
this.temporaryField.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
Boolean temporary = (Boolean) be.getValue();
if (temporary.booleanValue() != userOriginal.isTemporary()) {
updateTemporary(true);
} else {
updateTemporary(false);
}
}
});
this.expiredLabelField = new LabelField();
MultiField tempAndExpiredFields = new MultiField();
tempAndExpiredFields.setFieldLabel(UserModuleConstants.INSTANCE.temporaryFieldLabelText());
tempAndExpiredFields.add(temporaryField);
tempAndExpiredFields.add(new LabelField("<span class='spacer'> </span>"));
tempAndExpiredFields.add(expiredLabelField);
this.userRoleComboBox = new SimpleComboBox<String>() {
@Override
protected void onSelect(SimpleComboValue<String> model, int index) {
super.onSelect(model, index);
roleComboBinding.updateModel();
}
};
this.userRoleComboBox.setId(GPSimpleUserKeyValue.AUTORITHY.toString());
this.userRoleComboBox.setFieldLabel(UserModuleConstants.INSTANCE.userRoleLabelText());
this.userRoleComboBox.setEmptyText(UserModuleConstants.INSTANCE.UserPropertiesBinding_userRoleEmptyText());
this.userRoleComboBox.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_userRoleTooltipText());
this.userRoleComboBox.setEditable(false);
this.userRoleComboBox.setTypeAhead(true);
this.userRoleComboBox.setAllowBlank(false);
this.userRoleComboBox.setMaxHeight(150);
this.userRoleComboBox.setTriggerAction(TriggerAction.ALL);
this.trustedLevelComboBox = new SimpleComboBox<GPTrustedLevel>();
this.trustedLevelComboBox.setId(GPSimpleUserKeyValue.TRUSTED_LEVEL.toString());
this.trustedLevelComboBox.setFieldLabel(UserModuleConstants.INSTANCE.UserPropertiesBinding_trustedLevelLabelText());
this.trustedLevelComboBox.setEmptyText(UserModuleConstants.INSTANCE.UserPropertiesBinding_trustedLevelEmptyText());
this.trustedLevelComboBox.setToolTip(UserModuleConstants.INSTANCE.UserPropertiesBinding_trustedLevelTooltipText());
this.trustedLevelComboBox.setEditable(false);
this.trustedLevelComboBox.setTypeAhead(true);
this.trustedLevelComboBox.setAllowBlank(false);
this.trustedLevelComboBox.setMaxHeight(200);
this.trustedLevelComboBox.setTriggerAction(TriggerAction.ALL);
this.trustedLevelComboBox.add(Arrays.asList(GPTrustedLevel.values()));
fp.add(this.nameField);
fp.add(this.emailField);
fp.add(this.usernameField);
fp.add(this.passwordField);
fp.add(this.passwordRepeatField);
fp.add(enabledAndCreationFields);
fp.add(tempAndExpiredFields);
fp.add(this.userRoleComboBox);
fp.add(this.trustedLevelComboBox);
fp.setBorders(Boolean.FALSE);
return fp;
}
Aggregations