Greg Sheremeta has uploaded a new change for review.

Change subject: webadmin: cleanup CommonModel
......................................................................

webadmin: cleanup CommonModel

No logic changes. Just reordered the CommonModel class according to conventions.

Change-Id: I382f6d5b5615b91f697198d6e3e4d5d312fcedbc
Signed-off-by: Greg Sheremeta <gsher...@redhat.com>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
1 file changed, 343 insertions(+), 365 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/91/19391/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
index f81b234..37c3969 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/CommonModel.java
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-
 import org.ovirt.engine.core.common.businessentities.AuditLog;
 import org.ovirt.engine.core.common.businessentities.StorageDomain;
 import org.ovirt.engine.core.common.businessentities.StorageDomainType;
@@ -55,306 +54,51 @@
 public class CommonModel extends ListModel
 {
 
-    public static EventDefinition SignedOutEventDefinition;
+    // TODO: "SingedOut" is misspelled.
+    public static EventDefinition SignedOutEventDefinition  = new 
EventDefinition("SingedOut", CommonModel.class); //$NON-NLS-1$
     private Event privateSignedOutEvent;
-
-    public Event getSignedOutEvent()
-    {
-        return privateSignedOutEvent;
-    }
-
-    private void setSignedOutEvent(Event value)
-    {
-        privateSignedOutEvent = value;
-    }
-
     private UICommand privateSearchCommand;
-
-    public UICommand getSearchCommand()
-    {
-        return privateSearchCommand;
-    }
-
-    private void setSearchCommand(UICommand value)
-    {
-        privateSearchCommand = value;
-    }
-
     private UICommand privateConfigureCommand;
-
-    public UICommand getConfigureCommand()
-    {
-        return privateConfigureCommand;
-    }
-
-    private void setConfigureCommand(UICommand value)
-    {
-        privateConfigureCommand = value;
-    }
-
     private UICommand privateSignOutCommand;
-
-    public UICommand getSignOutCommand()
-    {
-        return privateSignOutCommand;
-    }
-
-    private void setSignOutCommand(UICommand value)
-    {
-        privateSignOutCommand = value;
-    }
-
     private UICommand privateClearSearchStringCommand;
-
-    public UICommand getClearSearchStringCommand()
-    {
-        return privateClearSearchStringCommand;
-    }
-
-    private void setClearSearchStringCommand(UICommand value)
-    {
-        privateClearSearchStringCommand = value;
-    }
-
-    @Override
-    public List<SearchableListModel> getItems()
-    {
-        return (List<SearchableListModel>) super.getItems();
-    }
-
-    public void setItems(List<SearchableListModel> value)
-    {
-        super.setItems(value);
-    }
-
-    @Override
-    public SearchableListModel getSelectedItem()
-    {
-        return (SearchableListModel) super.getSelectedItem();
-    }
-
-    public void setSelectedItem(SearchableListModel value)
-    {
-        super.setSelectedItem(value);
-    }
-
     private BookmarkListModel privateBookmarkList;
-
-    public BookmarkListModel getBookmarkList()
-    {
-        return privateBookmarkList;
-    }
-
-    private void setBookmarkList(BookmarkListModel value)
-    {
-        privateBookmarkList = value;
-    }
-
     private TagListModel privateTagList;
-
-    public TagListModel getTagList()
-    {
-        return privateTagList;
-    }
-
-    private void setTagList(TagListModel value)
-    {
-        privateTagList = value;
-    }
-
     private SystemTreeModel privateSystemTree;
-
-    public SystemTreeModel getSystemTree()
-    {
-        return privateSystemTree;
-    }
-
-    private void setSystemTree(SystemTreeModel value)
-    {
-        privateSystemTree = value;
-    }
-
     private SearchableListModel privateEventList;
-
-    public SearchableListModel getEventList()
-    {
-        return privateEventList;
-    }
-
-    private void setEventList(SearchableListModel value)
-    {
-        privateEventList = value;
-    }
-
     private TaskListModel privateTaskList;
-
-    public TaskListModel getTaskList() {
-        return privateTaskList;
-    }
-
-    public void setTaskList(TaskListModel taskList) {
-        this.privateTaskList = taskList;
-    }
-
     private AlertListModel privateAlertList;
-
-    public AlertListModel getAlertList()
-    {
-        return privateAlertList;
-    }
-
-    private void setAlertList(AlertListModel value)
-    {
-        privateAlertList = value;
-    }
-
     private SearchSuggestModel privateAutoCompleteModel;
-
-    public SearchSuggestModel getAutoCompleteModel()
-    {
-        return privateAutoCompleteModel;
-    }
-
-    private void setAutoCompleteModel(SearchSuggestModel value)
-    {
-        privateAutoCompleteModel = value;
-    }
-
     private String searchStringPrefix;
-
-    public String getSearchStringPrefix()
-    {
-        return searchStringPrefix;
-    }
-
-    public void setSearchStringPrefix(String value)
-    {
-        if (!StringHelper.stringsEqual(searchStringPrefix, value))
-        {
-            searchStringPrefix = value;
-            searchStringPrefixChanged();
-            onPropertyChanged(new 
PropertyChangedEventArgs("SearchStringPrefix")); //$NON-NLS-1$
-        }
-    }
-
     private boolean hasSearchStringPrefix;
-
-    public boolean getHasSearchStringPrefix()
-    {
-        return hasSearchStringPrefix;
-    }
-
-    private void setHasSearchStringPrefix(boolean value)
-    {
-        if (hasSearchStringPrefix != value)
-        {
-            hasSearchStringPrefix = value;
-            onPropertyChanged(new 
PropertyChangedEventArgs("HasSearchStringPrefix")); //$NON-NLS-1$
-        }
-    }
-
     private String searchString;
-
-    public String getSearchString()
-    {
-        return searchString;
-    }
-
-    public void setSearchString(String value)
-    {
-        setSearchString(value, true);
-    }
-
-    public void setSearchString(String value, boolean checkIfNewValue)
-    {
-        if (!checkIfNewValue || !StringHelper.stringsEqual(searchString, 
value))
-        {
-            searchString = value;
-            searchStringChanged();
-            onPropertyChanged(new PropertyChangedEventArgs("SearchString")); 
//$NON-NLS-1$
-        }
-    }
-
     private VdcUser loggedInUser;
-
-    public VdcUser getLoggedInUser()
-    {
-        return loggedInUser;
-    }
-
-    public void setLoggedInUser(VdcUser value)
-    {
-        if (loggedInUser != value)
-        {
-            loggedInUser = value;
-            onPropertyChanged(new PropertyChangedEventArgs("LoggedInUser")); 
//$NON-NLS-1$
-        }
-    }
-
     private List<AuditLog> privateEvents;
-
-    public List<AuditLog> getEvents()
-    {
-        return privateEvents;
-    }
-
-    public void setEvents(List<AuditLog> value)
-    {
-        privateEvents = value;
-    }
-
     private AuditLog lastEvent;
-
-    public AuditLog getLastEvent()
-    {
-        return lastEvent;
-    }
-
-    public void setLastEvent(AuditLog value)
-    {
-        if (lastEvent != value)
-        {
-            lastEvent = value;
-            onPropertyChanged(new PropertyChangedEventArgs("LastEvent")); 
//$NON-NLS-1$
-        }
-    }
-
     private AuditLog lastAlert;
-
-    public AuditLog getLastAlert()
-    {
-        return lastAlert;
-    }
-
-    public void setLastAlert(AuditLog value)
-    {
-        if (lastAlert != value)
-        {
-            lastAlert = value;
-            onPropertyChanged(new PropertyChangedEventArgs("LastAlert")); 
//$NON-NLS-1$
-        }
-    }
-
     private boolean hasSelectedTags;
+    private boolean executingSearch;
+    private RoleListModel roleListModel;
+    private SystemPermissionListModel systemPermissionListModel;
+    private ClusterPolicyListModel clusterPolicyListModel;
 
-    public boolean getHasSelectedTags()
-    {
-        return hasSelectedTags;
-    }
-
-    public void setHasSelectedTags(boolean value)
-    {
-        if (hasSelectedTags != value)
-        {
-            hasSelectedTags = value;
-            onPropertyChanged(new 
PropertyChangedEventArgs("HasSelectedTags")); //$NON-NLS-1$
-        }
-    }
-
-    static
-    {
-        SignedOutEventDefinition = new EventDefinition("SingedOut", 
CommonModel.class); //$NON-NLS-1$
-    }
+    // NOTE: when adding a new ListModel here, be sure to add it to the 
listModelCollection in init().
+    ObservableCollection<SearchableListModel> listModelCollection;
+    private SearchableListModel dataCenterList;
+    private SearchableListModel clusterList;
+    private SearchableListModel hostList;
+    private SearchableListModel storageList;
+    private SearchableListModel vmList;
+    private SearchableListModel poolList;
+    private SearchableListModel templateList;
+    private SearchableListModel userList;
+    private SearchableListModel eventList;
+    private ReportsListModel reportsList;
+    private SearchableListModel quotaList;
+    private SearchableListModel volumeList;
+    private SearchableListModel diskList;
+    private SearchableListModel networkList;
+    private SearchableListModel providerList;
+    private SearchableListModel profileList;
 
     private static CommonModel instance = null;
 
@@ -404,6 +148,63 @@
         setLoggedInUser(Frontend.getLoggedInUser());
     }
 
