summaryrefslogtreecommitdiff
path: root/java/management/eclipse-plugin/src
diff options
context:
space:
mode:
authorBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2006-12-29 15:47:42 +0000
committerBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2006-12-29 15:47:42 +0000
commitfa857787a62718cc1c9b9e2a4d49a2b867301fa4 (patch)
tree15120b1d476c8eebfdf6339d78e65737e4fe3e33 /java/management/eclipse-plugin/src
parent3ddb2f328dc6b6fc92c18bcfaaee65daf290b9da (diff)
downloadqpid-python-fa857787a62718cc1c9b9e2a4d49a2b867301fa4.tar.gz
QPID-213
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@491031 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management/eclipse-plugin/src')
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java106
1 files changed, 106 insertions, 0 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
new file mode 100644
index 0000000000..05425c5c01
--- /dev/null
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java
@@ -0,0 +1,106 @@
+package org.apache.qpid.management.ui.views;
+
+import org.apache.qpid.management.ui.ApplicationRegistry;
+import org.apache.qpid.management.ui.Constants;
+import org.apache.qpid.management.ui.ServerRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class MBeanTypeTabControl
+{
+ private FormToolkit _toolkit;
+ private Form _form;
+ private TabFolder _tabFolder;
+ private Composite _composite;
+ private Label _labelName;
+ private Label _labelDesc;
+ private List _list;
+ private Button _button;
+
+ private String _type = null;
+
+ public MBeanTypeTabControl(TabFolder tabFolder)
+ {
+ _tabFolder = tabFolder;
+ _toolkit = new FormToolkit(_tabFolder.getDisplay());
+ _form = _toolkit.createForm(_tabFolder);
+ createWidgets();
+ }
+
+ public Control getControl()
+ {
+ return _form;
+ }
+
+ private void createWidgets()
+ {
+ _form.getBody().setLayout(new GridLayout());
+ _composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
+ _composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ _composite.setLayout(new GridLayout(2, true));
+
+ _labelName = _toolkit.createLabel(_composite, "Type:", SWT.NONE);
+ GridData gridData = new GridData(SWT.CENTER, SWT.TOP, true, false, 2, 1);
+ _labelName.setLayoutData(gridData);
+ _labelName.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+ /*
+ _labelDesc = _toolkit.createLabel(_composite, " ", SWT.NONE);
+ _labelDesc.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, false, 2, 1));
+ _labelDesc.setFont(ApplicationRegistry.getFont(Constants.FONT_ITALIC));
+
+ _button = _toolkit.createButton(_composite, "<- Add to Navigation", SWT.PUSH);
+ gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
+ _button.setLayoutData(gridData);
+ */
+ _list = new List(_composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ _list.setLayoutData(gridData);
+ }
+
+ public void refresh(String typeName) throws Exception
+ {
+ _type = typeName;
+ setHeader();
+ populateList();
+ _form.layout();
+ }
+
+ private void setHeader()
+ {
+ _labelName.setText("Type: " + _type);
+ //_labelDesc.setText("Select the " + _type + " to add in the Navigation View");
+ }
+
+ private void populateList() throws Exception
+ {
+ ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
+ String[] items = null;
+ if (_type.equals(Constants.QUEUE))
+ {
+ items = serverRegistry.getQueueNames();
+ }
+ else if (_type.equals(Constants.EXCHANGE))
+ {
+ items = serverRegistry.getExchangeNames();
+ }
+ else if (_type.equals(Constants.CONNECTION))
+ {
+ items = serverRegistry.getConnectionNames();
+ }
+ else
+ {
+ throw new Exception("Unknown mbean type " + _type);
+ }
+
+ _list.setItems(items);
+ }
+}