From 14107f0914f0046ad79b9544dbb94c734d485db4 Mon Sep 17 00:00:00 2001 From: Mike Duff Date: Wed, 5 Mar 2014 12:02:33 -0600 Subject: [PATCH] Issue #2632 - Fix problem with multiple notifiers per user. Change-Id: Ia6f9d18e9217c74e6ecf6a2df324860a2b817000 Former-commit-id: 9963324b60be0a008f68c98395ccab31f39865fb [formerly 168a656194aa3b455f403aa92b290bbbe17d3b45] Former-commit-id: 8c693a5f70c677f6026bc143564a6bcbc4a0e63f --- .../ui/notifier/NotifierTools.java | 8 ++--- .../ui/session/AddNotifierDlg.java | 30 +++++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/notifier/NotifierTools.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/notifier/NotifierTools.java index 48d956292d..a519c50f4d 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/notifier/NotifierTools.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/notifier/NotifierTools.java @@ -35,8 +35,6 @@ import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Presence.Mode; import org.jivesoftware.smack.packet.Presence.Type; -import sun.audio.AudioDataStream; - import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; @@ -62,7 +60,8 @@ import com.raytheon.uf.viz.core.sounds.SoundUtil; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Feb 24, 2014 2632 mpduff Initial creation + * Feb 24, 2014 2632 mpduff Initial creation. + * Mar 05, 2014 2632 mpduff Removed unused field. * * * @@ -83,9 +82,6 @@ public class NotifierTools { /** Sound directory in localization */ private static final String SOUND_DIR = "collaboration/sounds"; - /** AudioDataStream object */ - private static AudioDataStream ads = null; - /** The contact notifier localization file */ private static LocalizationFile taskFile; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AddNotifierDlg.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AddNotifierDlg.java index dd6582633a..2e3535efe4 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AddNotifierDlg.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AddNotifierDlg.java @@ -21,10 +21,8 @@ package com.raytheon.uf.viz.collaboration.ui.session; import java.io.File; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -67,6 +65,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 20, 2014 2632 mpduff Initial creation + * Mar 05, 2014 2632 mpduff Changed task set to map of user->task. * * * @@ -83,7 +82,7 @@ public class AddNotifierDlg extends CaveSWTDialog { private final Map buttonMap = new HashMap(); /** Set of NotifierTask objects */ - private final Set taskSet = new HashSet(); + private final Map taskMap = new HashMap(); /** The user select Combo box */ private Combo userCbo; @@ -94,10 +93,13 @@ public class AddNotifierDlg extends CaveSWTDialog { /** Recurring radio button */ private Button recurringRdo; + /** The non-recurring radio button */ + private Button singleRdo; + /** Close callback */ private final ICloseCallback callback; - /** The class return value */ + /** The class return value */ private boolean returnValue = false; /** @@ -286,7 +288,7 @@ public class AddNotifierDlg extends CaveSWTDialog { freqComp.setLayoutData(gd); gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true); - Button singleRdo = new Button(freqComp, SWT.RADIO); + singleRdo = new Button(freqComp, SWT.RADIO); singleRdo.setLayoutData(gd); singleRdo.setText("Single Instance"); singleRdo.setSelection(true); @@ -338,14 +340,11 @@ public class AddNotifierDlg extends CaveSWTDialog { */ @Override protected void opened() { - // Check for existing notifiers List taskList = NotifierTools.getNotifierTasks(); - for (NotifierTask task : taskList) { - taskSet.add(task); + this.taskMap.put(task.getUserName(), task); if (task.getUserName().equals(userCbo.getText())) { this.populate(task); - return; } } } @@ -364,6 +363,14 @@ public class AddNotifierDlg extends CaveSWTDialog { } soundTxt.setText(task.getSoundFilePath()); + + if (task.isRecurring()) { + recurringRdo.setSelection(true); + singleRdo.setSelection(false); + } else { + recurringRdo.setSelection(false); + singleRdo.setSelection(true); + } } /** @@ -405,10 +412,9 @@ public class AddNotifierDlg extends CaveSWTDialog { } task.setRecurring(recurringRdo.getSelection()); + this.taskMap.put(task.getUserName(), task); - taskSet.add(task); - - if (NotifierTools.saveNotifiers(Lists.newArrayList(taskSet))) { + if (NotifierTools.saveNotifiers(Lists.newArrayList(taskMap.values()))) { MessageBox messageDialog = new MessageBox(this.getShell(), SWT.OK); messageDialog.setText("Notifier Saved"); messageDialog