+    private void initItems()
+    {
+        listModelCollection = new ObservableCollection<SearchableListModel>();
+
+        dataCenterList = new DataCenterListModel();
+        listModelCollection.add(dataCenterList);
+        clusterList = new ClusterListModel();
+        listModelCollection.add(clusterList);
+        hostList = new HostListModel();
+        listModelCollection.add(hostList);
+        storageList = new StorageListModel();
+        listModelCollection.add(storageList);
+        vmList = new VmListModel();
+        listModelCollection.add(vmList);
+        poolList = new PoolListModel();
+        listModelCollection.add(poolList);
+        templateList = new TemplateListModel();
+        listModelCollection.add(templateList);
+        eventList = new EventListModel();
+        listModelCollection.add(eventList);
+
+        quotaList = new QuotaListModel();
+        listModelCollection.add(quotaList);
+
+        volumeList = new VolumeListModel();
+        listModelCollection.add(volumeList);
+
+        diskList = new DiskListModel();
+        listModelCollection.add(diskList);
+
+        userList = new UserListModel();
+        listModelCollection.add(userList);
+
+        reportsList = new 
ReportsListModel(ReportInit.getInstance().getReportBaseUrl());
+        listModelCollection.add(reportsList);
+
+        reportsList.setIsAvailable(false);
+
+        networkList = new NetworkListModel();
+        listModelCollection.add(networkList);
+
+        providerList = new ProviderListModel();
+        listModelCollection.add(providerList);
+
+        profileList = new VnicProfileListModel();
+        listModelCollection.add(profileList);
+
+        setItems(listModelCollection);
+
+        roleListModel = new RoleListModel();
+        systemPermissionListModel = new SystemPermissionListModel();
+        clusterPolicyListModel = new ClusterPolicyListModel();
+
+        // Activate the default list model.
+        setSelectedItem(getDefaultItem());
+    }
+
     private void updateHasSelectedTags()
     {
         ArrayList<TagModel> selectedTags =
@@ -411,12 +212,6 @@
                         : new ArrayList<TagModel>();
 
         setHasSelectedTags(getSelectedItem() != null && selectedTags.size() > 
0);
-    }
-
-    private void setAllListModelsUnavailable() {
-        for (ListModel m : listModelCollection) {
-            m.setIsAvailable(false);
-        }
     }
 
     private void tagListModel_SelectedItemsChanged(Object sender, EventArgs e)
