Author: bhupendrab
Date: Wed Mar  7 09:10:13 2007
New Revision: 515649

URL: http://svn.apache.org/viewvc?view=rev&rev=515649
Log:
Fixed -> Clicking the top level Refresh button was throwing 
NullPointerException for virtual host if a server node is selected.
Added static import for Constants and added form.body layout instead of each 
Composite layout separately.

Modified:
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
    
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
 Wed Mar  7 09:10:13 2007
@@ -30,11 +30,11 @@
     public final static String APPLICATION_NAME = "Qpid Management Console";
     public final static String VALUE = "value";
     public final static String TYPE  = "type";
-    public final static String SERVER     = "server";
-    public final static String DOMAIN     = "domain";
+    public final static String NODE_TYPE_SERVER    = "server";
+    public final static String NODE_TYPE_DOMAIN    = "domain";
     public final static String NODE_TYPE_MBEANTYPE = "mbeantype";
     // currently used only for virtual host instances, but will work as 
general also
-    public final static String TYPE_INSTANCE = "mbeantype_instance";
+    public final static String NODE_TYPE_TYPEINSTANCE = "mbeantype_instance";
     public final static String MBEAN      = "mbean";
     public final static String ATTRIBUTE = "Attribute";
     public final static String ATTRIBUTES = "Attributes";

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
 Wed Mar  7 09:10:13 2007
@@ -20,8 +20,8 @@
  */
 package org.apache.qpid.management.ui.views;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.jmx.JMXServerRegistry;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;
@@ -158,10 +158,10 @@
         GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
         _table.setLayoutData(gridData);
         
-        for (int i = 0; i < Constants.ATTRIBUTE_TABLE_TITLES.length; ++i)
+        for (int i = 0; i < ATTRIBUTE_TABLE_TITLES.length; ++i)
         {
             final TableColumn column = new TableColumn(_table, SWT.NONE);
-            column.setText(Constants.ATTRIBUTE_TABLE_TITLES[i]);
+            column.setText(ATTRIBUTE_TABLE_TITLES[i]);
             column.setWidth(tableWidths[i]);
             column.setResizable(false);
         }
