Issue #1529 Disable menu items when no subscriptions selected
Amend: Rebase to 13.2.1 Change-Id: I5265c1036bc31a87a8bacadfd7b3a9219922f073 Former-commit-id: 50a157e679cc16cc47653314d538738355aada49
This commit is contained in:
parent
98f25434a9
commit
fc332a8b9a
3 changed files with 23 additions and 5 deletions
|
@ -91,6 +91,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Nov 6, 2012 1269 lvenable Initial creation.
|
||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||
* Jan 07, 2013 1451 djohnson Use TimeUtil.newGmtCalendar().
|
||||
* Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions selected.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -886,6 +887,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
|
|||
|
||||
MenuItem viewSubs = new MenuItem(m, SWT.NONE);
|
||||
viewSubs.setText("View Selected Subscriptions...");
|
||||
viewSubs.setEnabled(imageMgr.hasSubscriptionNameChecked());
|
||||
viewSubs.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPri
|
|||
* Nov 28, 2012 1269 lvenable Initial creation
|
||||
* Dec 13, 2012 1269 lvenable Fixes and updates.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum on subscriptions.
|
||||
* Jan 28, 2013 1529 djohnson Add hasSubscriptionNameChecked().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -491,4 +492,13 @@ public class BandwidthImageMgr implements IGraphOptions {
|
|||
regenerateImage(CanvasImages.X_HEADER);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there is a checked subscription name.
|
||||
*
|
||||
* @return true if at least one subscription name is checked
|
||||
*/
|
||||
public boolean hasSubscriptionNameChecked() {
|
||||
return checkMap.containsValue(Boolean.TRUE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* Dec 03, 2012 1279 mpduff Add ability to populate from a list of subscription names.
|
||||
* Dec 12, 2012 1391 bgonzale Added a job for subscription retrieves.
|
||||
* Jan 07, 2013 1437 bgonzale Added sort column direction updates.
|
||||
* Jan 28, 2013 1529 djohnson Disable menu items if no subscriptions are selected.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -120,7 +121,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
* Subscription action callback that is called when there is a table
|
||||
* selection.
|
||||
*/
|
||||
private ISubscriptionAction subActionCallback;
|
||||
private final ISubscriptionAction subActionCallback;
|
||||
|
||||
/** TableDataManager object. */
|
||||
private TableDataManager<SubscriptionManagerRowData> subManagerData;
|
||||
|
@ -756,11 +757,14 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
popupMenu.dispose();
|
||||
}
|
||||
|
||||
final boolean menuItemsEnabled = table.getSelectionIndices().length > 0;
|
||||
|
||||
// Detail popup menu
|
||||
popupMenu = new Menu(table);
|
||||
MenuItem item1 = new MenuItem(popupMenu, SWT.PUSH);
|
||||
item1.setText("Details... ");
|
||||
item1.addSelectionListener(new SelectionAdapter() {
|
||||
MenuItem detailsItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
detailsItem.setText("Details... ");
|
||||
detailsItem.setEnabled(menuItemsEnabled);
|
||||
detailsItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleDetails();
|
||||
|
@ -770,6 +774,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
if (subType == SubscriptionType.MANAGER) {
|
||||
MenuItem editItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
editItem.setText("Edit...");
|
||||
editItem.setEnabled(menuItemsEnabled);
|
||||
editItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
@ -780,6 +785,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
// Add the selected row to a subscription group
|
||||
MenuItem groupItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
groupItem.setText("Add to Group...");
|
||||
groupItem.setEnabled(menuItemsEnabled);
|
||||
groupItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue