Issue #427 instantiate collaboration resource

Change-Id: I5aa7ec5d7dfb3f2373730eb40dd9ea3178112d20

Former-commit-id: bea3b8fb0c [formerly 9c4b29c3aa] [formerly 260c7c10eb] [formerly f06338bcd4 [formerly 260c7c10eb [formerly 5cd5a85bf836ade2da3b43b2797c2a65d61be461]]]
Former-commit-id: f06338bcd4
Former-commit-id: 805a0a7445263fe4b32c76b708b396734638f2b0 [formerly 0f5b0f7e9e]
Former-commit-id: a2d7bdb709
This commit is contained in:
Nate Jensen 2012-04-04 14:05:12 -05:00
parent ae78c1b570
commit 63e389da6e
4 changed files with 199 additions and 1 deletions

View file

@ -96,7 +96,7 @@ public class CollaborationEditorInputHandler implements IInputHandler {
coords[1], mouseButton);
sendEvent(event);
}
return leader;
return !leader;
}
/*

View file

@ -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);
}
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 3, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class CollaborationResource extends
AbstractVizResource<CollaborationResourceData, IDescriptor> {
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);
}
}

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 3, 2012 njensen Initial creation
*
* </pre>
*
* @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;
}
}