summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-02-05 14:45:18 +0000
committerBhupendra Bhusman Bhardwaj <bhupendrab@apache.org>2007-02-05 14:45:18 +0000
commit4bfeb525ac30d53e3e628082649a459f9320ebd1 (patch)
tree9b3bc6dfa4ddec0d4c11f3087c2a94e4c9529aca
parent457694b9011aba6ec337ffcaca1f7a4f781a43bd (diff)
downloadqpid-python-4bfeb525ac30d53e3e628082649a459f9320ebd1.tar.gz
QPID-213
Also the parameter selection of boolean type is made as check-boxes instead of a drop-down. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@503706 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java14
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java11
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/MBeanTypeTabControl.java144
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java134
4 files changed, 204 insertions, 99 deletions
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
index 6fee8c5368..b3efc107da 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/Constants.java
@@ -28,8 +28,8 @@ package org.apache.qpid.management.ui;
public class Constants
{
public final static String APPLICATION_NAME = "Qpid Management Console";
- public final static String ITEM_VALUE = "value";
- public final static String ITEM_TYPE = "type";
+ 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_MBEANTYPE = "mbeantype";
@@ -41,12 +41,15 @@ public class Constants
public final static String NOTIFICATION = "Notifications";
public final static String RESULT = "Result";
public final static String VIRTUAL_HOST = "VirtualHost";
- public final static String QUEUE_OWNER = "owner";
+
+ // Attributes and operations are used to customize the GUI for Qpid. If these are changes in the
+ // Qpid server, then these should be updated accordingly
+ public final static String ATTRIBUTE_QUEUE_OWNER = "owner";
+ public final static String ATTRIBUTE_QUEUE_DEPTH = "QueueDepth";
+ public final static String ATTRIBUTE_QUEUE_CONSUMERCOUNT = "ActiveConsumerCount";
public final static String OPERATION_CREATE_QUEUE = "createNewQueue";
public final static String OPERATION_CREATE_BINDING = "createNewBinding";
- public final static String ATTRIBUTE_QUEUE_DEPTH = "QueueDepth";
-
public final static String ALL = "All";
public final static String NAVIGATION_ROOT = "Qpid Connections";
@@ -57,6 +60,7 @@ public class Constants
public final static String EXCHANGE_TYPE = "ExchangeType";
public final static String[] EXCHANGE_TYPE_VALUES = {"direct", "topic", "headers"};
public final static String[] BOOLEAN_TYPE_VALUES = {"false", "true"};
+ public final static String[] ATTRIBUTE_TABLE_TITLES = {"Attribute Name", "Value"};
public final static String CONNECTION ="Connection";
public final static String ACTION_ADDSERVER = "New Connection";
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
index 2b8e5cee1a..feb853ab00 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/AttributesTabControl.java
@@ -90,7 +90,6 @@ public class AttributesTabControl extends TabControl
private Table _table = null;
private TableViewer _tableViewer = null;
private static final int[] tableWidths = new int[] {300, 300};
- private final String[] _tableTitles = {"Attribute Name", "Value"};
private Composite _tableComposite = null;
private Composite _buttonsComposite = null;
@@ -159,10 +158,10 @@ public class AttributesTabControl extends TabControl
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
_table.setLayoutData(gridData);
- for (int i = 0; i < _tableTitles.length; ++i)
+ for (int i = 0; i < Constants.ATTRIBUTE_TABLE_TITLES.length; ++i)
{
final TableColumn column = new TableColumn(_table, SWT.NONE);
- column.setText(_tableTitles[i]);
+ column.setText(Constants.ATTRIBUTE_TABLE_TITLES[i]);
column.setWidth(tableWidths[i]);
column.setResizable(false);
}
@@ -178,7 +177,7 @@ public class AttributesTabControl extends TabControl
{
_tableViewer = new TableViewer(_table);
_tableViewer.setUseHashlookup(true);
- _tableViewer.setColumnProperties(_tableTitles);
+ _tableViewer.setColumnProperties(Constants.ATTRIBUTE_TABLE_TITLES);
_tableViewer.setContentProvider(new ContentProviderImpl());
_tableViewer.setLabelProvider(new LabelProviderImpl());
_tableViewer.setSorter(new ViewerSorterImpl());
@@ -485,7 +484,7 @@ public class AttributesTabControl extends TabControl
// Name
Label label = new Label(parent, SWT.NONE);
- label.setText(_tableTitles[0]);
+ label.setText(Constants.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);
@@ -503,7 +502,7 @@ public class AttributesTabControl extends TabControl
// value
label = new Label(parent, SWT.NONE);
- label.setText(_tableTitles[1]);
+ label.setText(Constants.ATTRIBUTE_TABLE_TITLES[1]);
label.setLayoutData(new GridData(SWT.TRAIL, SWT.TOP, false, false));
if (!attribute.isReadable())
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
index 3e76e3e1c0..37c0fba2ef 100644
--- 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
@@ -20,6 +20,7 @@ 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.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.TabFolder;
@@ -41,7 +42,7 @@ public class MBeanTypeTabControl
private TabFolder _tabFolder = null;
private Composite _composite = null;
private Composite _listComposite = null;
- private Composite _buttonsComposite = null;
+ private Composite _sortingComposite = null;
private Label _labelName = null;
private Label _labelDesc = null;
private Label _labelList = null;
@@ -50,6 +51,8 @@ public class MBeanTypeTabControl
private Button _refreshButton = null;
private Button _addButton = null;
private Button _sortBySizeButton = null;
+ private Button _sortByConsumercountButton = null;
+ private Button _sortByNameButton = null;
private String _type = null;
@@ -57,10 +60,12 @@ public class MBeanTypeTabControl
// is to be added to the navigation view.
private HashMap<String, ManagedBean> _objectsMap = new HashMap<String, ManagedBean>();
// Map required for sorting queues based on attribute values
- private Map<AttributeData, ManagedBean> _queueMap = new LinkedHashMap<AttributeData, ManagedBean>();
+ private Map<AttributeData, ManagedBean> _queueDepthMap = new LinkedHashMap<AttributeData, ManagedBean>();
+ // Map used for sorting Queues based on consumer count
+ private Map<AttributeData, ManagedBean> _queueConsumerCountMap = new LinkedHashMap<AttributeData, ManagedBean>();
private Sorter _sorterByName = new Sorter();
- private ComparatorImpl _sorterByQueueDepth = new ComparatorImpl();
+ private ComparatorImpl _sorterByAttribute = new ComparatorImpl();
public MBeanTypeTabControl(TabFolder tabFolder)
{
@@ -90,12 +95,7 @@ public class MBeanTypeTabControl
String[] selectedItems = _list.getSelection();
for (int i = 0; i < selectedItems.length; i++)
{
- String name = selectedItems[i];;
- if (Constants.QUEUE.equals(_type))
- {
- int endIndex = name.lastIndexOf("(");
- name = name.substring(0, endIndex -1);
- }
+ String name = selectedItems[i];
// pass the ManagedBean to the navigation view to be added
ManagedBean mbean = _objectsMap.get(name);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
@@ -126,12 +126,42 @@ public class MBeanTypeTabControl
}
});
+ _sortByNameButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e)
+ {
+ try
+ {
+ java.util.List<String> list = new ArrayList<String>(_objectsMap.keySet());
+ Collections.sort(list);
+ _list.setItems(list.toArray(new String[0]));
+ }
+ catch (Exception ex)
+ {
+ MBeanUtility.handleException(ex);
+ }
+ }
+ });
+
_sortBySizeButton.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e)
{
try
{
- sortQueueByQueueDepth();
+ sortQueuesByQueueDepth();
+ }
+ catch (Exception ex)
+ {
+ MBeanUtility.handleException(ex);
+ }
+ }
+ });
+
+ _sortByConsumercountButton.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e)
+ {
+ try
+ {
+ sortQueuesByConsumerCount();
}
catch (Exception ex)
{
@@ -143,6 +173,18 @@ public class MBeanTypeTabControl
private void createWidgets()
{
+ /* _form
+ * |
+ * _composite
+ * |
+ * ---------------------------------------------------------------------
+ * | | |
+ * _labelName, _labelDesc, _listComposite _sortingComposite
+ * _addButton, _refreshButton | |
+ * _labelList, _list sortingGroup
+ * |
+ * sorting radio buttons
+ */
_form.getBody().setLayout(new GridLayout());
_composite = _toolkit.createComposite(_form.getBody(), SWT.NONE);
_composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -166,7 +208,7 @@ public class MBeanTypeTabControl
_refreshButton = _toolkit.createButton(_composite, Constants.BUTTON_REFRESH, SWT.PUSH);
gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
- gridData.widthHint = 80;
+ gridData.widthHint = 120;
_refreshButton.setLayoutData(gridData);
// Composite to contain the item list
@@ -188,15 +230,39 @@ public class MBeanTypeTabControl
// Composite to contain buttons like - Sort by size
- _buttonsComposite = _toolkit.createComposite(_composite);
+ _sortingComposite = _toolkit.createComposite(_composite);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- _buttonsComposite.setLayoutData(gridData);
- _buttonsComposite.setLayout(new GridLayout());
+ _sortingComposite.setLayoutData(gridData);
+ _sortingComposite.setLayout(new GridLayout());
- _sortBySizeButton = _toolkit.createButton(_buttonsComposite, "Sort by Queue Depth", SWT.PUSH);
- gridData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
- _sortBySizeButton.setLayoutData(gridData);
+ Group sortingGroup = new Group(_sortingComposite, SWT.SHADOW_NONE);
+ sortingGroup.setBackground(_sortingComposite.getBackground());
+ sortingGroup.setText(" Sort List By ");
+ sortingGroup.setFont(ApplicationRegistry.getFont(Constants.FONT_BOLD));
+ gridData = new GridData(SWT.CENTER, SWT.TOP, true, true);
+ sortingGroup.setLayoutData(gridData);
+ sortingGroup.setLayout(new GridLayout());
+ _sortByNameButton = _toolkit.createButton(sortingGroup, "Queue Name", SWT.RADIO);
+ gridData = new GridData(SWT.LEAD, SWT.CENTER, true, false);
+ _sortByNameButton.setLayoutData(gridData);
+
+ _sortBySizeButton = _toolkit.createButton(sortingGroup, "Queue Depth", SWT.RADIO);
+ gridData = new GridData(SWT.LEAD, SWT.CENTER, true, false);
+ _sortBySizeButton.setLayoutData(gridData);
+
+ _sortByConsumercountButton = _toolkit.createButton(sortingGroup, "Consumer Count", SWT.RADIO);
+ gridData = new GridData(SWT.LEAD, SWT.CENTER, true, false);
+ _sortByConsumercountButton.setLayoutData(gridData);
+
+ selectDefaultSortingButton();
+ }
+
+ private void selectDefaultSortingButton()
+ {
+ _sortByNameButton.setSelection(true);
+ _sortBySizeButton.setSelection(false);
+ _sortByConsumercountButton.setSelection(false);
}
public void refresh(String typeName) throws Exception
@@ -225,7 +291,9 @@ public class MBeanTypeTabControl
{
// map should be cleared before populating it with new values
_objectsMap.clear();
- _queueMap.clear();
+ _queueDepthMap.clear();
+ _queueConsumerCountMap.clear();
+
ServerRegistry serverRegistry = ApplicationRegistry.getServerRegistry(MBeanView.getServer());
String[] items = null;
java.util.List<ManagedBean> list = null;
@@ -235,27 +303,27 @@ public class MBeanTypeTabControl
{
list = serverRegistry.getQueues(MBeanView.getVirtualHost());
items = getQueueItems(list);
- _sortBySizeButton.setVisible(true);
+ selectDefaultSortingButton();
+ _sortingComposite.setVisible(true);
}
else if (_type.equals(Constants.EXCHANGE))
{
list = serverRegistry.getExchanges(MBeanView.getVirtualHost());
items = getItems(list);
- _sortBySizeButton.setVisible(false);
+ _sortingComposite.setVisible(false);
}
else if (_type.equals(Constants.CONNECTION))
{
list = serverRegistry.getConnections(MBeanView.getVirtualHost());
items = getItems(list);
- _sortBySizeButton.setVisible(false);
+ _sortingComposite.setVisible(false);
}
else
{
throw new Exception("Unknown mbean type " + _type);
}
- _list.setItems(items);
-
+ _list.setItems(items);
}
// sets the map with appropriate mbean and name
@@ -290,30 +358,48 @@ public class MBeanTypeTabControl
AttributeData data = MBeanUtility.getAttributeData(mbean, Constants.ATTRIBUTE_QUEUE_DEPTH);
String value = data.getValue().toString();
items[i] = mbean.getName() + " (" + value + " KB)";
- _objectsMap.put(mbean.getName(), mbean);
- _queueMap.put(data, mbean);
+ _objectsMap.put(items[i], mbean);
+ _queueDepthMap.put(data, mbean);
+ data = MBeanUtility.getAttributeData(mbean, Constants.ATTRIBUTE_QUEUE_CONSUMERCOUNT);
+ _queueConsumerCountMap.put(data, mbean);
i++;
}
return items;
}
- private void sortQueueByQueueDepth() throws Exception
+ private void sortQueuesByQueueDepth()
{
// Queues are already in the alphabetically sorted order in _queueMap, now sort for queueDepth
- java.util.List<AttributeData> list = new ArrayList<AttributeData>(_queueMap.keySet());
- Collections.sort(list, _sorterByQueueDepth);
+ java.util.List<AttributeData> list = new ArrayList<AttributeData>(_queueDepthMap.keySet());
+ Collections.sort(list, _sorterByAttribute);
String[] items = new String[list.size()];
int i = 0;
for (AttributeData data : list)
{
- ManagedBean mbean = _queueMap.get(data);
+ ManagedBean mbean = _queueDepthMap.get(data);
String value = data.getValue().toString();
items[i++] = mbean.getName() + " (" + value + " KB)";
}
_list.setItems(items);
}
+ private void sortQueuesByConsumerCount()
+ {
+ java.util.List<AttributeData> list = new ArrayList<AttributeData>(_queueConsumerCountMap.keySet());
+ Collections.sort(list, _sorterByAttribute);
+
+ String[] items = new String[list.size()];
+ int i = 0;
+ for (AttributeData data : list)
+ {
+ ManagedBean mbean = _queueConsumerCountMap.get(data);
+ String value = data.getValue().toString();
+ items[i++] = mbean.getName() + " (" + value + " )";
+ }
+ _list.setItems(items);
+ }
+
private class ComparatorImpl implements java.util.Comparator<AttributeData>
{
public int compare(AttributeData data1, AttributeData data2)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
index a6329aa1c9..fc42561c75 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/OperationTabControl.java
@@ -66,9 +66,9 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
*/
public class OperationTabControl extends TabControl
{
- private int heightForAParameter = 30;
- private int labelNumerator = 30;
- private int valueNumerator = labelNumerator + 20;
+ private static final int heightForAParameter = 30;
+ private static final int labelWidth = 30;
+ private static final int valueWidth = labelWidth + 25;
private FormToolkit _toolkit;
private Form _form;
@@ -229,80 +229,79 @@ public class OperationTabControl extends TabControl
_paramsComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
_paramsComposite.setLayout(new FormLayout());
+ int parameterPositionOffset = 0;
for (ParameterData param : params)
{
boolean valueInCombo = false;
Label label = _toolkit.createLabel(_paramsComposite, ViewUtility.getDisplayText(param.getName()));
FormData formData = new FormData();
- formData.top = new FormAttachment(0, params.indexOf(param) * heightForAParameter + 2);
- formData.right = new FormAttachment(labelNumerator);
+ if (params.indexOf(param) == 0)
+ {
+ parameterPositionOffset = 0;
+ }
+ else
+ {
+ parameterPositionOffset += heightForAParameter;
+ }
+ formData.top = new FormAttachment(0, parameterPositionOffset + 2);
+ formData.right = new FormAttachment(labelWidth);
label.setLayoutData(formData);
label.setToolTipText(param.getDescription());
formData = new FormData();
- formData.top = new FormAttachment(0, params.indexOf(param) * heightForAParameter);
+ formData.top = new FormAttachment(0, parameterPositionOffset);
formData.left = new FormAttachment(label, 5);
- formData.right = new FormAttachment(valueNumerator);
+ formData.right = new FormAttachment(valueWidth);
+ String[] items = null;
if (param.getName().equals(Constants.QUEUE))
{
- Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
- combo.setItems(items);
- combo.add("Select Queue", 0);
- combo.select(0);
- combo.setLayoutData(formData);
- combo.setData(param);
- combo.addSelectionListener(parameterSelectionListener);
- valueInCombo = true;
+ items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
}
else if (param.getName().equals(Constants.EXCHANGE))
{
- Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- String[] items = ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_virtualHostName);
- combo.setItems(items);
- combo.add("Select Exchange", 0);
- combo.select(0);
- combo.setLayoutData(formData);
- combo.setData(param);
- combo.addSelectionListener(parameterSelectionListener);
- valueInCombo = true;
+ items = ApplicationRegistry.getServerRegistry(_mbean).getExchangeNames(_virtualHostName);
}
else if (param.getName().equals(Constants.EXCHANGE_TYPE))
{
- Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- combo.setItems(Constants.EXCHANGE_TYPE_VALUES);
- combo.add("Select Exchange Type", 0);
- combo.select(0);
- combo.setLayoutData(formData);
- combo.setData(param);
- combo.addSelectionListener(parameterSelectionListener);
- valueInCombo = true;
+ items = Constants.EXCHANGE_TYPE_VALUES;
+ }
+
+ if (items != null)
+ {
+ org.eclipse.swt.widgets.List _list = new org.eclipse.swt.widgets.List(_paramsComposite, SWT.BORDER | SWT.V_SCROLL);
+ int listSize = _form.getClientArea().height / 3;
+ int itemsHeight = items.length * (_list.getItemHeight() + 2);
+ listSize = (listSize > itemsHeight) ? itemsHeight : listSize;
+ parameterPositionOffset = parameterPositionOffset + listSize;
+ formData.bottom = new FormAttachment(0, parameterPositionOffset);
+ _list.setLayoutData(formData);
+ _list.setData(param);
+ _list.setItems(items);
+ _list.addSelectionListener(parameterSelectionListener);
+ valueInCombo = true;
}
else if (param.isBoolean())
{
- Combo combo = new Combo(_paramsComposite, SWT.READ_ONLY | SWT.DROP_DOWN);
- combo.setItems(Constants.BOOLEAN_TYPE_VALUES);
- combo.select(0);
- param.setValueFromString(combo.getItem(0));
- combo.setLayoutData(formData);
- combo.setData(param);
- combo.addSelectionListener(bolleanSelectionListener);
+ Button booleanButton = _toolkit.createButton(_paramsComposite, "", SWT.CHECK);
+ booleanButton.setLayoutData(formData);
+ booleanButton.setData(param);
+ booleanButton.addSelectionListener(bolleanSelectionListener);
valueInCombo = true;
}
else
{
Text text = _toolkit.createText(_paramsComposite, "", SWT.NONE);
formData = new FormData();
- formData.top = new FormAttachment(0, params.indexOf(param) * heightForAParameter);
+ formData.top = new FormAttachment(0, parameterPositionOffset);
formData.left = new FormAttachment(label, 5);
- formData.right = new FormAttachment(valueNumerator);
+ formData.right = new FormAttachment(valueWidth);
text.setLayoutData(formData);
text.addKeyListener(keyListener);
text.addVerifyListener(verifyListener);
text.setData(param);
}
- // parameter type (int, String etc)
+ // display the parameter data type next to the text field
if (valueInCombo)
label = _toolkit.createLabel(_paramsComposite, "");
else
@@ -314,8 +313,8 @@ public class OperationTabControl extends TabControl
label = _toolkit.createLabel(_paramsComposite, "(" + str + ")");
}
formData = new FormData();
- formData.top = new FormAttachment(0, params.indexOf(param) * heightForAParameter);
- formData.left = new FormAttachment(valueNumerator, 5);
+ formData.top = new FormAttachment(0, parameterPositionOffset);
+ formData.left = new FormAttachment(valueWidth, 5);
label.setLayoutData(formData);
}
}
@@ -350,14 +349,14 @@ public class OperationTabControl extends TabControl
Label label = _toolkit.createLabel(composite, ViewUtility.getDisplayText(param.getName()));
FormData formData = new FormData();
formData.top = new FormAttachment(0, 2);
- formData.right = new FormAttachment(labelNumerator);
+ formData.right = new FormAttachment(labelWidth);
label.setLayoutData(formData);
label.setToolTipText(param.getDescription());
formData = new FormData();
formData.top = new FormAttachment(0);
formData.left = new FormAttachment(label, 5);
- formData.right = new FormAttachment(valueNumerator);
+ formData.right = new FormAttachment(valueWidth);
Combo combo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
String[] items = ApplicationRegistry.getServerRegistry(_mbean).getQueueNames(_virtualHostName);
@@ -536,7 +535,7 @@ public class OperationTabControl extends TabControl
if (param.getValue() == null || param.getValue().toString().length() == 0)
{
// Customized check, because for this parameter null is allowed
- if (param.getName().equals(Constants.QUEUE_OWNER) &&
+ if (param.getName().equals(Constants.ATTRIBUTE_QUEUE_OWNER) &&
_opData.getName().equals(Constants.OPERATION_CREATE_QUEUE))
{
continue;
@@ -627,16 +626,25 @@ public class OperationTabControl extends TabControl
{
public void widgetSelected(SelectionEvent e)
{
- Combo combo = (Combo)e.widget;
- ParameterData parameter = (ParameterData)combo.getData();
- if (combo.getSelectionIndex() > 0)
+ ParameterData parameter = (ParameterData)e.widget.getData();
+ parameter.setValue(null);
+ if (e.widget instanceof Combo)
{
- String item = combo.getItem(combo.getSelectionIndex());
- parameter.setValueFromString(item);
+ Combo combo = (Combo)e.widget;
+ if (combo.getSelectionIndex() > 0)
+ {
+ String item = combo.getItem(combo.getSelectionIndex());
+ parameter.setValueFromString(item);
+ }
}
- else
+ else if (e.widget instanceof org.eclipse.swt.widgets.List)
{
- parameter.setValue(null);
+ org.eclipse.swt.widgets.List list = (org.eclipse.swt.widgets.List)e.widget;
+ String[] selectedItems = list.getSelection();
+ if (selectedItems.length > 0)
+ {
+ parameter.setValueFromString(selectedItems[0]);
+ }
}
}
}
@@ -648,10 +656,18 @@ public class OperationTabControl extends TabControl
{
public void widgetSelected(SelectionEvent e)
{
- Combo combo = (Combo)e.widget;
- ParameterData parameter = (ParameterData)combo.getData();
- String item = combo.getItem(combo.getSelectionIndex());
- parameter.setValueFromString(item);
+ ParameterData parameter = (ParameterData)(e.widget.getData());
+ if (e.widget instanceof Button)
+ {
+ Button button = (Button)e.widget;
+ parameter.setValue(button.getSelection());
+ }
+ else if (e.widget instanceof Combo)
+ {
+ Combo combo = (Combo)e.widget;
+ String item = combo.getItem(combo.getSelectionIndex());
+ parameter.setValueFromString(item);
+ }
}
}