Merge "Issue #1516 Changes to get point information into the proper DataSelection mapping (Planes)." into development

Former-commit-id: 73e44d87fa [formerly 1c61671766] [formerly 73e44d87fa [formerly 1c61671766] [formerly 078cc84047 [formerly 9e32ad8949af4f1e1a4d163056d510c2572f0aec]]]
Former-commit-id: 078cc84047
Former-commit-id: 65fc68e586 [formerly 0ee108f806]
Former-commit-id: 6b415ceab0
This commit is contained in:
Lee Venable 2013-01-29 09:19:56 -06:00 committed by Gerrit Code Review
commit ee66eb1671
4 changed files with 181 additions and 42 deletions

View file

@ -84,6 +84,8 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList;
* Jul 31, 2012 #875 rferrel Now uses markers.
* Sep 26, 2012 #1216 rferrel Change listener added to update
* points menu.
* Jan 14, 2013 #1516 rferrel Remove listeners on dispose and specify
* Data Selection in Points Tool Action.
*
* </pre>
*
@ -95,8 +97,22 @@ public class DataListsProdTableComp extends Composite implements
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataListsProdTableComp.class);
/**
* Listener to update planes current point menu.
*/
private IPointChangedListener pointChangeListener;
/**
* Listener to trigger reset.
*/
private IPointChangedListener resetPointChangeListener;
/**
* Listener to trigger reset.
*/
private IToolChangedListener resetToolChangeListener;
/**
* Perform a regular expression find instead of simply completing the input
*/
@ -112,6 +128,13 @@ public class DataListsProdTableComp extends Composite implements
super(proposals);
}
/*
* (non-Javadoc)
*
* @see
* net.sf.swtaddons.autocomplete.AutocompleteContentProposalProvider
* #getMatchingProposals(java.lang.String[], java.lang.String)
*/
@Override
protected List getMatchingProposals(String[] proposals,
String contents) {
@ -381,10 +404,19 @@ public class DataListsProdTableComp extends Composite implements
}
/**
* Dynamic controls for populating the sources' list.
*/
private SelectionControl sourceControl;
/**
* Dynamic controls for populating the fields' list.
*/
private SelectionControl fieldControl;
/**
* Dynamic controls for populating the planes' list.
*/
private SelectionControl planeControl;
/**
@ -437,28 +469,33 @@ public class DataListsProdTableComp extends Composite implements
initializeComponents();
resetToolChangeListener = new IToolChangedListener() {
@Override
public void toolChanged() {
VizApp.runAsync(new Runnable() {
public void run() {
updateMenuInventory();
}
});
}
};
ToolsDataManager.getInstance().addBaselinesChangedListener(
new IToolChangedListener() {
@Override
public void toolChanged() {
VizApp.runAsync(new Runnable() {
public void run() {
updateMenuInventory();
}
});
resetToolChangeListener);
resetPointChangeListener = new IPointChangedListener() {
@Override
public void pointChanged() {
VizApp.runAsync(new Runnable() {
public void run() {
updateMenuInventory();
}
});
}
};
PointsDataManager.getInstance().addPointsChangedListener(
new IPointChangedListener() {
@Override
public void pointChanged() {
VizApp.runAsync(new Runnable() {
public void run() {
updateMenuInventory();
}
});
}
});
resetPointChangeListener);
}
/**
@ -838,7 +875,7 @@ public class DataListsProdTableComp extends Composite implements
tbContrib.xml.id = "SoundingPointsButton";
final PointToolAction pta = new PointToolAction("Points",
pointDisplayString);
pointDisplayString, currentDataSelection);
planeControl.toolbar.add(pta);
pointChangeListener = new IPointChangedListener() {
@ -926,6 +963,18 @@ public class DataListsProdTableComp extends Composite implements
return currentDataSelection;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.volumebrowser.vbui.IDataMenuAction#setActiveDataSelection
* (
* com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection)
*/
public void setActiveDataSelection(DataSelection dataSelection) {
currentDataSelection = dataSelection;
}
/**
* Add product to the products table.
*/
@ -1063,7 +1112,6 @@ public class DataListsProdTableComp extends Composite implements
String[] selectedPlanes = planeControl.list.getSelectedKeys();
DataCatalogManager.getDataCatalogManager().updateAvailableData(
selectedSources, selectedFields, selectedPlanes);
}
/**
@ -1166,8 +1214,28 @@ public class DataListsProdTableComp extends Composite implements
markAvailableData(plane, planeControl);
}
/**
* Obtain the product table.
*
* @return prodTable
*/
public ProductTableComp getProductTable() {
return prodTable;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.widgets.Widget#dispose()
*/
@Override
public void dispose() {
ToolsDataManager.getInstance().removeBaselinesChangedListener(
resetToolChangeListener);
PointsDataManager.getInstance().removePointsChangedListener(
resetPointChangeListener);
super.dispose();
}
}

View file

@ -33,7 +33,7 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2009 #2161 lvenable Initial creation
*
* Jan 24, 2013 #1516 rferrel Added setActiveDataSelection
* </pre>
*
* @author lvenable
@ -57,4 +57,11 @@ public interface IDataMenuAction {
* @return The active data selection.
*/
DataSelection getActiveDataSelection();
/**
* Set the active data selection.
*
* @param dataSelection
*/
void setActiveDataSelection(DataSelection dataSelection);
}

View file

@ -41,6 +41,8 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2009 #2161 lvenable Initial creation
* Jan 24, 2013 #1516 rferrel Methods to change/get
* Active Data Selection.
*
* </pre>
*
@ -462,8 +464,7 @@ public class MenuItemManager {
}
}
/*
*
/**
*
* Convenience methods to print all of the data.
*
@ -480,6 +481,11 @@ public class MenuItemManager {
printMenu(planesMenuItemMap);
}
/**
* Print out the entries of the desired map.
*
* @param map
*/
private void printMenu(HashMap<String, ArrayList<MenuContributionItem>> map) {
Set<String> keys = map.keySet();
@ -533,7 +539,9 @@ public class MenuItemManager {
}
/**
* @return
* Obtain all the keys for lat/lon entries of the Planes Menu Item map.
*
* @return latLonKeys
*
*/
public List<String> getLatLonKeys() {
@ -557,7 +565,23 @@ public class MenuItemManager {
latLonKeys.add("LONS");
return latLonKeys;
}
/**
* Obtain the Active Data Selection.
*
* @return dataSelection
*/
public DataSelection getActiveDataSelection() {
return menuActionCB.getActiveDataSelection();
}
/**
* Set the Active Data Selection.
*
* @param dataSelection
*/
public void setActiveDataSelection(DataSelection dataSelection) {
menuActionCB.setActiveDataSelection(dataSelection);
}
}

View file

@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.ToolItem;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.uf.viz.points.data.IPointNode;
import com.raytheon.viz.volumebrowser.vbui.DataListsProdTableComp.DataSelection;
import com.raytheon.viz.volumebrowser.widget.MenuContributionItem;
import com.raytheon.viz.volumebrowser.xml.MenuContribution;
@ -52,6 +53,7 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
* Sep 25, 2012 1215 rferrel Clicking anywhere on the Point button
* now opens the menu.
* Sep 26, 2012 1216 rferrel resetMenu method added.
* Jan 24, 2013 1516 rferrel Change Active Data Selection prior to filling menus.
*
* </pre>
*
@ -60,21 +62,57 @@ import com.raytheon.viz.volumebrowser.xml.MenuContribution;
*/
public class PointToolAction extends Action implements IMenuCreator {
/**
* Menu to display the parentNode's children.
*/
private Menu menu;
private String pointNames;
/**
* Type of name to prepend to a point's name.
*/
private final String pointNames;
private IPointNode parentNode;
/**
* The Data Selection type that requested the menu.
*/
private final DataSelection dataSelection;
private PointsDataManager dataManager;
/**
* The group node associated with this action.
*/
private final IPointNode parentNode;
public PointToolAction(String text, String pointNames) {
this(text, pointNames, null);
/**
* Manager to get point information.
*/
private final PointsDataManager dataManager;
/**
* Constructor.
*
* @param text
* @param pointNames
* @param dataSelection
*/
public PointToolAction(String text, String pointNames,
DataSelection dataSelection) {
this(text, pointNames, dataSelection, null);
}
public PointToolAction(String text, String pointNames, IPointNode parentNode) {
/**
* Private constructor used recursively to generate menus for groups.
*
* @param text
* @param pointNames
* @param dataSelecion
* @param parentNode
*/
private PointToolAction(String text, String pointNames,
DataSelection dataSelecion, IPointNode parentNode) {
super(text, SWT.DROP_DOWN);
this.pointNames = pointNames;
this.dataSelection = dataSelecion;
this.parentNode = parentNode;
this.dataManager = PointsDataManager.getInstance();
}
@ -93,7 +131,6 @@ public class PointToolAction extends Action implements IMenuCreator {
getMenu(item.getParent());
}
menu.setVisible(true);
super.runWithEvent(event);
}
/*
@ -118,6 +155,7 @@ public class PointToolAction extends Action implements IMenuCreator {
@Override
public Menu getMenu(Control parent) {
if (menu == null) {
MenuItemManager.getInstance().setActiveDataSelection(dataSelection);
menu = new Menu(parent);
fillMenu(menu);
}
@ -134,7 +172,8 @@ public class PointToolAction extends Action implements IMenuCreator {
*/
@Override
public Menu getMenu(Menu parent) {
if (menu != null) {
if (menu == null) {
MenuItemManager.getInstance().setActiveDataSelection(dataSelection);
menu = new Menu(parent);
fillMenu(menu);
}
@ -159,6 +198,11 @@ public class PointToolAction extends Action implements IMenuCreator {
}
}
/**
* Populates the menu with the children of the parentNode.
*
* @param menu
*/
private void fillMenu(final Menu menu) {
List<IPointNode> nodes = dataManager.getChildren(parentNode);
@ -166,8 +210,8 @@ public class PointToolAction extends Action implements IMenuCreator {
for (IPointNode node : nodes) {
if (node.isGroup()) {
if (dataManager.getChildren(node).size() > 0) {
final PointToolAction submenu = new PointToolAction(""
+ node.getName(), pointNames, node);
final PointToolAction submenu = new PointToolAction(
node.getName(), pointNames, dataSelection, node);
submenu.menu = new Menu(menu);
menu.addDisposeListener(new DisposeListener() {
@ -199,6 +243,9 @@ public class PointToolAction extends Action implements IMenuCreator {
return this;
}
/**
* This class the details for placing a point in the desired menu.
*/
private class TitleContributionItem extends ContributionItem {
private String text;
@ -218,13 +265,6 @@ public class PointToolAction extends Action implements IMenuCreator {
this.text = text;
}
/**
* @return the text
*/
public String getText() {
return text;
}
/*
* (non-Javadoc)
*