[Bug #1081] validate and action stop if something fails while saving data
in progress type view. FEA: ItEr74S04BugFixing
This commit is contained in:
parent
c1e30ed2e7
commit
b9b11e8cb6
2 changed files with 30 additions and 8 deletions
|
|
@ -48,6 +48,8 @@ import org.zkoss.zul.Label;
|
|||
import org.zkoss.zul.Messagebox;
|
||||
import org.zkoss.zul.Row;
|
||||
import org.zkoss.zul.RowRenderer;
|
||||
import org.zkoss.zul.Textbox;
|
||||
import org.zkoss.zul.impl.InputElement;
|
||||
|
||||
/**
|
||||
* Controller for CRUD actions over a {@link AdvanceType}
|
||||
|
|
@ -165,14 +167,34 @@ public class AdvanceTypeCRUDController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
private boolean save() {
|
||||
try {
|
||||
advanceTypeModel.save();
|
||||
messagesForUser.showMessage(Level.INFO, _("Progress type saved"));
|
||||
return true;
|
||||
} catch (ValidationException e) {
|
||||
messagesForUser.showInvalidValues(e);
|
||||
return false;
|
||||
if (isAllValid()) {
|
||||
try {
|
||||
advanceTypeModel.save();
|
||||
messagesForUser.showMessage(Level.INFO,
|
||||
_("Progress type saved"));
|
||||
return true;
|
||||
} catch (ValidationException e) {
|
||||
messagesForUser.showInvalidValues(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAllValid() {
|
||||
Component window = this.getCurrentWindow();
|
||||
Textbox unitName = (Textbox) window.getFellowIfAny("unitName");
|
||||
InputElement defaultMaxValue = (InputElement) window
|
||||
.getFellowIfAny("defaultMaxValue");
|
||||
InputElement precision = (InputElement) window
|
||||
.getFellowIfAny("precision");
|
||||
unitName.setFocus(true);
|
||||
return (isValid(unitName) && isValid(precision) && isValid(defaultMaxValue));
|
||||
}
|
||||
|
||||
private boolean isValid(InputElement inputtext) {
|
||||
inputtext.setFocus(true);
|
||||
return inputtext.isValid();
|
||||
}
|
||||
|
||||
public void confirmRemove(AdvanceType advanceType) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Unit name')}" />
|
||||
<textbox value="@{controller.advanceType.unitName}" constraint="@{controller.distinctNames}" width="300px"
|
||||
<textbox id="unitName" value="@{controller.advanceType.unitName}" constraint="@{controller.distinctNames}" width="300px"
|
||||
disabled="@{controller.immutable}" />
|
||||
</row>
|
||||
<row>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue