ItEr28S11AltaEtiquetasTipoEtiquetaItEr27S11: Moved Label constraint checking to createAndAssign method
This commit is contained in:
parent
05bf7a4123
commit
e5cd66ed62
2 changed files with 8 additions and 2 deletions
|
|
@ -55,10 +55,15 @@ public class AssignedLabelsToOrderElementController extends
|
|||
throw new WrongValueException(cbLabelType, _("cannot be null"));
|
||||
}
|
||||
|
||||
// Check Label is not null or empty
|
||||
final String labelName = txtLabelName.getValue();
|
||||
final LabelType labelType = (LabelType) comboitem.getValue();
|
||||
if (labelName == null || labelName.isEmpty()) {
|
||||
throw new WrongValueException(txtLabelName,
|
||||
_("cannot be null or empty"));
|
||||
}
|
||||
|
||||
// Label does not exist, create
|
||||
final LabelType labelType = (LabelType) comboitem.getValue();
|
||||
Label label = assignedLabelsToOrderElementModel
|
||||
.findLabelByNameAndType(labelName, labelType);
|
||||
if (label == null) {
|
||||
|
|
@ -82,6 +87,7 @@ public class AssignedLabelsToOrderElementController extends
|
|||
private void assignLabel(Label label) {
|
||||
assignedLabelsToOrderElementModel.assignLabel(label);
|
||||
Util.reloadBindings(directLabels);
|
||||
txtLabelName.setValue("");
|
||||
}
|
||||
|
||||
private Label createLabel(String labelName, LabelType labelType) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,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" />
|
||||
<button style="margin-top: -4px" label="${i18n:_('Create & Assign')}"
|
||||
onClick="assignedLabelsController.createAndAssign()"/>
|
||||
</hbox>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue