Author: robbie Date: Tue Jun 23 09:50:50 2009 New Revision: 787613 URL: http://svn.apache.org/viewvc?rev=787613&view=rev Log: QPID-1929: create factory class to produce MBean views, clean up MBeanView accordingly, remove soon to be defunct 'edit attribute' menu item and action
Added: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java Removed: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/actions/EditAttribute.java Modified: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/plugin.xml qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java Modified: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/plugin.xml URL: http://svn.apache.org/viewvc/qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/plugin.xml?rev=787613&r1=787612&r2=787613&view=diff ============================================================================== --- qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/plugin.xml (original) +++ qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/plugin.xml Tue Jun 23 09:50:50 2009 @@ -94,11 +94,6 @@ name="Refresh"/> <command categoryId="org.apache.qpid.management.ui.category" - description="pops up the window for editing selected attribute" - id="org.apache.qpid.management.ui.actions.cmd_editAttribute" - name="Edit Attribute"/> - <command - categoryId="org.apache.qpid.management.ui.category" description="About Qpid Management Console" id="qpidmc.about" name="About"/> @@ -128,10 +123,6 @@ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="CTRL+Alt+F5"/> <key - commandId="org.apache.qpid.management.ui.actions.cmd_editAttribute" - schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" - sequence="CTRL+Alt+E"/> - <key commandId="org.eclipse.ui.file.exit" schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" sequence="CTRL+Alt+X"> @@ -165,14 +156,6 @@ <separator name="qpidActionsGroup"/> </menu> <action - class="org.apache.qpid.management.ui.actions.EditAttribute" - definitionId="org.apache.qpid.management.ui.actions.cmd_editAttribute" - id="org.apache.qpid.management.ui.actions.editAttribute" - label="Edit Attribute" - menubarPath="qpidmanager/mbeanactions" - style="push" - tooltip="Edit Attribute"/> - <action class="org.apache.qpid.management.ui.actions.Refresh" definitionId="org.apache.qpid.management.ui.actions.cmd_refresh" icon="icons/refresh.gif" Added: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java URL: http://svn.apache.org/viewvc/qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java?rev=787613&view=auto ============================================================================== --- qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java (added) +++ qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTabFolderFactory.java Tue Jun 23 09:50:50 2009 @@ -0,0 +1,237 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.management.ui.views; + +import static org.apache.qpid.management.ui.Constants.ATTRIBUTES; +import static org.apache.qpid.management.ui.Constants.NOTIFICATIONS; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import javax.management.MBeanServerConnection; + +import org.apache.qpid.management.ui.ApplicationRegistry; +import org.apache.qpid.management.ui.ServerRegistry; +import org.apache.qpid.management.ui.jmx.JMXManagedObject; +import org.apache.qpid.management.ui.jmx.MBeanUtility; +import org.apache.qpid.management.ui.model.NotificationInfoModel; +import org.apache.qpid.management.ui.model.OperationData; +import org.apache.qpid.management.ui.model.OperationDataModel; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; + +public class MBeanTabFolderFactory +{ + + private static final String MBEANTYPE_QUEUE = "VirtualHost.Queue"; + private static final String MBEANTYPE_CONNECTION = "VirtualHost.Connection"; + private static final String MBEANTYPE_EXCHANGE = "VirtualHost.Exchange"; + private static final String MBEANTYPE_VHOST_MANAGER = "VirtualHost.VirtualHostManager"; + private static final String MBEANTYPE_LOGGING_MANAGEMENT = "LoggingManagement"; + private static final String MBEANTYPE_USER_MANAGEMENT = "UserManagement"; + private static final String MBEANTYPE_CONFIGURATION_MANAGEMENT = "ConfigurationManagement"; + + + private MBeanTabFolderFactory() + { + //no instances + } + + public static TabFolder generateMBeanTabFolder(final Composite parent, final JMXManagedObject mbean, final MBeanServerConnection mbsc) + { + TabFolder tabFolder = new TabFolder(parent, SWT.NONE); + FormData layoutData = new FormData(); + layoutData.left = new FormAttachment(0); + layoutData.top = new FormAttachment(0); + layoutData.right = new FormAttachment(100); + layoutData.bottom = new FormAttachment(100); + tabFolder.setLayoutData(layoutData); + + QpidMBeanType mbeanType = QpidMBeanType.get(mbean.getType()); + + switch(mbeanType) + { + case QUEUE: + tempCreateGeneric(tabFolder, mbean); + break; + case CONNECTION: + tempCreateGeneric(tabFolder, mbean); + break; + case EXCHANGE: + tempCreateGeneric(tabFolder, mbean); + break; + case VHOST_MANAGER: + tempCreateGeneric(tabFolder, mbean); + break; + case LOGGING_MANAGEMENT: + tempCreateGeneric(tabFolder, mbean); + break; + case USER_MANAGEMENT: + tempCreateGeneric(tabFolder, mbean); + break; + case CONFIGURATION_MANAGEMENT: + tempCreateGeneric(tabFolder, mbean); + break; + case UNKNOWN: + tempCreateGeneric(tabFolder, mbean); + break; + } + + createNotificationsTabIfNecessary(tabFolder, mbean); + + tabFolder.addListener(SWT.Selection, new Listener() + { + public void handleEvent(Event evt) + { + TabItem tab = (TabItem)evt.item; + TabControl controller = (TabControl)tab.getData(TabControl.CONTROLLER); + if(controller != null) + { + controller.refresh(mbean); + } + } + }); + + return tabFolder; + } + + private static void tempCreateGeneric(TabFolder tabFolder, JMXManagedObject mbean) + { + createAttributesTab(tabFolder, mbean); + createOperationTabs(tabFolder, mbean); + } + + private static void createAttributesTab(TabFolder tabFolder, JMXManagedObject mbean) + { + ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(mbean); + if(serverRegistry.getAttributeModel(mbean).getCount() == 0) + { + return; + } + + TabItem tab = new TabItem(tabFolder, SWT.NONE); + tab.setText(ATTRIBUTES); + AttributesTabControl controller = new AttributesTabControl(tabFolder); + tab.setControl(controller.getControl()); + tab.setData(TabControl.CONTROLLER, controller); + } + + private static void createOperationTabs(TabFolder tabFolder, JMXManagedObject mbean) + { + ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(mbean); + int operationsCount = serverRegistry.getOperationModel(mbean).getCount(); + if(operationsCount == 0) + { + return; + } + + OperationDataModel operationModel = serverRegistry.getOperationModel(mbean); + for(OperationData operationData : operationModel.getOperations()) + { + TabItem operationTab = new TabItem(tabFolder, SWT.NONE); + operationTab.setText(ViewUtility.getDisplayText(operationData.getName())); + operationTab.setData(operationData); + OperationTabControl control = new OperationTabControl(tabFolder, operationData); + operationTab.setData(TabControl.CONTROLLER, control); + operationTab.setControl(control.getControl()); + } + } + + private static void createNotificationsTabIfNecessary(TabFolder tabFolder, JMXManagedObject mbean) + { + NotificationInfoModel[] items = MBeanUtility.getNotificationInfo(mbean); + if(items == null || items.length == 0) + { + //the mbean has no notifications to subscribe for, do not create the tab. + return; + } + + NotificationsTabControl controller = new NotificationsTabControl(tabFolder); + + TabItem tab = new TabItem(tabFolder, SWT.NONE); + tab.setText(NOTIFICATIONS); + tab.setData(TabControl.CONTROLLER, controller); + tab.setControl(controller.getControl()); + } + + + private enum QpidMBeanType + { + QUEUE (MBEANTYPE_QUEUE), + CONNECTION (MBEANTYPE_CONNECTION), + EXCHANGE (MBEANTYPE_EXCHANGE), + VHOST_MANAGER (MBEANTYPE_VHOST_MANAGER), + LOGGING_MANAGEMENT (MBEANTYPE_LOGGING_MANAGEMENT), + USER_MANAGEMENT (MBEANTYPE_USER_MANAGEMENT), + CONFIGURATION_MANAGEMENT (MBEANTYPE_CONFIGURATION_MANAGEMENT), + UNKNOWN (null); + + private static final Map<String,QpidMBeanType> lookup = new HashMap<String,QpidMBeanType>(); + + static + { + for(QpidMBeanType m : EnumSet.allOf(QpidMBeanType.class)) + { + lookup.put(m.getType(), m); + } + } + + private String type; + + private QpidMBeanType() + { + + } + + private QpidMBeanType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + + public static QpidMBeanType get(String type) + { + QpidMBeanType t= lookup.get(type); + if (t != null) + { + return t; + } + else + { + return UNKNOWN; + } + + } + } + + +} \ No newline at end of file Modified: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java URL: http://svn.apache.org/viewvc/qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java?rev=787613&r1=787612&r2=787613&view=diff ============================================================================== --- qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java (original) +++ qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanView.java Tue Jun 23 09:50:50 2009 @@ -20,19 +20,15 @@ */ package org.apache.qpid.management.ui.views; -import java.util.HashMap; +import javax.management.MBeanServerConnection; import static org.apache.qpid.management.ui.Constants.*; import org.apache.qpid.management.ui.ApplicationRegistry; import org.apache.qpid.management.ui.ManagedBean; import org.apache.qpid.management.ui.ManagedServer; -import org.apache.qpid.management.ui.ServerRegistry; -import org.apache.qpid.management.ui.exceptions.InfoRequiredException; +import org.apache.qpid.management.ui.jmx.JMXManagedObject; +import org.apache.qpid.management.ui.jmx.JMXServerRegistry; import org.apache.qpid.management.ui.jmx.MBeanUtility; -import org.apache.qpid.management.ui.model.AttributeData; -import org.apache.qpid.management.ui.model.NotificationInfoModel; -import org.apache.qpid.management.ui.model.OperationData; -import org.apache.qpid.management.ui.model.OperationDataModel; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.SWT; @@ -52,14 +48,10 @@ /** * MBean View create appropriate view based on the user selection on the Navigation View. - * Create TabFolder for all MBeans and displays the attribtues and method tabs. - * @author Bhupendra Bhardwaj - * */ public class MBeanView extends ViewPart { public static final String ID = "org.apache.qpid.management.ui.mbeanView"; - private static final String CONTROLLER = "CONTROLLER"; private FormToolkit _toolkit = null; private Form _form = null; @@ -68,15 +60,14 @@ private TreeObject _selectedNode = null; private ManagedBean _mbean = null; private static String _virtualHostName = null; - // This map contains a TabFolder for each kind of MBean. - // TabFolder is mapped with mbeantype(Connection, Queue and Exchange) - private HashMap<String, TabFolder> tabFolderMap = new HashMap<String, TabFolder>(); - private ISelectionListener selectionListener = new SelectionListenerImpl(); + private static MBeanServerConnection _mbsc = null; + private TabFolder _tabFolder = null; + private ISelectionListener _selectionListener = new SelectionListenerImpl(); // TabFolder to list all the mbeans for a given mbeantype(eg Connection, Queue, Exchange) - private TabFolder typeTabFolder = null; + private TabFolder _typeTabFolder = null; - private TabFolder notificationTabFolder = null; + private TabFolder _notificationTabFolder = null; /* * Listener for the selection events in the navigation view */ @@ -143,7 +134,7 @@ else if (NODE_TYPE_TYPEINSTANCE.equals(_selectedNode.getType())) { // An virtual host instance is selected - refreshTypeTabFolder(typeTabFolder.getItem(0)); + refreshTypeTabFolder(_typeTabFolder.getItem(0)); } else if (NODE_TYPE_MBEANTYPE.equals(_selectedNode.getType())) { @@ -194,6 +185,11 @@ _virtualHostName = _selectedNode.getVirtualHost(); } + + JMXServerRegistry serverRegistry = (JMXServerRegistry)ApplicationRegistry.getServerRegistry(_server); + if(serverRegistry != null){ + _mbsc = serverRegistry.getServerConnection(); + } } public static ManagedServer getServer() @@ -218,33 +214,24 @@ return; } - TabFolder tabFolder = tabFolderMap.get(_mbean.getType()); - /* - * This solution can be used if there are many versions of Qpid running. Otherwise - * there is no need to create a tabFolder everytime a bean is selected. - if (tabFolder != null && !tabFolder.isDisposed()) - { - tabFolder.dispose(); - } - tabFolder = createTabFolder(); - */ - if (tabFolder == null) + if (_tabFolder != null && !_tabFolder.isDisposed()) { - tabFolder = createMBeanTabFolder(); + _tabFolder.dispose(); } + _tabFolder = MBeanTabFolderFactory.generateMBeanTabFolder(_form.getBody(),(JMXManagedObject)_mbean,_mbsc); + int tabIndex = 0; if (NOTIFICATIONS.equals(_selectedNode.getType())) { - tabIndex = tabFolder.getItemCount() -1; + tabIndex = _tabFolder.getItemCount() -1; } - TabItem tab = tabFolder.getItem(tabIndex); + TabItem tab = _tabFolder.getItem(tabIndex); // If folder is being set as visible after tab refresh, then the tab // doesn't have the focus. - tabFolder.setSelection(tabIndex); + _tabFolder.setSelection(tabIndex); refreshTab(tab); - setVisible(tabFolder); } public void createPartControl(Composite parent) @@ -256,7 +243,7 @@ _form.setText(APPLICATION_NAME); // Add selection listener for selection events in the Navigation view - getSite().getPage().addSelectionListener(NavigationView.ID, selectionListener); + getSite().getPage().addSelectionListener(NavigationView.ID, _selectionListener); // Add mbeantype TabFolder. This will list all the mbeans under a mbeantype (eg Queue, Exchange). // Using this list mbeans will be added in the navigation view @@ -265,48 +252,17 @@ createNotificationsTabFolder(); } - private TabFolder createMBeanTabFolder() - { - TabFolder tabFolder = new TabFolder(_form.getBody(), SWT.NONE); - FormData layoutData = new FormData(); - layoutData.left = new FormAttachment(0); - layoutData.top = new FormAttachment(0); - layoutData.right = new FormAttachment(100); - layoutData.bottom = new FormAttachment(100); - tabFolder.setLayoutData(layoutData); - tabFolder.setVisible(false); - - createAttributesTab(tabFolder); - createOperationTabs(tabFolder); - createNotificationsTab(tabFolder); - - tabFolder.addListener(SWT.Selection, new Listener() - { - public void handleEvent(Event evt) - { - TabItem tab = (TabItem)evt.item; - refreshTab(tab); - } - }); - - tabFolderMap.put(_mbean.getType(), tabFolder); - return tabFolder; - } - private void refreshTab(TabItem tab) { - // We can avoid refreshing the attributes tab because it's control - // already contains the required values. But it is added for now and - // will remove if there is any performance issue or any other issue. - // The operations control should be refreshed because there is only one - // controller for all operations tab. - // The Notifications control needs to refresh with latest set of notifications - if (tab == null) + { return; + } - TabControl controller = (TabControl)tab.getData(CONTROLLER); - controller.refresh(_mbean); + TabControl controller = (TabControl)tab.getData(TabControl.CONTROLLER); + if(controller != null){ + controller.refresh(_mbean); + } } public void setFocus() @@ -320,125 +276,39 @@ super.dispose(); } - private void createAttributesTab(TabFolder tabFolder) - { - ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean); - if (serverRegistry.getAttributeModel(_mbean).getCount() == 0) - { - return; - } - - TabItem tab = new TabItem(tabFolder, SWT.NONE); - tab.setText(ATTRIBUTES); - AttributesTabControl controller = new AttributesTabControl(tabFolder); - tab.setControl(controller.getControl()); - tab.setData(CONTROLLER, controller); - } - - private void createOperationTabs(TabFolder tabFolder) - { - ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean); - int operationsCount = serverRegistry.getOperationModel(_mbean).getCount(); - if (operationsCount == 0) - { - return; - } - - OperationDataModel operationModel = serverRegistry.getOperationModel(_mbean); - for (OperationData operationData : operationModel.getOperations()) - { - TabItem operationTab = new TabItem(tabFolder, SWT.NONE); - operationTab.setText(ViewUtility.getDisplayText(operationData.getName())); - operationTab.setData(operationData); - OperationTabControl control = new OperationTabControl(tabFolder, operationData); - operationTab.setData(CONTROLLER, control); - operationTab.setControl(control.getControl()); - } - } - - private void createNotificationsTab(TabFolder tabFolder) - { - NotificationInfoModel[] items = MBeanUtility.getNotificationInfo(_mbean); - if (items == null || items.length == 0) - { - //the mbean has no notifications to subscribe for, do not create the tab. - return; - } - - NotificationsTabControl controller = new NotificationsTabControl(tabFolder); - - TabItem tab = new TabItem(tabFolder, SWT.NONE); - tab.setText(NOTIFICATIONS); - tab.setData(CONTROLLER, controller); - tab.setControl(controller.getControl()); - } - - /** - * For the EditAttribtue Action. Invoking this from action is same as clicking - * "EditAttribute" button from Attribute tab. - */ - public void editAttribute() throws Exception - { - if (_mbean == null) - throw new InfoRequiredException("Please select the managed object and then attribute to be edited"); - - String name = (_mbean.getName() != null) ? _mbean.getName() : _mbean.getType(); - ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(_mbean); - if (serverRegistry.getAttributeModel(_mbean).getCount() == 0) - { - throw new InfoRequiredException("There are no attributes to be edited for " + name); - } - - TabFolder tabFolder = tabFolderMap.get(_mbean.getType()); - int index = tabFolder.getSelectionIndex(); - if (index != 0) - { - tabFolder.setSelection(0); - throw new InfoRequiredException("Please select the attribute to be edited"); - } - - TabItem tab = tabFolder.getItem(0); - AttributesTabControl tabControl = (AttributesTabControl)tab.getData(CONTROLLER); - AttributeData attribute = tabControl.getSelectionAttribute(); - if (attribute == null) - throw new InfoRequiredException("Please select the attribute to be edited"); - - tabControl.createDetailsPopup(attribute); - } - /** * Creates TabFolder and tabs for each mbeantype (eg Connection, Queue, Exchange) */ private void createMBeanTypeTabFolder() { - typeTabFolder = new TabFolder(_form.getBody(), SWT.NONE); + _typeTabFolder = new TabFolder(_form.getBody(), SWT.NONE); FormData layoutData = new FormData(); layoutData.left = new FormAttachment(0); layoutData.top = new FormAttachment(0); layoutData.right = new FormAttachment(100); layoutData.bottom = new FormAttachment(100); - typeTabFolder.setLayoutData(layoutData); - typeTabFolder.setVisible(false); + _typeTabFolder.setLayoutData(layoutData); + _typeTabFolder.setVisible(false); - TabItem tab = new TabItem(typeTabFolder, SWT.NONE); + TabItem tab = new TabItem(_typeTabFolder, SWT.NONE); tab.setText(CONNECTION); - MBeanTypeTabControl controller = new ConnectionTypeTabControl(typeTabFolder); - tab.setData(CONTROLLER, controller); + MBeanTypeTabControl controller = new ConnectionTypeTabControl(_typeTabFolder); + tab.setData(TabControl.CONTROLLER, controller); tab.setControl(controller.getControl()); - tab = new TabItem(typeTabFolder, SWT.NONE); + tab = new TabItem(_typeTabFolder, SWT.NONE); tab.setText(EXCHANGE); - controller = new ExchangeTypeTabControl(typeTabFolder); - tab.setData(CONTROLLER, controller); + controller = new ExchangeTypeTabControl(_typeTabFolder); + tab.setData(TabControl.CONTROLLER, controller); tab.setControl(controller.getControl()); - tab = new TabItem(typeTabFolder, SWT.NONE); + tab = new TabItem(_typeTabFolder, SWT.NONE); tab.setText(QUEUE); - controller = new QueueTypeTabControl(typeTabFolder); - tab.setData(CONTROLLER, controller); + controller = new QueueTypeTabControl(_typeTabFolder); + tab.setData(TabControl.CONTROLLER, controller); tab.setControl(controller.getControl()); - typeTabFolder.addListener(SWT.Selection, new Listener() + _typeTabFolder.addListener(SWT.Selection, new Listener() { public void handleEvent(Event evt) { @@ -457,28 +327,28 @@ private void createNotificationsTabFolder() { - notificationTabFolder = new TabFolder(_form.getBody(), SWT.NONE); + _notificationTabFolder = new TabFolder(_form.getBody(), SWT.NONE); FormData layoutData = new FormData(); layoutData.left = new FormAttachment(0); layoutData.top = new FormAttachment(0); layoutData.right = new FormAttachment(100); layoutData.bottom = new FormAttachment(100); - notificationTabFolder.setLayoutData(layoutData); - notificationTabFolder.setVisible(false); + _notificationTabFolder.setLayoutData(layoutData); + _notificationTabFolder.setVisible(false); - VHNotificationsTabControl controller = new VHNotificationsTabControl(notificationTabFolder); - TabItem tab = new TabItem(notificationTabFolder, SWT.NONE); + VHNotificationsTabControl controller = new VHNotificationsTabControl(_notificationTabFolder); + TabItem tab = new TabItem(_notificationTabFolder, SWT.NONE); tab.setText(NOTIFICATIONS); - tab.setData(CONTROLLER, controller); + tab.setData(TabControl.CONTROLLER, controller); tab.setControl(controller.getControl()); } private void refreshNotificationPage() { - TabItem tab = notificationTabFolder.getItem(0); - VHNotificationsTabControl controller = (VHNotificationsTabControl)tab.getData(CONTROLLER); + TabItem tab = _notificationTabFolder.getItem(0); + VHNotificationsTabControl controller = (VHNotificationsTabControl)tab.getData(TabControl.CONTROLLER); controller.refresh(); - notificationTabFolder.setVisible(true); + _notificationTabFolder.setVisible(true); } /** @@ -493,58 +363,43 @@ { return; } - typeTabFolder.setSelection(tab); - MBeanTypeTabControl controller = (MBeanTypeTabControl)tab.getData(CONTROLLER); + _typeTabFolder.setSelection(tab); + MBeanTypeTabControl controller = (MBeanTypeTabControl)tab.getData(TabControl.CONTROLLER); controller.refresh(); - typeTabFolder.setVisible(true); + _typeTabFolder.setVisible(true); } private void refreshTypeTabFolder(String type) throws Exception { if (CONNECTION.equals(type)) { - refreshTypeTabFolder(typeTabFolder.getItem(0)); + refreshTypeTabFolder(_typeTabFolder.getItem(0)); } else if (EXCHANGE.equals(type)) { - refreshTypeTabFolder(typeTabFolder.getItem(1)); + refreshTypeTabFolder(_typeTabFolder.getItem(1)); } else if (QUEUE.equals(type)) { - refreshTypeTabFolder(typeTabFolder.getItem(2)); + refreshTypeTabFolder(_typeTabFolder.getItem(2)); } } - - /** - * hides other folders and makes the given one visible. - * @param tabFolder - */ - private void setVisible(TabFolder tabFolder) - { - for (TabFolder folder : tabFolderMap.values()) - { - if (folder == tabFolder) - folder.setVisible(true); - else - folder.setVisible(false); - } - } - + private void setInvisible() { - for (TabFolder folder : tabFolderMap.values()) + if (_tabFolder != null) { - folder.setVisible(false); + _tabFolder.setVisible(false); } - if (typeTabFolder != null) + if (_typeTabFolder != null) { - typeTabFolder.setVisible(false); + _typeTabFolder.setVisible(false); } - if (notificationTabFolder != null) + if (_notificationTabFolder != null) { - notificationTabFolder.setVisible(false); + _notificationTabFolder.setVisible(false); } } Modified: qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java URL: http://svn.apache.org/viewvc/qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java?rev=787613&r1=787612&r2=787613&view=diff ============================================================================== --- qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java (original) +++ qpid/branches/jmx_mc_gsoc09/qpid/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/TabControl.java Tue Jun 23 09:50:50 2009 @@ -33,6 +33,7 @@ */ public abstract class TabControl { + public static final String CONTROLLER = "controller"; protected ManagedBean _mbean = null; protected TabFolder _tabFolder = null; --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org