From 2f8e80b25491ed565d37b2a5d309763a78066605 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Wed, 4 Apr 2012 14:05:12 -0500 Subject: [PATCH] Issue #427 instantiate collaboration resource Change-Id: I5aa7ec5d7dfb3f2373730eb40dd9ea3178112d20 Former-commit-id: 260c7c10eba2d56241f9ba285a4642e811129cef [formerly 260c7c10eba2d56241f9ba285a4642e811129cef [formerly 5cd5a85bf836ade2da3b43b2797c2a65d61be461]] Former-commit-id: f06338bcd400071f0f545b0af7bed0587889af83 Former-commit-id: 0f5b0f7e9ec5f7c44051ab7c2405268ac72e1f3e --- .../CollaborationEditorInputHandler.java | 2 +- .../ui/role/ParticipantEventController.java | 21 +++++ .../ui/rsc/CollaborationResource.java | 90 +++++++++++++++++++ .../ui/rsc/CollaborationResourceData.java | 87 ++++++++++++++++++ 4 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java create mode 100644 cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResourceData.java diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java index 8ac11c224e..e8032bc2a0 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java @@ -96,7 +96,7 @@ public class CollaborationEditorInputHandler implements IInputHandler { coords[1], mouseButton); sendEvent(event); } - return leader; + return !leader; } /* 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 54add573b8..a00c65dc24 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 @@ -30,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.rsc.CollaborationResource; +import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData; 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.drawables.IDescriptor; +import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; import com.raytheon.uf.viz.core.rsc.LoadProperties; @@ -60,6 +64,8 @@ public class ParticipantEventController extends AbstractRoleEventController { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ParticipantEventController.class); + private CollaborationResource collabRsc; + public ParticipantEventController(ISharedDisplaySession session) { super(session); } @@ -73,6 +79,8 @@ public class ParticipantEventController extends AbstractRoleEventController { @Override public void run() { CollaborationEditor editor = EditorSetup.createEditor(se); + initializeResources(editor.getActiveDisplayPane() + .getDescriptor()); editor.registerMouseHandler( new CollaborationEditorInputHandler(session, editor .getDisplayPanes()[0]), @@ -102,6 +110,15 @@ public class ParticipantEventController extends AbstractRoleEventController { } } + private void initializeResources(IDescriptor desc) { + CollaborationResourceData crd = new CollaborationResourceData(); + ResourcePair rp = ResourcePair.constructSystemResourcePair(crd); + desc.getResourceList().add(rp); + desc.getResourceList().instantiateResources(desc, false); + collabRsc = (CollaborationResource) rp.getResource(); + this.session.registerEventHandler(collabRsc); + } + /* * (non-Javadoc) * @@ -132,5 +149,9 @@ public class ParticipantEventController extends AbstractRoleEventController { public void shutdown() { super.shutdown(); CollaborationPathToolbar.getToolbar().close(); + + if (this.collabRsc != null) { + this.session.unRegisterEventHandler(collabRsc); + } } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java new file mode 100644 index 0000000000..f1cd7f360c --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResource.java @@ -0,0 +1,90 @@ +/** + * 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.rsc; + +import org.eclipse.swt.graphics.RGB; + +import com.google.common.eventbus.Subscribe; +import com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable; +import com.raytheon.uf.viz.core.DrawableString; +import com.raytheon.uf.viz.core.IGraphicsTarget; +import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.core.drawables.PaintProperties; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.LoadProperties; + +/** + * A resource for displaying rendered data that is received from the Data + * Provider. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 3, 2012            njensen     Initial creation
+ * 
+ * 
+ * + * @author njensen + * @version 1.0 + */ + +public class CollaborationResource extends + AbstractVizResource { + + protected CollaborationResource(CollaborationResourceData resourceData, + LoadProperties loadProperties) { + super(resourceData, loadProperties); + // TODO Auto-generated constructor stub + } + + @Override + protected void disposeInternal() { + // TODO Auto-generated method stub + + } + + @Override + protected void paintInternal(IGraphicsTarget target, + PaintProperties paintProps) throws VizException { + // TODO Auto-generated method stub + DrawableString string = new DrawableString( + "You can't see it but there is a collaboration resource on this editor", + new RGB(255, 0, 255)); + string.setCoordinates(800, 3000); + target.drawStrings(string); + } + + @Override + protected void initInternal(IGraphicsTarget target) throws VizException { + // TODO Auto-generated method stub + + } + + @Subscribe + public void renderableArrived(IRenderable render) { + // TODO add it to a list or something + System.out.println("Received renderable " + render); + } + +} diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResourceData.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResourceData.java new file mode 100644 index 0000000000..988aeb11ee --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/rsc/CollaborationResourceData.java @@ -0,0 +1,87 @@ +/** + * 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.rsc; + +import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.rsc.AbstractResourceData; +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.uf.viz.core.rsc.LoadProperties; + +/** + * Resource data for a CollaborationResource. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 3, 2012            njensen     Initial creation
+ * 
+ * 
+ * + * @author njensen + * @version 1.0 + */ + +public class CollaborationResourceData extends AbstractResourceData { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon + * .uf.viz.core.rsc.LoadProperties, + * com.raytheon.uf.viz.core.drawables.IDescriptor) + */ + @Override + public AbstractVizResource construct(LoadProperties loadProperties, + IDescriptor descriptor) throws VizException { + return new CollaborationResource(this, loadProperties); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object + * ) + */ + @Override + public void update(Object updateData) { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.rsc.AbstractResourceData#equals(java.lang.Object + * ) + */ + @Override + public boolean equals(Object obj) { + // TODO Auto-generated method stub + return false; + } + +}