@@ -177,7 +177,7 @@
     {
         _tableViewer = new TableViewer(_table);
         _tableViewer.setUseHashlookup(true);
-        _tableViewer.setColumnProperties(Constants.ATTRIBUTE_TABLE_TITLES);
+        _tableViewer.setColumnProperties(ATTRIBUTE_TABLE_TITLES);
         _tableViewer.setContentProvider(new ContentProviderImpl());
         _tableViewer.setLabelProvider(new LabelProviderImpl());
         _tableViewer.setSorter(new ViewerSorterImpl());
@@ -194,8 +194,8 @@
     private void addDetailsButton()
     {
         // Create and configure the button for attribute details
-        _detailsButton = _toolkit.createButton(_buttonsComposite, 
Constants.BUTTON_DETAILS, SWT.PUSH | SWT.CENTER);
-        
_detailsButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _detailsButton = _toolkit.createButton(_buttonsComposite, 
BUTTON_DETAILS, SWT.PUSH | SWT.CENTER);
+        _detailsButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData gridData = new GridData(SWT.CENTER, SWT.TOP, false, false);
         gridData.widthHint = 80;
         _detailsButton.setLayoutData(gridData);
@@ -219,8 +219,8 @@
     private void addEditButton()
     {
         // Create and configure the button for editing attribute
-        _editButton = _toolkit.createButton(_buttonsComposite, 
Constants.BUTTON_EDIT_ATTRIBUTE, SWT.PUSH | SWT.CENTER);
-        
_editButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _editButton = _toolkit.createButton(_buttonsComposite, 
BUTTON_EDIT_ATTRIBUTE, SWT.PUSH | SWT.CENTER);
+        _editButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData gridData = new GridData(SWT.CENTER, SWT.TOP, false, false);
         gridData.widthHint = 80;
         _editButton.setLayoutData(gridData);
@@ -241,8 +241,8 @@
      */ 
     private void addGraphButton()
     {
-        _graphButton = _toolkit.createButton(_buttonsComposite, 
Constants.BUTTON_GRAPH, SWT.PUSH | SWT.CENTER);
-        
_graphButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _graphButton = _toolkit.createButton(_buttonsComposite, BUTTON_GRAPH, 
SWT.PUSH | SWT.CENTER);
+        _graphButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData gridData = new GridData(SWT.CENTER, SWT.TOP, false, false);
         gridData.widthHint = 80;
         _graphButton.setLayoutData(gridData);
@@ -263,9 +263,9 @@
      */
     private void addRefreshButton()
     {    
-        _refreshButton = _toolkit.createButton(_buttonsComposite, 
Constants.BUTTON_REFRESH, SWT.PUSH | SWT.CENTER);
+        _refreshButton = _toolkit.createButton(_buttonsComposite, 
BUTTON_REFRESH, SWT.PUSH | SWT.CENTER);
 
-        
_refreshButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _refreshButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData gridData = new GridData(SWT.CENTER, SWT.TOP, false, false);
         gridData.widthHint = 80;
         _refreshButton.setLayoutData(gridData);
@@ -425,7 +425,7 @@
         }
         
         Display display = Display.getCurrent();
-        Shell shell = ViewUtility.createPopupShell(Constants.ATTRIBUTE, width, 
height);
+        Shell shell = ViewUtility.createPopupShell(ATTRIBUTE, width, height);
         createDetailsPopupContents(shell, data);
 
         shell.open();
@@ -484,7 +484,7 @@
 
         // Name
         Label label = new Label(parent, SWT.NONE);               
-        label.setText(Constants.ATTRIBUTE_TABLE_TITLES[0]);
+        label.setText(ATTRIBUTE_TABLE_TITLES[0]);
         GridData layoutData = new GridData(SWT.TRAIL, SWT.TOP, false, false);
         label.setLayoutData(layoutData);
         Text  value = new Text(parent, SWT.BEGINNING | SWT.BORDER 
|SWT.READ_ONLY);
@@ -494,7 +494,7 @@
         
         // Description
         label = new Label(parent, SWT.NONE);
-        label.setText(Constants.DESCRIPTION);
+        label.setText(DESCRIPTION);
         label.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         value = new Text(parent, SWT.BEGINNING | SWT.BORDER | SWT.READ_ONLY);
         value.setText(attribute.getDescription());
@@ -502,7 +502,7 @@
         
         // value
         label = new Label(parent, SWT.NONE);
-        label.setText(Constants.ATTRIBUTE_TABLE_TITLES[1]);
+        label.setText(ATTRIBUTE_TABLE_TITLES[1]);
         label.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
         
         if (!attribute.isReadable())
@@ -582,9 +582,9 @@
     {
         final Button updateButton = new Button(parent, SWT.PUSH | SWT.CENTER);
         // set the data to access in the listener
-        parent.setData(Constants.BUTTON_UPDATE, updateButton);
+        parent.setData(BUTTON_UPDATE, updateButton);
         
-        updateButton.setText(Constants.BUTTON_UPDATE);
+        updateButton.setText(BUTTON_UPDATE);
         GridData gridData = new GridData (SWT.CENTER, SWT.BOTTOM, true, true, 
2, 1);
         gridData.widthHint = 100;
         updateButton.setLayoutData(gridData);
@@ -642,7 +642,9 @@
         }
         _tableViewer.setInput(attributesList);
         checkForEnablingButtons(getSelectionAttribute());
-        _form.layout();
+        
+        _form.layout(true);
+        _form.getBody().layout(true, true);
     }
     
     /**
@@ -679,7 +681,8 @@
         else
         {
             _editButton.setEnabled(false);
-            if (attribute.isNumber())
+            // Currently only Queues are having attributes, which are suitable 
for a graph
+            if (attribute.isNumber() && _mbean.isQueue())
             {
                 _graphButton.setEnabled(true);
             }
@@ -770,7 +773,7 @@
             try
             {
                 animate(canvas, data);
-                Display.getCurrent().timerExec(Constants.TIMER_INTERVAL, this);
+                Display.getCurrent().timerExec(TIMER_INTERVAL, this);
             }
             catch(Exception ex)
             {
@@ -780,7 +783,7 @@
         };
 
         // Launch the timer
-        display.timerExec(Constants.TIMER_INTERVAL, runnable);
+        display.timerExec(TIMER_INTERVAL, runnable);
         
         while (!shell.isDisposed())
         {
@@ -915,7 +918,7 @@
         
         public Font getFont(Object element)
         {
-            return ApplicationRegistry.getFont(Constants.FONT_TABLE_CELL);
+            return ApplicationRegistry.getFont(FONT_TABLE_CELL);
         }
         
         public Color getForeground(Object element)

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
 Wed Mar  7 09:10:13 2007
@@ -3,8 +3,8 @@
 import java.util.Collections;
 import java.util.HashMap;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;
 import org.apache.qpid.management.ui.model.AttributeData;
@@ -135,11 +135,11 @@
         _labelName = _toolkit.createLabel(_headerComposite, "Type:", SWT.NONE);
         GridData gridData = new GridData(SWT.CENTER, SWT.TOP, true, false);
         _labelName.setLayoutData(gridData);
-        _labelName.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+        _labelName.setFont(ApplicationRegistry.getFont(FONT_BOLD));
         
         _labelDesc = _toolkit.createLabel(_headerComposite, " ", SWT.NONE);
         _labelDesc.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, 
false));
-        _labelDesc.setFont(ApplicationRegistry.getFont(Constants.FONT_ITALIC));
+        _labelDesc.setFont(ApplicationRegistry.getFont(FONT_ITALIC));
         
         _headerComposite.layout();
     }
@@ -203,7 +203,7 @@
      */
     protected void createRefreshButton(Composite parentComposite)
     {
-        Button _refreshButton = _toolkit.createButton(parentComposite, 
Constants.BUTTON_REFRESH, SWT.PUSH);
+        Button _refreshButton = _toolkit.createButton(parentComposite, 
BUTTON_REFRESH, SWT.PUSH);
         GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
         gridData.widthHint = 120;
         _refreshButton.setLayoutData(gridData);
@@ -241,7 +241,7 @@
         _labelList = _toolkit.createLabel(_listComposite, " ", SWT.CENTER);
         gridData = new GridData(SWT.CENTER, SWT.TOP, true, false, 1, 1);
         _labelList.setLayoutData(gridData);
-        _labelList.setFont(ApplicationRegistry.getFont(Constants.FONT_NORMAL));
+        _labelList.setFont(ApplicationRegistry.getFont(FONT_NORMAL));
         
         _list = new List(_listComposite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL 
| SWT.H_SCROLL);
         gridData = new GridData(SWT.FILL, SWT.FILL, true, true,1, 1);
@@ -271,10 +271,8 @@
     
     public void layout()
     {
-        _headerComposite.layout();
-        _listComposite.layout();
-        _composite.layout();
-        _form.layout();
+        _form.layout(true);
+        _form.getBody().layout(true, true);
     }
     
     // sets the map with appropriate mbean and name

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java
 Wed Mar  7 09:10:13 2007
@@ -22,8 +22,8 @@
 
 import java.util.HashMap;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.ManagedServer;
 import org.apache.qpid.management.ui.ServerRegistry;
@@ -91,7 +91,7 @@
             // an mbeantype. For mbeantype selection(eg Connection, Queue, 
Exchange) _mbean will remain null.
             _mbean = null;
             setInvisible();
-            _form.setText(Constants.APPLICATION_NAME);
+            _form.setText(APPLICATION_NAME);
             
             // If a selected node(mbean) gets unregistered from mbena server, 
mbenaview should should 
             // make the tabfolber for that mbean invisible
@@ -99,22 +99,38 @@
                 return;
             
             setServer();
-            try
+            refreshMBeanView();
+        }
+    }
+    
+    public void refreshMBeanView()
+    {
+        try
+        {
+            if (NODE_TYPE_SERVER.equals(_selectedNode.getType()) ||
+                NODE_TYPE_DOMAIN.equals(_selectedNode.getType()) )
             {
-                if 
(Constants.NODE_TYPE_MBEANTYPE.equals(_selectedNode.getType()))
-                {
-                    refreshTypeTabFolder(_selectedNode.getName());
-                }
-                else
-                {
-                    showSelectedMBean();
-                }
-                _form.layout();
+                return;
+            }
+            else if (NODE_TYPE_TYPEINSTANCE.equals(_selectedNode.getType()))
+            {
+                // An virtual host instance is selected
+                refreshTypeTabFolder(typeTabFolder.getItem(0));
             }
-            catch(Exception ex)
+            else if (NODE_TYPE_MBEANTYPE.equals(_selectedNode.getType()))
             {
-                MBeanUtility.handleException(_mbean, ex);
+                refreshTypeTabFolder(_selectedNode.getName());
+            } 
+            else
+            {
+                showSelectedMBean();
             }
+            _form.layout(true);
+            _form.getBody().layout(true, true);
+        }
+        catch(Exception ex)
+        {
+            MBeanUtility.handleException(_mbean, ex);
         }
     }
 
@@ -126,7 +142,8 @@
      */
     private void setServer()
     {
-        if (Constants.SERVER.equals(_selectedNode.getType()))
+        if (NODE_TYPE_SERVER.equals(_selectedNode.getType()) ||
+            NODE_TYPE_DOMAIN.equals(_selectedNode.getType()) )
         {
             _server = (ManagedServer)_selectedNode.getManagedObject();
             _virtualHostName = null;
@@ -134,12 +151,12 @@
         else
         {
             TreeObject parent = _selectedNode.getParent();
-            while (parent != null && 
!parent.getType().equals(Constants.SERVER))
+            while (parent != null && 
!parent.getType().equals(NODE_TYPE_SERVER))
             {
                 parent = parent.getParent();
             }
             
-            if (parent != null && parent.getType().equals(Constants.SERVER))
+            if (parent != null && parent.getType().equals(NODE_TYPE_SERVER))
                 _server = (ManagedServer)parent.getManagedObject();
             
             _virtualHostName = _selectedNode.getVirtualHost();
@@ -158,11 +175,11 @@
     
     private void showSelectedMBean() throws Exception
     {     
-        if (Constants.NOTIFICATION.equals(_selectedNode.getType()))
+        if (NOTIFICATION.equals(_selectedNode.getType()))
         {
             _mbean = 
(ManagedBean)_selectedNode.getParent().getManagedObject();                
         }
-        else if (Constants.MBEAN.equals(_selectedNode.getType()))
+        else if (MBEAN.equals(_selectedNode.getType()))
         {
             _mbean = (ManagedBean)_selectedNode.getManagedObject();            
    
         }
@@ -203,7 +220,7 @@
         }
         _form.setText(text);
         int tabIndex = 0;
-        if (Constants.NOTIFICATION.equals(_selectedNode.getType()))
+        if (NOTIFICATION.equals(_selectedNode.getType()))
         {
             tabIndex = tabFolder.getItemCount() -1;
         }
@@ -222,7 +239,7 @@
         _toolkit = new FormToolkit(parent.getDisplay());
         _form = _toolkit.createForm(parent);
         _form.getBody().setLayout(new FormLayout());
-        _form.setText(Constants.APPLICATION_NAME);
+        _form.setText(APPLICATION_NAME);
         
         // Add selection listener for selection events in the Navigation view
         getSite().getPage().addSelectionListener(NavigationView.ID, 
selectionListener); 
@@ -232,35 +249,6 @@
         createMBeanTypeTabFolder();
     }
     
-    public void refreshMBeanView() throws Exception
-    {
-        int tabIndex = 0;
-        TabItem tab = null;
-        if (_mbean == null)
-        {
-            tabIndex = typeTabFolder.getSelectionIndex();
-            if (tabIndex == -1)
-                return;
-
-            tab = typeTabFolder.getItem(tabIndex);
-            refreshTypeTabFolder(tab);
-        }
-        else
-        {
-            TabFolder tabFolder = tabFolderMap.get(_mbean.getType());
-            if (tabFolder == null)
-                return;
-
-            tabIndex = tabFolder.getSelectionIndex();
-            tab = tabFolder.getItem(tabIndex);
-            if (tab == null)
-                return;
-
-            refreshTab(tab);
-        }
-        _form.layout();
-    }
-    
     private TabFolder createMBeanTabFolder()
     {
         TabFolder tabFolder = new TabFolder(_form.getBody(), SWT.NONE);
@@ -325,7 +313,7 @@
         }
         
         TabItem tab = new TabItem(tabFolder, SWT.NONE);
-        tab.setText(Constants.ATTRIBUTES);
+        tab.setText(ATTRIBUTES);
         AttributesTabControl controller = new AttributesTabControl(tabFolder);
         tab.setControl(controller.getControl());
         tab.setData(CONTROLLER, controller);
@@ -357,7 +345,7 @@
         NotificationsTabControl controller = new 
NotificationsTabControl(tabFolder);
         
         TabItem tab = new TabItem(tabFolder, SWT.NONE);
-        tab.setText(Constants.NOTIFICATION);
+        tab.setText(NOTIFICATION);
         tab.setData(CONTROLLER, controller);
         tab.setControl(controller.getControl());
     }
@@ -410,19 +398,19 @@
         typeTabFolder.setVisible(false);
               
         TabItem tab = new TabItem(typeTabFolder, SWT.NONE);
-        tab.setText(Constants.CONNECTION); 
+        tab.setText(CONNECTION); 
         MBeanTypeTabControl controller = new 
ConnectionTypeTabControl(typeTabFolder);
         tab.setData(CONTROLLER, controller);
         tab.setControl(controller.getControl());
         
         tab = new TabItem(typeTabFolder, SWT.NONE);
-        tab.setText(Constants.EXCHANGE);      
+        tab.setText(EXCHANGE);      
         controller = new ExchangeTypeTabControl(typeTabFolder);
         tab.setData(CONTROLLER, controller);
         tab.setControl(controller.getControl());
         
         tab = new TabItem(typeTabFolder, SWT.NONE);
-        tab.setText(Constants.QUEUE);  
+        tab.setText(QUEUE);  
         controller = new QueueTypeTabControl(typeTabFolder);
         tab.setData(CONTROLLER, controller);
         tab.setControl(controller.getControl());
@@ -464,15 +452,15 @@
     
     private void refreshTypeTabFolder(String type) throws Exception
     {
-        if (Constants.CONNECTION.equals(type))
+        if (CONNECTION.equals(type))
         {
             refreshTypeTabFolder(typeTabFolder.getItem(0));
         }
-        else if (Constants.EXCHANGE.equals(type))
+        else if (EXCHANGE.equals(type))
         {
             refreshTypeTabFolder(typeTabFolder.getItem(1));
         }
-        else if (Constants.QUEUE.equals(type))
+        else if (QUEUE.equals(type))
         {
             refreshTypeTabFolder(typeTabFolder.getItem(2));
         }

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NavigationView.java
 Wed Mar  7 09:10:13 2007
@@ -30,8 +30,8 @@
 import java.util.HashMap;
 import java.util.List;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.ManagedServer;
 import org.apache.qpid.management.ui.ServerRegistry;
@@ -190,7 +190,7 @@
         }
         
         // Server connection is successful. Now add the server in the tree
-        TreeObject serverNode = new TreeObject(serverAddress, 
Constants.SERVER);
+        TreeObject serverNode = new TreeObject(serverAddress, 
NODE_TYPE_SERVER);
         serverNode.setUrl(url);
         serverNode.setManagedObject(managedServer);
         _serversRootNode.addChild(serverNode);
@@ -241,9 +241,9 @@
         String domain = server.getDomain();
         try
         {
-            if (!domain.equals(Constants.ALL))
+            if (!domain.equals(ALL))
             {
-                TreeObject domainNode = new TreeObject(domain, 
Constants.DOMAIN);
+                TreeObject domainNode = new TreeObject(domain, 
NODE_TYPE_DOMAIN);
                 domainNode.setParent(serverNode);
 
                 populateDomain(domainNode); 
@@ -254,7 +254,7 @@
                 List<String> domains = MBeanUtility.getAllDomains(server);;    
       
                 for (String domainName : domains)
                 {       
-                    TreeObject domainNode = new TreeObject(domainName, 
Constants.DOMAIN);
+                    TreeObject domainNode = new TreeObject(domainName, 
NODE_TYPE_DOMAIN);
                     domainNode.setParent(serverNode);
 
                     domainList.add(domainNode);
@@ -299,7 +299,7 @@
         // This will add the default nodes to the domain node
         for (TreeObject child : domain.getChildren())
         {
-            if (!child.getName().startsWith(Constants.VIRTUAL_HOST))
+            if (!child.getName().startsWith(VIRTUAL_HOST))
             {
                 addDefaultNodes(domain);
             }
@@ -315,13 +315,13 @@
      */
     private void addDefaultNodes(TreeObject parent)
     {
-        TreeObject typeChild = new TreeObject(Constants.CONNECTION, 
Constants.NODE_TYPE_MBEANTYPE);
+        TreeObject typeChild = new TreeObject(CONNECTION, NODE_TYPE_MBEANTYPE);
         typeChild.setParent(parent);
         typeChild.setVirtualHost(parent.getVirtualHost());
-        typeChild = new TreeObject(Constants.EXCHANGE, 
Constants.NODE_TYPE_MBEANTYPE);
+        typeChild = new TreeObject(EXCHANGE, NODE_TYPE_MBEANTYPE);
         typeChild.setParent(parent);
         typeChild.setVirtualHost(parent.getVirtualHost());
-        typeChild = new TreeObject(Constants.QUEUE, 
Constants.NODE_TYPE_MBEANTYPE);
+        typeChild = new TreeObject(QUEUE, NODE_TYPE_MBEANTYPE);
         typeChild.setParent(parent);
         typeChild.setVirtualHost(parent.getVirtualHost());
     }
@@ -338,7 +338,7 @@
         List<TreeObject> childNodes = parent.getChildren();
         for (TreeObject child : childNodes)
         {
-            if ((Constants.NODE_TYPE_MBEANTYPE.equals(child.getType()) || 
Constants.TYPE_INSTANCE.equals(child.getType())) &&
+            if ((NODE_TYPE_MBEANTYPE.equals(child.getType()) || 
NODE_TYPE_TYPEINSTANCE.equals(child.getType())) &&
                  typeName.equals(child.getName()))
                 return child;
         }
@@ -350,7 +350,7 @@
         List<TreeObject> childNodes = typeNode.getChildren();
         for (TreeObject child : childNodes)
         {
-            if (Constants.MBEAN.equals(child.getType()) && 
mbeanName.equals(child.getName()))
+            if (MBEAN.equals(child.getType()) && 
mbeanName.equals(child.getName()))
                 return true;
         }
         return false;
@@ -401,7 +401,7 @@
                 typeNode.setVirtualHost(mbean.getVirtualHostName());
                 
                 // Create default nodes for VHost instances
-                if (type.equals(Constants.VIRTUAL_HOST))
+                if (type.equals(VIRTUAL_HOST))
                 {
                     addDefaultNodes(typeNode);
                 }
@@ -422,20 +422,20 @@
         
         // Add notification node
         // TODO: show this only if the mbean sends any notification
-        TreeObject notificationNode = new TreeObject(Constants.NOTIFICATION, 
Constants.NOTIFICATION);
+        TreeObject notificationNode = new TreeObject(NOTIFICATION, 
NOTIFICATION);
         notificationNode.setParent(mbeanNode);
     }
     
     private TreeObject createTypeNode(TreeObject parent, String name)
     {
-        TreeObject typeNode = new TreeObject(name, 
Constants.NODE_TYPE_MBEANTYPE);
+        TreeObject typeNode = new TreeObject(name, NODE_TYPE_MBEANTYPE);
         typeNode.setParent(parent);
         return typeNode;
     }
     
     private TreeObject createTypeInstanceNode(TreeObject parent, String name)
     {
-        TreeObject typeNode = new TreeObject(name, Constants.TYPE_INSTANCE);
+        TreeObject typeNode = new TreeObject(name, NODE_TYPE_TYPEINSTANCE);
         typeNode.setParent(parent);
         return typeNode;
     }
@@ -466,7 +466,7 @@
         TreeObject objectToRemove = null;
         for (TreeObject child : list)
         {
-            if (Constants.MBEAN.equals(child.getType()))
+            if (MBEAN.equals(child.getType()))
             {
                 String name = mbean.getName() != null ? mbean.getName() : 
mbean.getType();
                 if (child.getName().equals(name))
@@ -589,7 +589,7 @@
     {
         IStructuredSelection ss = 
(IStructuredSelection)_treeViewer.getSelection();
         TreeObject selectedNode = (TreeObject)ss.getFirstElement();
-        if (ss.isEmpty() || selectedNode == null || 
(!selectedNode.getType().equals(Constants.SERVER)))
+        if (ss.isEmpty() || selectedNode == null || 
(!selectedNode.getType().equals(NODE_TYPE_SERVER)))
         {
             throw new InfoRequiredException("Please select the server");
         }
@@ -612,7 +612,7 @@
         
         createTreeViewer(composite);
         _rootNode = new TreeObject("ROOT", "ROOT");
-        _serversRootNode = new TreeObject(Constants.NAVIGATION_ROOT, "ROOT");
+        _serversRootNode = new TreeObject(NAVIGATION_ROOT, "ROOT");
         _serversRootNode.setParent(_rootNode);
         
         _treeViewer.setInput(_rootNode);
@@ -633,7 +633,7 @@
                     String url = getRMIURL(serverAddress);
                     ManagedServer managedServer = new ManagedServer(url, 
"org.apache.qpid");
                     managedServer.setName(serverAddress);
-                    TreeObject serverNode = new TreeObject(serverAddress, 
Constants.SERVER);
+                    TreeObject serverNode = new TreeObject(serverAddress, 
NODE_TYPE_SERVER);
                     serverNode.setUrl(url);
                     serverNode.setManagedObject(managedServer);
                     _serversRootNode.addChild(serverNode);
@@ -711,28 +711,28 @@
         public Image getImage(Object element)
         {
             TreeObject node = (TreeObject)element;
-            if (node.getType().equals(Constants.NOTIFICATION))
+            if (node.getType().equals(NOTIFICATION))
             {
-                return 
ApplicationRegistry.getImage(Constants.NOTIFICATION_IMAGE);
+                return ApplicationRegistry.getImage(NOTIFICATION_IMAGE);
             }
-            else if (!node.getType().equals(Constants.MBEAN))
+            else if (!node.getType().equals(MBEAN))
             {
                if (_treeViewer.getExpandedState(node))
-                   return 
ApplicationRegistry.getImage(Constants.OPEN_FOLDER_IMAGE);
+                   return ApplicationRegistry.getImage(OPEN_FOLDER_IMAGE);
                else
-                   return 
ApplicationRegistry.getImage(Constants.CLOSED_FOLDER_IMAGE);
+                   return ApplicationRegistry.getImage(CLOSED_FOLDER_IMAGE);
                    
             }
             else
             {
-                return ApplicationRegistry.getImage(Constants.MBEAN_IMAGE);
+                return ApplicationRegistry.getImage(MBEAN_IMAGE);
             }
         }
         
         public String getText(Object element)
         {
             TreeObject node = (TreeObject)element;
-            if (node.getType().equals(Constants.NODE_TYPE_MBEANTYPE))
+            if (node.getType().equals(NODE_TYPE_MBEANTYPE))
             {
                 return node.getName() + "s";
             }
@@ -745,14 +745,14 @@
         public Font getFont(Object element)
         {
             TreeObject node = (TreeObject)element;
-            if (node.getType().equals(Constants.SERVER))
+            if (node.getType().equals(NODE_TYPE_SERVER))
             {
                 if (node.getChildren().isEmpty())
-                    return ApplicationRegistry.getFont(Constants.FONT_NORMAL);
+                    return ApplicationRegistry.getFont(FONT_NORMAL);
                 else
-                    return ApplicationRegistry.getFont(Constants.FONT_BOLD);
+                    return ApplicationRegistry.getFont(FONT_BOLD);
             }
-            return ApplicationRegistry.getFont(Constants.FONT_NORMAL);
+            return ApplicationRegistry.getFont(FONT_NORMAL);
         }
     } // End of LabelProviderImpl
     
@@ -762,7 +762,7 @@
         public int category(Object element)
         {
             TreeObject node = (TreeObject)element;
-            if (node.getType().equals(Constants.MBEAN))
+            if (node.getType().equals(MBEAN))
                 return 1;
             return 2;
         }

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/NotificationsTabControl.java
 Wed Mar  7 09:10:13 2007
@@ -23,8 +23,8 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.ServerRegistry;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;
@@ -142,7 +142,7 @@
         composite.setLayout(new FormLayout());
         
         Label label = _toolkit.createLabel(composite, "Select the notification 
to subscribe or unsubscribe");
-        label.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+        label.setFont(ApplicationRegistry.getFont(FONT_BOLD));
         FormData formData = new FormData();
         formData.top = new FormAttachment(0, 10);
         formData.left = new FormAttachment(0, 10);
@@ -165,8 +165,8 @@
         typesCombo.addSelectionListener(comboListener);
         
         _subscribeButton = new Button(composite, SWT.PUSH | SWT.CENTER);
-        
_subscribeButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
-        _subscribeButton.setText(Constants.SUBSCRIBE_BUTTON);
+        _subscribeButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
+        _subscribeButton.setText(SUBSCRIBE_BUTTON);
         formData = new FormData();
         formData.top = new FormAttachment(label, 10);
         formData.left = new FormAttachment(65, 10);
@@ -175,8 +175,8 @@
         _subscribeButton.addSelectionListener(selectionListener);
         
         _unsubscribeButton = new Button(composite, SWT.PUSH | SWT.CENTER);
-        
_unsubscribeButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
-        _unsubscribeButton.setText(Constants.UNSUBSCRIBE_BUTTON);
+        _unsubscribeButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
+        _unsubscribeButton.setText(UNSUBSCRIBE_BUTTON);
         formData = new FormData();
         formData.top = new FormAttachment(label, 10);
         formData.left = new FormAttachment(_subscribeButton, 10);
@@ -189,8 +189,8 @@
         formData.top = new FormAttachment(notificationNameCombo, 5);
         formData.left = new FormAttachment(0, 10);
         fixedLabel.setLayoutData(formData);
-        fixedLabel.setText(Constants.DESCRIPTION + " : ");
-        fixedLabel.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+        fixedLabel.setText(DESCRIPTION + " : ");
+        fixedLabel.setFont(ApplicationRegistry.getFont(FONT_BOLD));
         
         descriptionLabel = _toolkit.createLabel(composite, "");
         formData = new FormData();
@@ -199,7 +199,7 @@
         formData.right = new FormAttachment(100);
         descriptionLabel.setLayoutData(formData);
         descriptionLabel.setText("      ");
-        
descriptionLabel.setFont(ApplicationRegistry.getFont(Constants.FONT_ITALIC));
+        descriptionLabel.setFont(ApplicationRegistry.getFont(FONT_ITALIC));
     }
     
     /**
@@ -212,8 +212,8 @@
         composite.setLayout(new GridLayout(2, true));
         
         // Add Clear Button
-        _clearButton = _toolkit.createButton(composite, 
Constants.BUTTON_CLEAR, SWT.PUSH | SWT.CENTER);
-        
_clearButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _clearButton = _toolkit.createButton(composite, BUTTON_CLEAR, SWT.PUSH 
| SWT.CENTER);
+        _clearButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData gridData = new GridData(SWT.LEAD, SWT.TOP, true, false);
         gridData.widthHint = 80;
         _clearButton.setLayoutData(gridData);
@@ -231,8 +231,8 @@
             });
         
         // Add Refresh Button
-        _refreshButton = _toolkit.createButton(composite, 
Constants.BUTTON_REFRESH, SWT.PUSH | SWT.CENTER);
-        
_refreshButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _refreshButton = _toolkit.createButton(composite, BUTTON_REFRESH, 
SWT.PUSH | SWT.CENTER);
+        _refreshButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         gridData = new GridData(SWT.TRAIL, SWT.TOP, true, false);
         gridData.widthHint = 80;
         _refreshButton.setLayoutData(gridData);
@@ -427,7 +427,8 @@
         
         populateNotificationInfo();        
         workerRunning = true;
-        _form.layout();       
+        _form.layout(true);   
+        _form.getBody().layout(true, true);
     }
     
     private void refresh()

Modified: 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java?view=diff&rev=515649&r1=515648&r2=515649
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
 Wed Mar  7 09:10:13 2007
@@ -24,8 +24,8 @@
 import java.util.List;
 import java.util.Map.Entry;
 
+import static org.apache.qpid.management.ui.Constants.*;
 import org.apache.qpid.management.ui.ApplicationRegistry;
-import org.apache.qpid.management.ui.Constants;
 import org.apache.qpid.management.ui.ManagedBean;
 import org.apache.qpid.management.ui.jmx.MBeanUtility;
 import org.apache.qpid.management.ui.model.OperationData;
@@ -121,8 +121,8 @@
             _paramsComposite = _toolkit.createComposite(_form.getBody(), 
SWT.NONE);
             _paramsComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, 
true, false));
         }
-        _executionButton = _toolkit.createButton(_form.getBody(), 
Constants.BUTTON_EXECUTE, SWT.PUSH | SWT.CENTER);
-        
_executionButton.setFont(ApplicationRegistry.getFont(Constants.FONT_BUTTON));
+        _executionButton = _toolkit.createButton(_form.getBody(), 
BUTTON_EXECUTE, SWT.PUSH | SWT.CENTER);
+        _executionButton.setFont(ApplicationRegistry.getFont(FONT_BUTTON));
         GridData layoutData = new GridData(SWT.CENTER, SWT.TOP, true, false);
         layoutData.verticalIndent = 20;
         _executionButton.setLayoutData(layoutData);
@@ -162,15 +162,15 @@
         List<ParameterData> params = _opData.getParameters();
         if (params != null && !params.isEmpty())
         {            
-            setButton(Constants.BUTTON_EXECUTE);
+            setButton(BUTTON_EXECUTE);
         }
-        else if (_opData.getImpact() == Constants.OPERATION_IMPACT_ACTION)
+        else if (_opData.getImpact() == OPERATION_IMPACT_ACTION)
         {
-            setButton(Constants.BUTTON_EXECUTE);
+            setButton(BUTTON_EXECUTE);
         }
-        else if (_opData.getImpact() == Constants.OPERATION_IMPACT_INFO)
+        else if (_opData.getImpact() == OPERATION_IMPACT_INFO)
         {
-            setButton(Constants.BUTTON_REFRESH);
+            setButton(BUTTON_REFRESH);
             executeAndShowResults();
         }
         
@@ -180,12 +180,8 @@
     
     public void layout()
     {
-        _headerComposite.layout();
-        if (_paramsComposite != null && !_paramsComposite.isDisposed())
-        {
-            _paramsComposite.layout();
-        }
-        _form.layout();
+        _form.layout(true);
+        _form.getBody().layout(true, true);
     }
     
     /**
@@ -196,12 +192,12 @@
         _form.setText(ViewUtility.getDisplayText(_opData.getName()));
         _headerComposite.setLayout(new GridLayout(2, false));
         //operation description
-        Label label = _toolkit.createLabel(_headerComposite,  
Constants.DESCRIPTION + " : ");
-        label.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+        Label label = _toolkit.createLabel(_headerComposite,  DESCRIPTION + " 
: ");
+        label.setFont(ApplicationRegistry.getFont(FONT_BOLD));
         label.setLayoutData(new GridData(SWT.LEAD, SWT.TOP, false, false));
         
         label = _toolkit.createLabel(_headerComposite,  
_opData.getDescription());
-        label.setFont(ApplicationRegistry.getFont(Constants.FONT_NORMAL));
+        label.setFont(ApplicationRegistry.getFont(FONT_NORMAL));
         label.setLayoutData(new GridData(SWT.LEAD, SWT.TOP, true, false));
         
         _headerComposite.layout();
@@ -220,8 +216,8 @@
         
         // Customised parameter widgets        
         if (_mbean.isExchange() &&
-            
Constants.EXCHANGE_TYPE_VALUES[2].equals(_mbean.getProperty(Constants.EXCHANGE_TYPE))
 &&
-            
_opData.getName().equalsIgnoreCase(Constants.OPERATION_CREATE_BINDING))
+            EXCHANGE_TYPE_VALUES[2].equals(_mbean.getProperty(EXCHANGE_TYPE)) 
&&
+            _opData.getName().equalsIgnoreCase(OPERATION_CREATE_BINDING))
         {                                  
             customCreateNewBinding(); 
             return;
@@ -254,24 +250,24 @@
             formData.left = new FormAttachment(label, 5);
             formData.right = new FormAttachment(valueWidth);
             String[] items = null;
-            if (param.getName().equals(Constants.QUEUE))
+            if (param.getName().equals(QUEUE))
             {
                 List<String> qList = 
ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
-                // Customization for AMQQueueMBean method 
Constants.OPERATION_MOVE_MESSAGES
-                if 
(_opData.getName().equals(Constants.OPERATION_MOVE_MESSAGES))
+                // Customization for AMQQueueMBean method 
OPERATION_MOVE_MESSAGES
+                if (_opData.getName().equals(OPERATION_MOVE_MESSAGES))
                 {
                     qList.remove(_mbean.getName());    
                 }
                 // End of Customization
                 items = qList.toArray(new String[0]);
             }
-            else if (param.getName().equals(Constants.EXCHANGE))
+            else if (param.getName().equals(EXCHANGE))
             {
                 items = 
ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_virtualHostName);
             }
-            else if (param.getName().equals(Constants.EXCHANGE_TYPE))
+            else if (param.getName().equals(EXCHANGE_TYPE))
             {
-                items = Constants.EXCHANGE_TYPE_VALUES;
+                items = EXCHANGE_TYPE_VALUES;
             }
             
             if (items != null)
@@ -466,7 +462,7 @@
         _executionButton.removeSelectionListener(refreshListener);
         _executionButton.removeSelectionListener(operationExecutionListener);
         
-        if (Constants.BUTTON_EXECUTE.equals(text))
+        if (BUTTON_EXECUTE.equals(text))
         {
             _executionButton.addSelectionListener(operationExecutionListener); 
   
         }
@@ -485,8 +481,8 @@
         Display display = Display.getCurrent();
         int width = 600;
         int height = 400;
-        Shell shell = ViewUtility.createPopupShell(Constants.RESULT, width, 
height);
-        shell.setImage(ApplicationRegistry.getImage(Constants.CONSOLE_IMAGE));
+        Shell shell = ViewUtility.createPopupShell(RESULT, width, height);
+        shell.setImage(ApplicationRegistry.getImage(CONSOLE_IMAGE));
         ViewUtility.populateCompositeWithData(_toolkit, shell, result);
         
         shell.open();
@@ -554,8 +550,8 @@
                     if (param.getValue() == null || 
param.getValue().toString().length() == 0)
                     {
                         // Customized check, because for this parameter null 
is allowed
-                        if 
(param.getName().equals(Constants.ATTRIBUTE_QUEUE_OWNER) &&
-                            
_opData.getName().equals(Constants.OPERATION_CREATE_QUEUE))
+                        if (param.getName().equals(ATTRIBUTE_QUEUE_OWNER) &&
+                            _opData.getName().equals(OPERATION_CREATE_QUEUE))
                         {
                             continue;
                         }
@@ -569,7 +565,7 @@
                 }
             }
             
-            if (_opData.getImpact() == Constants.OPERATION_IMPACT_ACTION)
+            if (_opData.getImpact() == OPERATION_IMPACT_ACTION)
             {
                 String bean = _mbean.getName() == null ? _mbean.getType() : 
_mbean.getName();
                 int response = ViewUtility.popupConfirmationMessage(bean, 


Reply via email to