@@ -776,79 +571,10 @@
         setWindow(null);
     }
 
-    private SearchableListModel dataCenterList;
-    private SearchableListModel clusterList;
-    private SearchableListModel hostList;
-    private SearchableListModel storageList;
-    private SearchableListModel vmList;
-    private SearchableListModel poolList;
-    private SearchableListModel templateList;
-    private SearchableListModel userList;
-    private SearchableListModel eventList;
-    private ReportsListModel reportsList;
-    private SearchableListModel quotaList;
-    private SearchableListModel monitor;
-    private SearchableListModel volumeList;
-    private SearchableListModel diskList;
-    private SearchableListModel networkList;
-    private SearchableListModel providerList;
-    private SearchableListModel profileList;
-
-    private void initItems()
-    {
-        listModelCollection = new ObservableCollection<SearchableListModel>();
-
-        dataCenterList = new DataCenterListModel();
-        listModelCollection.add(dataCenterList);
-        clusterList = new ClusterListModel();
-        listModelCollection.add(clusterList);
-        hostList = new HostListModel();
-        listModelCollection.add(hostList);
-        storageList = new StorageListModel();
-        listModelCollection.add(storageList);
-        vmList = new VmListModel();
-        listModelCollection.add(vmList);
-        poolList = new PoolListModel();
-        listModelCollection.add(poolList);
-        templateList = new TemplateListModel();
-        listModelCollection.add(templateList);
-        eventList = new EventListModel();
-        listModelCollection.add(eventList);
-
-        quotaList = new QuotaListModel();
-        listModelCollection.add(quotaList);
-
-        volumeList = new VolumeListModel();
-        listModelCollection.add(volumeList);
-
-        diskList = new DiskListModel();
-        listModelCollection.add(diskList);
-
-        userList = new UserListModel();
-        listModelCollection.add(userList);
-
-        reportsList = new 
ReportsListModel(ReportInit.getInstance().getReportBaseUrl());
-        listModelCollection.add(reportsList);
-
-        reportsList.setIsAvailable(false);
-
-        networkList = new NetworkListModel();
-        listModelCollection.add(networkList);
-
-        providerList = new ProviderListModel();
-        listModelCollection.add(providerList);
-
-        profileList = new VnicProfileListModel();
-        listModelCollection.add(profileList);
-
-        setItems(listModelCollection);
-
-        roleListModel = new RoleListModel();
-        systemPermissionListModel = new SystemPermissionListModel();
-        clusterPolicyListModel = new ClusterPolicyListModel();
-
-        // Activate the default list model.
-        setSelectedItem(getDefaultItem());
+    private void setAllListModelsUnavailable() {
+        for (ListModel m : listModelCollection) {
+            m.setIsAvailable(false);
+        }
     }
 
     private SearchableListModel getDefaultItem()
@@ -874,12 +600,6 @@
             systemTree_ItemChanged(sender, args);
         }
     }
-
-    private boolean executingSearch;
-    private RoleListModel roleListModel;
-    private SystemPermissionListModel systemPermissionListModel;
-    private ClusterPolicyListModel clusterPolicyListModel;
-    private ObservableCollection<SearchableListModel> listModelCollection;
 
     @Override
     protected void onSelectedItemChanging(Object newValue, Object oldValue)
@@ -1337,4 +1057,262 @@
     public ClusterPolicyListModel getClusterPolicyListModel() {
         return clusterPolicyListModel;
     }
+
+    public Event getSignedOutEvent()
+    {
+        return privateSignedOutEvent;
+    }
+
+    private void setSignedOutEvent(Event value)
+    {
+        privateSignedOutEvent = value;
+    }
+
+    public UICommand getSearchCommand()
+    {
+        return privateSearchCommand;
+    }
+
+    private void setSearchCommand(UICommand value)
+    {
+        privateSearchCommand = value;
+    }
+
+    public UICommand getConfigureCommand()
+    {
+        return privateConfigureCommand;
+    }
+
+    private void setConfigureCommand(UICommand value)
+    {
+        privateConfigureCommand = value;
+    }
+
+    public UICommand getSignOutCommand()
+    {
+        return privateSignOutCommand;
+    }
+
+    private void setSignOutCommand(UICommand value)
+    {
+        privateSignOutCommand = value;
+    }
+
+    public UICommand getClearSearchStringCommand()
+    {
+        return privateClearSearchStringCommand;
+    }
+
+    private void setClearSearchStringCommand(UICommand value)
+    {
+        privateClearSearchStringCommand = value;
+    }
+
+    @Override
+    public List<SearchableListModel> getItems()
+    {
+        return (List<SearchableListModel>) super.getItems();
+    }
+
+    public void setItems(List<SearchableListModel> value)
+    {
+        super.setItems(value);
+    }
+
+    @Override
+    public SearchableListModel getSelectedItem()
+    {
+        return (SearchableListModel) super.getSelectedItem();
+    }
+
+    public void setSelectedItem(SearchableListModel value)
+    {
+        super.setSelectedItem(value);
+    }
+
+    public BookmarkListModel getBookmarkList()
+    {
+        return privateBookmarkList;
+    }
+
+    private void setBookmarkList(BookmarkListModel value)
+    {
+        privateBookmarkList = value;
+    }
+
+    public TagListModel getTagList()
+    {
+        return privateTagList;
+    }
+
+    private void setTagList(TagListModel value)
+    {
+        privateTagList = value;
+    }
+
+    public SystemTreeModel getSystemTree()
+    {
+        return privateSystemTree;
+    }
+
+    private void setSystemTree(SystemTreeModel value)
+    {
+        privateSystemTree = value;
+    }
+
+    public SearchableListModel getEventList()
+    {
+        return privateEventList;
+    }
+
+    private void setEventList(SearchableListModel value)
+    {
+        privateEventList = value;
+    }
+
+    public TaskListModel getTaskList() {
+        return privateTaskList;
+    }
+
+    public void setTaskList(TaskListModel taskList) {
+        this.privateTaskList = taskList;
+    }
+
+    public AlertListModel getAlertList()
+    {
+        return privateAlertList;
+    }
+
+    private void setAlertList(AlertListModel value)
+    {
+        privateAlertList = value;
+    }
+    public SearchSuggestModel getAutoCompleteModel()
+    {
+        return privateAutoCompleteModel;
+    }
+
+    private void setAutoCompleteModel(SearchSuggestModel value)
+    {
+        privateAutoCompleteModel = value;
+    }
+
+    public String getSearchStringPrefix()
+    {
+        return searchStringPrefix;
+    }
+
+    public void setSearchStringPrefix(String value)
+    {
+        if (!StringHelper.stringsEqual(searchStringPrefix, value))
+        {
+            searchStringPrefix = value;
+            searchStringPrefixChanged();
+            onPropertyChanged(new 
PropertyChangedEventArgs("SearchStringPrefix")); //$NON-NLS-1$
+        }
+    }
+
+    public boolean getHasSearchStringPrefix()
+    {
+        return hasSearchStringPrefix;
+    }
+
+    private void setHasSearchStringPrefix(boolean value)
+    {
+        if (hasSearchStringPrefix != value)
+        {
+            hasSearchStringPrefix = value;
+            onPropertyChanged(new 
PropertyChangedEventArgs("HasSearchStringPrefix")); //$NON-NLS-1$
+        }
+    }
+
+    public String getSearchString()
+    {
+        return searchString;
+    }
+
+    public void setSearchString(String value)
+    {
+        setSearchString(value, true);
+    }
+
+    public void setSearchString(String value, boolean checkIfNewValue)
+    {
+        if (!checkIfNewValue || !StringHelper.stringsEqual(searchString, 
value))
+        {
+            searchString = value;
+            searchStringChanged();
+            onPropertyChanged(new PropertyChangedEventArgs("SearchString")); 
//$NON-NLS-1$
+        }
+    }
+
+    public VdcUser getLoggedInUser()
+    {
+        return loggedInUser;
+    }
+
+    public void setLoggedInUser(VdcUser value)
+    {
+        if (loggedInUser != value)
+        {
+            loggedInUser = value;
+            onPropertyChanged(new PropertyChangedEventArgs("LoggedInUser")); 
//$NON-NLS-1$
+        }
+    }
+
+    public List<AuditLog> getEvents()
+    {
+        return privateEvents;
+    }
+
+    public void setEvents(List<AuditLog> value)
+    {
+        privateEvents = value;
+    }
+
+    public AuditLog getLastEvent()
+    {
+        return lastEvent;
+    }
+
+    public void setLastEvent(AuditLog value)
+    {
+        if (lastEvent != value)
+        {
+            lastEvent = value;
+            onPropertyChanged(new PropertyChangedEventArgs("LastEvent")); 
//$NON-NLS-1$
+        }
+    }
+
+    public AuditLog getLastAlert()
+    {
+        return lastAlert;
+    }
+
+    public void setLastAlert(AuditLog value)
+    {
+        if (lastAlert != value)
+        {
+            lastAlert = value;
+            onPropertyChanged(new PropertyChangedEventArgs("LastAlert")); 
//$NON-NLS-1$
+        }
+    }
+
+    public boolean getHasSelectedTags()
+    {
+        return hasSelectedTags;
+    }
+
+    public void setHasSelectedTags(boolean value)
+    {
+        if (hasSelectedTags != value)
+        {
+            hasSelectedTags = value;
+            onPropertyChanged(new 
PropertyChangedEventArgs("HasSelectedTags")); //$NON-NLS-1$
+        }
+    }
+
 }
+
+
+


-- 
To view, visit http://gerrit.ovirt.org/19391
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I382f6d5b5615b91f697198d6e3e4d5d312fcedbc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to