Alona Kaplan has uploaded a new change for review. Change subject: webadmin: Network dialog- field validation indication for tabs ......................................................................
webadmin: Network dialog- field validation indication for tabs Change-Id: I8b9cfd6d4c8fcb4768c99c42393dd0d0c72f7cbd Bug-Url: https://bugzilla.redhat.com/1115827 Signed-off-by: Alona Kaplan <[email protected]> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java 3 files changed, 65 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/30664/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java index 119f9ac..c6ff122 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkModel.java @@ -44,6 +44,7 @@ import org.ovirt.engine.ui.uicompat.EventArgs; import org.ovirt.engine.ui.uicompat.IEventListener; import org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback; +import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs; public abstract class NetworkModel extends Model { @@ -75,6 +76,8 @@ private UICommand addQosCommand; private final Network network; private final ListModel sourceListModel; + private boolean isGeneralTabValid; + private boolean isVnicProfileTabValid; public NetworkModel(ListModel sourceListModel) { @@ -172,6 +175,9 @@ // Update changeability according to initial values updateVlanTagChangeability(); updateSubnetChangeability(); + + setIsGeneralTabValid(true); + setIsVnicProfileTabValid(true); } private VnicProfileModel createDefaultProfile() { @@ -415,7 +421,35 @@ return addQosCommand; } - public boolean validate() + public boolean getIsGeneralTabValid() + { + return isGeneralTabValid; + } + + public void setIsGeneralTabValid(boolean value) + { + if (isGeneralTabValid != value) + { + isGeneralTabValid = value; + onPropertyChanged(new PropertyChangedEventArgs("IsGeneralTabValid")); //$NON-NLS-1$ + } + } + + public boolean getIsVnicProfileTabValid() + { + return isVnicProfileTabValid; + } + + public void setIsVnicProfileTabValid(boolean value) + { + if (isVnicProfileTabValid != value) + { + isVnicProfileTabValid = value; + onPropertyChanged(new PropertyChangedEventArgs("IsVnicProfileTabValid")); //$NON-NLS-1$ + } + } + + private boolean validate() { RegexValidation tempVar = new RegexValidation(); tempVar.setExpression("^[A-Za-z0-9_]{1,15}$"); //$NON-NLS-1$ @@ -462,9 +496,11 @@ getNetworkLabel().validateSelectedItem(new IValidation[] { new AsciiNameValidation() }); - return getName().getIsValid() && getVLanTag().getIsValid() && getDescription().getIsValid() + setIsGeneralTabValid(getName().getIsValid() && getVLanTag().getIsValid() && getDescription().getIsValid() && getMtu().getIsValid() && getExternalProviders().getIsValid() && getComment().getIsValid() - && subnetValid && profilesValid && getNetworkLabel().getIsValid(); + && subnetValid && getNetworkLabel().getIsValid()); + setIsVnicProfileTabValid(profilesValid); + return getIsGeneralTabValid() && getIsVnicProfileTabValid(); } protected boolean isCustomMtu() { diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java index 42d6c28..f4aface 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/presenter/popup/AbstractNetworkPopupPresenterWidget.java @@ -28,6 +28,10 @@ UiCommandButton getQosButton(); void addMtuEditor(); + + void updateGeneralTabValidity(boolean isValid); + + void updateVnicProfileTabValidity(boolean isValid); } public AbstractNetworkPopupPresenterWidget(EventBus eventBus, V view) { @@ -48,6 +52,10 @@ if ("Message".equals(propertyName)) { //$NON-NLS-1$ getView().setMessageLabel(model.getMessage()); + } else if ("IsGeneralTabValid".equals(propertyName)) { //$NON-NLS-1$ + getView().updateGeneralTabValidity(model.getIsGeneralTabValid()); + } else if ("IsVnicProfileTabValid".equals(propertyName)) { //$NON-NLS-1$ + getView().updateVnicProfileTabValidity(model.getIsVnicProfileTabValid()); } } }); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java index 962f5a5..0188b47 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/AbstractNetworkPopupView.java @@ -448,6 +448,24 @@ panel.add(mtuEditor); } + @Override + public void updateGeneralTabValidity(boolean isValid) { + if (isValid) { + generalTab.markAsValid(); + } else { + generalTab.markAsInvalid(null); + } + } + + @Override + public void updateVnicProfileTabValidity(boolean isValid) { + if (isValid) { + profilesTab.markAsValid(); + } else { + profilesTab.markAsInvalid(null); + } + } + interface WidgetStyle extends CssResource { String valueBox(); -- To view, visit http://gerrit.ovirt.org/30664 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8b9cfd6d4c8fcb4768c99c42393dd0d0c72f7cbd Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
