ItEr28S11AltaEtiquetasTipoEtiquetaItEr27S11: Add constraints on creating label
This commit is contained in:
parent
ead0ee0f6e
commit
e1ac8d2909
2 changed files with 2 additions and 8 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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 & Assign')}"
|
||||
onClick="assignedLabelsController.createAndAssign()"/>
|
||||
</hbox>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue