changeset 273:98a4eaab0fa6

gui: show host/vm summary on startup Reviewed-by: vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-May/001158.html
author Omair Majid <omajid@redhat.com>
date Wed, 02 May 2012 12:42:13 -0400
parents d380c6cdf82a
children a3e7c7406bfa
files client/src/main/java/com/redhat/thermostat/client/MainWindowControllerImpl.java client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java client/src/test/java/com/redhat/thermostat/client/MainWindowControllerImplTest.java
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/main/java/com/redhat/thermostat/client/MainWindowControllerImpl.java	Wed May 02 12:35:43 2012 -0400
+++ b/client/src/main/java/com/redhat/thermostat/client/MainWindowControllerImpl.java	Wed May 02 12:42:13 2012 -0400
@@ -95,6 +95,8 @@
         appInfo = new ApplicationInfo();
         view.setWindowTitle(appInfo.getName());
         initializeTimer();
+
+        updateView();
     }
 
     private class HostsVMsLoaderImpl implements HostsVMsLoader {
--- a/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Wed May 02 12:35:43 2012 -0400
+++ b/client/src/main/java/com/redhat/thermostat/client/ui/MainWindow.java	Wed May 02 12:42:13 2012 -0400
@@ -599,7 +599,7 @@
     @Override
     public Ref getSelectedHostOrVm() {
         TreePath path = agentVmTree.getSelectionPath();
-        if (path.getPathCount() == 1) {
+        if (path == null || path.getPathCount() == 1) {
             return null;
         }
         return (Ref) ((DefaultMutableTreeNode) path.getLastPathComponent()).getUserObject();
--- a/client/src/test/java/com/redhat/thermostat/client/MainWindowControllerImplTest.java	Wed May 02 12:35:43 2012 -0400
+++ b/client/src/test/java/com/redhat/thermostat/client/MainWindowControllerImplTest.java	Wed May 02 12:42:13 2012 -0400
@@ -47,6 +47,7 @@
 import static org.mockito.Mockito.when;
 import static org.mockito.Mockito.times;
 
+import java.awt.Component;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.TimeUnit;
@@ -172,6 +173,11 @@
     }
 
     @Test
+    public void verifySubViewIsSetByDefault() {
+        verify(view).setSubView(any(Component.class));
+    }
+
+    @Test
     public void verifyUpdateHostsVMsLoadsCorrectHosts() {
 
         Collection<HostRef> expectedHosts = new ArrayList<>();