From 64ef004e7884a4f72ec483e67fdf20e97e16e92d Mon Sep 17 00:00:00 2001 From: Matt Nash Date: Wed, 4 Apr 2012 11:23:34 -0500 Subject: [PATCH] Issue #429 working telestration collaboration capabilities Former-commit-id: 3c2fcc59d02b86c11c33d582bff723dd8f8de6a7 [formerly 3c2fcc59d02b86c11c33d582bff723dd8f8de6a7 [formerly f1c9552a757e7d194e31ed9786cb358c53e631b7]] Former-commit-id: c27a3cf672900f3506e23d4269c0820488e4e259 Former-commit-id: 28df06150e765bab6103c35f2618b949bbd11d3a --- .../ui/role/ParticipantEventController.java | 40 +++-- .../ui/role/SessionLeaderEventController.java | 7 + .../CollaborationDrawingLayer.java | 147 +++++++++++++++--- .../CollaborationPathDrawingResourceData.java | 4 +- .../telestrator/TelestratorColorManager.java | 98 ++++++++++++ .../ui/telestrator/TelestratorLine.java | 81 ---------- .../ClearDrawingEvent.java} | 9 +- .../event/CollaborationDrawingEvent.java | 95 +++++++++++ .../collaboration/comm/provider/Tools.java | 10 +- .../META-INF/MANIFEST.MF | 1 + .../raytheon/uf/viz/drawing/DrawingLayer.java | 6 +- .../uf/viz/drawing/actions/RedoAddAction.java | 2 +- .../uf/viz/drawing/actions/UndoAddAction.java | 2 +- .../uf/viz/drawing/events/DrawingEvent.java | 31 +--- .../uf/viz/ui/menus/xml/IncludeMenuItem.java | 2 +- 15 files changed, 384 insertions(+), 151 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorColorManager.java delete mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorLine.java rename cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/{TelestratorObject.java => event/ClearDrawingEvent.java} (76%) create mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java index e486a74eb9..54add573b8 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java @@ -22,6 +22,7 @@ package com.raytheon.uf.viz.collaboration.ui.role; import com.google.common.eventbus.Subscribe; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; import com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; @@ -29,9 +30,13 @@ import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor; import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditorInputHandler; import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup; import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor; +import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingResourceData; +import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar; import com.raytheon.uf.viz.core.VizApp; +import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; -import com.raytheon.uf.viz.drawing.PathToolbar; +import com.raytheon.uf.viz.core.rsc.LoadProperties; +import com.raytheon.uf.viz.drawing.PathDrawingResourceData; /** * Handles the events of a session that are specific to the Participant role. @@ -74,6 +79,23 @@ public class ParticipantEventController extends AbstractRoleEventController { InputPriority.SYSTEM_RESOURCE); CollaborationDataManager.getInstance().editorCreated( session.getSessionId(), editor); + + // activate the drawing tool by default for participants + PathDrawingResourceData data = new CollaborationPathDrawingResourceData(); + try { + editor.getActiveDisplayPane() + .getDescriptor() + .getResourceList() + .add(data.construct(new LoadProperties(), + editor.getActiveDisplayPane() + .getDescriptor())); + } catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, + e.getLocalizedMessage(), e); + } + // PathDrawingTool tool = new + // CollaborationPathDrawingTool(); + // tool.activate(); } }); @@ -90,13 +112,13 @@ public class ParticipantEventController extends AbstractRoleEventController { @Override public void startup() { super.startup(); - VizApp.runAsync(new Runnable() { - @Override - public void run() { - PathToolbar toolbar = PathToolbar.getToolbar(); - toolbar.open(); - } - }); + // VizApp.runAsync(new Runnable() { + // @Override + // public void run() { + // PathToolbar toolbar = CollaborationPathToolbar.getToolbar(); + // toolbar.open(); + // } + // }); } /* @@ -109,6 +131,6 @@ public class ParticipantEventController extends AbstractRoleEventController { @Override public void shutdown() { super.shutdown(); - PathToolbar.getToolbar().close(); + CollaborationPathToolbar.getToolbar().close(); } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/SessionLeaderEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/SessionLeaderEventController.java index 117d57404b..5aa295b6bc 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/SessionLeaderEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/SessionLeaderEventController.java @@ -20,9 +20,11 @@ package com.raytheon.uf.viz.collaboration.ui.role; import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; +import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingTool; import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.drawing.PathToolbar; +import com.raytheon.uf.viz.drawing.tools.PathDrawingTool; /** * TODO Add Description @@ -63,6 +65,11 @@ public class SessionLeaderEventController extends AbstractRoleEventController { VizApp.runAsync(new Runnable() { @Override public void run() { + // activate the drawing tool by default for the session leader + PathDrawingTool tool = new CollaborationPathDrawingTool(); + tool.activate(); + + // open the path drawing toolbar PathToolbar toolbar = CollaborationPathToolbar.getToolbar(); toolbar.open(); } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java index e5f65461e4..b706e2611e 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java @@ -19,15 +19,23 @@ **/ package com.raytheon.uf.viz.collaboration.ui.telestrator; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; import java.util.Map; -import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; +import com.google.common.eventbus.Subscribe; +import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; +import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession; import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; +import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; +import com.raytheon.uf.viz.collaboration.ui.telestrator.event.ClearDrawingEvent; +import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; @@ -37,6 +45,9 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.drawing.DrawingLayer; import com.raytheon.uf.viz.drawing.PathDrawingResourceData; +import com.raytheon.viz.ui.EditorUtil; +import com.raytheon.viz.ui.editor.AbstractEditor; +import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.LineString; /** @@ -59,7 +70,11 @@ import com.vividsolutions.jts.geom.LineString; public class CollaborationDrawingLayer extends DrawingLayer { - private Multimap collaboratorShapes; + private Multimap collaboratorShapes; + + private List deletedCollaboratorShapes; + + private RGB officialColor = null; /** * @param data @@ -68,6 +83,48 @@ public class CollaborationDrawingLayer extends DrawingLayer { public CollaborationDrawingLayer(PathDrawingResourceData data, LoadProperties props) { super(data, props); + AbstractEditor editor = EditorUtil + .getActiveEditorAs(AbstractEditor.class); + CollaborationDataManager mgr = CollaborationDataManager.getInstance(); + for (String str : mgr.getSessions().keySet()) { + if (editor.equals(mgr.getEditor(str))) { + mgr.getSession(str).registerEventHandler(this); + break; + } + } + } + + @Subscribe + public void handle(IDisplayEvent event) { + if (event instanceof ClearDrawingEvent) { + resetTemp(); + disposeInternal(); + issueRefresh(); + } else if (event instanceof CollaborationDrawingEvent) { + CollaborationDrawingEvent collEvent = (CollaborationDrawingEvent) event; + addCollaborationShape(collEvent.getGeom(), + getCapability(ColorableCapability.class).getColor()); + } + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.drawing.DrawingLayer#reset() + */ + @Override + public void reset() { + super.reset(); + ClearDrawingEvent event = new ClearDrawingEvent(); + Map sessions = CollaborationDataManager + .getInstance().getSessions(); + for (String str : sessions.keySet()) { + try { + ((ISharedDisplaySession) sessions.get(str)).sendEvent(event); + } catch (CollaborationException e) { + e.printStackTrace(); + } + } } /* @@ -81,7 +138,13 @@ public class CollaborationDrawingLayer extends DrawingLayer { protected void initInternal(IGraphicsTarget target) throws VizException { super.initInternal(target); this.collaboratorShapes = HashMultimap.create(); - getCapabilities().removeCapability(ColorableCapability.class); + this.collaboratorShapes = Multimaps + .synchronizedMultimap(this.collaboratorShapes); + this.deletedCollaboratorShapes = new ArrayList(); + TelestratorColorManager colorManager = TelestratorColorManager + .getColorManager(); + officialColor = colorManager.getColorFromUser(CollaborationDataManager + .getInstance().getLoginId()); } /* @@ -99,14 +162,33 @@ public class CollaborationDrawingLayer extends DrawingLayer { OutlineCapability outline = getCapability(OutlineCapability.class); // paint the shapes that come over from others - for (Color color : collaboratorShapes.keySet()) { - for (IWireframeShape sh : collaboratorShapes.get(color)) { - target.drawWireframeShape(sh, color.getRGB(), - outline.getOutlineWidth(), outline.getLineStyle()); + synchronized (collaboratorShapes) { + for (RGB color : collaboratorShapes.keySet()) { + for (IWireframeShape sh : collaboratorShapes.get(color)) { + target.drawWireframeShape(sh, color, + outline.getOutlineWidth(), outline.getLineStyle()); + } } } } + public void addCollaborationShape(Geometry geom, RGB color) { + IWireframeShape shape = target.createWireframeShape(false, + getDescriptor()); + drawTempLinePrimitive(geom, shape); + synchronized (collaboratorShapes) { + collaboratorShapes.put(color, shape); + } + issueRefresh(); + } + + public void removeCollaborationShape(Geometry geom, RGB color) { + synchronized (collaboratorShapes) { + // deletedCollaboratorShapes. + // collaboratorShapes.remove(geom, color); + } + } + /* * (non-Javadoc) * @@ -115,10 +197,18 @@ public class CollaborationDrawingLayer extends DrawingLayer { @Override protected void disposeInternal() { super.disposeInternal(); - for (IWireframeShape shape : collaboratorShapes.values()) { + synchronized (collaboratorShapes) { + for (IWireframeShape shape : collaboratorShapes.values()) { + shape.dispose(); + } + } + + for (IWireframeShape shape : deletedCollaboratorShapes) { shape.dispose(); } + collaboratorShapes.clear(); + deletedCollaboratorShapes.clear(); } /* @@ -131,21 +221,36 @@ public class CollaborationDrawingLayer extends DrawingLayer { @Override public void finalizeLine(LineString line, String uuid) { super.finalizeLine(line, uuid); + sendDrawEvent(line); + } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.drawing.DrawingLayer#addTempDrawLine(com.vividsolutions + * .jts.geom.LineString) + */ + @Override + public void addTempDrawLine(LineString line) { + super.addTempDrawLine(line); + // sendDrawEvent(line); + } + + private void sendDrawEvent(LineString line) { Map sessions = CollaborationDataManager .getInstance().getSessions(); - - TelestratorLine tObject = new TelestratorLine(); - // set the coordinates of the TransferLine - tObject.setCoordinates(Arrays.asList(line.getCoordinates())); + CollaborationDrawingEvent tObject = new CollaborationDrawingEvent(line, + officialColor); // get the color of the user here, before sending it off - tObject.setColor(null); - // for (String str : sessions.keySet()) { - // try { - // ((ISharedDisplaySession) sessions.get(str)).sendEvent(tObject); - // } catch (CollaborationException e) { - // e.printStackTrace(); - // } - // } + AbstractEditor editor = EditorUtil + .getActiveEditorAs(AbstractEditor.class); + for (String str : sessions.keySet()) { + try { + ((ISharedDisplaySession) sessions.get(str)).sendEvent(tObject); + } catch (CollaborationException e) { + e.printStackTrace(); + } + } } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java index 05a03ff1f9..2209e688bf 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java @@ -19,6 +19,8 @@ **/ package com.raytheon.uf.viz.collaboration.ui.telestrator; +import javax.xml.bind.annotation.XmlElement; + import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; @@ -81,6 +83,6 @@ public class CollaborationPathDrawingResourceData extends */ @Override public void setClassT(String classT) { - + System.out.println("setClassT"); } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorColorManager.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorColorManager.java new file mode 100644 index 0000000000..64eaf9195b --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorColorManager.java @@ -0,0 +1,98 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.collaboration.ui.telestrator; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.swt.graphics.RGB; + +import com.raytheon.viz.core.ColorUtil; + +/** + * TODO Add Description + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 3, 2012            mnash     Initial creation
+ * 
+ * 
+ * + * @author mnash + * @version 1.0 + */ + +public class TelestratorColorManager { + + private Map colors; + + private static TelestratorColorManager colorManager = null; + + private static RGB[] rgbPresets = null; + + public static TelestratorColorManager getColorManager() { + if (colorManager == null) { + colorManager = new TelestratorColorManager(); + rgbPresets = ColorUtil.getResourceColorPresets(); + } + return colorManager; + } + + /** + * + */ + private TelestratorColorManager() { + if (colors == null) { + colors = new HashMap(); + } + } + + /** + * @return the colors + */ + public Map getColors() { + return colors; + } + + /** + * Add a user with a new color value + * + * @param user + */ + public void addUser(String user) { + int count = colors.size(); + if (rgbPresets.length <= colors.size()) { + count = rgbPresets.length % colors.size(); + } + colors.put(user, rgbPresets[count]); + } + + public RGB getColorFromUser(String user) { + if (colors.get(user) == null) { + addUser(user); + } + return colors.get(user); + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorLine.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorLine.java deleted file mode 100644 index e57114701e..0000000000 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorLine.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.collaboration.ui.telestrator; - -import java.util.List; - -import org.eclipse.swt.graphics.Color; - -import com.vividsolutions.jts.geom.Coordinate; - -/** - * A line for the telestrator - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Mar 26, 2012            mnash     Initial creation
- * 
- * 
- * - * @author mnash - * @version 1.0 - */ - -public class TelestratorLine extends TelestratorObject { - // the color of the shape to be drawn - private Color color; - - // the coordinates to be converted into a wireframe shape - private List coordinates; - - /** - * @param color - * the color to set - */ - public void setColor(Color color) { - this.color = color; - } - - /** - * @return the color - */ - public Color getColor() { - return color; - } - - /** - * @param coordinates - * the coordinates to set - */ - public void setCoordinates(List coordinates) { - this.coordinates = coordinates; - } - - /** - * @return the coordinates - */ - public List getCoordinates() { - return coordinates; - } -} diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorObject.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/ClearDrawingEvent.java similarity index 76% rename from cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorObject.java rename to cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/ClearDrawingEvent.java index e52b9e352b..b263292063 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/TelestratorObject.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/ClearDrawingEvent.java @@ -17,9 +17,11 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.uf.viz.collaboration.ui.telestrator; +package com.raytheon.uf.viz.collaboration.ui.telestrator.event; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent; +import com.raytheon.uf.viz.drawing.events.DrawingEvent; /** * TODO Add Description @@ -30,7 +32,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 26, 2012 mnash Initial creation + * Apr 4, 2012 mnash Initial creation * * * @@ -38,6 +40,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent; * @version 1.0 */ -public class TelestratorObject implements IDisplayEvent { +@DynamicSerialize +public class ClearDrawingEvent extends DrawingEvent implements IDisplayEvent { } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java new file mode 100644 index 0000000000..a4a6389b19 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java @@ -0,0 +1,95 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.collaboration.ui.telestrator.event; + +import org.eclipse.swt.graphics.RGB; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent; +import com.raytheon.uf.viz.drawing.events.DrawingEvent; +import com.vividsolutions.jts.geom.Geometry; + +/** + * TODO Add Description + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 3, 2012            mnash     Initial creation
+ * 
+ * 
+ * + * @author mnash + * @version 1.0 + */ + +@DynamicSerialize +public class CollaborationDrawingEvent extends DrawingEvent implements + IDisplayEvent { + + @DynamicSerializeElement + private Geometry geom; + + // @DynamicSerializeElement + // private RGB color; + + public CollaborationDrawingEvent() { + + } + + public CollaborationDrawingEvent(Geometry geom, RGB color) { + this.geom = geom; + // this.color = color; + } + + // /** + // * @return the color + // */ + // public RGB getColor() { + // return color; + // } + // + // /** + // * @param color + // * the color to set + // */ + // public void setColor(RGB color) { + // this.color = color; + // } + + /** + * @return the geom + */ + public Geometry getGeom() { + return geom; + } + + /** + * @param geom + * the geom to set + */ + public void setGeom(Geometry geom) { + this.geom = geom; + } +} diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java index 5b6d7a2c30..b7338b69b9 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/Tools.java @@ -49,7 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; public abstract class Tools { public static final String TAG_INVITE = "[[INVITEID#"; - + public static final String TAG_INVITE_ID = TAG_INVITE + "%s]]%s"; public static final String PROP_SESSION_ID = "sessionId"; @@ -329,7 +329,7 @@ public abstract class Tools { sb.append(ENV_THRIFT); } catch (SerializationException e) { throw new CollaborationException( - "[THRIFT] Could not serialize object"); + "[THRIFT] Could not serialize object", e); } break; } @@ -342,7 +342,7 @@ public abstract class Tools { } } catch (JAXBException je) { throw new CollaborationException( - "[JAXB] Could not serialize object"); + "[JAXB] Could not serialize object", je); } break; } @@ -389,7 +389,7 @@ public abstract class Tools { unMarshalledData = SerializationUtil.transformFromThrift(b); } catch (SerializationException e) { throw new CollaborationException( - "Could not deserialize object"); + "Could not deserialize object", e); } } else if (data.startsWith(ENV_JAXB)) { String s = data.substring(ENV_JAXB.length()); @@ -397,7 +397,7 @@ public abstract class Tools { unMarshalledData = SerializationUtil.unmarshalFromXml(s); } catch (JAXBException je) { throw new CollaborationException( - "[JAXB] Could not deserialize object"); + "[JAXB] Could not deserialize object", je); } } else if (data.startsWith(ENV_STRING)) { unMarshalledData = data.substring(ENV_STRING.length()); diff --git a/cave/com.raytheon.uf.viz.drawing/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.drawing/META-INF/MANIFEST.MF index 0d483df5ec..3d92ef1175 100644 --- a/cave/com.raytheon.uf.viz.drawing/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.drawing/META-INF/MANIFEST.MF @@ -4,6 +4,7 @@ Bundle-Name: Drawing Bundle-SymbolicName: com.raytheon.uf.viz.drawing;singleton:=true Bundle-Version: 1.0.0.qualifier Bundle-Activator: com.raytheon.uf.viz.drawing.Activator +Eclipse-RegisterBuddy: com.raytheon.uf.viz.core Bundle-Vendor: RAYTHEON Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingLayer.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingLayer.java index 6f56bb0412..2be7c173e0 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingLayer.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/DrawingLayer.java @@ -163,7 +163,7 @@ public class DrawingLayer extends * @param shape * @param wShape */ - private void drawTempLinePrimitive(Geometry shape, IWireframeShape wShape) { + protected void drawTempLinePrimitive(Geometry shape, IWireframeShape wShape) { LineString line = (LineString) shape; int pts = line.getNumPoints(); @@ -214,7 +214,9 @@ public class DrawingLayer extends public void finalizeLine(LineString line, String uuid) { tempWireframeShape.compile(); wireframeShapes.put(line, tempWireframeShape); - DrawingEvent event = new DrawingEvent(line, null); + + // this will update the toolbar if necessary + DrawingEvent event = new DrawingEvent(); eventBus.post(event); } diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/RedoAddAction.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/RedoAddAction.java index c5376f10b2..873ff2627e 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/RedoAddAction.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/RedoAddAction.java @@ -58,7 +58,7 @@ public class RedoAddAction extends AbstractHandler { if (pair.getResource() instanceof DrawingLayer) { ((DrawingLayer) pair.getResource()).redoAdd(); ((DrawingLayer) pair.getResource()).getEventBus().post( - new DrawingEvent(null, null)); + new DrawingEvent()); break; } } diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/UndoAddAction.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/UndoAddAction.java index 8ada3a8fb1..77401ace3d 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/UndoAddAction.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/actions/UndoAddAction.java @@ -57,7 +57,7 @@ public class UndoAddAction extends AbstractHandler { if (pair.getResource() instanceof DrawingLayer) { ((DrawingLayer) pair.getResource()).undoAdd(); ((DrawingLayer) pair.getResource()).getEventBus().post( - new DrawingEvent(null, null)); + new DrawingEvent()); break; } } diff --git a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/events/DrawingEvent.java b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/events/DrawingEvent.java index e6e63b5c43..5d6cba0783 100644 --- a/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/events/DrawingEvent.java +++ b/cave/com.raytheon.uf.viz.drawing/src/com/raytheon/uf/viz/drawing/events/DrawingEvent.java @@ -19,8 +19,8 @@ **/ package com.raytheon.uf.viz.drawing.events; -import com.raytheon.viz.ui.editor.AbstractEditor; -import com.vividsolutions.jts.geom.Geometry; +import com.raytheon.uf.common.serialization.ISerializableObject; +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; /** * TODO Add Description @@ -39,28 +39,7 @@ import com.vividsolutions.jts.geom.Geometry; * @version 1.0 */ -public class DrawingEvent { +@DynamicSerialize +public class DrawingEvent implements ISerializableObject { - private AbstractEditor editor; - - private Geometry geom; - - public DrawingEvent(Geometry geom, AbstractEditor editor) { - this.geom = geom; - this.editor = editor; - } - - /** - * @return the geom - */ - public Geometry getGeom() { - return geom; - } - - /** - * @return the editor - */ - public AbstractEditor getEditor() { - return editor; - } -} +} \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java index e1aee40a63..fc04856f21 100644 --- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java +++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/xml/IncludeMenuItem.java @@ -106,7 +106,7 @@ public class IncludeMenuItem extends CommonIncludeMenuItem implements */ @Override public String getId() { - return subMenuName; + return "IncludeSubMenuContributionId_" + subMenuName; } }; return new IContributionItem[] { submenuCont };