ItEr28S11AltaEtiquetasTipoEtiquetaItEr27S11: Add constraints on creating label

This commit is contained in:
Diego Pino Garcia 2009-10-01 18:12:32 +02:00 committed by Javier Moran Rua
parent ead0ee0f6e
commit e1ac8d2909
2 changed files with 2 additions and 8 deletions

View file

@ -48,20 +48,14 @@ public class AssignedLabelsToOrderElementController extends
}
public void createAndAssign() {
// Check LabelType is not null
final Comboitem comboitem = cbLabelType.getSelectedItem();
if (comboitem == null || comboitem.getValue() == null) {
throw new WrongValueException(cbLabelType, _("cannot be null"));
}
// Check Label is not null or empty
final String labelName = txtLabelName.getValue();
if (labelName == null || labelName.isEmpty()) {
throw new WrongValueException(txtLabelName,
_("cannot be null or empty"));
}
final LabelType labelType = (LabelType) comboitem.getValue();
if (!assignedLabelsToOrderElementModel.existsLabelByNameAndType(
labelName, labelType)) {

View file

@ -49,7 +49,7 @@
</vbox>
<hbox>
<autocomplete id="cbLabelType" finder="LabelTypeFinder" buttonVisible="true" />
<textbox id="txtLabelName" constraint="no empty:${i18n:_('cannot be null or empty')}"/>
<textbox id="txtLabelName" constraint="no empty:${i18n:_('cannot be null or empty')}" />
<button style="margin-top: -4px" label="${i18n:_('Create &amp; Assign')}"
onClick="assignedLabelsController.createAndAssign()"/>
</hbox>