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

on undo/redo from keyboard

Former-commit-id: b5da470e0a [formerly 5c3d4a7fffe3873afbe8db60310afae2b3f0738b]
Former-commit-id: 8b87b6a0a1
This commit is contained in:
Max Schenkelberg 2012-06-05 16:42:55 -05:00
parent 6be2a8435a
commit a6ca2ee4f6
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)
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.setDataManager(self.dataMgr)
desc = display.getDescriptor()
self.dataMgr.getSpatialDisplayManager().setDescriptor(desc)
VizPainter.VizPainter.__init__(self, display)

View file

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

View file

@ -19,11 +19,20 @@
**/
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.ExecutionEvent;
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.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
import com.raytheon.viz.ui.EditorUtil;
@ -62,18 +71,45 @@ public class UndoRedoHandler extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
CollaborationDrawingResource resource = (CollaborationDrawingResource) EditorUtil
.getActiveEditorAs(IDisplayPaneContainer.class)
.getActiveDisplayPane().getDescriptor().getResourceList()
.getResourcesByTypeAsType(CollaborationDrawingResource.class)
.get(0);
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();
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
if (window != null) {
IDisplayPaneContainer container = EditorUtil.getActiveEditorAs(
window, IDisplayPaneContainer.class);
if (container != null) {
Map<String, CollaborationSessionView> viewMap = new HashMap<String, CollaborationSessionView>();
for (IViewReference view : window.getActivePage()
.getViewReferences()) {
if (CollaborationSessionView.ID.equals(view.getId())) {
CollaborationSessionView csv = (CollaborationSessionView) view
.getPart(false);
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;
}

View file

@ -1,5 +1,6 @@
com.raytheon.viz.gfe.core.GFEMapRenderableDisplay
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.CwaXML
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.XmlRootElement;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -73,19 +70,20 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay
private DataManager dataMgr;
@SuppressWarnings("unchecked")
public GFEMapRenderableDisplay() {
super();
dataMgr = DataManager.getCurrentInstance();
dataMgr.getSpatialDisplayManager().addSpatialEditorTimeChangedListener(
this);
Message.registerInterest(this, ShowQuickViewDataMsg.class);
}
public GFEMapRenderableDisplay(MapDescriptor desc) {
super(desc);
}
@SuppressWarnings("unchecked")
public GFEMapRenderableDisplay(MapDescriptor desc) {
super(desc);
dataMgr = DataManager.getCurrentInstance();
public void setDataManager(DataManager dataManager) {
if (this.dataMgr != null) {
dataMgr.getSpatialDisplayManager()
.removeSpatialEditorTimeChangedListener(this);
}
dataMgr = dataManager;
dataMgr.getSpatialDisplayManager().addSpatialEditorTimeChangedListener(
this);
Message.registerInterest(this, ShowQuickViewDataMsg.class);
@ -118,15 +116,11 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay
@Override
protected PaintProperties calcPaintDataTime(PaintProperties paintProps,
AbstractVizResource<?, ?> rsc) {
IWorkbenchWindow window = null;
if (container != null) {
window = ((IWorkbenchPart) container).getSite()
.getWorkbenchWindow();
if (dataMgr != null) {
Date date = dataMgr.getSpatialDisplayManager()
.getSpatialEditorTime();
paintProps.setDataTime(new DataTime(date));
}
Date date = DataManager.getInstance(window).getSpatialDisplayManager()
.getSpatialEditorTime();
paintProps.setDataTime(new DataTime(date));
GFEPaintProperties gfeProps = new GFEPaintProperties(paintProps);
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.IExtent;
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.exception.VizException;
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.actions.FormatterlauncherAction;
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.internal.GFESpatialDisplayManager;
import com.raytheon.viz.gfe.procedures.ProcedureJob;
@ -128,7 +130,10 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
defineKeys();
DataManager dm = DataManager.getInstance(perspectiveWindow);
IRenderableDisplay display = pane.getRenderableDisplay();
if (display instanceof GFEMapRenderableDisplay) {
((GFEMapRenderableDisplay) display).setDataManager(dm);
}
// Add GFE Legend
try {
ResourcePair legend = ResourcePair

View file

@ -19,6 +19,9 @@
**/
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.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
@ -40,7 +43,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* @author chammack
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class GFEResourceData extends AbstractResourceData {
@Override