From 31e01a9f9aea37899e3202d529e4f39c77be540b Mon Sep 17 00:00:00 2001 From: Dustin Johnson Date: Mon, 20 May 2013 12:23:41 -0500 Subject: [PATCH] Issue #2038 More information when bandwidth manager can't schedule a subscription Amend: Peer review comments Change-Id: If2ae3f98a3a04709c2cdc7632ca89f2ee6a5e08d Former-commit-id: b1414f6aebda59cb6d83d1f0d0154fa4cd850953 --- .../actions/SubscriptionManagerAction.java | 25 +- .../common/ui/SubscriptionViewer.java | 21 +- .../common/ui/UserSelectComp.java | 13 +- ...rceApplyAndIncreaseLatencyDisplayText.java | 8 +- .../DisplayForceApplyPromptDialog.java | 169 +++++++----- .../ForceApplyPromptConfiguration.java | 204 ++++++++++++++ .../ISubscriptionManagerFilter.java | 58 ++++ .../subscription/SubscriptionManagerDlg.java | 62 +++-- .../SubscriptionManagerFilters.java | 104 ++++++++ .../subscription/SubscriptionService.java | 118 +++++---- .../subscription/SubscriptionTableComp.java | 105 ++------ .../subscription/subset/SubsetManagerDlg.java | 8 +- .../viz/datadelivery/system/BandwidthTab.java | 3 +- .../system/SystemManagementDlg.java | 7 +- .../uf/viz/event/CaveEventBusHandler.java | 7 +- deltaScripts/13.5.1/removeDeliveryOptions.sql | 8 +- edexOsgi/build.edex/esb/conf/modes.xml | 1 + .../bandwidth/IProposeScheduleResponse.java | 18 +- .../bandwidth/ProposeScheduleResponse.java | 23 +- .../registry/GroupDefinition.java | 5 +- .../ebxml/SubscriptionFilterableQuery.java | 29 +- .../handlers/BaseSubscriptionHandler.java | 19 ++ .../handlers/IBaseSubscriptionHandler.java | 12 + .../handlers/PendingSubscriptionHandler.java | 18 +- .../handlers/SubscriptionHandler.java | 15 ++ .../com.raytheon.uf.common.event/.classpath | 1 + .../build.properties | 3 +- .../res/spring/eventbus-common.xml | 8 + .../raytheon/uf/common/event/EventBus.java | 35 +-- .../uf/common/event/EventBusBean.java | 66 +++++ .../uf/common/event/IBaseEventBusHandler.java | 66 +++++ .../uf/common/event/IEventBusHandler.java | 28 +- ...idth.notification.BandwidthEventBusFactory | 1 - ...dth.notification.IBandwidthEventBusHandler | 1 + .../bandwidth-datadelivery-eventbus.xml | 17 ++ .../res/spring/bandwidth-datadelivery.xml | 12 +- .../bandwidth/BandwidthManager.java | 187 +++++++------ .../FindSubscriptionRequiredDataSetSize.java | 103 ++++++++ .../FindSubscriptionRequiredLatency.java | 106 ++++++++ .../IFindSubscriptionRequiredValue.java | 96 +++++++ .../bandwidth/WfoBandwidthManagerCreator.java | 1 + .../BandwidthAsyncEventBusFactory.java | 12 + .../notification/BandwidthEventBus.java | 91 +------ .../notification/BandwidthEventBusBean.java | 66 +++++ .../BandwidthEventBusFactory.java | 4 +- .../EdexBandwidthEventBusHandler.java | 97 +++++++ .../IBandwidthEventBusHandler.java | 42 +++ .../res/spring/event-datadelivery-ingest.xml | 15 +- .../res/spring/event-common.xml | 15 +- .../event/AsynchronousEventBusFactory.java | 10 +- .../edex/event/BaseEdexEventBusHandler.java | 249 ++++++++++++++++++ .../uf/edex/event/EdexEventBusHandler.java | 128 ++------- .../uf/edex/event/GoogleEventBusFactory.java | 16 +- .../res/spring/ebxml-subscription.xml | 10 +- .../web/webServiceBeans.xml | 1 + .../res/spring/stats-common.xml | 17 +- .../bandwidth/BandwidthManagerIntTest.java | 2 + .../bandwidth/BandwidthServiceIntTest.java | 73 ++++- .../IntegrationTestWfoBandwidthManager.java | 8 +- .../bandwidth/WfoBandwidthManagerIntTest.java | 1 + .../LifecycleManagerSubmitObjectsTest.java | 1 + .../services/validator/ValidatorImplTest.java | 1 + ...idth.notification.BandwidthEventBusFactory | 1 - ...dth.notification.IBandwidthEventBusHandler | 1 + .../BaseMemorySubscriptionHandler.java | 20 +- .../uf/common/event/BaseEventBusTest.java | 121 +++++++++ .../uf/common/event/EventBusTest.java | 60 +++++ .../raytheon/uf/common/util/SpringFiles.java | 5 + .../notification/BandwidthEventBusTest.java | 61 +++++ .../BandwidthSyncEventBusFactory.java | 24 +- .../TestBandwidthEventBusHandler.java | 50 ++++ .../uf/edex/event/TestEventBusHandler.java | 13 +- ...criptionServiceSingleSubscriptionTest.java | 2 +- .../AbstractSubscriptionServiceTest.java | 30 ++- .../SubscriptionServiceMassUpdateTest.java | 19 +- .../SubscriptionServiceStoreAdhocTest.java | 15 +- .../SubscriptionServiceStoreTest.java | 18 +- .../SubscriptionServiceUpdateTest.java | 3 +- 78 files changed, 2405 insertions(+), 688 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ForceApplyPromptConfiguration.java create mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionManagerFilter.java create mode 100644 cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerFilters.java create mode 100644 edexOsgi/com.raytheon.uf.common.event/res/spring/eventbus-common.xml create mode 100644 edexOsgi/com.raytheon.uf.common.event/src/com/raytheon/uf/common/event/EventBusBean.java create mode 100644 edexOsgi/com.raytheon.uf.common.event/src/com/raytheon/uf/common/event/IBaseEventBusHandler.java delete mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/META-INF/services/com.raytheon.uf.edex.datadelivery.bandwidth.notification.BandwidthEventBusFactory create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/META-INF/services/com.raytheon.uf.edex.datadelivery.bandwidth.notification.IBandwidthEventBusHandler create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/res/spring/bandwidth-datadelivery-eventbus.xml create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/FindSubscriptionRequiredDataSetSize.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/FindSubscriptionRequiredLatency.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/IFindSubscriptionRequiredValue.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/notification/BandwidthEventBusBean.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/notification/EdexBandwidthEventBusHandler.java create mode 100644 edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth/src/com/raytheon/uf/edex/datadelivery/bandwidth/notification/IBandwidthEventBusHandler.java create mode 100644 edexOsgi/com.raytheon.uf.edex.event/src/com/raytheon/uf/edex/event/BaseEdexEventBusHandler.java delete mode 100644 tests/resources/META-INF/services/com.raytheon.uf.edex.datadelivery.bandwidth.notification.BandwidthEventBusFactory create mode 100644 tests/resources/META-INF/services/com.raytheon.uf.edex.datadelivery.bandwidth.notification.IBandwidthEventBusHandler create mode 100644 tests/unit/com/raytheon/uf/common/event/BaseEventBusTest.java create mode 100644 tests/unit/com/raytheon/uf/common/event/EventBusTest.java create mode 100644 tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/notification/BandwidthEventBusTest.java create mode 100644 tests/unit/com/raytheon/uf/edex/datadelivery/bandwidth/notification/TestBandwidthEventBusHandler.java diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java index 4c88e80f9f..c0eefec0dd 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java @@ -21,7 +21,6 @@ package com.raytheon.uf.viz.datadelivery.actions; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -33,7 +32,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices; +import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg; +import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters; /** * Subscription Manager Dialog Action class. @@ -46,6 +47,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg; * ------------ ---------- ----------- -------------------------- * Jan 10, 2012 mpduff Initial creation * Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}. + * May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog. * * * @@ -54,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg; */ public class SubscriptionManagerAction extends AbstractHandler { + /** Status Handler */ private final IUFStatusHandler statusHandler = UFStatus .getHandler(SubscriptionManagerAction.class); @@ -64,8 +67,24 @@ public class SubscriptionManagerAction extends AbstractHandler { /** Permission String */ private final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_VIEW; + /** + * Constructor. + */ + public SubscriptionManagerAction() { + } + @Override - public Object execute(ExecutionEvent arg0) throws ExecutionException { + public Object execute(ExecutionEvent arg0) { + return loadSubscriptionManager(SubscriptionManagerFilters.getAll()); + } + + /** + * Load the SubscriptionManager dialog with the specified filter. + * + * @param filter + * the filter + */ + public Object loadSubscriptionManager(ISubscriptionManagerFilter filter) { try { // check if user is authorized IUser user = UserController.getUserObject(); @@ -78,7 +97,7 @@ public class SubscriptionManagerAction extends AbstractHandler { if ((dlg == null) || (dlg.isDisposed() == true)) { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); - dlg = new SubscriptionManagerDlg(shell); + dlg = new SubscriptionManagerDlg(shell, filter); dlg.open(); } else { dlg.bringToTop(); diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java index ade517177d..b2e70ca470 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java @@ -33,6 +33,8 @@ import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionAction; +import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter; +import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp.SubscriptionType; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; @@ -53,6 +55,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; * Dec 03, 2012 1269 mpduff Change to take a list of subscriptions for the view mode. * Dec 10, 2012 1300 bgonzale Table filtering by dataset and provider. * May 23, 2012 2020 mpduff Implement method. + * May 28, 2013 1650 djohnson Filters now control what subscriptions are shown. * * * @author mpduff @@ -179,16 +182,16 @@ public class SubscriptionViewer extends AbstractViewDlg implements tableConfig.setTableStyle(SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); tableConfig.setTableHeight(200); - tableComp = new SubscriptionTableComp(shell, tableConfig, this, - SubscriptionType.VIEWER); - if (isTableFilteredByDatasetAndProvider()) { - tableComp.populateActiveFilteredDataByDataSetAndProvider( - datasetName, providerName); - } else { - tableComp.setSubscriptionNameList(this.subscriptionNameList); - tableComp.populateData(); - } + ISubscriptionManagerFilter filter = (isTableFilteredByDatasetAndProvider()) ? SubscriptionManagerFilters + .getByProviderAndDataSet(providerName, datasetName) : +SubscriptionManagerFilters + .getByNames(this.subscriptionNameList); + + tableComp = new SubscriptionTableComp(shell, tableConfig, this, + SubscriptionType.VIEWER, filter); + + tableComp.populateData(); tableComp.populateTable(); } diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java index 3ba53d7ba4..df617e40b6 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java @@ -93,6 +93,8 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate; * Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion. * Apr 08, 2013 1826 djohnson Remove unused code, delivery options. * May 15, 2013 1040 mpduff OfficeID is now a list so need to add it rather than set it. + * May 23, 2013 1650 djohnson Fix creation of new GroupDefinitions. + * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions. * * * @author jpiatt @@ -359,6 +361,10 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay, // Get Group Definition GroupDefinition groupDefinition = GroupDefinitionManager .getGroup(groupName); + if (groupDefinition == null) { + groupDefinition = new GroupDefinition(); + groupDefinition.setGroupName(groupName); + } for (Subscription subscription : groupSubscriptions) { @@ -499,15 +505,20 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay, public String getOptionDisplayText(ForceApplyPromptResponse option, int requiredLatency, Subscription subscription, Set wouldBeUnscheduledSubscriptions) { + final boolean singleSubscription = wouldBeUnscheduledSubscriptions + .size() == 1; switch (option) { case CANCEL: return "Do not update the group definition."; case FORCE_APPLY: - if (wouldBeUnscheduledSubscriptions.size() == 1) { + if (singleSubscription) { return "Update the group definition and unschedule " + wouldBeUnscheduledSubscriptions.iterator().next(); } return "Update the group definition and unschedule the subscriptions"; + case EDIT_SUBSCRIPTIONS: + return "Edit the " + + ((singleSubscription) ? "subscription" : "subscriptions"); case INCREASE_LATENCY: // Signifies it should not be an option return null; diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java index e3d5702ed7..4df123b53d 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java @@ -38,6 +38,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 4, 2012 1286 djohnson Initial creation + * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions. * * * @@ -78,17 +79,22 @@ public class CancelForceApplyAndIncreaseLatencyDisplayText implements int requiredLatency, Subscription subscription, Set wouldBeUnscheduledSubscriptions) { final String name = subscription.getName(); + final boolean singleSubscription = wouldBeUnscheduledSubscriptions + .size() == 1; switch (option) { case CANCEL: return "Do not " + actionText + " " + name; case FORCE_APPLY: - if (wouldBeUnscheduledSubscriptions.size() == 1 + if (singleSubscription && wouldBeUnscheduledSubscriptions.contains(name)) { return titleCaseActionText + " " + name + " and leave in an unscheduled status"; } return titleCaseActionText + " " + name + " and unschedule the others"; + case EDIT_SUBSCRIPTIONS: + return "Edit the " + + ((singleSubscription) ? "subscription" : "subscriptions"); case INCREASE_LATENCY: return "Increase the latency on " + name + " to " + requiredLatency + " minutes"; diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java index 0cbfced6c9..97c59b43a6 100644 --- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java +++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java @@ -19,52 +19,48 @@ **/ package com.raytheon.uf.viz.datadelivery.subscription; -import java.util.Set; - import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; 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.Group; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; +import com.google.common.collect.Lists; import com.raytheon.uf.common.datadelivery.registry.Subscription; +import com.raytheon.uf.common.util.SizeUtil; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** - * TODO Add Description + * Dialog allowing the user to choose how to continue with their subscription + * creation/modification request. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Nov 29, 2012            djohnson     Initial creation
- *
+ * May 22, 2013 1650       djohnson     Add more bandwidth information.
+ * 
  * 
