Merge "Issue #2433 - Implement view by priority check box menus review comments" into development
Former-commit-id:b94ed41ba2
[formerly12aa173989
] [formerly96ea26a9a2
] [formerlyb94ed41ba2
[formerly12aa173989
] [formerly96ea26a9a2
] [formerlyab3de987b4
[formerly96ea26a9a2
[formerly 27cb84fc6629e94927a4e80cba9586df20805b0a]]]] Former-commit-id:ab3de987b4
Former-commit-id:9c2583527b
[formerly4ed1e7327e
] [formerly 8daa78433782df24239da5092047d00e8f37b314 [formerly9784b3737e
]] Former-commit-id: 50caae37371681677237dd625f0273a2cda32223 [formerly51234efbbb
] Former-commit-id:c59ab27cd4
This commit is contained in:
commit
e60d6d27ae
2 changed files with 84 additions and 23 deletions
|
@ -57,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
|
||||
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
|
||||
* Feb 07, 2014 2453 mpduff Refactored dialog.
|
||||
* Mar 18, 2014 2433 mpduff Update javadoc.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,15 +116,10 @@ public class FindDlg extends CaveSWTDialog {
|
|||
* The parent shell
|
||||
* @param filteredTableList
|
||||
* Table data containing the text to be searched.
|
||||
* @param sIndex
|
||||
* Start table index
|
||||
* @param eIndex
|
||||
* End table index
|
||||
* @param selected
|
||||
* Selected table index
|
||||
* @param callback
|
||||
* ITableFind callback
|
||||
*
|
||||
*/
|
||||
public FindDlg(Shell parent,
|
||||
TableDataManager<NotificationRowData> filteredTableList,
|
||||
|
|
|
@ -22,6 +22,8 @@ package com.raytheon.uf.viz.datadelivery.notification;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -105,6 +107,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu.
|
||||
* Sep 25, 2013 2410 mpduff Check type of localization file.
|
||||
* Feb 07, 2013 2453 mpduff Support find dialog refactor..
|
||||
* Mar 18, 2014 2433 mpduff Implement view by priority check box menus.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -198,6 +201,10 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
/** SaveAs config dialog */
|
||||
private LoadSaveConfigDlg saveAsDlg;
|
||||
|
||||
/** Priority -> Priority Menu Item map */
|
||||
private final Map<Priority, MenuItem> priorityMenuMap = new HashMap<Priority, MenuItem>(
|
||||
Priority.values().length);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -374,22 +381,24 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
}
|
||||
});
|
||||
|
||||
MenuItem hidePriorityMI = new MenuItem(editMenu, SWT.CASCADE);
|
||||
lockableMenuItems.add(hidePriorityMI);
|
||||
hidePriorityMI.setText("Hide by Priority");
|
||||
hidePriorityMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
// Create view menu
|
||||
MenuItem viewMenuItem = new MenuItem(menuBar, SWT.CASCADE);
|
||||
viewMenuItem.setText("&View");
|
||||
|
||||
}
|
||||
});
|
||||
Menu viewMenu = new Menu(menuBar);
|
||||
viewMenuItem.setMenu(viewMenu);
|
||||
|
||||
Menu subMenu = new Menu(menuBar);
|
||||
hidePriorityMI.setMenu(subMenu);
|
||||
MenuItem priorityMI = new MenuItem(viewMenu, SWT.CASCADE);
|
||||
priorityMI.setText("By Priority");
|
||||
|
||||
createPriorityMenus(subMenu);
|
||||
Menu priorityMenu = new Menu(viewMenu);
|
||||
priorityMI.setMenu(priorityMenu);
|
||||
|
||||
MenuItem hideOlderMI = new MenuItem(editMenu, SWT.NONE);
|
||||
createPriorityMenus(priorityMenu);
|
||||
|
||||
new MenuItem(viewMenu, SWT.SEPARATOR);
|
||||
|
||||
MenuItem hideOlderMI = new MenuItem(viewMenu, SWT.NONE);
|
||||
lockableMenuItems.add(hideOlderMI);
|
||||
hideOlderMI.setText("Hide Older Than Selected");
|
||||
hideOlderMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -400,7 +409,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
|
||||
});
|
||||
|
||||
MenuItem hideMI = new MenuItem(editMenu, SWT.NONE);
|
||||
MenuItem hideMI = new MenuItem(viewMenu, SWT.NONE);
|
||||
lockableMenuItems.add(hideMI);
|
||||
hideMI.setText("Hide Notification(s)");
|
||||
hideMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -410,7 +419,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
}
|
||||
});
|
||||
|
||||
MenuItem unhideMI = new MenuItem(editMenu, SWT.NONE);
|
||||
MenuItem unhideMI = new MenuItem(viewMenu, SWT.NONE);
|
||||
lockableMenuItems.add(unhideMI);
|
||||
unhideMI.setText("Show Hidden Notifications");
|
||||
unhideMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -487,17 +496,31 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
* Menu to hold these menu items
|
||||
*/
|
||||
private void createPriorityMenus(Menu menu) {
|
||||
NotificationFilterXML xml = NotificationConfigManager.getInstance()
|
||||
.getFilterXml();
|
||||
for (Priority priority : PriorityImages.Priority.values()) {
|
||||
MenuItem mi = new MenuItem(menu, SWT.NONE);
|
||||
MenuItem mi = new MenuItem(menu, SWT.CHECK);
|
||||
mi.setText("Priority " + priority.getPriorityNum());
|
||||
mi.setData(priority.getPriorityNum());
|
||||
if (priority == Priority.Priority1) {
|
||||
mi.setEnabled(false);
|
||||
mi.setSelection(true);
|
||||
continue;
|
||||
}
|
||||
for (Priority p : xml.getPriorityList()) {
|
||||
if (priority.equals(p)) {
|
||||
mi.setSelection(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mi.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
tableComp.handleHideByPriority((Integer) ((MenuItem) e
|
||||
.getSource()).getData());
|
||||
updatePriorityView(priorityMenuMap);
|
||||
}
|
||||
});
|
||||
priorityMenuMap.put(priority, mi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,6 +927,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
*/
|
||||
@Override
|
||||
public void tableChanged() {
|
||||
updatePriorityViewMenus();
|
||||
tableComp.tableChangedAfterConfigLoad();
|
||||
}
|
||||
|
||||
|
@ -927,4 +951,45 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Update the priority menus to match the configuration.
|
||||
*/
|
||||
public void updatePriorityViewMenus() {
|
||||
NotificationConfigManager configMan = NotificationConfigManager
|
||||
.getInstance();
|
||||
configMan.getFilterXml();
|
||||
|
||||
for (Priority priority : priorityMenuMap.keySet()) {
|
||||
priorityMenuMap.get(priority).setSelection(false);
|
||||
for (Priority p : configMan.getFilterXml().getPriorityList()) {
|
||||
if (p.equals(priority)) {
|
||||
priorityMenuMap.get(p).setSelection(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the priority view items
|
||||
*
|
||||
* @param priorityMap
|
||||
*/
|
||||
public void updatePriorityView(Map<Priority, MenuItem> priorityMap) {
|
||||
NotificationConfigManager configManager = NotificationConfigManager
|
||||
.getInstance();
|
||||
NotificationFilterXML xml = configManager.getFilterXml();
|
||||
|
||||
xml.clearPriorityList();
|
||||
for (Priority p : priorityMap.keySet()) {
|
||||
if (priorityMap.get(p).getSelection()) {
|
||||
xml.addPriority(p);
|
||||
}
|
||||
}
|
||||
|
||||
configManager.setFilterXml(xml);
|
||||
configManager.saveXml();
|
||||
|
||||
tableComp.tableChangedAfterConfigLoad();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue