Issue #590 fixed GFE session creation bugs. Added refresh to tool items

on undo/redo from keyboard

Former-commit-id: 603726498f [formerly f0e2ef8c91] [formerly b5da470e0a] [formerly 8b87b6a0a1 [formerly b5da470e0a [formerly 5c3d4a7fffe3873afbe8db60310afae2b3f0738b]]]
Former-commit-id: 8b87b6a0a1
Former-commit-id: 1b3f753ea0cf2015ee33e8f1e26d5a3ddf66eec2 [formerly a6ca2ee4f6]
Former-commit-id: af72c6411a
This commit is contained in:
Max Schenkelberg 2012-06-05 16:42:55 -05:00
parent 3e52d57e9b
commit 4fe4709862
7 changed files with 83 additions and 43 deletions

View file

@ -68,6 +68,7 @@ class GFEPainter(VizPainter.VizPainter):
envelope = self.dataMgr.getRefManager().loadRefSet(self.refId).overallDomain(CoordinateType.LATLON) envelope = self.dataMgr.getRefManager().loadRefSet(self.refId).overallDomain(CoordinateType.LATLON)
geom = GfeImageUtil.getLocationGeometry(gloc, envelope, float(imageWidth), float(imageHeight), expandLeft / 100.0, expandRight / 100.0, expandTop / 100.0, expandBottom / 100.0) geom = GfeImageUtil.getLocationGeometry(gloc, envelope, float(imageWidth), float(imageHeight), expandLeft / 100.0, expandRight / 100.0, expandTop / 100.0, expandBottom / 100.0)
display = GFEMapRenderableDisplay(MapDescriptor(geom)) display = GFEMapRenderableDisplay(MapDescriptor(geom))
display.setDataManager(self.dataMgr)
desc = display.getDescriptor() desc = display.getDescriptor()
self.dataMgr.getSpatialDisplayManager().setDescriptor(desc) self.dataMgr.getSpatialDisplayManager().setDescriptor(desc)
VizPainter.VizPainter.__init__(self, display) VizPainter.VizPainter.__init__(self, display)

View file

@ -167,7 +167,7 @@ public class CollaborationSessionView extends SessionView implements
assigned = assignLayer(); assigned = assignLayer();
} }
if (assigned) { if (assigned) {
updateToolItem(); updateToolItems();
} }
} }
@ -224,7 +224,7 @@ public class CollaborationSessionView extends SessionView implements
} else { } else {
layer.setDrawMode(DrawMode.DRAW); layer.setDrawMode(DrawMode.DRAW);
} }
updateToolItem(); updateToolItems();
} }
}); });
drawAction.getAction().setImageDescriptor( drawAction.getAction().setImageDescriptor(
@ -236,7 +236,7 @@ public class CollaborationSessionView extends SessionView implements
@Override @Override
public void run() { public void run() {
layer.undo(); layer.undo();
updateToolItem(); updateToolItems();
} }
}); });
undoAction.getAction().setImageDescriptor( undoAction.getAction().setImageDescriptor(
@ -248,7 +248,7 @@ public class CollaborationSessionView extends SessionView implements
@Override @Override
public void run() { public void run() {
layer.redo(); layer.redo();
updateToolItem(); updateToolItems();
} }
}); });
redoAction.getAction().setImageDescriptor( redoAction.getAction().setImageDescriptor(
@ -265,7 +265,7 @@ public class CollaborationSessionView extends SessionView implements
} else { } else {
layer.setDrawMode(DrawMode.ERASE); layer.setDrawMode(DrawMode.ERASE);
} }
updateToolItem(); updateToolItems();
} }
}); });
eraseAction.getAction().setImageDescriptor( eraseAction.getAction().setImageDescriptor(
@ -276,7 +276,7 @@ public class CollaborationSessionView extends SessionView implements
clearAction = new ActionContributionItem(new Action("Clear") { clearAction = new ActionContributionItem(new Action("Clear") {
public void run() { public void run() {
layer.clear(); layer.clear();
updateToolItem(); updateToolItems();
}; };
}); });
clearAction.getAction().setImageDescriptor( clearAction.getAction().setImageDescriptor(
@ -289,7 +289,7 @@ public class CollaborationSessionView extends SessionView implements
public void run() { public void run() {
resource.setLockingDrawing(((ToolItem) lockAction.getWidget()) resource.setLockingDrawing(((ToolItem) lockAction.getWidget())
.getSelection()); .getSelection());
updateToolItem(); updateToolItems();
}; };
}); });
lockAction.getAction().setImageDescriptor( lockAction.getAction().setImageDescriptor(
@ -307,7 +307,7 @@ public class CollaborationSessionView extends SessionView implements
mgr.insert(mgr.getSize() - 1, new Separator()); mgr.insert(mgr.getSize() - 1, new Separator());
} }
private void updateToolItem() { public void updateToolItems() {
boolean assigned = true; boolean assigned = true;
if (layer == null) { if (layer == null) {
assigned = assignLayer(); assigned = assignLayer();
@ -445,7 +445,7 @@ public class CollaborationSessionView extends SessionView implements
clearAction.getAction().setEnabled(false); clearAction.getAction().setEnabled(false);
eraseAction.getAction().setEnabled(false); eraseAction.getAction().setEnabled(false);
} else { } else {
updateToolItem(); updateToolItems();
} }
} }
} }

View file

@ -19,11 +19,20 @@
**/ **/
package com.raytheon.uf.viz.collaboration.ui.telestrator.handlers; package com.raytheon.uf.viz.collaboration.ui.telestrator.handlers;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource; import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.drawing.DrawingToolLayer; import com.raytheon.uf.viz.drawing.DrawingToolLayer;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
@ -62,18 +71,45 @@ public class UndoRedoHandler extends AbstractHandler {
*/ */
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
CollaborationDrawingResource resource = (CollaborationDrawingResource) EditorUtil IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
.getActiveEditorAs(IDisplayPaneContainer.class) if (window != null) {
.getActiveDisplayPane().getDescriptor().getResourceList() IDisplayPaneContainer container = EditorUtil.getActiveEditorAs(
.getResourcesByTypeAsType(CollaborationDrawingResource.class) window, IDisplayPaneContainer.class);
.get(0); if (container != null) {
DrawingToolLayer layer = resource.getDrawingLayerFor(resource Map<String, CollaborationSessionView> viewMap = new HashMap<String, CollaborationSessionView>();
.getMyUser()); for (IViewReference view : window.getActivePage()
String action = event.getParameter(ACTION_ID); .getViewReferences()) {
if (UNDO_ID.equals(action)) { if (CollaborationSessionView.ID.equals(view.getId())) {
layer.undo(); CollaborationSessionView csv = (CollaborationSessionView) view
} else if (REDO_ID.equals(action)) { .getPart(false);
layer.redo(); viewMap.put(csv.getSessionId(), csv);
}
}
for (IDisplayPane pane : container.getDisplayPanes()) {
List<CollaborationDrawingResource> resources = pane
.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(
CollaborationDrawingResource.class);
for (CollaborationDrawingResource resource : resources) {
DrawingToolLayer layer = resource
.getDrawingLayerFor(resource.getMyUser());
String action = event.getParameter(ACTION_ID);
if (UNDO_ID.equals(action)) {
layer.undo();
} else if (REDO_ID.equals(action)) {
layer.redo();
}
CollaborationSessionView view = viewMap.get(resource
.getResourceData().getSessionId());
if (view != null) {
view.updateToolItems();
}
}
}
}
} }
return null; return null;
} }

View file

@ -1,5 +1,6 @@
com.raytheon.viz.gfe.core.GFEMapRenderableDisplay com.raytheon.viz.gfe.core.GFEMapRenderableDisplay
com.raytheon.viz.gfe.rsc.GFELegendResourceData com.raytheon.viz.gfe.rsc.GFELegendResourceData
com.raytheon.viz.gfe.rsc.GFEResourceData
com.raytheon.uf.common.site.xml.AdjacentWfoXML com.raytheon.uf.common.site.xml.AdjacentWfoXML
com.raytheon.uf.common.site.xml.CwaXML com.raytheon.uf.common.site.xml.CwaXML
com.raytheon.viz.gfe.textformatter.CombinationsFileUtil$ComboData com.raytheon.viz.gfe.textformatter.CombinationsFileUtil$ComboData