- * + * * @author djohnson - * @version 1.0 + * @version 1.0 */ public class DisplayForceApplyPromptDialog extends CaveSWTDialog { - private final String dialogTitle; - private final String message; - - private final int requiredLatency; - - private final IForceApplyPromptDisplayText displayTextStrategy; - - private final Subscription subscription; - - private final Set wouldBeUnscheduledSubscriptions; + private final ForceApplyPromptConfiguration configuration; /** * Constructor. @@ -75,61 +71,99 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog { * @param subscription * @param wouldBeUnscheduledSubscriptions */ - public DisplayForceApplyPromptDialog(String title, String message, - int requiredLatency, - IForceApplyPromptDisplayText displayTextStrategy, - Subscription subscription, - Set wouldBeUnscheduledSubscriptions) { - super(displayTextStrategy.getShell()); + public DisplayForceApplyPromptDialog( + ForceApplyPromptConfiguration configuration) { + super(configuration.displayTextStrategy.getShell()); - this.dialogTitle = title; - this.message = message; - this.requiredLatency = requiredLatency; - this.displayTextStrategy = displayTextStrategy; - this.subscription = subscription; - this.wouldBeUnscheduledSubscriptions = wouldBeUnscheduledSubscriptions; + this.configuration = configuration; } /** * {@inheritDoc} - * @param subscription + * + * @param subscription */ @Override protected void initializeComponents(final Shell shell) { - setText(dialogTitle); + setText(configuration.title); // Initialize layout - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + GridData gd = new GridData(SWT.FILL, SWT.FILL, false, true); gd.widthHint = 400; - gd.heightHint = 100; Label textLabel = new Label(shell, SWT.WRAP); textLabel.setLayoutData(gd); - textLabel.setText(message); + textLabel.setText(configuration.message); + + if (configuration.hasUnscheduledSubscriptions()) { + Composite unscheduledSubscriptionsComp = new Composite(shell, + SWT.NONE); + unscheduledSubscriptionsComp.setLayout(new GridLayout(1, false)); + unscheduledSubscriptionsComp.setLayoutData(new GridData(SWT.FILL, + SWT.FILL, true, true)); + + final List list = new List(unscheduledSubscriptionsComp, SWT.MULTI + | SWT.BORDER); + list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + final SelectionListener listener = new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + list.deselectAll(); + } + }; + list.setItems(configuration.wouldBeUnscheduledSubscriptions + .toArray(new String[configuration.wouldBeUnscheduledSubscriptions + .size()])); + list.addSelectionListener(listener); + } + + if (configuration.hasBandwidthDetails()) { + Group group = new Group(shell, SWT.BORDER); + group.setText("Bandwidth Details"); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + group.setLayout(new GridLayout(1, false)); + + Label rulesLatency = new Label(group, SWT.WRAP); + rulesLatency.setText("Maximum latency recommended by rules: " + + configuration.maximumLatency + " minutes"); + rulesLatency.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, + true)); + + Label sizeLabel = new Label(group, SWT.WRAP); + sizeLabel + .setText("Maximum allowed size with current latency: " + + SizeUtil + .prettyByteSize(configuration.maximumAllowedSize)); + sizeLabel + .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + } + + Composite leftComp = new Composite(shell, SWT.NONE); + leftComp.setLayout(new GridLayout(1, false)); + leftComp.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false)); + + Label choiceLabel = new Label(leftComp, SWT.WRAP); + choiceLabel.setLayoutData(gd); + choiceLabel.setText("\nWhat would you like to do?\n"); // Add radio buttons - Composite leftComp = new Composite(shell, SWT.NONE); - GridLayout gl = new GridLayout(1, false); - leftComp.setLayout(gl); - GridData gd2 = new GridData(SWT.LEFT, SWT.DEFAULT, true, false); - leftComp.setLayoutData(gd2); - - Button[] radios = getRadioButtons(leftComp, requiredLatency, - displayTextStrategy, subscription); + Button[] radios = getRadioButtons(leftComp, + configuration.requiredLatency, + configuration.displayTextStrategy, configuration.subscription); radios[0].setSelection(true); setReturnValue(ForceApplyPromptResponse.CANCEL); + radios[0].setFocus(); - // Add a close button + // Add an OK button Composite centeredComp = new Composite(shell, SWT.NONE); - gl = new GridLayout(1, false); - centeredComp.setLayout(gl); - gd2 = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - centeredComp.setLayoutData(gd2); + centeredComp.setLayout(new GridLayout(1, false)); + gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); + centeredComp.setLayoutData(gd); - Button closeBtn = new Button(centeredComp, SWT.NONE); - closeBtn.setText("OK"); - closeBtn.setLayoutData(gd2); - closeBtn.addSelectionListener(new SelectionAdapter() { + Button okBtn = new Button(centeredComp, SWT.NONE); + okBtn.setText("OK"); + okBtn.setLayoutData(gd); + okBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { shell.dispose(); @@ -158,30 +192,29 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog { .values(); final int length = values.length; - Button[] buttons = new Button[length]; + java.util.List