Merge "Issue #2271 - Fix menu problem with previously selected points being selectable again" into omaha_14.2.1

Former-commit-id: 997c575919 [formerly 249435f17c] [formerly 997c575919 [formerly 249435f17c] [formerly 2c6b4309f0 [formerly c4cda041169c5fe3f813a71c1b09b5eaeba9e385]]]
Former-commit-id: 2c6b4309f0
Former-commit-id: 4850830125 [formerly cc7885610d]
Former-commit-id: 291c7f95c4
This commit is contained in:
Lee Venable 2013-12-09 09:51:41 -06:00 committed by Gerrit Code Review
commit 099f3f504a
4 changed files with 67 additions and 5 deletions

View file

@ -84,6 +84,7 @@ import com.vividsolutions.jts.geom.LineString;
* Nov 17, 2009 3120 rjpeter Updated to use LevelMappingFactory. * Nov 17, 2009 3120 rjpeter Updated to use LevelMappingFactory.
* Jul 31, 2012 875 rferrel Now uses points. * Jul 31, 2012 875 rferrel Now uses points.
* May 30, 2013 2055 bsteffen Remove modelName from sounding pointName. * May 30, 2013 2055 bsteffen Remove modelName from sounding pointName.
* Dec 06, 2013 2271 mpduff Added check for null coordinate.
* *
* </pre> * </pre>
* *
@ -427,6 +428,10 @@ public class GridDataCatalog extends AbstractInventoryDataCatalog {
for (String letter : pointLetters) { for (String letter : pointLetters) {
Coordinate c = PointsDataManager.getInstance() Coordinate c = PointsDataManager.getInstance()
.getCoordinate(letter); .getCoordinate(letter);
if (c == null) {
break;
}
DirectPosition2D dp = new DirectPosition2D(c.x, c.y); DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
llToCRS.transform(dp, dp); llToCRS.transform(dp, dp);
if (env.contains(dp.x, dp.y)) { if (env.contains(dp.x, dp.y)) {

View file

@ -86,7 +86,8 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList;
* points menu. * points menu.
* Jan 14, 2013 #1516 rferrel Remove listeners on dispose and specify * Jan 14, 2013 #1516 rferrel Remove listeners on dispose and specify
* Data Selection in Points Tool Action. * Data Selection in Points Tool Action.
* * Dec 06, 2013 #2271 mpduff Save the selected plane points so the menu's are
* recreated correctly on a pointChange action.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -105,13 +106,13 @@ public class DataListsProdTableComp extends Composite implements
/** /**
* Listener to trigger reset. * Listener to trigger reset.
*/ */
private IPointChangedListener resetPointChangeListener; private final IPointChangedListener resetPointChangeListener;
/** /**
* Listener to trigger reset. * Listener to trigger reset.
*/ */
private IToolChangedListener resetToolChangeListener; private final IToolChangedListener resetToolChangeListener;
/** /**
* Perform a regular expression find instead of simply completing the input * Perform a regular expression find instead of simply completing the input
@ -473,6 +474,7 @@ public class DataListsProdTableComp extends Composite implements
@Override @Override
public void toolChanged() { public void toolChanged() {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override
public void run() { public void run() {
updateMenuInventory(); updateMenuInventory();
} }
@ -487,6 +489,7 @@ public class DataListsProdTableComp extends Composite implements
@Override @Override
public void pointChanged() { public void pointChanged() {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override
public void run() { public void run() {
updateMenuInventory(); updateMenuInventory();
} }
@ -882,8 +885,20 @@ public class DataListsProdTableComp extends Composite implements
@Override @Override
public void pointChanged() { public void pointChanged() {
MenuItemManager.getInstance().clearPlanesMap(); VizApp.runAsync(new Runnable() {
pta.resetMenu(); @Override
public void run() {
MenuItemManager menuItemMgr = MenuItemManager
.getInstance();
Set<String> planeListItems = planeControl.list
.getAvailableKeys().keySet();
menuItemMgr.clearPlanesMap();
menuItemMgr.setSelectedPlaneItems(planeListItems);
pta.resetMenu();
}
});
} }
}; };
PointsDataManager.getInstance().addPointsChangedListener( PointsDataManager.getInstance().addPointsChangedListener(
@ -947,6 +962,7 @@ public class DataListsProdTableComp extends Composite implements
* Menu information that contains information about the item * Menu information that contains information about the item
* selected. * selected.
*/ */
@Override
public void addToList(String displayStr, MenuContribution menuContrib) { public void addToList(String displayStr, MenuContribution menuContrib) {
activeList.addItemToList(displayStr, menuContrib); activeList.addItemToList(displayStr, menuContrib);
@ -959,6 +975,7 @@ public class DataListsProdTableComp extends Composite implements
* *
* @return The active data selection. * @return The active data selection.
*/ */
@Override
public DataSelection getActiveDataSelection() { public DataSelection getActiveDataSelection() {
return currentDataSelection; return currentDataSelection;
} }
@ -971,6 +988,7 @@ public class DataListsProdTableComp extends Composite implements
* ( * (
* com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection) * com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection)
*/ */
@Override
public void setActiveDataSelection(DataSelection dataSelection) { public void setActiveDataSelection(DataSelection dataSelection) {
currentDataSelection = dataSelection; currentDataSelection = dataSelection;
} }

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.volumebrowser.vbui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -43,6 +44,7 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
* May 27, 2009 #2161 lvenable Initial creation * May 27, 2009 #2161 lvenable Initial creation
* Jan 24, 2013 #1516 rferrel Methods to change/get * Jan 24, 2013 #1516 rferrel Methods to change/get
* Active Data Selection. * Active Data Selection.
* Dec 06, 2013 #2271 mpduff Added the set of keys for the selected plane items
* *
* </pre> * </pre>
* *
@ -75,6 +77,11 @@ public class MenuItemManager {
*/ */
private IDataMenuAction menuActionCB; private IDataMenuAction menuActionCB;
/**
* Set of keys for the selected plane items.
*/
private Set<String> selectedPlaneItems = new HashSet<String>(0);
/** /**
* Constructor. * Constructor.
*/ */
@ -584,4 +591,23 @@ public class MenuItemManager {
public void setActiveDataSelection(DataSelection dataSelection) { public void setActiveDataSelection(DataSelection dataSelection) {
menuActionCB.setActiveDataSelection(dataSelection); menuActionCB.setActiveDataSelection(dataSelection);
} }
/**
* Set the set of selected keys for the plane item list
*
* @param selectedPlaneItems
* Set of selected keys
*/
public void setSelectedPlaneItems(Set<String> selectedPlaneItems) {
this.selectedPlaneItems = selectedPlaneItems;
}
/**
* Get the set of selected keys for the plane item list
*
* @return The selected keys
*/
public Set<String> getSelectedPlaneItems() {
return selectedPlaneItems;
}
} }

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.volumebrowser.vbui; package com.raytheon.viz.volumebrowser.vbui;
import java.util.List; import java.util.List;
import java.util.Set;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.ActionContributionItem;
@ -54,6 +55,7 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
* now opens the menu. * now opens the menu.
* Sep 26, 2012 1216 rferrel resetMenu method added. * Sep 26, 2012 1216 rferrel resetMenu method added.
* Jan 24, 2013 1516 rferrel Change Active Data Selection prior to filling menus. * Jan 24, 2013 1516 rferrel Change Active Data Selection prior to filling menus.
* Dec 06, 2013 2271 mpduff Disable plane menu items for already selected items.
* *
* </pre> * </pre>
* *
@ -173,6 +175,7 @@ public class PointToolAction extends Action implements IMenuCreator {
@Override @Override
public Menu getMenu(Menu parent) { public Menu getMenu(Menu parent) {
if (menu == null) { if (menu == null) {
MenuItemManager.getInstance().setActiveDataSelection(dataSelection); MenuItemManager.getInstance().setActiveDataSelection(dataSelection);
menu = new Menu(parent); menu = new Menu(parent);
fillMenu(menu); fillMenu(menu);
@ -229,6 +232,16 @@ public class PointToolAction extends Action implements IMenuCreator {
TitleContributionItem cci = new TitleContributionItem(); TitleContributionItem cci = new TitleContributionItem();
cci.setText(node.getName()); cci.setText(node.getName());
cci.fill(menu, -1); cci.fill(menu, -1);
// disable menu items for already selected items
if (dataSelection == DataSelection.PLANES) {
Set<String> planeItems = MenuItemManager.getInstance()
.getSelectedPlaneItems();
for (String s : planeItems) {
MenuItemManager.getInstance().disableMenuItem(s,
DataSelection.PLANES);
}
}
} }
} }
} }