View file

@ -25,9 +25,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -73,19 +70,20 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay
private DataManager dataMgr; private DataManager dataMgr;
@SuppressWarnings("unchecked")
public GFEMapRenderableDisplay() { public GFEMapRenderableDisplay() {
super(); }
dataMgr = DataManager.getCurrentInstance();
dataMgr.getSpatialDisplayManager().addSpatialEditorTimeChangedListener( public GFEMapRenderableDisplay(MapDescriptor desc) {
this); super(desc);
Message.registerInterest(this, ShowQuickViewDataMsg.class);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public GFEMapRenderableDisplay(MapDescriptor desc) { public void setDataManager(DataManager dataManager) {
super(desc); if (this.dataMgr != null) {
dataMgr = DataManager.getCurrentInstance(); dataMgr.getSpatialDisplayManager()
.removeSpatialEditorTimeChangedListener(this);
}
dataMgr = dataManager;
dataMgr.getSpatialDisplayManager().addSpatialEditorTimeChangedListener( dataMgr.getSpatialDisplayManager().addSpatialEditorTimeChangedListener(
this); this);
Message.registerInterest(this, ShowQuickViewDataMsg.class); Message.registerInterest(this, ShowQuickViewDataMsg.class);
@ -118,15 +116,11 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay
@Override @Override
protected PaintProperties calcPaintDataTime(PaintProperties paintProps, protected PaintProperties calcPaintDataTime(PaintProperties paintProps,
AbstractVizResource<?, ?> rsc) { AbstractVizResource<?, ?> rsc) {
IWorkbenchWindow window = null; if (dataMgr != null) {
if (container != null) { Date date = dataMgr.getSpatialDisplayManager()
window = ((IWorkbenchPart) container).getSite() .getSpatialEditorTime();
.getWorkbenchWindow(); paintProps.setDataTime(new DataTime(date));
} }
Date date = DataManager.getInstance(window).getSpatialDisplayManager()
.getSpatialEditorTime();
paintProps.setDataTime(new DataTime(date));
GFEPaintProperties gfeProps = new GFEPaintProperties(paintProps); GFEPaintProperties gfeProps = new GFEPaintProperties(paintProps);
if (qvTime != null) { if (qvTime != null) {

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
@ -57,6 +58,7 @@ import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.PythonPreferenceStore; import com.raytheon.viz.gfe.PythonPreferenceStore;
import com.raytheon.viz.gfe.actions.FormatterlauncherAction; import com.raytheon.viz.gfe.actions.FormatterlauncherAction;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.GFEMapRenderableDisplay;
import com.raytheon.viz.gfe.core.ISpatialDisplayManager; import com.raytheon.viz.gfe.core.ISpatialDisplayManager;
import com.raytheon.viz.gfe.core.internal.GFESpatialDisplayManager; import com.raytheon.viz.gfe.core.internal.GFESpatialDisplayManager;
import com.raytheon.viz.gfe.procedures.ProcedureJob; import com.raytheon.viz.gfe.procedures.ProcedureJob;
@ -128,7 +130,10 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
defineKeys(); defineKeys();
DataManager dm = DataManager.getInstance(perspectiveWindow); DataManager dm = DataManager.getInstance(perspectiveWindow);
IRenderableDisplay display = pane.getRenderableDisplay();
if (display instanceof GFEMapRenderableDisplay) {
((GFEMapRenderableDisplay) display).setDataManager(dm);
}
// Add GFE Legend // Add GFE Legend
try { try {
ResourcePair legend = ResourcePair ResourcePair legend = ResourcePair

View file

@ -19,6 +19,9 @@
**/ **/
package com.raytheon.viz.gfe.rsc; package com.raytheon.viz.gfe.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
@ -40,7 +43,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* @author chammack * @author chammack
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE)
public class GFEResourceData extends AbstractResourceData { public class GFEResourceData extends AbstractResourceData {
@Override @Override