Bug #1556: Use a combo box to show the value of UserAuthenticationType field.

It's a step previous to allow the edition of that field.

FEA: ItEr77S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-11-08 18:10:56 +01:00 committed by Manuel Rego Casasnovas
parent a9591cecd6
commit 5a6241b7f9
2 changed files with 37 additions and 1 deletions

View file

@ -283,6 +283,16 @@ public class UserCRUDController extends BaseCRUDController<User> implements
//because they are not directly associated to an attribute
passwordBox.setRawValue("");
passwordConfirmationBox.setRawValue("");
hideAuthenticationTypesCombo();
}
private void hideAuthenticationTypesCombo() {
Row comboRow = (Row) editWindow
.getFellowIfAny("authenticationTypeComboRow");
Row labelRow = (Row) editWindow
.getFellowIfAny("authenticationTypeLabelRow");
comboRow.setVisible(false);
labelRow.setVisible(true);
}
@Override
@ -294,6 +304,28 @@ public class UserCRUDController extends BaseCRUDController<User> implements
//cleans the box and forces the check of the new Constraint (null)
passwordBox.setValue("");
passwordConfirmationBox.setValue("");
//setup authentication type combo box
prepareAuthenticationTypesCombo();
}
private void prepareAuthenticationTypesCombo() {
Combobox combo = (Combobox) editWindow
.getFellowIfAny("authenticationTypeCombo");
combo.getChildren().clear();
for (UserAuthenticationType type : UserAuthenticationType.values()) {
Comboitem item = combo.appendItem(type.toString());
item.setValue(type);
if (type.equals(getAuthenticationType())) {
combo.setSelectedItem(item);
}
}
Row comboRow = (Row) editWindow
.getFellowIfAny("authenticationTypeComboRow");
Row labelRow = (Row) editWindow
.getFellowIfAny("authenticationTypeLabelRow");
comboRow.setVisible(true);
labelRow.setVisible(false);
}
@Override

View file

@ -85,7 +85,11 @@
<textbox id="email"
value="@{controller.user.email}" width="300px"/>
</row>
<row>
<row id="authenticationTypeComboRow">
<label value="${i18n:_('Authentication type')}" />
<combobox id="authenticationTypeCombo" autodrop="true" />
</row>
<row id="authenticationTypeLabelRow">
<label value="${i18n:_('Authentication type')}" />
<label value="@{controller.authenticationType}" />
</row>