Issue #697 added support for multiple editors

Change-Id: Ic3ac12bb9368f0ec54dd8151ba1876002ff44e82

Former-commit-id: 816500d7c4 [formerly 51c2a41e68] [formerly dd99479eeb] [formerly fceef3c5a1 [formerly dd99479eeb [formerly 3afc7b49cb42c005a0e9cf5221e35fc3ab78007a]]]
Former-commit-id: fceef3c5a1
Former-commit-id: f94add25d0e7e6bf562b43f3ede6e45e7d953f95 [formerly e5e1a4de6a]
Former-commit-id: f0d2893e97
This commit is contained in:
Max Schenkelberg 2012-06-13 17:52:11 -05:00
parent cd82be177f
commit ea948bbb82
108 changed files with 3260 additions and 2601 deletions

View file

@ -7,7 +7,7 @@ Bundle-Activator: com.raytheon.uf.viz.collaboration.comm.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ecf;bundle-version="3.1.300",
org.eclipse.ecf;bundle-version="3.1.300";visibility:=reexport,
org.eclipse.ecf.presence;bundle-version="2.0.0",
org.eclipse.ecf.provider.xmpp;bundle-version="3.2.0",
org.apache.commons.lang;bundle-version="2.3.0",
@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
org.jivesoftware.smack;bundle-version="3.1.100",
org.eclipse.swt;bundle-version="3.6.1",
com.raytheon.uf.common.comm
com.raytheon.uf.common.comm,
com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.collaboration.comm,
@ -32,4 +33,5 @@ Export-Package: com.raytheon.uf.viz.collaboration.comm,
com.raytheon.uf.viz.collaboration.comm.provider.event,
com.raytheon.uf.viz.collaboration.comm.provider.info,
com.raytheon.uf.viz.collaboration.comm.provider.session,
com.raytheon.uf.viz.collaboration.comm.provider.user
com.raytheon.uf.viz.collaboration.comm.provider.user,
com.raytheon.uf.viz.collaboration.comm.storage

View file

@ -64,6 +64,12 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PeerToPeerCommHelper.class);
private static String httpServer;
public static String getCollaborationHttpServer() {
return httpServer;
}
private CollaborationConnection manager;
/**
@ -210,6 +216,7 @@ public class PeerToPeerCommHelper implements IIMMessageListener {
return;
}
httpServer = httpdCollaborationURL;
// configuration is valid; publish it.
IHttpdCollaborationConfigurationEvent configurationEvent = new HttpdCollaborationConfigurationEvent(
httpdCollaborationURL);

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
package com.raytheon.uf.viz.collaboration.comm.storage;
import java.net.URI;
import java.util.ArrayList;
@ -42,9 +42,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.compression.CompressionUtil;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.session.PeerToPeerCommHelper;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
import com.raytheon.uf.viz.remote.graphics.events.DisposeObjectEvent;
@ -102,11 +100,7 @@ public class CollaborationObjectEventStorage implements
int displayId) {
this.displayId = displayId;
this.client = HttpClient.getInstance();
this.sessionDataURL = Activator
.getDefault()
.getPreferenceStore()
.getString(
CollabPrefConstants.HttpCollaborationConfiguration.P_HTTP_SESSION_URL);
this.sessionDataURL = PeerToPeerCommHelper.getCollaborationHttpServer();
this.sessionDataURL += session.getSessionId() + "/";
}

View file

@ -17,10 +17,9 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
package com.raytheon.uf.viz.collaboration.comm.storage;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
/**

View file

@ -17,10 +17,9 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
package com.raytheon.uf.viz.collaboration.comm.storage;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
/**

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.comm.storage;
/**
* Interface for distinguishing events that are persisted and should be

View file

@ -9,11 +9,26 @@ Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core,
com.raytheon.viz.ui,
org.geotools;bundle-version="2.6.4",
org.eclipse.ui;bundle-version="3.6.1",
com.raytheon.uf.viz.collaboration.comm
com.raytheon.uf.viz.collaboration.comm,
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0",
com.raytheon.uf.viz.drawing;bundle-version="1.0.0",
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.common.util;bundle-version="1.12.1174",
com.raytheon.viz.core;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.collaboration.display.editor,
com.raytheon.uf.viz.collaboration.display.editor.input
Export-Package: com.raytheon.uf.viz.collaboration.display,
com.raytheon.uf.viz.collaboration.display.data,
com.raytheon.uf.viz.collaboration.display.editor,
com.raytheon.uf.viz.collaboration.display.roles,
com.raytheon.uf.viz.collaboration.display.roles.dataprovider,
com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event,
com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc,
com.raytheon.uf.viz.collaboration.display.rsc,
com.raytheon.uf.viz.collaboration.display.rsc.rendering,
com.raytheon.uf.viz.collaboration.display.rsc.telestrator
Import-Package: org.eclipse.swt.widgets

View file

@ -1,2 +1,5 @@
com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData
com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor
com.raytheon.uf.viz.collaboration.display.editor.CreateRemoteDisplay
com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc.DataProviderRscData
com.raytheon.uf.viz.collaboration.display.rsc.CollaborationWrapperResourceData
com.raytheon.uf.viz.collaboration.display.rsc.SharedResource
com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResourceData

View file

@ -1,15 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.ui.editors">
<editor
class="com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor"
default="true"
id="com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor"
icon="icons/messages.gif"
name="Collaboration">
</editor>
</extension>
</plugin>
<extension-point id="renderingExtension" name="renderingExtension" schema="schema/renderingExtension.exsd"/>
<extension
point="com.raytheon.uf.viz.collaboration.display.renderingExtension">
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.GeneralRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.ImagingRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.OffscreenRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.ShapeRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.StringRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.display.rsc.rendering.PrimitiveRenderingHandler">
</renderingExtension>
</extension>
</plugin>

View file

@ -3,28 +3,39 @@ package com.raytheon.uf.viz.collaboration.display;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
public class Activator implements BundleActivator {
private static BundleContext context;
public static final IUFStatusHandler statusHandler = UFStatus
.getHandler(Activator.class);
static BundleContext getContext() {
return context;
}
private static BundleContext context;
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,89 @@
/**
* 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.display;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
/**
* Interface for object that contains remote displays
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 12, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public interface IRemoteDisplayContainer {
public static class RemoteDisplay {
private final int displayId;
private final IRenderableDisplay display;
/**
* @param displayId
* @param display
*/
public RemoteDisplay(int displayId, IRenderableDisplay display) {
this.displayId = displayId;
this.display = display;
}
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @return the display
*/
public IRenderableDisplay getDisplay() {
return display;
}
}
public static enum RemoteDisplayChangeType {
CREATED, DISPOSED, ACTIVATED;
}
public static interface IRemoteDisplayChangedListener {
public void remoteDisplayChanged(RemoteDisplay remoteDisplay,
RemoteDisplayChangeType changeType);
}
public void addRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener);
public void removeRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener);
public RemoteDisplay getActiveDisplay();
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui;
package com.raytheon.uf.viz.collaboration.display.data;
import org.eclipse.swt.graphics.RGB;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui;
package com.raytheon.uf.viz.collaboration.display.data;
import java.util.HashMap;
import java.util.Map;
@ -29,6 +29,7 @@ import com.raytheon.viz.core.ColorUtil;
/**
*
* Manages colors of different users for a session
*
* <pre>
*

View file

@ -17,15 +17,11 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.data;
import java.util.List;
package com.raytheon.uf.viz.collaboration.display.data;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.role.IRoleEventController;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.roles.IRoleEventController;
/**
* A container holding an underlying session and associated data for a shared
@ -62,13 +58,7 @@ public class SessionContainer {
* the editor associated with a session, only valid if not fulfilling the
* Data Provider role
**/
private CollaborationEditor collaborationEditor;
/**
* the editors shared with a session, only valid if fulfilling the Data
* Provider role
**/
private List<AbstractEditor> sharedEditors;
private ICollaborationEditor collaborationEditor;
public ISharedDisplaySession getSession() {
return session;
@ -86,32 +76,14 @@ public class SessionContainer {
this.roleEventController = roleEventController;
}
public CollaborationEditor getCollaborationEditor() {
public ICollaborationEditor getCollaborationEditor() {
return collaborationEditor;
}
public void setCollaborationEditor(CollaborationEditor collaborationEditor) {
if (this.sharedEditors != null) {
throw new IllegalStateException(
"Cannot have both a "
+ "CollaborationEditor and shared editors on the same session at the same time");
}
public void setCollaborationEditor(ICollaborationEditor collaborationEditor) {
this.collaborationEditor = collaborationEditor;
}
public List<AbstractEditor> getSharedEditors() {
return sharedEditors;
}
public void setSharedEditors(List<AbstractEditor> sharedEditors) {
if (this.collaborationEditor != null) {
throw new IllegalStateException(
"Cannot have both a "
+ "CollaborationEditor and shared editors on the same session at the same time");
}
this.sharedEditors = sharedEditors;
}
public String getSessionId() {
return sessionId;
}

View file

@ -17,11 +17,9 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.data;
package com.raytheon.uf.viz.collaboration.display.data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -30,12 +28,9 @@ import org.eclipse.ui.IEditorPart;
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.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.role.DataProviderEventController;
import com.raytheon.uf.viz.collaboration.ui.role.IRoleEventController;
import com.raytheon.uf.viz.collaboration.ui.role.ParticipantEventController;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.uf.viz.collaboration.display.roles.DataProviderEventController;
import com.raytheon.uf.viz.collaboration.display.roles.IRoleEventController;
import com.raytheon.uf.viz.collaboration.display.roles.ParticipantEventController;
/**
* Tracks all of the active sessions that are SharedDisplaySessions. Provides
@ -78,26 +73,9 @@ public class SharedDisplaySessionMgr {
switch (initialRole) {
case DATA_PROVIDER:
rec = new DataProviderEventController(session);
List<AbstractEditor> editorList = new ArrayList<AbstractEditor>();
// TODO better way to determine which editor to start sharing?
// or better yet, maybe we should add this elsewhere after it has
// already been initialized with the correct target/resources
IEditorPart part = VizWorkbenchManager.getInstance()
.getActiveEditor();
if (part instanceof AbstractEditor) {
AbstractEditor sharedEditor = (AbstractEditor) part;
editorList.add(sharedEditor);
container.setSharedEditors(editorList);
} else {
throw new CollaborationException(
"Cannot share a Collaboration Editor, please select a different tab");
}
break;
case PARTICIPANT:
rec = new ParticipantEventController(session);
// don't need to set the CollaborationEditor, as it won't be created
// until we receive the initial data
break;
default:
throw new IllegalArgumentException(

View file

@ -0,0 +1,62 @@
/**
* 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.display.editor;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Event for activating a remote display
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class ActivateRemoteDisplay {
@DynamicSerializeElement
private int displayId;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
}

View file

@ -1,182 +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.display.editor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.viz.ui.input.InputManager;
/**
* A collaboration editor that displays the display of an editor shared by the
* Data Provider.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 16, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class CollaborationEditor extends EditorPart implements ISaveablePart2 {
public static final String EDITOR_ID = "com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor";
private String sessionId;
private IRenderableDisplay display;
private CollaborationPaneManager paneManager;
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
* org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
setInput(input);
setSite(site);
CollaborationEditorInput cei = (CollaborationEditorInput) input;
setPartName(cei.getName());
this.sessionId = cei.getSessionId();
this.display = cei.getDisplay();
display.getDescriptor().getResourceList()
.instantiateResources(display.getDescriptor(), true);
paneManager = new CollaborationPaneManager();
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public void createPartControl(Composite parent) {
paneManager.initializeComponents(paneManager, parent);
paneManager.addPane(display);
}
public InputManager getInputManager() {
return paneManager.getMouseManager();
}
public String getSessionId() {
return sessionId;
}
public IRenderableDisplay getDisplay() {
return display;
}
public IDisplayPane getActiveDisplayPane() {
return paneManager.getActiveDisplayPane();
}
public void setCanvasSize(Rectangle bounds) {
paneManager.setCanvasSize(bounds);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#isDirty()
*/
@Override
public boolean isDirty() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.
* IProgressMonitor)
*/
@Override
public void doSave(IProgressMonitor monitor) {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
@Override
public void doSaveAs() {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
*/
@Override
public boolean isSaveAsAllowed() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
paneManager.setFocus();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISaveablePart2#promptToSaveOnClose()
*/
@Override
public int promptToSaveOnClose() {
// Let the user know why we refuse to close the editor
MessageDialog.openError(getSite().getShell(), "Closing Disabled",
"Please close the \"" + getPartName()
+ "\" chat to exit the session.");
// Cancel the clsoe
return ISaveablePart2.CANCEL;
}
}

View file

@ -23,8 +23,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
/**
* Editor input for CollaborationEditor
*
@ -44,26 +42,15 @@ import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
public class CollaborationEditorInput implements IEditorInput {
private IRenderableDisplay display;
private String title;
private String sessionId;
public CollaborationEditorInput(IRenderableDisplay display,
String sessionId, String title) {
this.display = display;
public CollaborationEditorInput(String sessionId, String title) {
this.sessionId = sessionId;
this.title = title;
}
/**
* @return the display
*/
public IRenderableDisplay getDisplay() {
return display;
}
/**
* @return the sessionId
*/

View file

@ -1,155 +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.display.editor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.viz.ui.panes.PaneManager;
/**
* PaneManager for the CollaborationEditor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class CollaborationPaneManager extends PaneManager {
private Composite wrapperComp;
private Composite canvasComp;
private ScrolledComposite scrollable;
private Rectangle scrollableBounds;
private Rectangle canvasBounds;
private LoopProperties loopProperties = new LoopProperties();
@Override
public IDisplayPane addPane(IRenderableDisplay renderableDisplay) {
// // scrollable composite
scrollable = new ScrolledComposite(composite, SWT.H_SCROLL
| SWT.V_SCROLL);
scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// Composite for canvas comp
wrapperComp = new Composite(scrollable, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
// Sets background color of wrapper composite to white
wrapperComp.setBackground(wrapperComp.getDisplay().getSystemColor(
SWT.COLOR_WHITE));
wrapperComp.setSize(1000, 1000);
canvasComp = new Composite(wrapperComp, SWT.NONE);
canvasComp.setLayout(gl);
canvasComp.setSize(1000, 1000);
// Set canvasComp as content on scrollable
scrollable.setContent(wrapperComp);
scrollable.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event event) {
scrollableBounds = ((Composite) event.widget).getBounds();
setCanvasSize(canvasBounds);
}
});
IDisplayPane pane = addPane(renderableDisplay, canvasComp);
canvasComp.layout();
scrollableBounds = scrollable.getBounds();
canvasBounds = canvasComp.getBounds();
return pane;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.panes.PaneManager#getLoopProperties()
*/
@Override
public LoopProperties getLoopProperties() {
return loopProperties;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.panes.PaneManager#setLoopProperties(com.raytheon.
* uf.viz.core.datastructure.LoopProperties)
*/
@Override
public void setLoopProperties(LoopProperties loopProperties) {
this.loopProperties = loopProperties;
}
public void setCanvasSize(Rectangle bounds) {
canvasBounds = bounds;
canvasComp.setSize(bounds.width, bounds.height);
Rectangle scrollableBounds = new Rectangle(this.scrollableBounds.x,
this.scrollableBounds.y, this.scrollableBounds.width,
this.scrollableBounds.height);
// Subtract size of scroll bars if visible
ScrollBar vertical = scrollable.getVerticalBar();
ScrollBar horizon = scrollable.getHorizontalBar();
if (scrollableBounds.width <= canvasBounds.width) {
scrollableBounds.height -= horizon.getSize().y;
}
if (scrollableBounds.height <= canvasBounds.height) {
scrollableBounds.width -= vertical.getSize().x;
}
wrapperComp.setSize(
Math.max(canvasBounds.width, scrollableBounds.width),
Math.max(canvasBounds.height, scrollableBounds.height));
canvasComp.setLocation(
Math.max(0, (scrollableBounds.width - bounds.width) / 2),
Math.max(0, (scrollableBounds.height - bounds.height) / 2));
wrapperComp.layout();
canvasComp.layout();
}
}

View file

@ -24,15 +24,9 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
import com.raytheon.uf.common.serialization.adapters.JTSEnvelopeAdapter;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.vividsolutions.jts.geom.Envelope;
/**
* A SharedEditorData is a POJO to be sent out by the Data Provider that
@ -55,31 +49,27 @@ import com.vividsolutions.jts.geom.Envelope;
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class SharedEditorData implements ISerializableObject {
public class CreateRemoteDisplay implements ISerializableObject {
/** The geometry of the descriptor */
private GeneralGridGeometry geometry;
@XmlAttribute
private int displayId;
@XmlElement
private AbstractRenderableDisplay display;
/** the view's extent, i.e. the current zoom/pan */
private Envelope envelope;
@XmlAttribute
private int width;
@XmlAttribute
private int height;
@XmlElement
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
public GeneralGridGeometry getGeometry() {
return geometry;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
public void setGeometry(GeneralGridGeometry geometry) {
this.geometry = geometry;
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
@ -97,44 +87,4 @@ public class SharedEditorData implements ISerializableObject {
this.display = display;
}
@XmlElement
@XmlJavaTypeAdapter(value = JTSEnvelopeAdapter.class)
public Envelope getEnvelope() {
return envelope;
}
public void setEnvelope(Envelope envelope) {
this.envelope = envelope;
}
/**
* @return the width
*/
public int getWidth() {
return width;
}
/**
* @param width
* the width to set
*/
public void setWidth(int width) {
this.width = width;
}
/**
* @return the height
*/
public int getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(int height) {
this.height = height;
}
}

View file

@ -0,0 +1,62 @@
/**
* 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.display.editor;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Event object for disposes a remote display
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class DisposeRemoteDisplay {
@DynamicSerializeElement
private int displayId;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
}

View file

@ -0,0 +1,56 @@
/**
* 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.display.editor;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.ui.IEditorPart;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.core.IDisplayPane;
/**
* Interface for the Collaboration Editor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public interface ICollaborationEditor extends IEditorPart,
IRemoteDisplayContainer {
public static final String EDITOR_ID = "com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor";
public IDisplayPane getActiveDisplayPane();
public void setCanvasBounds(int displayId, Rectangle canvasBounds);
public String getSessionId();
}

View file

@ -0,0 +1,80 @@
/**
* 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.display.editor;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Requests a remote display object be sent to the user
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@DynamicSerialize
public class RemoteDisplayRequested {
@DynamicSerializeElement
private int displayId;
@DynamicSerializeElement
private String userId;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the userId
*/
public String getUserId() {
return userId;
}
/**
* @param userId
* the userId to set
*/
public void setUserId(String userId) {
this.userId = userId;
}
}

View file

@ -19,16 +19,10 @@
**/
package com.raytheon.uf.viz.collaboration.display.editor;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Collaboration event to reproject the viewing editor
@ -46,14 +40,30 @@ import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
* @author mschenke
* @version 1.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class ReprojectEditor implements ISerializableObject {
@DynamicSerialize
public class ReprojectRemoteDisplay {
@XmlElement
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
@DynamicSerializeElement
private int displayId;
@DynamicSerializeElement
private GeneralGridGeometry targetGeometry;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the targetGeometry
*/

View file

@ -1,247 +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.display.editor.input;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.swt.widgets.Event;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
/**
* CollaborationInputHandler that holds other handlers that should only be used
* when part of a collaboration session. Essentially it's a layer of handlers
* specific for collaboration.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 4, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class CollaborationInputHandler implements IInputHandler {
private List<IInputHandler> handlers = Collections
.synchronizedList(new LinkedList<IInputHandler>());
public void registerInputHandler(IInputHandler handler) {
handlers.add(handler);
}
public void unregisterInputHandler(IInputHandler handler) {
handlers.remove(handler);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseDown(int, int,
* int)
*/
@Override
public boolean handleMouseDown(int x, int y, int mouseButton) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseDown(x, y, mouseButton)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseDownMove(int,
* int, int)
*/
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseDownMove(x, y, mouseButton)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseUp(int, int,
* int)
*/
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseUp(x, y, mouseButton)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseHover(int,
* int)
*/
@Override
public boolean handleMouseHover(int x, int y) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseHover(x, y)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseMove(int, int)
*/
@Override
public boolean handleMouseMove(int x, int y) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseMove(x, y)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleDoubleClick(int,
* int, int)
*/
@Override
public boolean handleDoubleClick(int x, int y, int button) {
for (IInputHandler handler : handlers) {
if (handler.handleDoubleClick(x, y, button)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseWheel(org.eclipse
* .swt.widgets.Event, int, int)
*/
@Override
public boolean handleMouseWheel(Event event, int x, int y) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseWheel(event, x, y)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseExit(org.eclipse
* .swt.widgets.Event)
*/
@Override
public boolean handleMouseExit(Event event) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseExit(event)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.IInputHandler#handleMouseEnter(org.eclipse
* .swt.widgets.Event)
*/
@Override
public boolean handleMouseEnter(Event event) {
for (IInputHandler handler : handlers) {
if (handler.handleMouseEnter(event)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleKeyDown(int)
*/
@Override
public boolean handleKeyDown(int keyCode) {
for (IInputHandler handler : handlers) {
if (handler.handleKeyDown(keyCode)) {
return true;
}
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IInputHandler#handleKeyUp(int)
*/
@Override
public boolean handleKeyUp(int keyCode) {
for (IInputHandler handler : handlers) {
if (handler.handleKeyUp(keyCode)) {
return true;
}
}
return true;
}
/**
* Get the list of registered handlers
*
* @return
*/
public List<IInputHandler> getRegisteredHandlers() {
return handlers;
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role;
package com.raytheon.uf.viz.collaboration.display.roles;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
@ -29,18 +29,15 @@ import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResourceData;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
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.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
@ -132,13 +129,6 @@ public abstract class AbstractRoleEventController implements
protected List<ResourcePair> getResourcesToAdd() {
List<ResourcePair> resources = new ArrayList<ResourcePair>();
CollaborationDrawingResourceData resourceData = new CollaborationDrawingResourceData();
resourceData.setSessionId(session.getSessionId());
ResourcePair resource = new ResourcePair();
resource.setResourceData(resourceData);
resource.setProperties(new ResourceProperties());
resource.setLoadProperties(new LoadProperties());
resources.add(resource);
return resources;
}

View file

@ -0,0 +1,141 @@
/**
* 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.display.roles;
import org.eclipse.swt.graphics.RGB;
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.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.display.data.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* TODO: This class is in severe need of a refactor!
*
* Handles the events of a session that are specific to the Data Provider role.
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 26, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class DataProviderEventController extends AbstractRoleEventController {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataProviderEventController.class);
public DataProviderEventController(ISharedDisplaySession session) {
super(session);
}
@Subscribe
public void participantChanged(IVenueParticipantEvent event) {
if (event.getEventType().equals(ParticipantEventType.ARRIVED)
&& !event.getParticipant().equals(session.getUserID())) {
try {
SharedEditorsManager sem = SharedEditorsManager
.getManager(session);
AbstractEditor active = sem.getActiveSharedEditor();
if (active != null) {
IDisplayPane activePane = active.getActiveDisplayPane();
if (activePane != null) {
ActivateRemoteDisplay arde = new ActivateRemoteDisplay();
arde.setDisplayId(sem.getDisplayId(activePane
.getRenderableDisplay()));
session.sendObjectToPeer(event.getParticipant(), arde);
}
}
// new color for each user
SessionColorManager scm = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getColorManager();
RGB color = scm.getColorFromUser(event.getParticipant());
ColorChangeEvent cce = new ColorChangeEvent(
event.getParticipant(), color);
session.sendObjectToVenue(cce);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
"Error sending initialization data to new participant "
+ event.getParticipant().getName(), e);
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #startup()
*/
@Override
public void startup() {
super.startup();
AbstractEditor active = EditorUtil
.getActiveEditorAs(AbstractEditor.class);
if (active != null
&& SharedEditorsManager.isBeingShared(active) == false) {
try {
SharedEditorsManager.getManager(session).shareEditor(active);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #shutdown()
*/
@Override
public void shutdown() {
super.shutdown();
SharedEditorsManager.getManager(session).dispose();
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role;
package com.raytheon.uf.viz.collaboration.display.roles;
/**
* Interface for an event controller. Starting up an IRoleEventController is

View file

@ -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.display.roles;
import org.eclipse.ui.PartInitException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditorInput;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.viz.ui.VizWorkbenchManager;
/**
* Handles the events of a session that are specific to the Participant role.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 26, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ParticipantEventController extends AbstractRoleEventController {
public ParticipantEventController(ISharedDisplaySession session) {
super(session);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #startup()
*/
@Override
public void startup() {
super.startup();
CollaborationEditorInput input = new CollaborationEditorInput(
session.getSessionId(), session.getVenue().getInfo()
.getVenueDescription());
try {
ICollaborationEditor editor = (ICollaborationEditor) VizWorkbenchManager
.getInstance().getCurrentWindow().getActivePage()
.openEditor(input, ICollaborationEditor.EDITOR_ID);
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId());
sc.setCollaborationEditor(editor);
} catch (PartInitException e) {
throw new RuntimeException("Unable to open collaboration editor", e);
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #shutdown()
*/
@Override
public void shutdown() {
super.shutdown();
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId());
if (sc != null) {
sc.getCollaborationEditor().getSite().getPage()
.closeEditor(sc.getCollaborationEditor(), false);
}
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider;
import java.util.ArrayDeque;
import java.util.Arrays;
@ -31,13 +31,15 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.compression.CompressionUtil;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrame;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.collaboration.ui.rsc.ParticipantInitializedEvent;
import com.raytheon.uf.viz.collaboration.comm.storage.CollaborationObjectEventStorage;
import com.raytheon.uf.viz.collaboration.comm.storage.IObjectEventPersistance;
import com.raytheon.uf.viz.collaboration.comm.storage.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.RenderFrame;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.collaboration.display.rsc.ParticipantInitializedEvent;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
@ -154,15 +156,6 @@ public class CollaborationDispatcher extends Dispatcher {
display.refresh();
}
/**
* Returns the IRenderableDisplay this dispatcher is dispatching for
*
* @return
*/
public IRenderableDisplay getDisplay() {
return display;
}
@Subscribe
public void handleNeedsRenderFrameEvent(RenderFrameNeededEvent event) {
synchronized (previousFrames) {

View file

@ -0,0 +1,804 @@
/**
* 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.display.roles.dataprovider;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
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.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.CreateRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.DisposeRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.RemoteDisplayRequested;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc.DataProviderRscData;
import com.raytheon.uf.viz.collaboration.display.rsc.CollaborationWrapperResource;
import com.raytheon.uf.viz.collaboration.display.rsc.CollaborationWrapperResourceData;
import com.raytheon.uf.viz.collaboration.display.rsc.SelfAddingSystemResourceListener;
import com.raytheon.uf.viz.collaboration.display.rsc.SharedResource;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
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.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.DispatcherFactory;
import com.raytheon.uf.viz.remote.graphics.DispatchingGraphicsFactory;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Manager class for managing the sharing of editors in an
* {@link ISharedDisplaySession}
*
* TODO: Handle DataProviderRsc adding/removing! Maybe put in wrap/unwrap
* resource?
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 8, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class SharedEditorsManager implements IRemoteDisplayContainer {
public class RemoteDisplayEventHandler {
@Subscribe
public void remoteDisplayRequested(RemoteDisplayRequested event) {
String userId = event.getUserId();
UserId user = null;
for (UserId uid : session.getVenue().getParticipants()) {
if (uid.getFQName().equals(userId)) {
user = uid;
}
}
if (user != null) {
int displayId = event.getDisplayId();
for (DisplayData data : displayData.values()) {
if (data.displayId == displayId) {
CreateRemoteDisplay creation = new CreateRemoteDisplay();
creation.setDisplayId(displayId);
creation.setDisplay(createRemoteDisplay(data.display));
sendEvent(creation);
break;
}
}
}
}
}
private class SharedEditorDisplayChangedListener implements
IRenderableDisplayChangedListener {
private AbstractEditor sharedEditor;
private SharedEditorDisplayChangedListener(AbstractEditor sharedEditor) {
this.sharedEditor = sharedEditor;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.IRenderableDisplayChangedListener#
* renderableDisplayChanged(com.raytheon.uf.viz.core.IDisplayPane,
* com.raytheon.uf.viz.core.drawables.IRenderableDisplay,
* com.raytheon.uf
* .viz.core.IRenderableDisplayChangedListener.DisplayChangeType)
*/
@Override
public void renderableDisplayChanged(IDisplayPane pane,
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
if (type == DisplayChangeType.ADD) {
try {
if (displayData.containsKey(newRenderableDisplay) == false) {
// We aren't sharing this display, but is anyone else?
if (isBeingShared(newRenderableDisplay)) {
// if so, remove it from their session
removeDisplay(pane);
}
shareDisplay(pane);
}
if (activeSharedEditor == sharedEditor) {
activeSharedEditor = null;
activateEditor(sharedEditor);
}
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
}
private class SharedEditorPartListener implements IPartListener {
private List<IWorkbenchPage> pages = new LinkedList<IWorkbenchPage>();
private void addPage(IWorkbenchPage page) {
if (pages.contains(page) == false) {
page.addPartListener(this);
pages.add(page);
}
}
private void removePage(IWorkbenchPage page) {
if (pages.contains(page)) {
// We are listening on this page, should we be?
for (AbstractEditor editor : sharedEditors) {
if (editor.getSite().getPage() == page) {
// Another shared editor is on this page, keep listening
return;
}
}
// Made it here, we should not be listening anymore
page.removePartListener(this);
pages.remove(page);
}
}
@Override
public void partActivated(IWorkbenchPart part) {
if (sharedEditors.contains(part)) {
activateEditor((AbstractEditor) part);
}
}
@Override
public void partClosed(IWorkbenchPart part) {
if (sharedEditors.contains(part)) {
try {
removeEditor((AbstractEditor) part);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@Override
public void partDeactivated(IWorkbenchPart part) {
// Ignore
}
@Override
public void partOpened(IWorkbenchPart part) {
// Ignored
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
// Ignored
}
}
private class SharedEditorDispatcherFactory implements DispatcherFactory {
@Override
public Dispatcher createNewDispatcher(IRenderableDisplay display)
throws InstantiationException {
try {
CollaborationDispatcher dispatcher = new CollaborationDispatcher(
session, display);
DisplayData data = new DisplayData();
data.display = display;
data.dispatcher = dispatcher;
data.displayId = dispatcher.getDispatcherId();
data.resourceListener = new SharedEditorResourceWrapperListener(
display, data.displayId);
displayData.put(display, data);
return dispatcher;
} catch (Exception e) {
throw new InstantiationException(
"Error creating new dispatcher: "
+ e.getLocalizedMessage());
}
}
}
private class SharedEditorResourceWrapperListener extends
SelfAddingSystemResourceListener implements AddListener {
private int displayId;
private SharedEditorResourceWrapperListener(IRenderableDisplay display,
int displayId) throws VizException {
super(new DataProviderRscData(session.getSessionId(), displayId),
display.getDescriptor());
this.displayId = displayId;
this.descriptor.getResourceList().addPostAddListener(this);
}
@Override
public void notifyAdd(ResourcePair rp) throws VizException {
wrapResourcePair(rp);
if (shouldBeLocal(rp)) {
sendSharedResource(displayId, rp, false);
}
}
@Override
public void notifyRemove(ResourcePair rp) throws VizException {
super.notifyRemove(rp);
if (rp.getResource() instanceof CollaborationWrapperResource) {
// Send event to venue to unload
sendSharedResource(displayId, rp, true);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.rsc.
* SelfAddingSystemResourceListener#dispose()
*/
@Override
public void dispose() {
super.dispose();
this.descriptor.getResourceList().removePostAddListener(this);
}
}
private static class DisplayData {
private SharedEditorResourceWrapperListener resourceListener;
private CollaborationDispatcher dispatcher;
private IRenderableDisplay display;
private int displayId;
}
private static Map<String, SharedEditorsManager> managerMap = new HashMap<String, SharedEditorsManager>();
private static List<AbstractEditor> allSharedEditors = new LinkedList<AbstractEditor>();
/**
* Gets/Creates the SharedEditorManager for the given session
*
* @param session
* @return
*/
public static SharedEditorsManager getManager(ISharedDisplaySession session) {
SharedEditorsManager manager = managerMap.get(session.getSessionId());
if (manager == null) {
manager = new SharedEditorsManager(session);
managerMap.put(session.getSessionId(), manager);
}
return manager;
}
/**
*
* @param editor
* @return
*/
public static ISharedDisplaySession getSharedEditorSession(
AbstractEditor editor) {
for (String sessionId : managerMap.keySet()) {
SharedEditorsManager manager = managerMap.get(sessionId);
if (manager.sharedEditors.contains(editor)) {
return manager.session;
}
}
return null;
}
public static boolean isBeingShared(AbstractEditor editor) {
return allSharedEditors.contains(editor);
}
public static boolean isBeingShared(IRenderableDisplay display) {
for (SharedEditorsManager manager : managerMap.values()) {
if (manager.displayData.containsKey(display)) {
return true;
}
}
return false;
}
private DispatcherFactory factory = new SharedEditorDispatcherFactory();
private SharedEditorPartListener partListener = new SharedEditorPartListener();
private Map<AbstractEditor, SharedEditorDisplayChangedListener> listenerMap = new IdentityHashMap<AbstractEditor, SharedEditorsManager.SharedEditorDisplayChangedListener>();
private List<AbstractEditor> sharedEditors = new LinkedList<AbstractEditor>();
private Map<IRenderableDisplay, DisplayData> displayData = new IdentityHashMap<IRenderableDisplay, DisplayData>();
private Set<IRemoteDisplayChangedListener> listeners = new LinkedHashSet<IRemoteDisplayChangedListener>();
private RemoteDisplayEventHandler eventHandler = new RemoteDisplayEventHandler();
private AbstractEditor activeSharedEditor;
private String editorTitleSuffix;
private ISharedDisplaySession session;
private SharedEditorsManager(ISharedDisplaySession session) {
this.session = session;
session.registerEventHandler(eventHandler);
editorTitleSuffix = " ("
+ session.getVenue().getInfo().getVenueDescription() + ")";
}
public void registerRemoteRenderableDisplayChangedListener(
IRenderableDisplayChangedListener listener) {
}
public int getDisplayId(IRenderableDisplay display) {
int displayId = -1;
DisplayData data = displayData.get(display);
if (data != null) {
displayId = data.displayId;
}
return displayId;
}
public AbstractEditor getActiveSharedEditor() {
return activeSharedEditor;
}
public List<AbstractEditor> getSharedEditors() {
return new ArrayList<AbstractEditor>(sharedEditors);
}
/**
* Shares the AbstractEditor for the session. Throws exception if editor is
* already being shared
*
* @param editor
* @throws CollaborationException
*/
public void shareEditor(AbstractEditor editor)
throws CollaborationException {
if (sharedEditors.contains(editor) == false) {
if (allSharedEditors.contains(sharedEditors) == false) {
// Add to tracking lists
sharedEditors.add(editor);
allSharedEditors.add(editor);
try {
for (IDisplayPane pane : editor.getDisplayPanes()) {
shareDisplay(pane);
}
} catch (CollaborationException e) {
removeEditor(editor);
Activator.statusHandler
.handle(Priority.PROBLEM, "Error sharding editor: "
+ e.getLocalizedMessage(), e);
return;
}
// Add and manage display listener
SharedEditorDisplayChangedListener listener = new SharedEditorDisplayChangedListener(
editor);
editor.addRenderableDisplayChangedListener(listener);
listenerMap.put(editor, listener);
// Update tab title
editor.setTabTitle(editor.getPartName() + editorTitleSuffix);
partListener.addPage(editor.getSite().getPage());
// If editor is currently active, activate it!
if (EditorUtil.getActiveEditor(editor.getSite()
.getWorkbenchWindow()) == editor) {
activateEditor(editor);
}
} else {
throw new CollaborationException(
"Cannot shared editor already being shared with another session");
}
} else {
throw new CollaborationException(
"Cannot share editor, it is already being shared with the session");
}
}
/**
* Removes the editor from being shared in the session. Throws exception if
* editor is not being shared by this session
*
* @param editor
* @throws CollaborationException
*/
public void removeEditor(AbstractEditor editor)
throws CollaborationException {
if (sharedEditors.contains(editor)) {
if (activeSharedEditor == editor) {
activeSharedEditor = null;
}
// Remove renderable display listener
editor.removeRenderableDisplayChangedListener(listenerMap
.remove(editor));
// Update tab title
String name = editor.getPartName();
editor.setTabTitle(name.substring(0, name.length()
- editorTitleSuffix.length()));
sharedEditors.remove(editor);
allSharedEditors.remove(editor);
partListener.removePage(editor.getSite().getPage());
for (IDisplayPane pane : editor.getDisplayPanes()) {
removeDisplay(pane);
}
} else {
throw new CollaborationException(
"Cannot unshare editor that isn't being shared by session");
}
}
/**
* Disposes the object, removes all shared editors
*/
public void dispose() {
List<AbstractEditor> copy = new ArrayList<AbstractEditor>(sharedEditors);
for (AbstractEditor editor : copy) {
try {
removeEditor(editor);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
// Clean up any dispatchers not removed from editors
Collection<DisplayData> data = this.displayData.values();
for (DisplayData d : data) {
IRenderableDisplay display = d.display;
IDisplayPaneContainer container = display.getContainer();
for (IDisplayPane pane : container.getDisplayPanes()) {
if (pane.getDisplay() == display) {
removeDisplay(pane);
break;
}
}
}
session.unregisterEventHandler(eventHandler);
}
/**
* Shares the display on the pane with the venue by creating a remote object
* representation for the participants, wrapping the local resources and
* injecting the remote target functionality. <b>Should only be called if
* the display on the pane is not already being shared</b>
*
* @param pane
* @throws CollaborationException
*/
private void shareDisplay(IDisplayPane pane) throws CollaborationException {
IRenderableDisplay display = pane.getRenderableDisplay();
if (display instanceof AbstractRenderableDisplay) {
// Clone the display
AbstractRenderableDisplay clonedDisplay = createRemoteDisplay(display);
if (clonedDisplay != null) {
wrapDisplay(display);
// Inject with remote target, have to find pane
try {
DispatchingGraphicsFactory.injectRemoteFunctionality(pane,
factory);
} catch (InstantiationException e) {
throw new CollaborationException(
"Error injecting remote functionality", e);
}
DisplayData data = displayData.get(display);
if (data != null) {
fireListeners(data, RemoteDisplayChangeType.CREATED);
CreateRemoteDisplay event = new CreateRemoteDisplay();
event.setDisplayId(data.displayId);
event.setDisplay(clonedDisplay);
sendEvent(event);
} else {
throw new CollaborationException(
"Remote functionality injection failed");
}
}
}
}
/**
* Removes the shared display capability from the display pane
*
* @param pane
*/
private void removeDisplay(IDisplayPane pane) {
IRenderableDisplay display = pane.getRenderableDisplay();
unwrapDisplay(display);
DispatchingGraphicsFactory.extractRemoteFunctionality(pane);
DisplayData data = displayData.remove(display);
if (data != null) {
fireListeners(data, RemoteDisplayChangeType.DISPOSED);
data.dispatcher.dispose();
data.resourceListener.dispose();
DisposeRemoteDisplay event = new DisposeRemoteDisplay();
event.setDisplayId(data.displayId);
sendEvent(event);
}
}
/**
* Creates a copy of the realDisplay object that can be used to send a
* {@link CreateRemoteDisplay} event. Does not matter if display is
* currently shared or not
*
* @param realDisplay
* @return
*/
private AbstractRenderableDisplay createRemoteDisplay(
IRenderableDisplay realDisplay) {
AbstractRenderableDisplay clonedDisplay = null;
if (realDisplay instanceof AbstractRenderableDisplay) {
clonedDisplay = ((AbstractRenderableDisplay) realDisplay)
.cloneDisplay();
ResourceList clonedList = clonedDisplay.getDescriptor()
.getResourceList();
clonedList.clear();
List<ResourcePair> toKeep = new ArrayList<ResourcePair>();
for (ResourcePair rp : realDisplay.getDescriptor()
.getResourceList()) {
if (shouldBeLocal(rp)) {
AbstractResourceData resourceData = rp.getResourceData();
if (resourceData != null) {
if (resourceData instanceof CollaborationWrapperResourceData) {
resourceData = ((CollaborationWrapperResourceData) resourceData)
.getWrappedResourceData();
}
// Copy ResourcePair for our remote display
ResourcePair copy = new ResourcePair();
copy.setLoadProperties(rp.getLoadProperties());
copy.setProperties(rp.getProperties());
copy.setResourceData(resourceData);
toKeep.add(copy);
}
}
}
clonedList.addAll(toKeep);
}
return clonedDisplay;
}
/**
* Wraps the resources that will not be shared and drawn locally.
*
* @param display
*/
private void wrapDisplay(IRenderableDisplay display) {
ResourceList list = display.getDescriptor().getResourceList();
for (ResourcePair rp : list) {
wrapResourcePair(rp);
}
}
/**
* Unwraps the local wrapped resources from the display.
*
* @param display
*/
private void unwrapDisplay(IRenderableDisplay display) {
ResourceList list = display.getDescriptor().getResourceList();
for (ResourcePair rp : list) {
unwrapResourcePair(rp);
}
}
private boolean wrapResourcePair(ResourcePair rp) {
boolean wrapped = false;
if (shouldBeLocal(rp)
&& rp.getResource() instanceof CollaborationWrapperResource == false
&& rp.getResourceData() instanceof CollaborationWrapperResourceData == false) {
AbstractResourceData resourceData = rp.getResourceData();
// Wrap resource data with wrapper object
CollaborationWrapperResourceData wrapperRscData = new CollaborationWrapperResourceData();
wrapperRscData.setWrappedResourceData(resourceData);
rp.setResourceData(wrapperRscData);
if (rp.getResource() != null) {
// If resource is set in pair, set here too
rp.setResource(new CollaborationWrapperResource(wrapperRscData,
rp.getLoadProperties(), rp.getResource()));
}
wrapped = true;
}
return wrapped;
}
private boolean unwrapResourcePair(ResourcePair rp) {
boolean wasWrapped = false;
if (rp.getResourceData() instanceof CollaborationWrapperResourceData
|| rp.getResource() instanceof CollaborationWrapperResource) {
if (rp.getResource() instanceof CollaborationWrapperResource) {
rp.setResource(((CollaborationWrapperResource) rp.getResource())
.getWrappedResource());
rp.setResourceData(rp.getResource().getResourceData());
} else {
rp.setResourceData(((CollaborationWrapperResourceData) rp
.getResourceData()).getWrappedResourceData());
}
wasWrapped = true;
}
return wasWrapped;
}
/**
* Determines if the {@link ResourcePair} should be kept as a locally drawn
* resource or not
*
* @param rp
* @return
*/
private boolean shouldBeLocal(ResourcePair rp) {
return rp.getProperties().isMapLayer();
}
/**
* Sends an event to the venue marking the active display on the editor as
* the actively painting display
*
* @param editor
*/
private void activateEditor(AbstractEditor editor) {
if (activeSharedEditor != editor) {
activeSharedEditor = editor;
IDisplayPane pane = editor.getActiveDisplayPane();
IRenderableDisplay display = pane.getRenderableDisplay();
DisplayData data = displayData.get(display);
if (data != null) {
for (DisplayData d : displayData.values()) {
d.dispatcher.setActiveDisplay(display);
}
fireListeners(data, RemoteDisplayChangeType.ACTIVATED);
ActivateRemoteDisplay event = new ActivateRemoteDisplay();
event.setDisplayId(data.displayId);
sendEvent(event);
}
}
}
/**
* Sends a shared resource event
*
* @param rp
* resource to send
* @param remove
* whether the resource should be added or removed by the
* participants
*/
private void sendSharedResource(int displayId, ResourcePair rp,
boolean remove) {
ResourcePair copy = new ResourcePair();
copy.setLoadProperties(rp.getLoadProperties());
copy.setProperties(rp.getProperties());
AbstractResourceData resourceData = rp.getResourceData();
if (resourceData instanceof CollaborationWrapperResourceData) {
resourceData = ((CollaborationWrapperResourceData) resourceData)
.getWrappedResourceData();
} else if (rp.getResource() instanceof CollaborationWrapperResource) {
copy.setResourceData(rp.getResource().getResourceData());
}
copy.setResource(null);
copy.setResourceData(resourceData);
SharedResource resource = new SharedResource();
resource.setDisplayId(displayId);
resource.setRemoveResource(remove);
resource.setResource(rp);
sendEvent(resource);
}
/**
* Sends an object to the venue
*
* @param event
*/
private void sendEvent(Object event) {
try {
session.sendObjectToVenue(event);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
private void fireListeners(DisplayData data, RemoteDisplayChangeType type) {
for (IRemoteDisplayChangedListener listener : listeners) {
listener.remoteDisplayChanged(new RemoteDisplay(data.displayId,
data.display), type);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* addRemoteDisplayChangedListener
* (com.raytheon.uf.viz.collaboration.display.
* IRemoteDisplayContainer.IRemoteDisplayChangedListener)
*/
@Override
public void addRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener) {
listeners.add(listener);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* removeRemoteDisplayChangedListener
* (com.raytheon.uf.viz.collaboration.display
* .IRemoteDisplayContainer.IRemoteDisplayChangedListener)
*/
@Override
public void removeRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener) {
listeners.remove(listener);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* getActiveDisplay()
*/
@Override
public RemoteDisplay getActiveDisplay() {
if (activeSharedEditor == null) {
return null;
}
DisplayData data = displayData.get(activeSharedEditor
.getActiveDisplayPane().getRenderableDisplay());
return new RemoteDisplay(data.displayId, data.display);
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.viz.remote.graphics.events.DisposeObjectEvent;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
/**
* Special interface for distinguishing IRenderFrameEvents from other render

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import java.util.Arrays;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import java.util.ArrayList;
import java.util.Iterator;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import java.util.LinkedList;
import java.util.List;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.viz.remote.graphics.events.rendering.IRenderEvent;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@ -25,10 +25,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
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.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectRemoteDisplay;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -77,10 +77,6 @@ public class DataProviderRsc extends
}
}
public DataProviderRsc(DataProviderRsc rsc) {
this(rsc.getResourceData(), rsc.getLoadProperties());
}
@Override
protected void disposeInternal() {
@ -106,8 +102,9 @@ public class DataProviderRsc extends
*/
@Override
public void project(CoordinateReferenceSystem crs) throws VizException {
ReprojectEditor event = new ReprojectEditor();
ReprojectRemoteDisplay event = new ReprojectRemoteDisplay();
event.setTargetGeometry(descriptor.getGridGeometry());
event.setDisplayId(resourceData.getDisplayId());
try {
session.sendObjectToVenue(event);
} catch (CollaborationException e) {
@ -126,18 +123,6 @@ public class DataProviderRsc extends
return text;
}
public void setRoomName(String name) {
this.roomName = name;
}
public void setSubject(String subject) {
this.subject = subject;
}
public void setSession(ISharedDisplaySession session) {
this.session = session;
}
/*
* (non-Javadoc)
*

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.roles.dataprovider.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -50,6 +50,18 @@ public class DataProviderRscData extends AbstractResourceData {
@XmlAttribute
private String sessionId;
@XmlAttribute
private int displayId;
public DataProviderRscData() {
}
public DataProviderRscData(String sessionId, int displayId) {
this.sessionId = sessionId;
this.displayId = displayId;
}
/*
* (non-Javadoc)
*
@ -64,6 +76,21 @@ public class DataProviderRscData extends AbstractResourceData {
return new DataProviderRsc(this, loadProperties);
}
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the sessionId
*/

View file

@ -17,10 +17,9 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.rsc;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
@ -39,18 +38,18 @@ import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.FrameDisposed;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.UpdateRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingDataManager;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.collaboration.comm.storage.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.FrameDisposed;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.IRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.RenderFrameEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.RenderFrameNeededEvent;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.UpdateRenderFrameEvent;
import com.raytheon.uf.viz.collaboration.display.rsc.rendering.CollaborationRenderingDataManager;
import com.raytheon.uf.viz.collaboration.display.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizApp;
@ -155,47 +154,32 @@ public class CollaborationResource extends
}
}
private Map<Integer, DisplayData> displayData;
private Rectangle previousBounds = null;
private DisplayData currentData;
private DisplayData displayData;
public CollaborationResource(CollaborationResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
displayData = new HashMap<Integer, DisplayData>();
}
private DisplayData getDisplayData(int displayId) {
DisplayData data = displayData.get(displayId);
if (data == null) {
data = new DisplayData(displayId, resourceData.getSession(), this);
displayData.put(displayId, data);
}
return data;
}
@Override
protected void disposeInternal() {
resourceData.getSession().unregisterEventHandler(this);
for (DisplayData data : displayData.values()) {
data.dispose();
}
displayData.clear();
displayData.dispose();
}
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
if (currentData == null) {
if (displayData == null) {
return;
}
Map<IExtent, List<IRenderEvent>> renderableMap = currentData.renderableMap;
List<AbstractDispatchingObjectEvent> dataChangeEvents = currentData.dataChangeEvents;
Set<Integer> waitingOnObjects = currentData.waitingOnObjects;
EventBus renderingRouter = currentData.renderingRouter;
Map<IExtent, List<IRenderEvent>> renderableMap = displayData.renderableMap;
List<AbstractDispatchingObjectEvent> dataChangeEvents = displayData.dataChangeEvents;
Set<Integer> waitingOnObjects = displayData.waitingOnObjects;
EventBus renderingRouter = displayData.renderingRouter;
// Get the renderables for my extent
List<IRenderEvent> currentRenderables = null;
@ -203,9 +187,9 @@ public class CollaborationResource extends
currentRenderables = renderableMap.get(paintProps.getView()
.getExtent());
if (currentRenderables == null) {
synchronized (currentData.currentRenderables) {
synchronized (displayData.currentRenderables) {
currentRenderables = new ArrayList<IRenderEvent>(
currentData.currentRenderables);
displayData.currentRenderables);
}
}
}
@ -225,7 +209,7 @@ public class CollaborationResource extends
}
}
currentData.dataManager.beginRender(target, paintProps);
displayData.dataManager.beginRender(target, paintProps);
synchronized (renderingRouter) {
for (AbstractRemoteGraphicsEvent event : currentDataChangeEvents) {
@ -235,29 +219,29 @@ public class CollaborationResource extends
for (IRenderEvent event : currentRenderables) {
renderingRouter.post(event);
}
if (currentData.latestMouseLocation != null) {
renderingRouter.post(currentData.latestMouseLocation);
if (displayData.latestMouseLocation != null) {
renderingRouter.post(displayData.latestMouseLocation);
}
}
}
public void lockObject(int displayId, int objectId) {
DisplayData data = getDisplayData(displayId);
synchronized (data.dataChangeEvents) {
data.waitingOnObjects.add(objectId);
public void lockObject(int objectId) {
synchronized (displayData.dataChangeEvents) {
displayData.waitingOnObjects.add(objectId);
}
}
public void unlockObject(int displayId, int objectId) {
DisplayData data = getDisplayData(displayId);
synchronized (data.dataChangeEvents) {
data.waitingOnObjects.remove(objectId);
public void unlockObject(int objectId) {
synchronized (displayData.dataChangeEvents) {
displayData.waitingOnObjects.remove(objectId);
}
}
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
ISharedDisplaySession session = resourceData.getSession();
displayData = new DisplayData(resourceData.getDisplayId(), session,
this);
ParticipantInitializedEvent event = new ParticipantInitializedEvent();
event.setUserId(session.getUserID().getFQName());
try {
@ -271,13 +255,14 @@ public class CollaborationResource extends
@Subscribe
public void updateRenderFrameEvent(UpdateRenderFrameEvent event) {
DisplayData data = getDisplayData(event.getDisplayId());
currentData = data;
if (event.getDisplayId() != resourceData.getDisplayId()) {
return;
}
int objectId = event.getObjectId();
RenderFrameEvent frame = data.dataManager.getRenderableObject(objectId,
RenderFrameEvent.class, false);
RenderFrameEvent frame = displayData.dataManager.getRenderableObject(
objectId, RenderFrameEvent.class, false);
if (frame == null) {
if (data.waitingOnFrames.contains(objectId) == false) {
if (displayData.waitingOnFrames.contains(objectId) == false) {
RenderFrameNeededEvent needEvent = new RenderFrameNeededEvent();
needEvent.setDisplayId(event.getDisplayId());
needEvent.setObjectId(objectId);
@ -285,7 +270,7 @@ public class CollaborationResource extends
try {
session.sendObjectToPeer(session.getCurrentDataProvider(),
needEvent);
data.waitingOnFrames.add(objectId);
displayData.waitingOnFrames.add(objectId);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
"Error sending message to data provider", e);
@ -330,34 +315,39 @@ public class CollaborationResource extends
@Subscribe
public void renderFrameEvent(RenderFrameEvent event) {
DisplayData data = getDisplayData(event.getDisplayId());
currentData = data;
if (event.getDisplayId() != resourceData.getDisplayId()) {
return;
}
if (event instanceof UpdateRenderFrameEvent == false) {
// Not an update event, new frame
int objectId = event.getObjectId();
for (IRenderEvent re : event.getRenderEvents()) {
renderableArrived((AbstractRemoteGraphicsEvent) re.clone());
}
data.dataManager.putRenderableObject(objectId, event);
displayData.dataManager.putRenderableObject(objectId, event);
}
issueRefresh();
}
@Subscribe
public void disposeRenderFrame(FrameDisposed event) {
DisplayData data = getDisplayData(event.getDisplayId());
data.waitingOnFrames.remove(event.getObjectId());
data.dataManager.dispose(event.getObjectId());
if (event.getDisplayId() != resourceData.getDisplayId()) {
return;
}
displayData.waitingOnFrames.remove(event.getObjectId());
displayData.dataManager.dispose(event.getObjectId());
}
@Subscribe
public void persitableArrived(final IPersistedEvent event) {
if (event.getDisplayId() != resourceData.getDisplayId()) {
return;
}
retrievePool.schedule(new Runnable() {
@Override
public void run() {
try {
DisplayData data = getDisplayData(event.getDisplayId());
AbstractDispatchingObjectEvent objectEvent = data.dataManager
AbstractDispatchingObjectEvent objectEvent = displayData.dataManager
.retrieveEvent(event);
if (objectEvent != null) {
renderableArrived(objectEvent);
@ -371,31 +361,30 @@ public class CollaborationResource extends
}
public void postObjectEvent(AbstractDispatchingObjectEvent event) {
DisplayData data = getDisplayData(event.getDisplayId());
synchronized (data.renderingRouter) {
data.renderingRouter.post(event);
synchronized (displayData.renderingRouter) {
displayData.renderingRouter.post(event);
}
}
@Subscribe
public void renderableArrived(AbstractRemoteGraphicsEvent event) {
if (event instanceof IRenderFrameEvent) {
if (event.getDisplayId() != resourceData.getDisplayId()
|| event instanceof IRenderFrameEvent) {
// Skip IRenderFrameEvents, not applicable here
return;
}
DisplayData data = getDisplayData(event.getDisplayId());
if (event instanceof IRenderEvent) {
// Render based event
if (event instanceof BeginFrameEvent) {
// If begin frame event, clear current active renderables
data.activeRenderables.clear();
data.activeRenderables.add((IRenderEvent) event);
displayData.activeRenderables.clear();
displayData.activeRenderables.add((IRenderEvent) event);
} else if (event instanceof EndFrameEvent) {
synchronized (data.currentRenderables) {
synchronized (displayData.currentRenderables) {
IExtent current = null;
data.currentRenderables.clear();
displayData.currentRenderables.clear();
// Frame over, process BeginFrameEvent now to keep in sync
for (IRenderEvent renderable : data.activeRenderables) {
for (IRenderEvent renderable : displayData.activeRenderables) {
if (renderable instanceof BeginFrameEvent) {
// Handle begin frame event immediately before next
// paint occurs
@ -403,7 +392,7 @@ public class CollaborationResource extends
.getRenderableDisplay();
final BeginFrameEvent bfe = (BeginFrameEvent) renderable;
display.setBackgroundColor(bfe.getColor());
final CollaborationEditor editor = SharedDisplaySessionMgr
final ICollaborationEditor editor = SharedDisplaySessionMgr
.getSessionContainer(
resourceData.getSession()
.getSessionId())
@ -414,7 +403,9 @@ public class CollaborationResource extends
VizApp.runAsync(new Runnable() {
@Override
public void run() {
editor.setCanvasSize(bfe.getBounds());
editor.setCanvasBounds(
bfe.getDisplayId(),
bfe.getBounds());
display.getView().setExtent(
bfe.getExtent());
}
@ -425,25 +416,25 @@ public class CollaborationResource extends
current = bfe.getExtent();
} else {
// Add to list for processing in paintInternal
data.currentRenderables.add(renderable);
displayData.currentRenderables.add(renderable);
}
}
data.activeRenderables.clear();
data.renderableMap
.put(current, new ArrayList<IRenderEvent>(
data.currentRenderables));
displayData.activeRenderables.clear();
displayData.renderableMap.put(current,
new ArrayList<IRenderEvent>(
displayData.currentRenderables));
}
issueRefresh();
} else if (event instanceof MouseLocationEvent) {
data.latestMouseLocation = (MouseLocationEvent) event;
displayData.latestMouseLocation = (MouseLocationEvent) event;
issueRefresh();
} else {
data.activeRenderables.add((IRenderEvent) event);
displayData.activeRenderables.add((IRenderEvent) event);
}
} else if (event instanceof AbstractDispatchingObjectEvent) {
// If not IRenderEvent, event modifies data object
synchronized (data.dataChangeEvents) {
data.dataChangeEvents
synchronized (displayData.dataChangeEvents) {
displayData.dataChangeEvents
.add((AbstractDispatchingObjectEvent) event);
}
issueRefresh();

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.rsc;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -48,6 +48,18 @@ public class CollaborationResourceData extends AbstractResourceData {
private ISharedDisplaySession session;
private int displayId;
/**
* @param session2
* @param displayId2
*/
public CollaborationResourceData(ISharedDisplaySession session,
int displayId) {
this.session = session;
this.displayId = displayId;
}
/*
* (non-Javadoc)
*
@ -108,11 +120,10 @@ public class CollaborationResourceData extends AbstractResourceData {
}
/**
* @param session
* the session to set
* @return the displayId
*/
public void setSession(ISharedDisplaySession session) {
this.session = session;
public int getDisplayId() {
return displayId;
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.rsc;
import java.util.Map;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc;
package com.raytheon.uf.viz.collaboration.display.rsc;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;

View file

@ -0,0 +1,89 @@
/**
* 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.display.rsc;
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.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
/**
* Listener that manages a system resource and readds it when it is removed
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 13, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class SelfAddingSystemResourceListener implements RemoveListener {
protected IDescriptor descriptor;
private ResourcePair resource;
public SelfAddingSystemResourceListener(AbstractResourceData resourceData,
IDescriptor descriptor) throws VizException {
this.descriptor = descriptor;
addResource(resourceData);
descriptor.getResourceList().addPostRemoveListener(this);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener#notifyRemove
* (com.raytheon.uf.viz.core.drawables.ResourcePair)
*/
@Override
public void notifyRemove(ResourcePair rp) throws VizException {
if (rp == resource) {
addResource(rp.getResourceData());
}
}
/**
*
*/
private void addResource(AbstractResourceData resourceData)
throws VizException {
resource = ResourcePair.constructSystemResourcePair(resourceData);
resource.instantiateResource(descriptor, true);
descriptor.getResourceList().add(resource);
}
public void dispose() {
ResourceList resourceList = descriptor.getResourceList();
resourceList.removePostRemoveListener(this);
resourceList.remove(resource);
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.editor;
package com.raytheon.uf.viz.collaboration.display.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@ -49,12 +49,30 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
@XmlRootElement
public class SharedResource implements ISerializableObject {
@XmlAttribute
private int displayId;
@XmlAttribute
private boolean removeResource = false;
@XmlElement
private ResourcePair resource;
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the resource
*/

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import java.util.ArrayList;
import java.util.Arrays;
@ -38,11 +38,11 @@ import com.google.common.eventbus.EventBus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.CollaborationObjectEventStorage;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.IObjectEventRetrieval;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResource;
import com.raytheon.uf.viz.collaboration.comm.storage.CollaborationObjectEventStorage;
import com.raytheon.uf.viz.collaboration.comm.storage.IObjectEventRetrieval;
import com.raytheon.uf.viz.collaboration.comm.storage.IPersistedEvent;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.rsc.CollaborationResource;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent;
@ -66,7 +66,7 @@ import com.raytheon.uf.viz.remote.graphics.events.AbstractDispatchingObjectEvent
public class CollaborationRenderingDataManager implements IObjectEventRetrieval {
private static final String RENDERING_EXTENSION = "com.raytheon.uf.viz.collaboration.ui.renderingExtension";
private static final String RENDERING_EXTENSION = "com.raytheon.uf.viz.collaboration.display.renderingExtension";
private static Collection<IConfigurationElement> handlerElements = new LinkedList<IConfigurationElement>();
@ -188,7 +188,7 @@ public class CollaborationRenderingDataManager implements IObjectEventRetrieval
}
} else if (retrieve) {
try {
resource.lockObject(displayId, objectId);
resource.lockObject(objectId);
AbstractDispatchingObjectEvent[] events = retrieveObjectEvents(objectId);
for (AbstractDispatchingObjectEvent event : events) {
resource.postObjectEvent(event);
@ -200,7 +200,7 @@ public class CollaborationRenderingDataManager implements IObjectEventRetrieval
"Error retrieving object events: "
+ e.getLocalizedMessage(), e);
} finally {
resource.unlockObject(displayId, objectId);
resource.unlockObject(objectId);
}
}
return obj;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.PaintProperties;

View file

@ -17,14 +17,14 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import org.eclipse.swt.graphics.RGB;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.event.MouseLocationEvent;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.PixelExtent;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import java.awt.image.RenderedImage;
import java.util.ArrayList;
@ -26,7 +26,7 @@ import java.util.List;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.colormap.IColorMap;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IMesh;

View file

@ -17,13 +17,13 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import java.nio.Buffer;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.ext.IOffscreenRenderingExtension;

View file

@ -17,11 +17,11 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.DrawableCircle;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.IGraphicsTarget;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import java.util.HashMap;
@ -25,7 +25,7 @@ import org.eclipse.swt.graphics.RGB;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IShadedShape;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.rsc.rendering;
package com.raytheon.uf.viz.collaboration.display.rsc.rendering;
import java.io.File;
import java.io.IOException;
@ -25,7 +25,7 @@ import java.io.IOException;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IFont;

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.collaboration.ui.telestrator.event;
package com.raytheon.uf.viz.collaboration.display.rsc.telestrator;
import java.util.List;
@ -47,9 +47,12 @@ import com.vividsolutions.jts.geom.Coordinate;
public class CollaborationDrawingEvent {
public static enum CollaborationEventType {
DRAW, ERASE, REDO, UNDO, CLEAR, TOGGLE_LOCK, CLEAR_ALL;
DRAW, ERASE, REDO, UNDO, CLEAR, LOCK_USERS, UNLOCK_USERS, CLEAR_ALL;
}
@DynamicSerializeElement
private int displayId;
@DynamicSerializeElement
private List<Coordinate> coordinates;
@ -59,6 +62,29 @@ public class CollaborationDrawingEvent {
@DynamicSerializeElement
private CollaborationEventType type;
public CollaborationDrawingEvent() {
}
public CollaborationDrawingEvent(int displayId) {
this.displayId = displayId;
}
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the coordinates
*/

View file

@ -17,7 +17,7 @@
* 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.display.rsc.telestrator;
import java.util.HashMap;
import java.util.List;
@ -30,11 +30,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -88,17 +87,17 @@ public class CollaborationDrawingResource extends
*/
public CollaborationDrawingResource(
CollaborationDrawingResourceData resourceData,
LoadProperties loadProperties) {
LoadProperties loadProperties) throws VizException {
super(resourceData, loadProperties);
}
container = SharedDisplaySessionMgr.getSessionContainer(resourceData
.getSessionId());
if (container == null) {
throw new VizException("Could not find container for sessionId: "
+ resourceData.getSessionId());
}
public CollaborationDrawingResource(CollaborationDrawingResource resource) {
super(resource.getResourceData(), resource.getLoadProperties());
this.layerMap = new HashMap<UserId, DrawingToolLayer>(resource.layerMap);
resource.layerMap.clear();
this.myUser = resource.myUser;
this.getCapabilities().addCapability(
resource.getCapability(OutlineCapability.class));
myUser = container.getSession().getUserID();
layerMap = new HashMap<UserId, DrawingToolLayer>();
}
/*
@ -111,36 +110,32 @@ public class CollaborationDrawingResource extends
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
EditableManager.makeEditable(this, true);
container = SharedDisplaySessionMgr.getSessionContainer(resourceData
.getSessionId());
if (container == null) {
throw new VizException("Could not find container for sessionId: "
+ resourceData.getSessionId());
if (layerMap == null) {
layerMap = new HashMap<UserId, DrawingToolLayer>();
}
if (layerMap == null) {
// Don't reinitialized
myUser = container.getSession().getUserID();
layerMap = new HashMap<UserId, DrawingToolLayer>();
OutlineCapability outline = getCapability(OutlineCapability.class);
outline.setLineStyle(LineStyle.SOLID);
outline.setOutlineWidth(4);
outline.setSuppressingMenuItems(true);
OutlineCapability outline = getCapability(OutlineCapability.class);
outline.setLineStyle(LineStyle.SOLID);
outline.setOutlineWidth(4);
outline.setSuppressingMenuItems(true);
ColorableCapability colorable = getCapability(ColorableCapability.class);
colorable.setSuppressingMenuItems(true);
ColorableCapability colorable = getCapability(ColorableCapability.class);
colorable.setSuppressingMenuItems(true);
if (isSessionLeader()) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
event.setUserName(myUser);
event.setType(CollaborationEventType.CLEAR_ALL);
sendEvent(event);
}
if (isSessionLeader()) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent(
resourceData.getDisplayId());
event.setUserName(myUser);
event.setType(CollaborationEventType.CLEAR_ALL);
sendEvent(event);
}
manager = new CollaborationDrawingUIManager(this);
container.getSession().registerEventHandler(this);
getDrawingLayerFor(getMyUser()).setDrawMode(
resourceData.getResourceMode());
setLockingDrawing(resourceData.isLocking());
}
/*
@ -273,12 +268,17 @@ public class CollaborationDrawingResource extends
}
public void setLockingDrawing(boolean lockingDrawing) {
this.lockingDrawing = lockingDrawing;
if (isSessionLeader()) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
event.setUserName(myUser);
event.setType(CollaborationEventType.TOGGLE_LOCK);
sendEvent(event);
if (this.lockingDrawing != lockingDrawing) {
resourceData.setLocking(lockingDrawing);
this.lockingDrawing = lockingDrawing;
if (isSessionLeader()) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent(
resourceData.getDisplayId());
event.setUserName(myUser);
event.setType(lockingDrawing ? CollaborationEventType.LOCK_USERS
: CollaborationEventType.UNLOCK_USERS);
sendEvent(event);
}
}
}
@ -314,7 +314,8 @@ public class CollaborationDrawingResource extends
@Subscribe
public void handleDrawEvent(CollaborationDrawingEvent event) {
UserId user = event.getUserName();
if (user.equals(myUser)) {
if (event.getDisplayId() != resourceData.getDisplayId()
|| user.equals(myUser)) {
// Early exit case, don't process my own events twice
issueRefresh();
return;
@ -327,9 +328,13 @@ public class CollaborationDrawingResource extends
case CLEAR:
layer.clear();
break;
case TOGGLE_LOCK:
// Toggle locking
setLockingDrawing(!isLockingDrawing());
case LOCK_USERS:
// lock
setLockingDrawing(true);
break;
case UNLOCK_USERS:
// unlock
setLockingDrawing(false);
break;
case DRAW:
layer.setDrawMode(DrawMode.DRAW);

View file

@ -17,16 +17,18 @@
* 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.display.rsc.telestrator;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
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.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
/**
* Resource data for the CollaborationDrawingResource
@ -50,6 +52,15 @@ public class CollaborationDrawingResourceData extends AbstractResourceData {
@XmlAttribute
private String sessionId;
@XmlAttribute
private int displayId;
@XmlElement
private DrawMode resourceMode = DrawMode.NONE;
@XmlAttribute
private boolean locking = false;
/*
* (non-Javadoc)
*
@ -80,6 +91,51 @@ public class CollaborationDrawingResourceData extends AbstractResourceData {
this.sessionId = sessionId;
}
/**
* @return the displayId
*/
public int getDisplayId() {
return displayId;
}
/**
* @param displayId
* the displayId to set
*/
public void setDisplayId(int displayId) {
this.displayId = displayId;
}
/**
* @return the resourceMode
*/
public DrawMode getResourceMode() {
return resourceMode;
}
/**
* @param resourceMode
* the resourceMode to set
*/
public void setResourceMode(DrawMode resourceMode) {
this.resourceMode = resourceMode;
}
/**
* @return the locking
*/
public boolean isLocking() {
return locking;
}
/**
* @param locking
* the locking to set
*/
public void setLocking(boolean locking) {
this.locking = locking;
}
/*
* (non-Javadoc)
*

View file

@ -17,15 +17,14 @@
* 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.display.rsc.telestrator;
import java.util.ArrayList;
import java.util.List;
import org.geotools.coverage.grid.GeneralGridGeometry;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
import com.vividsolutions.jts.geom.Coordinate;
@ -62,6 +61,19 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
this.resource = resource;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.drawing.DrawingToolLayer#setDrawMode(com.raytheon
* .uf.viz.drawing.DrawingToolLayer.DrawMode)
*/
@Override
public void setDrawMode(DrawMode drawMode) {
super.setDrawMode(drawMode);
resource.getResourceData().setResourceMode(drawMode);
}
/*
* (non-Javadoc)
*
@ -131,7 +143,8 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
}
private void sendCoordinateEvent(CollaborationEventType type) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
CollaborationDrawingEvent event = new CollaborationDrawingEvent(
resource.getResourceData().getDisplayId());
event.setType(type);
event.setUserName(resource.getMyUser());
event.setCoordinates(new ArrayList<Coordinate>(coordinates));
@ -140,7 +153,8 @@ public class CollaborationDrawingToolLayer extends DrawingToolLayer {
}
private void sendSimpleEvent(CollaborationEventType type) {
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
CollaborationDrawingEvent event = new CollaborationDrawingEvent(
resource.getResourceData().getDisplayId());
event.setType(type);
event.setUserName(resource.getMyUser());
resource.sendEvent(event);

View file

@ -17,14 +17,8 @@
* 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.display.rsc.telestrator;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.drawing.DrawingToolUIManager;
/**
@ -49,25 +43,10 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
private CollaborationDrawingResource resource;
private CollaborationSessionView view;
public CollaborationDrawingUIManager(CollaborationDrawingResource resource) {
super(resource.getDrawingLayerFor(resource.getMyUser()), resource
.getResourceContainer());
this.resource = resource;
VizApp.runAsync(new Runnable() {
@Override
public void run() {
CollaborationDrawingResource resource = CollaborationDrawingUIManager.this.resource;
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
IViewReference viewRef = page.findViewReference(
CollaborationSessionView.ID, resource.getContainer()
.getSessionId());
view = (CollaborationSessionView) viewRef.getPart(false);
view.updateToolItems();
}
});
}
/*
@ -90,19 +69,4 @@ public class CollaborationDrawingUIManager extends DrawingToolUIManager {
return super.canTellestrate(mouseButton) && resource.canTellestrate();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.drawing.DrawingToolUIManager#handleMouseUp(int,
* int, int)
*/
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
boolean rval = super.handleMouseUp(x, y, mouseButton);
if (rval) {
view.updateToolItems();
}
return rval;
}
}

View file

@ -122,13 +122,6 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.notification"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.collaboration.display"
download-size="0"

View file

@ -8,7 +8,7 @@ Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.viz.collaboration.ui;bundle-version="1.0.0",
com.raytheon.uf.viz.collaboration.display;bundle-version="1.0.0",
com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0",
com.raytheon.viz.pointdata;bundle-version="1.12.1174",
com.google.guava;bundle-version="1.0.0"

View file

@ -27,7 +27,7 @@
</graphicsExtension>
</extension>
<extension
point="com.raytheon.uf.viz.collaboration.ui.renderingExtension">
point="com.raytheon.uf.viz.collaboration.display.renderingExtension">
<renderingExtension
class="com.raytheon.uf.viz.collaboration.pointdata.rendering.PointImageRenderingHandler">
</renderingExtension>

View file

@ -25,10 +25,10 @@ import java.util.Set;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.collaboration.pointdata.image.DrawPointImagesEvent;
import com.raytheon.uf.viz.collaboration.pointdata.image.PointImageEvent;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;

View file

@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
org.geotools;bundle-version="2.6.4",
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
com.raytheon.uf.viz.collaboration.ui;bundle-version="1.0.0",
com.raytheon.uf.viz.collaboration.display;bundle-version="1.0.0",
com.raytheon.uf.viz.collaboration.comm;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -30,7 +30,7 @@
</graphicsExtension>
</extension>
<extension
point="com.raytheon.uf.viz.collaboration.ui.renderingExtension">
point="com.raytheon.uf.viz.collaboration.display.renderingExtension">
<renderingExtension
class="com.raytheon.uf.viz.collaboration.radar.rendering.RadarGraphicsExtRenderingHandler">
</renderingExtension>

View file

@ -21,13 +21,13 @@ package com.raytheon.uf.viz.collaboration.radar.rendering;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.display.Activator;
import com.raytheon.uf.viz.collaboration.display.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.collaboration.display.rsc.rendering.ImagingRenderingHandler;
import com.raytheon.uf.viz.collaboration.radar.mesh.CreateRadarRadialMesh;
import com.raytheon.uf.viz.collaboration.radar.mosaic.CreateMosaicImageEvent;
import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateImagesToMosaic;
import com.raytheon.uf.viz.collaboration.radar.mosaic.UpdateMosaicExtent;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.CollaborationRenderingHandler;
import com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ImagingRenderingHandler;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;

View file

@ -6,8 +6,7 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.collaboration.ui.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
Export-Package: com.raytheon.uf.viz.collaboration.ui,
com.raytheon.uf.viz.collaboration.ui.rsc.rendering
Export-Package: com.raytheon.uf.viz.collaboration.ui
Require-Bundle: com.raytheon.viz.ui,
org.eclipse.ui,
org.eclipse.core.runtime,
@ -18,20 +17,8 @@ Require-Bundle: com.raytheon.viz.ui,
org.geotools;bundle-version="2.6.4",
com.raytheon.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.viz.drawing;bundle-version="1.0.0",
com.raytheon.uf.viz.remote.graphics;bundle-version="1.0.0",
com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
com.raytheon.uf.viz.notification;bundle-version="1.0.0",
com.raytheon.uf.viz.collaboration.display;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.pgen;bundle-version="1.0.0",
gov.noaa.nws.ncep.staticdataprovider;bundle-version="1.0.0",
gov.noaa.nws.ncep.common.staticdata;bundle-version="1.0.0",
org.eclipse.ecf.presence
Import-Package: com.raytheon.uf.common.status,
com.raytheon.uf.viz.core.maps.display,
com.raytheon.uf.viz.core.maps.rsc,
com.raytheon.uf.viz.drawing,
com.raytheon.viz.awipstools.ui.display,
org.eclipse.ecf.presence,
org.eclipse.ecf.presence.roster
org.eclipse.ecf.presence;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy

View file

@ -1,5 +0,0 @@
com.raytheon.uf.viz.collaboration.ui.editor.SharedResource
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData
com.raytheon.uf.viz.collaboration.ui.rsc.DataProviderRscData
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData
com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResourceData

View file

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

View file

@ -20,8 +20,6 @@
-->
<?eclipse version="3.2"?>
<plugin>
<extension-point id="renderingExtension" name="renderingExtension" schema="schema/renderingExtension.exsd"/>
<extension
point="org.eclipse.ui.commands">
<category
@ -140,30 +138,14 @@
point="com.raytheon.viz.ui.editorMenuAddition">
<editorMenuAddition
class="com.raytheon.uf.viz.collaboration.ui.actions.ShareEditorAction"
name="Share Editor"
name="Share with"
icon="icons/add_correction.gif">
</editorMenuAddition>
</extension>
<extension
point="com.raytheon.uf.viz.collaboration.ui.renderingExtension">
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.GeneralRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ImagingRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.OffscreenRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.ShapeRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.StringRenderingHandler">
</renderingExtension>
<renderingExtension
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.PrimitiveRenderingHandler">
</renderingExtension>
<editorMenuAddition
class="com.raytheon.uf.viz.collaboration.ui.actions.UnshareEditorAction"
name="Unshare"
icon="icons/remove_editor.gif">
</editorMenuAddition>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
@ -234,4 +216,14 @@
</contextId>
</classContext>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor"
default="true"
id="com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor"
icon="icons/collab_editor.gif"
name="Collaboration">
</editor>
</extension>
</plugin>

View file

@ -109,11 +109,13 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.data.AlertWordWrapper;
import com.raytheon.uf.viz.collaboration.ui.data.CollaborationGroupContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SessionGroupContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.login.ChangeStatusDialog;
import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
@ -1546,8 +1548,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
if (linkToEditorAction.isChecked()) {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
if (part instanceof CollaborationEditor) {
String sessionId = ((CollaborationEditor) part).getSessionId();
if (part instanceof ICollaborationEditor) {
String sessionId = ((ICollaborationEditor) part).getSessionId();
for (IViewReference ref : page.getViewReferences()) {
if (ref.getPart(false) instanceof CollaborationSessionView) {
CollaborationSessionView view = (CollaborationSessionView) ref
@ -1561,7 +1563,7 @@ public class CollaborationGroupView extends CaveFloatingView implements
} else if (part instanceof CollaborationSessionView) {
String sessionId = ((CollaborationSessionView) part)
.getSessionId();
CollaborationEditor editor = SharedDisplaySessionMgr
ICollaborationEditor editor = SharedDisplaySessionMgr
.getSessionContainer(sessionId)
.getCollaborationEditor();
if (editor != null) {

View file

@ -48,7 +48,8 @@ import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;

View file

@ -49,7 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;

View file

@ -1,4 +1,4 @@
package com.raytheon.uf.viz.notification.notifier;
package com.raytheon.uf.viz.collaboration.ui.actions;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -19,14 +19,31 @@
**/
package com.raytheon.uf.viz.collaboration.ui.actions;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.MessageBox;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import com.raytheon.uf.common.status.UFStatus.Priority;
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.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.actions.ContributedEditorMenuAction;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* TODO Add Description
* Action to share an editor with a chosen session
*
* <pre>
*
@ -42,28 +59,135 @@ import com.raytheon.viz.ui.actions.ContributedEditorMenuAction;
* @version 1.0
*/
public class ShareEditorAction extends ContributedEditorMenuAction {
public class ShareEditorAction extends ContributedEditorMenuAction implements
IMenuCreator {
private Menu menu;
public ShareEditorAction() {
super("Share with", IAction.AS_DROP_DOWN_MENU);
}
@Override
public boolean shouldBeVisible() {
// TODO only return true if you are the DataProvider on a session AND
// the editor is not already shared
if (true) {
return true;
return getActiveSharableEditor() != null && getSessions().size() > 0;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.IMenuCreator#dispose()
*/
@Override
public void dispose() {
if (menu != null) {
menu.dispose();
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets
* .Control)
*/
@Override
public Menu getMenu(Control parent) {
if (menu != null) {
menu.dispose();
}
return true;
menu = new Menu(parent);
fillMenu(menu);
return menu;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets
* .Menu)
*/
@Override
public void run() {
// TODO need to add this editor to the list of editors associated with
// the collaboration session
// remove the message box and the not yet implemented message
MessageBox messageBox = new MessageBox(Display.getCurrent()
.getActiveShell(), SWT.ICON_INFORMATION);
messageBox.setText("Not Yet Implemented");
messageBox.setMessage("Share Editor is not yet implemented");
messageBox.open();
public Menu getMenu(Menu parent) {
if (menu != null) {
menu.dispose();
}
menu = new Menu(parent);
fillMenu(menu);
return menu;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#getMenuCreator()
*/
@Override
public IMenuCreator getMenuCreator() {
return this;
}
/**
* @param menu2
*/
private void fillMenu(Menu menu) {
final AbstractEditor editor = getActiveSharableEditor();
if (editor != null) {
List<ISharedDisplaySession> sessions = getSessions();
for (final ISharedDisplaySession session : sessions) {
final IVenueInfo sessionInfo = session.getVenue().getInfo();
ActionContributionItem aci = new ActionContributionItem(
new Action(sessionInfo.getVenueDescription()) {
@Override
public void run() {
try {
SharedEditorsManager.getManager(session)
.shareEditor(editor);
} catch (CollaborationException e) {
Activator.statusHandler.handle(
Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
});
aci.fill(menu, -1);
}
}
}
private AbstractEditor getActiveSharableEditor() {
AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class);
if (editor != null
&& SharedEditorsManager.isBeingShared(editor) == false) {
return editor;
}
return null;
}
private List<ISharedDisplaySession> getSessions() {
Collection<String> sessionIds = SharedDisplaySessionMgr
.getActiveSessionIds();
List<ISharedDisplaySession> sessions = new ArrayList<ISharedDisplaySession>();
for (String sessionId : sessionIds) {
SessionContainer container = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
if (container != null) {
ISharedDisplaySession session = container.getSession();
if (session != null
&& session.getUserID() == session
.getCurrentDataProvider()) {
sessions.add(container.getSession());
}
}
}
return sessions;
}
}

View file

@ -0,0 +1,91 @@
/**
* 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.actions;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.actions.ContributedEditorMenuAction;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Action to remove an editor from being shared
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 11, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class UnshareEditorAction extends ContributedEditorMenuAction {
public UnshareEditorAction() {
super("Unshare");
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class);
SharedEditorsManager manager = getActiveSharedEditorManager(editor);
if (manager != null) {
try {
manager.removeEditor(editor);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@Override
public boolean shouldBeVisible() {
AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class);
return getActiveSharedEditorManager(editor) != null;
}
private SharedEditorsManager getActiveSharedEditorManager(
AbstractEditor editor) {
SharedEditorsManager manager = null;
ISharedDisplaySession session = SharedEditorsManager
.getSharedEditorSession(editor);
if (session != null) {
manager = SharedEditorsManager.getManager(session);
}
return manager;
}
}

View file

@ -0,0 +1,404 @@
/**
* 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.editor;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.ISaveablePart2;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ActivateRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditorInput;
import com.raytheon.uf.viz.collaboration.display.editor.CreateRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.DisposeRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.editor.RemoteDisplayRequested;
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectRemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.rsc.CollaborationResourceData;
import com.raytheon.uf.viz.collaboration.display.rsc.SharedResource;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
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.viz.ui.input.InputManager;
/**
* A collaboration editor that displays the display of an editor shared by the
* Data Provider.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 16, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class CollaborationEditor extends EditorPart implements
ICollaborationEditor, ISaveablePart2 {
private ISharedDisplaySession session;
private CollaborationPaneManager paneManager;
private Map<Integer, IRenderableDisplay> displayMap = new LinkedHashMap<Integer, IRenderableDisplay>(
5, 1.25f, true);
private int currentActiveDisplay = -1;
private Set<IRemoteDisplayChangedListener> listeners = new LinkedHashSet<IRemoteDisplayChangedListener>();
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
* org.eclipse.ui.IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
setInput(input);
setSite(site);
CollaborationEditorInput cei = (CollaborationEditorInput) input;
setPartName(cei.getName());
session = SharedDisplaySessionMgr.getSessionContainer(
cei.getSessionId()).getSession();
session.registerEventHandler(this);
paneManager = new CollaborationPaneManager();
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public void createPartControl(Composite parent) {
paneManager.initializeComponents(paneManager, parent);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#dispose()
*/
@Override
public void dispose() {
super.dispose();
session.unregisterEventHandler(this);
}
@Subscribe
public void createRemoteDisplay(CreateRemoteDisplay event) {
int displayId = event.getDisplayId();
IRenderableDisplay display = displayMap.get(displayId);
if (display == null) {
display = event.getDisplay();
for (ResourcePair rp : display.getDescriptor().getResourceList()) {
rp.getProperties().setSystemResource(true);
}
CollaborationResourceData crd = new CollaborationResourceData(
session, displayId);
ResourcePair rp = ResourcePair.constructSystemResourcePair(crd);
display.getDescriptor().getResourceList().add(rp);
display.getDescriptor().getResourceList()
.instantiateResources(display.getDescriptor(), true);
displayMap.put(displayId, display);
fireListeners(displayId, display, RemoteDisplayChangeType.CREATED);
if (currentActiveDisplay == displayId) {
ActivateRemoteDisplay activate = new ActivateRemoteDisplay();
activate.setDisplayId(displayId);
activateRemoteDisplay(activate);
}
}
}
@Subscribe
public void activateRemoteDisplay(ActivateRemoteDisplay event) {
currentActiveDisplay = event.getDisplayId();
final IRenderableDisplay display = displayMap.get(currentActiveDisplay);
if (display == null) {
RemoteDisplayRequested request = new RemoteDisplayRequested();
request.setDisplayId(currentActiveDisplay);
request.setUserId(session.getUserID().getFQName());
try {
session.sendObjectToPeer(session.getCurrentDataProvider(),
request);
} catch (CollaborationException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
} else {
fireListeners(currentActiveDisplay, display,
RemoteDisplayChangeType.ACTIVATED);
VizApp.runAsync(new Runnable() {
@Override
public void run() {
paneManager.activateDisplay(currentActiveDisplay, display);
}
});
}
}
@Subscribe
public void disposeRemoteDisplay(DisposeRemoteDisplay event) {
final IRenderableDisplay display = displayMap.remove(event
.getDisplayId());
if (display != null) {
fireListeners(event.getDisplayId(), display,
RemoteDisplayChangeType.DISPOSED);
VizApp.runAsync(new Runnable() {
@Override
public void run() {
paneManager.dispose(display);
for (Integer id : displayMap.keySet()) {
ActivateRemoteDisplay event = new ActivateRemoteDisplay();
event.setDisplayId(id);
activateRemoteDisplay(event);
break;
}
}
});
}
}
@Subscribe
public void reprojectRemoteDisplay(ReprojectRemoteDisplay event) {
IRenderableDisplay display = displayMap.get(event.getDisplayId());
if (display != null) {
IDescriptor descriptor = display.getDescriptor();
try {
descriptor.setGridGeometry(event.getTargetGeometry());
Rectangle bounds = paneManager.getCanvasSize(display);
if (bounds != null) {
display.scaleToClientArea(bounds);
display.refresh();
}
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
}
@Subscribe
public void sharedResourceEvent(SharedResource event) {
IRenderableDisplay display = displayMap.get(event.getDisplayId());
if (display != null) {
IDescriptor descriptor = display.getDescriptor();
event.getResource().getProperties().setSystemResource(true);
if (event.isRemoveResource()) {
descriptor.getResourceList().remove(event.getResource());
} else {
descriptor.getResourceList().add(event.getResource());
descriptor.getResourceList().instantiateResources(descriptor,
true);
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor
* #setCanvasBounds(org.eclipse.swt.graphics.Rectangle)
*/
@Override
public void setCanvasBounds(int displayId, Rectangle canvasBounds) {
IRenderableDisplay display = displayMap.get(displayId);
if (display != null) {
paneManager.setCanvasSize(display, canvasBounds);
}
}
public InputManager getInputManager() {
return paneManager.getMouseManager();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor
* #getSessionId()
*/
@Override
public String getSessionId() {
return session.getSessionId();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor
* #getActiveDisplayPane()
*/
@Override
public IDisplayPane getActiveDisplayPane() {
return paneManager.getActiveDisplayPane();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#isDirty()
*/
@Override
public boolean isDirty() {
return true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.
* IProgressMonitor)
*/
@Override
public void doSave(IProgressMonitor monitor) {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#doSaveAs()
*/
@Override
public void doSaveAs() {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
*/
@Override
public boolean isSaveAsAllowed() {
return false;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#setFocus()
*/
@Override
public void setFocus() {
paneManager.setFocus();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISaveablePart2#promptToSaveOnClose()
*/
@Override
public int promptToSaveOnClose() {
// Let the user know why we refuse to close the editor
MessageDialog.openError(getSite().getShell(), "Closing Disabled",
"Please close the \"" + getPartName()
+ "\" chat to exit the session.");
// Cancel the clsoe
return ISaveablePart2.CANCEL;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* addRemoteDisplayChangedListener
* (com.raytheon.uf.viz.collaboration.display.
* IRemoteDisplayContainer.IRemoteDisplayChangedListener)
*/
@Override
public void addRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener) {
listeners.add(listener);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* removeRemoteDisplayChangedListener
* (com.raytheon.uf.viz.collaboration.display
* .IRemoteDisplayContainer.IRemoteDisplayChangedListener)
*/
@Override
public void removeRemoteDisplayChangedListener(
IRemoteDisplayChangedListener listener) {
listeners.remove(listener);
}
private void fireListeners(int displayId, IRenderableDisplay display,
RemoteDisplayChangeType changeType) {
for (IRemoteDisplayChangedListener listener : listeners) {
listener.remoteDisplayChanged(
new RemoteDisplay(displayId, display), changeType);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer#
* getActiveDisplay()
*/
@Override
public RemoteDisplay getActiveDisplay() {
IRenderableDisplay display = displayMap.get(currentActiveDisplay);
if (display == null) {
return null;
}
return new RemoteDisplay(currentActiveDisplay, display);
}
}

View file

@ -0,0 +1,247 @@
/**
* 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.editor;
import java.util.IdentityHashMap;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.viz.ui.panes.PaneManager;
import com.raytheon.viz.ui.panes.VizDisplayPane;
/**
* PaneManager for the CollaborationEditor
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 7, 2012 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class CollaborationPaneManager extends PaneManager {
private static class DisplayData {
private IDisplayPane pane;
private Composite wrapperComp;
private Composite canvasComp;
private ScrolledComposite scrollable;
private Rectangle scrollableBounds;
private Rectangle canvasBounds;
}
private Map<IRenderableDisplay, DisplayData> displayMap = new IdentityHashMap<IRenderableDisplay, DisplayData>();
private DisplayData activeData;
private LoopProperties loopProperties = new LoopProperties();
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.panes.PaneManager#initializeComponents(com.raytheon
* .uf.viz.core.IDisplayPaneContainer, org.eclipse.swt.widgets.Composite)
*/
@Override
public void initializeComponents(IDisplayPaneContainer container,
Composite comp) {
super.initializeComponents(container, comp);
adjustPaneLayout(1);
}
public IDisplayPane activateDisplay(int displayId,
final IRenderableDisplay renderableDisplay) {
DisplayData data = displayMap.get(renderableDisplay);
if (data == null) {
data = new DisplayData();
final DisplayData finalData = data;
// // scrollable composite
data.scrollable = new ScrolledComposite(composite, SWT.H_SCROLL
| SWT.V_SCROLL);
data.scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
true, true));
// Composite for canvas comp
data.wrapperComp = new Composite(data.scrollable, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
// Sets background color of wrapper composite to white
data.wrapperComp.setBackground(data.wrapperComp.getDisplay()
.getSystemColor(SWT.COLOR_WHITE));
data.wrapperComp.setSize(1, 1);
data.canvasComp = new Composite(data.wrapperComp, SWT.NONE);
data.canvasComp.setLayout(gl);
data.canvasComp.setSize(1, 1);
// Set canvasComp as content on scrollable
data.scrollable.setContent(data.wrapperComp);
data.scrollable.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event event) {
finalData.scrollableBounds = ((Composite) event.widget)
.getBounds();
setCanvasSize(renderableDisplay, finalData.canvasBounds);
}
});
try {
data.pane = createNewPane(renderableDisplay, data.canvasComp);
registerHandlers(data.pane);
data.canvasComp.layout();
data.scrollableBounds = data.scrollable.getBounds();
data.canvasBounds = data.canvasComp.getBounds();
displayMap.put(renderableDisplay, data);
} catch (Exception e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
return null;
}
}
if (activeData != null) {
setExclude(activeData, true);
}
setExclude(data, false);
activeData = data;
composite.layout();
activatedPane = activeData.pane;
displayPanes.clear();
displayPanes.add((VizDisplayPane) activatedPane);
return activeData.pane;
}
/**
* @param display
*/
public void dispose(IRenderableDisplay display) {
DisplayData data = displayMap.remove(display);
if (data != null) {
data.pane.dispose();
data.scrollable.dispose();
if (activeData == data) {
activeData = null;
activatedPane = null;
displayPanes.clear();
}
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.panes.PaneManager#getLoopProperties()
*/
@Override
public LoopProperties getLoopProperties() {
return loopProperties;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.panes.PaneManager#setLoopProperties(com.raytheon.
* uf.viz.core.datastructure.LoopProperties)
*/
@Override
public void setLoopProperties(LoopProperties loopProperties) {
this.loopProperties = loopProperties;
}
public Rectangle getCanvasSize(IRenderableDisplay display) {
Rectangle bounds = null;
DisplayData data = displayMap.get(display);
if (data != null) {
bounds = data.canvasBounds;
}
return bounds;
}
public void setCanvasSize(IRenderableDisplay display, Rectangle bounds) {
DisplayData data = displayMap.get(display);
if (data == null) {
return;
}
data.canvasBounds = bounds;
data.canvasComp.setSize(bounds.width, bounds.height);
Rectangle scrollableBounds = new Rectangle(data.scrollableBounds.x,
data.scrollableBounds.y, data.scrollableBounds.width,
data.scrollableBounds.height);
// Subtract size of scroll bars if visible
ScrollBar vertical = data.scrollable.getVerticalBar();
ScrollBar horizon = data.scrollable.getHorizontalBar();
if (scrollableBounds.width <= data.canvasBounds.width) {
scrollableBounds.height -= horizon.getSize().y;
}
if (scrollableBounds.height <= data.canvasBounds.height) {
scrollableBounds.width -= vertical.getSize().x;
}
data.wrapperComp.setSize(
Math.max(data.canvasBounds.width, scrollableBounds.width),
Math.max(data.canvasBounds.height, scrollableBounds.height));
data.canvasComp.setLocation(
Math.max(0, (scrollableBounds.width - bounds.width) / 2),
Math.max(0, (scrollableBounds.height - bounds.height) / 2));
data.wrapperComp.layout();
data.canvasComp.layout();
}
private void setExclude(DisplayData data, boolean exclude) {
GridData gd = (GridData) data.scrollable.getLayoutData();
data.scrollable.setVisible(!exclude);
gd.exclude = exclude;
}
}

View file

@ -1,158 +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.editor;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.ui.PartInitException;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditorInput;
import com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResource;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.vividsolutions.jts.geom.Envelope;
/**
* Utilities for setting up collaboration editors.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 19, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class EditorSetup {
/**
* Extracts a SharedEditorData object from the editor passed in.
*
* @param editor
* the editor to extract a shared editor for.
* @return
*/
public static SharedEditorData extractSharedEditorData(AbstractEditor editor) {
SharedEditorData se = new SharedEditorData();
IRenderableDisplay display = editor.getActiveDisplayPane()
.getRenderableDisplay();
if (display instanceof AbstractRenderableDisplay) {
AbstractRenderableDisplay clonedDisplay = ((AbstractRenderableDisplay) display)
.cloneDisplay();
List<ResourcePair> toKeep = new ArrayList<ResourcePair>();
for (ResourcePair rp : display.getDescriptor().getResourceList()) {
if (rp.getResource() instanceof CollaborationWrapperResource) {
CollaborationWrapperResource resource = (CollaborationWrapperResource) rp
.getResource();
ResourcePair copy = new ResourcePair();
copy.setLoadProperties(rp.getLoadProperties());
copy.setProperties(rp.getProperties());
copy.setResourceData(resource.getWrapperResourceData());
toKeep.add(copy);
}
}
ResourceList list = clonedDisplay.getDescriptor().getResourceList();
list.clear();
list.addAll(toKeep);
se.setDisplay(clonedDisplay);
}
// extract grid geometry
IDescriptor desc = display.getDescriptor();
se.setGeometry(desc.getGridGeometry());
// extract extent to get the proper zoom/pan
IExtent extent = editor.getActiveDisplayPane().getRenderableDisplay()
.getExtent();
se.setEnvelope(new Envelope(extent.getMinX(), extent.getMaxX(), extent
.getMinY(), extent.getMaxY()));
// Set current size
Rectangle bounds = display.getBounds();
se.setWidth(bounds.width);
se.setHeight(bounds.height);
return se;
}
/**
* Creates and opens a CollaborationEditor based on the SharedEditorData.
*
* @param sharedEditor
* the data necessary to create the editor
* @return
*/
public static CollaborationEditor createEditor(
SharedEditorData sharedEditor, String sessionId, String title) {
CollaborationEditor editor = null;
AbstractRenderableDisplay disp = sharedEditor.getDisplay();
PixelExtent extent = new PixelExtent(sharedEditor.getEnvelope()
.getMinX(), sharedEditor.getEnvelope().getMaxX(), sharedEditor
.getEnvelope().getMinY(), sharedEditor.getEnvelope().getMaxY());
disp.setExtent(extent);
List<ResourcePair> toRemove = new ArrayList<ResourcePair>();
ResourceList list = disp.getDescriptor().getResourceList();
for (ResourcePair rp : list) {
if (rp.getResourceData() instanceof CollaborationWrapperResourceData) {
rp.setResourceData(((CollaborationWrapperResourceData) rp
.getResourceData()).getWrappedResourceData());
} else {
toRemove.add(rp);
}
}
list.removeAll(toRemove);
try {
CollaborationEditorInput input = new CollaborationEditorInput(disp,
sessionId, title);
editor = (CollaborationEditor) VizWorkbenchManager.getInstance()
.getCurrentWindow().getActivePage()
.openEditor(input, CollaborationEditor.EDITOR_ID);
editor.setCanvasSize(new Rectangle(0, 0, sharedEditor.getWidth(),
sharedEditor.getHeight()));
} catch (PartInitException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
"Error opening collaboration participant editor", e);
}
return editor;
}
}

View file

@ -1,536 +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.role;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
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.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor;
import com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
import com.raytheon.uf.viz.collaboration.ui.editor.event.InputEvent;
import com.raytheon.uf.viz.collaboration.ui.role.dataprovider.CollaborationDispatcher;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResource;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData;
import com.raytheon.uf.viz.collaboration.ui.rsc.DataProviderRscData;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
import com.raytheon.uf.viz.core.VizApp;
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.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener;
import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener;
import com.raytheon.uf.viz.remote.graphics.Dispatcher;
import com.raytheon.uf.viz.remote.graphics.DispatcherFactory;
import com.raytheon.uf.viz.remote.graphics.DispatchingGraphicsFactory;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* TODO: This class is in severe need of a refactor!
*
* Handles the events of a session that are specific to the Data Provider role.
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 26, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class DataProviderEventController extends AbstractRoleEventController
implements IRenderableDisplayChangedListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataProviderEventController.class);
private ResourceWrapperListener wrappingListener;
private DispatcherFactory factory = new DispatcherFactory() {
@Override
public Dispatcher createNewDispatcher(IRenderableDisplay display)
throws InstantiationException {
try {
CollaborationDispatcher dispatcher = new CollaborationDispatcher(
session, display);
dispatchers.add(dispatcher);
dispatcher.setActiveDisplay(activeDisplay);
return dispatcher;
} catch (CollaborationException e) {
throw new InstantiationException(
"Error constructing collaboration dispatcher: "
+ e.getLocalizedMessage());
}
}
};
private List<CollaborationDispatcher> dispatchers = new CopyOnWriteArrayList<CollaborationDispatcher>();
private IRenderableDisplay activeDisplay;
private String tabTitleSuffix;
public DataProviderEventController(ISharedDisplaySession session) {
super(session);
tabTitleSuffix = " ("
+ session.getVenue().getInfo().getVenueDescription() + ")";
}
@Subscribe
public void participantChanged(IVenueParticipantEvent event) {
if (event.getEventType().equals(ParticipantEventType.ARRIVED)
&& !event.getParticipant().equals(session.getUserID())) {
// TODO send over the one that is currently active, not the one
SharedDisplaySessionMgr
.getSessionContainer(this.session.getSessionId())
.getSharedEditors().get(0);
AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class);
SharedEditorData se = EditorSetup.extractSharedEditorData(editor);
// new color for each user
SessionColorManager manager = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getColorManager();
RGB color = manager.getColorFromUser(event.getParticipant());
ColorChangeEvent cce = new ColorChangeEvent(event.getParticipant(),
color);
try {
session.sendObjectToVenue(cce);
session.sendObjectToPeer(event.getParticipant(), se);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM,
"Error sending initialization data to new participant "
+ event.getParticipant().getName(), e);
}
}
}
@Subscribe
public void roleTransferred(TransferRoleCommand cmd) {
if (cmd.getRole() == SharedDisplayRole.SESSION_LEADER) {
session.setCurrentSessionLeader(cmd.getUser());
if (cmd.getUser().getFQName()
.equals(session.getUserID().getFQName())) {
// this cave should assume session leader control
InputUtil.enableDataProviderInput(session.getSessionId());
} else if (session.getCurrentSessionLeader().getFQName()
.equals(session.getUserID().getFQName())
&& !session.getCurrentSessionLeader().getFQName()
.equals(cmd.getUser().getFQName())) {
// this cave should release session leader control
InputUtil.disableDataProviderInput(session.getSessionId());
}
}
}
@Subscribe
public void sessionLeaderInput(InputEvent event) {
// TODO needs to be based on the editor that is both shared and active
final AbstractEditor editor = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId()).getSharedEditors()
.get(0);
IDisplayPane pane = editor.getDisplayPanes()[0];
final Event swtEvent = new Event();
swtEvent.display = editor.getActiveDisplayPane().getDisplay();
// translate event type
switch (event.getType()) {
case MOUSE_DOWN:
swtEvent.type = SWT.MouseDown;
break;
case MOUSE_UP:
swtEvent.type = SWT.MouseUp;
break;
case MOUSE_DOWN_MOVE:
case MOUSE_MOVE:
swtEvent.type = SWT.MouseMove;
break;
case DOUBLE_CLICK:
swtEvent.type = SWT.MouseDoubleClick;
break;
case MOUSE_HOVER:
swtEvent.type = SWT.MouseHover;
break;
case MOUSE_WHEEL:
swtEvent.type = SWT.MouseWheel;
break;
case KEY_DOWN:
swtEvent.type = SWT.KeyDown;
break;
case KEY_UP:
swtEvent.type = SWT.KeyUp;
break;
}
// translate coordinates of event
switch (event.getType()) {
case MOUSE_DOWN:
case MOUSE_DOWN_MOVE:
case MOUSE_UP:
case MOUSE_HOVER:
case MOUSE_MOVE:
case MOUSE_WHEEL:
case DOUBLE_CLICK:
double[] screen = pane.gridToScreen(new double[] { event.getX(),
event.getY(), 0.0 });
swtEvent.x = (int) Math.round(screen[0]);
swtEvent.y = (int) Math.round(screen[1]);
break;
}
// translate specific metadata
switch (event.getType()) {
case MOUSE_DOWN:
case MOUSE_DOWN_MOVE:
case MOUSE_UP:
case DOUBLE_CLICK:
swtEvent.button = event.getEventData();
break;
case MOUSE_WHEEL:
swtEvent.count = event.getEventData();
break;
case KEY_DOWN:
case KEY_UP:
swtEvent.keyCode = event.getEventData();
break;
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
editor.getMouseManager().handleEvent(swtEvent);
}
});
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #startup()
*/
@Override
public void startup() {
super.startup();
SessionContainer sessionContainer = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId());
SessionColorManager manager = sessionContainer.getColorManager();
manager.addUser(session.getCurrentDataProvider());
wrappingListener = new ResourceWrapperListener();
for (AbstractEditor editor : sessionContainer.getSharedEditors()) {
super.activateResources(editor);
// Replace pane resources that will be shared with
// CollaborationWrapperResource objects
for (IDisplayPane pane : editor.getDisplayPanes()) {
handleNewDisplay(pane);
setActiveDisplay(pane.getRenderableDisplay());
}
editor.addRenderableDisplayChangedListener(this);
editor.setTabTitle(editor.getPartName() + tabTitleSuffix);
}
}
private void setActiveDisplay(IRenderableDisplay display) {
this.activeDisplay = display;
for (CollaborationDispatcher dispatcher : dispatchers) {
dispatcher.setActiveDisplay(display);
}
ReprojectEditor event = new ReprojectEditor();
event.setTargetGeometry(display.getDescriptor().getGridGeometry());
try {
session.sendObjectToVenue(event);
} catch (CollaborationException e) {
Activator.statusHandler.handle(
Priority.PROBLEM,
"Error sending reprojection event: "
+ e.getLocalizedMessage(), e);
}
}
/**
* Handles a new display pane
*
* @param pane
* @return true if the pane is not currently being handled by the controller
*/
private boolean handleNewDisplay(IDisplayPane pane) {
boolean newDisplay = false;
for (CollaborationDispatcher dispatcher : dispatchers) {
if (dispatcher.getDisplay() == pane.getRenderableDisplay()) {
// We already have a dispatcher for this display
return false;
}
}
try {
if (DispatchingGraphicsFactory.injectRemoteFunctionality(pane,
factory)) {
// If we injected successfully, do resource management
ResourceList list = pane.getDescriptor().getResourceList();
for (ResourcePair rp : pane.getDescriptor().getResourceList()) {
wrapResourcePair(rp);
}
list.addPreAddListener(wrappingListener);
list.addPostRemoveListener(wrappingListener);
newDisplay = true;
}
} catch (InstantiationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
return newDisplay;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #getResourcesToAdd()
*/
@Override
protected List<ResourcePair> getResourcesToAdd() {
List<ResourcePair> resources = super.getResourcesToAdd();
DataProviderRscData resourceData = new DataProviderRscData();
resourceData.setSessionId(session.getSessionId());
resources.add(ResourcePair.constructSystemResourcePair(resourceData));
return resources;
}
private void sendSharedResource(ResourcePair rp, boolean remove) {
// Send event to venue to load resource
SharedResource sr = new SharedResource();
ResourcePair copy = new ResourcePair();
copy.setLoadProperties(rp.getLoadProperties());
copy.setProperties(rp.getProperties());
if (rp.getResourceData() instanceof CollaborationWrapperResourceData) {
copy.setResourceData(((CollaborationWrapperResourceData) rp
.getResourceData()).getWrappedResourceData());
} else if (rp.getResource() instanceof CollaborationWrapperResource) {
copy.setResourceData(rp.getResource().getResourceData());
}
sr.setResource(copy);
sr.setRemoveResource(remove);
try {
session.sendObjectToVenue(sr);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Wraps ResourcePair in collaboration wrapper resource if resource should
* be loaded on locally for every user in venue
*
* @param rp
* @return true if ResourcePair was wrapped, false otherwise
*/
private boolean wrapResourcePair(ResourcePair rp) {
if (rp.getProperties() != null && rp.getProperties().isMapLayer()
&& (rp.getResource() != null || rp.getResourceData() != null)) {
CollaborationWrapperResourceData wrapperRscData = new CollaborationWrapperResourceData();
if (rp.getResource() != null) {
wrapperRscData.setWrappedResourceData(rp.getResource()
.getResourceData());
rp.setResource(new CollaborationWrapperResource(wrapperRscData,
rp.getLoadProperties(), rp.getResource()));
} else {
wrapperRscData.setWrappedResourceData(rp.getResourceData());
}
if (rp.getResourceData() != null) {
rp.setResourceData(wrapperRscData);
}
return true;
}
return false;
}
private void unwrapResourcePair(ResourcePair rp) {
if (rp.getResource() instanceof CollaborationWrapperResource) {
rp.setResource(((CollaborationWrapperResource) rp.getResource())
.getWrappedResource());
rp.setResourceData(rp.getResource().getResourceData());
} else if (rp.getResourceData() instanceof CollaborationWrapperResourceData) {
rp.setResourceData(((CollaborationWrapperResourceData) rp
.getResourceData()).getWrappedResourceData());
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #shutdown()
*/
@Override
public void shutdown() {
// Dispatchers created are responsible for display extraction
for (CollaborationDispatcher dispatcher : dispatchers) {
disposeDispatcher(dispatcher);
}
super.shutdown();
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId());
if (sc != null) {
for (AbstractEditor editor : sc.getSharedEditors()) {
partClosed(editor);
}
}
}
private void disposeDispatcher(CollaborationDispatcher dispatcher) {
dispatcher.dispose();
if (PlatformUI.getWorkbench().isClosing() == false) {
// Extract the remote functionality
IRenderableDisplay display = dispatcher.getDisplay();
for (IDisplayPane pane : display.getContainer().getDisplayPanes()) {
if (pane.getRenderableDisplay() == display) {
super.deactivateResources(display);
ResourceList list = pane.getDescriptor().getResourceList();
for (ResourcePair rp : list) {
unwrapResourcePair(rp);
}
list.removePreAddListener(wrappingListener);
list.removePostRemoveListener(wrappingListener);
DispatchingGraphicsFactory.extractRemoteFunctionality(pane);
break;
}
}
}
dispatchers.remove(dispatcher);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #partClosed(org.eclipse.ui.IWorkbenchPart)
*/
@Override
public void partClosed(IWorkbenchPart part) {
super.partClosed(part);
if (part instanceof AbstractEditor) {
AbstractEditor editor = (AbstractEditor) part;
editor.removeRenderableDisplayChangedListener(this);
String partName = editor.getPartName();
if (partName.endsWith(tabTitleSuffix)) {
editor.setTabTitle(partName.substring(0, partName.length()
- tabTitleSuffix.length()));
}
for (IDisplayPane pane : editor.getDisplayPanes()) {
for (CollaborationDispatcher dispatcher : dispatchers) {
if (pane.getRenderableDisplay() == dispatcher.getDisplay()) {
disposeDispatcher(dispatcher);
return;
}
}
}
}
}
private class ResourceWrapperListener implements AddListener,
RemoveListener {
@Override
public void notifyAdd(ResourcePair rp) throws VizException {
if (wrapResourcePair(rp)) {
// Send event to venue to load
sendSharedResource(rp, false);
}
}
@Override
public void notifyRemove(ResourcePair rp) throws VizException {
if (rp.getResource() instanceof CollaborationWrapperResource) {
// Send event to venue to unload
sendSharedResource(rp, true);
}
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.IRenderableDisplayChangedListener#
* renderableDisplayChanged(com.raytheon.uf.viz.core.IDisplayPane,
* com.raytheon.uf.viz.core.drawables.IRenderableDisplay,
* com.raytheon.uf.viz
* .core.IRenderableDisplayChangedListener.DisplayChangeType)
*/
@Override
public void renderableDisplayChanged(IDisplayPane pane,
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
if (type == DisplayChangeType.ADD) {
if (handleNewDisplay(pane)) {
activateResources(newRenderableDisplay);
}
if (newRenderableDisplay.getGraphicsAdapter() instanceof DispatchingGraphicsFactory) {
for (CollaborationDispatcher dispatcher : dispatchers) {
if (dispatcher.getDisplay() == newRenderableDisplay) {
setActiveDisplay(newRenderableDisplay);
break;
}
}
}
}
}
}

View file

@ -1,170 +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.role;
import java.util.List;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.editor.input.CollaborationInputHandler;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.event.EventForwardingInputHandler;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 9, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class InputUtil {
/**
* Gets the CollaborationInputHandler associated with an editor.
*
* @param editor
* @return
*/
public static CollaborationInputHandler getCollaborationInputHandler(
CollaborationEditor editor) {
CollaborationInputHandler handler = null;
IInputHandler[] array = editor.getInputManager()
.getHandlersForPriority(InputPriority.SYSTEM_RESOURCE);
for (IInputHandler h : array) {
if (h instanceof CollaborationInputHandler) {
handler = (CollaborationInputHandler) h;
break;
}
}
return handler;
}
/**
* Gets the CollaborationInputHandler associated with an editor.
*
* @param editor
* @return
*/
public static CollaborationInputHandler getCollaborationInputHandler(
AbstractEditor editor) {
CollaborationInputHandler handler = null;
IInputHandler[] array = editor.getMouseManager()
.getHandlersForPriority(InputPriority.SYSTEM_RESOURCE);
for (IInputHandler h : array) {
if (h instanceof CollaborationInputHandler) {
handler = (CollaborationInputHandler) h;
break;
}
}
return handler;
}
/**
* Disables the data provider's input on the actively shared editors by
* adding a CollaborationInputHandler that disables other inputs.
*
* @param sessionId
* the session to disable input for
*/
public static void disableDataProviderInput(String sessionId) {
List<AbstractEditor> list = SharedDisplaySessionMgr
.getSessionContainer(sessionId).getSharedEditors();
for (AbstractEditor editor : list) {
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
if (handler == null) {
handler = new CollaborationInputHandler();
editor.registerMouseHandler(handler,
InputPriority.SYSTEM_RESOURCE);
}
List<IInputHandler> handlers = handler.getRegisteredHandlers();
for (IInputHandler input : handlers) {
handler.unregisterInputHandler(input);
}
// TODO need to leave telestrator power in the editor
}
}
/**
* Enables the standard input on editors for a data provider by removing a
* CollaborationInputHandler on the shared editors.
*
* @param sessionId
* the session to enable the input on editors
*/
public static void enableDataProviderInput(String sessionId) {
List<AbstractEditor> list = SharedDisplaySessionMgr
.getSessionContainer(sessionId).getSharedEditors();
for (AbstractEditor editor : list) {
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
if (handler != null) {
editor.unregisterMouseHandler(handler);
}
}
}
/**
* Enables a session leader's input on a CollaborationEditor by adding an
* EventForwardingInputHandler that sends events back to the Data Provider.
*
* @param editor
* the editor to enable input for
*/
public static void enableSessionLeaderInput(CollaborationEditor editor) {
IDisplayPane pane = editor.getActiveDisplayPane();
ISharedDisplaySession session = SharedDisplaySessionMgr
.getSessionContainer(editor.getSessionId()).getSession();
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
EventForwardingInputHandler mouseHandler = new EventForwardingInputHandler(
session, pane);
handler.registerInputHandler(mouseHandler);
}
/**
* Disables a session leader's input on the CollaborationEditor by removing
* the EventForwardingInputHandler.
*
* @param editor
* the editor to disable input for
*/
public static void disableSessionLeaderInput(CollaborationEditor editor) {
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
for (IInputHandler h : handler.getRegisteredHandlers()) {
handler.unregisterInputHandler(h);
}
// TODO need to leave telestrator power in the editor
}
}

View file

@ -1,207 +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.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.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.editor.ReprojectEditor;
import com.raytheon.uf.viz.collaboration.display.editor.SharedEditorData;
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
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.ResourceProperties;
/**
* Handles the events of a session that are specific to the Participant role.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 26, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ParticipantEventController extends AbstractRoleEventController {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ParticipantEventController.class);
public ParticipantEventController(ISharedDisplaySession session) {
super(session);
}
@Subscribe
public void editorDataArrived(final SharedEditorData se) {
// TODO need to detect if we already have a CollaborationEditor for
// this session. If so, that implies DataProvider changed and we
// should reuse the editor, reinitializing the descriptor and
// renderable display but keeping the drawing and telestrator
VizApp.runSync(new Runnable() {
@Override
public void run() {
String sessionId = ParticipantEventController.this.session
.getSessionId();
SessionContainer container = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
String title = session.getVenue().getInfo()
.getVenueDescription();
// initialize and open editor
CollaborationEditor editor = EditorSetup.createEditor(se,
sessionId, title);
container.setCollaborationEditor(editor);
initializeResources(editor.getDisplay().getDescriptor());
activateResources(editor.getDisplay());
}
});
}
@Subscribe
public void reprojectEditor(final ReprojectEditor event) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
CollaborationEditor editor = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor();
if (editor != null) {
// Only reproject if editor has been created
IDisplayPane pane = editor.getActiveDisplayPane();
IDescriptor desc = pane.getDescriptor();
if (desc instanceof AbstractDescriptor) {
try {
((AbstractDescriptor) desc).setGridGeometry(event
.getTargetGeometry());
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Error reprojecting collaboration display: "
+ e.getLocalizedMessage(), e);
}
}
pane.setZoomLevel(1.0);
pane.scaleToClientArea();
pane.refresh();
}
}
});
}
@Subscribe
public void resourceDataArrived(SharedResource sr) {
ResourcePair rp = sr.getResource();
// TODO: Need to tie shared resource adding to a displayId so we add it
// to the correct editor/pane
CollaborationEditor editor = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor();
IDescriptor affectedDescriptor = editor.getActiveDisplayPane()
.getDescriptor();
if (sr.isRemoveResource()) {
affectedDescriptor.getResourceList().remove(
convertToLocalResourcePair(rp));
} else {
affectedDescriptor.getResourceList().add(
convertToLocalResourcePair(rp));
affectedDescriptor.getResourceList().instantiateResources(
affectedDescriptor, true);
}
}
private ResourcePair convertToLocalResourcePair(ResourcePair rp) {
if (rp.getProperties() != null) {
rp.getProperties().setSystemResource(true);
} else {
ResourceProperties props = new ResourceProperties();
props.setSystemResource(true);
rp.setProperties(props);
}
return rp;
}
private void initializeResources(IDescriptor desc) {
CollaborationResourceData crd = new CollaborationResourceData();
crd.setSession(session);
ResourcePair rp = ResourcePair.constructSystemResourcePair(crd);
desc.getResourceList().add(rp);
desc.getResourceList().instantiateResources(desc, true);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
* #shutdown()
*/
@Override
public void shutdown() {
super.shutdown();
SessionContainer container = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId());
if (container != null) {
super.deactivateResources(container.getCollaborationEditor()
.getDisplay());
}
}
@Subscribe
public void roleTransferred(TransferRoleCommand cmd) {
if (cmd.getRole() == SharedDisplayRole.SESSION_LEADER) {
session.setCurrentSessionLeader(cmd.getUser());
if (cmd.getUser().getFQName()
.equals(session.getUserID().getFQName())) {
// this cave should assume session leader control
InputUtil.enableSessionLeaderInput(SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor());
} else if (session.getCurrentSessionLeader().getFQName()
.equals(session.getUserID().getFQName())
&& !session.getCurrentSessionLeader().getFQName()
.equals(cmd.getUser().getFQName())) {
// this cave should release session leader control
InputUtil.disableSessionLeaderInput(SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor());
}
}
}
}

View file

@ -67,10 +67,10 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
import com.raytheon.uf.viz.collaboration.ui.actions.PopupNotifier;
import com.raytheon.uf.viz.collaboration.ui.data.AlertWord;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.icon.IconUtil;
import com.raytheon.uf.viz.notification.notifier.PopupNotifier;
import com.raytheon.viz.ui.views.CaveFloatingView;
/**

View file

@ -21,7 +21,9 @@ package com.raytheon.uf.viz.collaboration.ui.session;
**/
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.jface.action.Action;
@ -57,26 +59,31 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.IRemoteDisplayChangedListener;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteDisplay;
import com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.RemoteDisplayChangeType;
import com.raytheon.uf.viz.collaboration.display.data.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.display.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.display.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
import com.raytheon.uf.viz.collaboration.display.rsc.SelfAddingSystemResourceListener;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingEvent;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResource;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResourceData;
import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.ui.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.ui.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationDrawingResource;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.core.ContextManager;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.icon.IconUtil;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.drawing.DrawingToolLayer;
import com.raytheon.uf.viz.drawing.DrawingToolLayer.DrawMode;
import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* TODO Add Description
* View class for a collaboration session
*
* <pre>
*
@ -92,7 +99,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* @version 1.0
*/
public class CollaborationSessionView extends SessionView implements
IPartListener {
IPartListener, IRemoteDisplayChangedListener {
public static final String ID = "com.raytheon.uf.viz.collaboration.CollaborationSession";
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -100,6 +107,13 @@ public class CollaborationSessionView extends SessionView implements
private static final String COLLABORATION_SESSION_IMAGE_NAME = "messages.gif";
private Runnable actionUpdater = new Runnable() {
@Override
public void run() {
updateToolItems();
}
};
private Action colorChangeAction;
private ActionContributionItem drawAction;
@ -116,39 +130,33 @@ public class CollaborationSessionView extends SessionView implements
private ISharedDisplaySession session;
private CollaborationDrawingResource getCurrentResource() {
CollaborationDrawingResource resource = null;
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
List<IRenderableDisplay> displays = new ArrayList<IRenderableDisplay>();
if (sc.getCollaborationEditor() == null) {
for (AbstractEditor editor : sc.getSharedEditors()) {
ResourceList list = editor.getActiveDisplayPane()
.getDescriptor().getResourceList();
resource = getCurrentResource(list);
if (resource != null) {
break;
}
private IRemoteDisplayContainer container;
private IRenderableDisplay currentDisplay;
private boolean locked = false;
private DrawMode drawMode = DrawMode.NONE;
private Map<IRenderableDisplay, SelfAddingSystemResourceListener> listeners = new IdentityHashMap<IRenderableDisplay, SelfAddingSystemResourceListener>();
public CollaborationDrawingResource getCurrentDrawingResource() {
CollaborationDrawingResource currentResource = null;
if (currentDisplay != null) {
for (CollaborationDrawingResource resource : currentDisplay
.getDescriptor()
.getResourceList()
.getResourcesByTypeAsType(
CollaborationDrawingResource.class)) {
currentResource = resource;
break;
}
} else {
resource = getCurrentResource(SharedDisplaySessionMgr
.getSessionContainer(sessionId).getCollaborationEditor()
.getDisplay().getDescriptor().getResourceList());
}
return resource;
}
private CollaborationDrawingResource getCurrentResource(ResourceList rl) {
for (CollaborationDrawingResource resource : rl
.getResourcesByTypeAsType(CollaborationDrawingResource.class)) {
return resource;
}
return null;
return currentResource;
}
private DrawingToolLayer getCurrentLayer() {
CollaborationDrawingResource resource = getCurrentResource();
CollaborationDrawingResource resource = getCurrentDrawingResource();
if (resource != null) {
return resource.getDrawingLayerFor(resource.getMyUser());
}
@ -164,6 +172,22 @@ public class CollaborationSessionView extends SessionView implements
public void init(IViewSite site) throws PartInitException {
super.init(site);
site.getPage().addPartListener(this);
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
if (sc != null) {
session = sc.getSession();
if (sc.getCollaborationEditor() != null) {
container = sc.getCollaborationEditor();
} else {
container = SharedEditorsManager.getManager(session);
}
container.addRemoteDisplayChangedListener(this);
RemoteDisplay remoteDisplay = container.getActiveDisplay();
if (remoteDisplay != null) {
remoteDisplayChanged(container.getActiveDisplay(),
RemoteDisplayChangeType.ACTIVATED);
}
}
}
protected void createActions() {
@ -204,10 +228,13 @@ public class CollaborationSessionView extends SessionView implements
@Override
public void run() {
DrawingToolLayer layer = getCurrentLayer();
if (layer.getDrawMode() == DrawMode.DRAW) {
layer.setDrawMode(DrawMode.NONE);
} else {
layer.setDrawMode(DrawMode.DRAW);
if (layer != null) {
if (layer.getDrawMode() == DrawMode.DRAW) {
layer.setDrawMode(DrawMode.NONE);
} else {
layer.setDrawMode(DrawMode.DRAW);
}
drawMode = layer.getDrawMode();
}
updateToolItems();
}
@ -258,6 +285,7 @@ public class CollaborationSessionView extends SessionView implements
} else {
layer.setDrawMode(DrawMode.ERASE);
}
drawMode = layer.getDrawMode();
}
updateToolItems();
}
@ -284,10 +312,11 @@ public class CollaborationSessionView extends SessionView implements
lockAction = new ActionContributionItem(new Action(
"Lock Collaborators", SWT.TOGGLE) {
public void run() {
CollaborationDrawingResource resource = getCurrentResource();
CollaborationDrawingResource resource = getCurrentDrawingResource();
if (resource != null) {
resource.setLockingDrawing(((ToolItem) lockAction
.getWidget()).getSelection());
locked = resource.isLockingDrawing();
updateToolItems();
}
};
@ -305,11 +334,20 @@ public class CollaborationSessionView extends SessionView implements
mgr.insert(mgr.getSize() - 1, eraseAction);
mgr.insert(mgr.getSize() - 1, lockAction);
mgr.insert(mgr.getSize() - 1, new Separator());
updateToolItems();
}
public void updateToolItems() {
DrawingToolLayer layer = getCurrentLayer();
if (layer != null) {
CollaborationDrawingResource currentResource = getCurrentDrawingResource();
DrawingToolLayer layer = null;
if (currentResource != null) {
layer = currentResource.getDrawingLayerFor(currentResource
.getMyUser());
}
if (layer != null
&& (currentResource.isLockingDrawing() == false || currentResource
.isSessionLeader())) {
drawAction.getAction().setEnabled(true);
undoAction.getAction().setEnabled(layer.canUndo());
redoAction.getAction().setEnabled(layer.canRedo());
@ -329,10 +367,15 @@ public class CollaborationSessionView extends SessionView implements
eraseAction.getAction().setChecked(false);
break;
}
CollaborationDrawingResource resource = getCurrentResource();
if (resource != null && !resource.isSessionLeader()) {
lockAction.getAction().setEnabled(false);
}
lockAction.getAction().setChecked(
currentResource.isLockingDrawing());
} else {
drawAction.getAction().setEnabled(false);
undoAction.getAction().setEnabled(false);
redoAction.getAction().setEnabled(false);
clearAction.getAction().setEnabled(false);
eraseAction.getAction().setEnabled(false);
lockAction.getAction().setEnabled(false);
}
}
@ -432,21 +475,8 @@ public class CollaborationSessionView extends SessionView implements
}
@Subscribe
public void receiveLocking(CollaborationDrawingEvent event) {
if (event.getType() == CollaborationEventType.TOGGLE_LOCK) {
CollaborationDrawingResource resource = getCurrentResource();
if (resource != null && !resource.isSessionLeader()) {
if (drawAction.getAction().isEnabled()) {
drawAction.getAction().setEnabled(false);
undoAction.getAction().setEnabled(false);
redoAction.getAction().setEnabled(false);
clearAction.getAction().setEnabled(false);
eraseAction.getAction().setEnabled(false);
} else {
updateToolItems();
}
}
}
public void collaborationEvent(CollaborationDrawingEvent event) {
VizApp.runAsync(actionUpdater);
}
/*
@ -467,20 +497,13 @@ public class CollaborationSessionView extends SessionView implements
label.setText(labelInfo.toString());
}
@Override
protected void setSession(String sessionId) {
super.setSession(sessionId);
this.session = (ISharedDisplaySession) CollaborationConnection
.getConnection().getSession(sessionId);
}
public String getSessionId() {
return session.getSessionId();
}
@Override
public void dispose() {
CollaborationEditor assocEditor = SharedDisplaySessionMgr
ICollaborationEditor assocEditor = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getCollaborationEditor();
if (assocEditor != null) {
@ -494,6 +517,9 @@ public class CollaborationSessionView extends SessionView implements
session.close();
super.dispose();
getSite().getPage().removePartListener(this);
if (container != null) {
container.removeRemoteDisplayChangedListener(this);
}
}
// =================== Context activation code ===================
@ -506,14 +532,17 @@ public class CollaborationSessionView extends SessionView implements
*/
@Override
public void partActivated(IWorkbenchPart part) {
// do this only if we care about the part being activated
// only done if we care about the part that was activated
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
List<IEditorPart> editors = new ArrayList<IEditorPart>();
editors.add(sc.getCollaborationEditor());
if (sc.getSharedEditors() != null) {
editors.addAll(sc.getSharedEditors());
if (sc.getCollaborationEditor() == null) {
editors.addAll(SharedEditorsManager.getManager(sc.getSession())
.getSharedEditors());
} else {
editors.add(sc.getCollaborationEditor());
}
if (this == part || editors.contains(part)) {
ContextManager
.getInstance(getSite().getPage().getWorkbenchWindow())
@ -555,10 +584,13 @@ public class CollaborationSessionView extends SessionView implements
SessionContainer sc = SharedDisplaySessionMgr
.getSessionContainer(sessionId);
List<IEditorPart> editors = new ArrayList<IEditorPart>();
editors.add(sc.getCollaborationEditor());
if (sc.getSharedEditors() != null) {
editors.addAll(sc.getSharedEditors());
if (sc.getCollaborationEditor() == null) {
editors.addAll(SharedEditorsManager.getManager(sc.getSession())
.getSharedEditors());
} else {
editors.add(sc.getCollaborationEditor());
}
if (this == part || editors.contains(part)) {
ContextManager
.getInstance(getSite().getPage().getWorkbenchWindow())
@ -576,4 +608,63 @@ public class CollaborationSessionView extends SessionView implements
public void partOpened(IWorkbenchPart part) {
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer.
* IRemoteDisplayChangedListener
* #remoteDisplayChanged(com.raytheon.uf.viz.core
* .drawables.IRenderableDisplay,
* com.raytheon.uf.viz.collaboration.display.IRemoteDisplayContainer
* .RemoteDisplayChangeType)
*/
@Override
public void remoteDisplayChanged(RemoteDisplay remoteDisplay,
RemoteDisplayChangeType changeType) {
IRenderableDisplay display = remoteDisplay.getDisplay();
int displayId = remoteDisplay.getDisplayId();
switch (changeType) {
case CREATED:
if (listeners.containsKey(display) == false) {
CollaborationDrawingResourceData resourceData = new CollaborationDrawingResourceData();
resourceData.setSessionId(sessionId);
resourceData.setDisplayId(displayId);
try {
listeners.put(display,
new SelfAddingSystemResourceListener(resourceData,
display.getDescriptor()));
display.refresh();
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
break;
case ACTIVATED:
if (listeners.containsKey(display) == false) {
remoteDisplayChanged(remoteDisplay,
RemoteDisplayChangeType.CREATED);
}
currentDisplay = display;
CollaborationDrawingResource resource = getCurrentDrawingResource();
if (resource != null && resource.isSessionLeader()) {
resource.setLockingDrawing(locked);
resource.getDrawingLayerFor(resource.getMyUser()).setDrawMode(
drawMode);
}
VizApp.runAsync(actionUpdater);
break;
case DISPOSED:
SelfAddingSystemResourceListener listener = listeners
.remove(display);
if (listener != null) {
listener.dispose();
}
if (display == currentDisplay) {
currentDisplay = null;
VizApp.runAsync(actionUpdater);
}
break;
}
}
}

View file

@ -43,8 +43,8 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
import com.raytheon.uf.viz.collaboration.comm.provider.session.SharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
/**
* Generate the Participant's label and icon image.

View file

@ -55,6 +55,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@ -73,7 +74,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConnection;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.collaboration.display.data.SessionColorManager;
import com.raytheon.uf.viz.core.VizApp;
/**
@ -577,6 +578,19 @@ public class SessionView extends AbstractSessionView {
label.setText(labelInfo.toString());
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite)
*/
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
this.sessionId = site.getSecondaryId();
this.session = (IVenueSession) CollaborationConnection.getConnection()
.getSession(this.sessionId);
}
/*
* (non-Javadoc)
*
@ -585,19 +599,12 @@ public class SessionView extends AbstractSessionView {
*/
@Override
protected String getSessionName() {
setSession(getViewSite().getSecondaryId());
if (session == null) {
return sessionId;
}
return session.getVenue().getInfo().getVenueDescription();
}
protected void setSession(String sessionId) {
this.sessionId = sessionId;
this.session = (IVenueSession) CollaborationConnection.getConnection()
.getSession(this.sessionId);
}
@Subscribe
public void participantHandler(IVenueParticipantEvent event)
throws Exception {

View file

@ -19,23 +19,21 @@
**/
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.IEditorPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.display.editor.ICollaborationEditor;
import com.raytheon.uf.viz.collaboration.display.roles.dataprovider.SharedEditorsManager;
import com.raytheon.uf.viz.collaboration.display.rsc.telestrator.CollaborationDrawingResource;
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;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Action for invoking undo/redo on the CollaborationDrawingToolbar
@ -73,43 +71,43 @@ public class UndoRedoHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
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);
}
String sessionId = null;
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof ICollaborationEditor) {
sessionId = ((ICollaborationEditor) editor).getSessionId();
} else if (editor instanceof AbstractEditor) {
ISharedDisplaySession session = SharedEditorsManager
.getSharedEditorSession((AbstractEditor) editor);
if (session != null) {
sessionId = session.getSessionId();
}
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();
}
if (sessionId != null) {
for (IViewReference ref : window.getActivePage()
.getViewReferences()) {
if (CollaborationSessionView.ID.equals(ref.getId())) {
CollaborationSessionView view = (CollaborationSessionView) ref
.getView(false);
if (sessionId.equals(view.getSessionId())) {
CollaborationDrawingResource resource = view
.getCurrentDrawingResource();
if (resource != null) {
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();
}
view.updateToolItems();
break;
}
}
}
}
}
}
return null;
}

View file

@ -754,16 +754,17 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
return gridGeometry;
}
/**
* Set the grid geometry
/*
* (non-Javadoc)
*
* @param gridGeometry
* the gridGeometry to set
* @throws VizException
* @see
* com.raytheon.uf.viz.core.drawables.IDescriptor#setGridGeometry(org.geotools
* .coverage.grid.GeneralGridGeometry)
*/
public void setGridGeometry(GeneralGridGeometry gridGeometry)
@Override
public void setGridGeometry(GeneralGridGeometry geometry)
throws VizException {
this.gridGeometry = gridGeometry;
this.gridGeometry = geometry;
init();
}

View file

@ -26,6 +26,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.AbstractTimeMatcher;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
@ -320,6 +321,15 @@ public interface IDescriptor extends IResourceGroup {
*/
public abstract GeneralGridGeometry getGridGeometry();
/**
* Set the geometry for the descriptor
*
* @param geometry
* @throws VizException
*/
public abstract void setGridGeometry(GeneralGridGeometry geometry)
throws VizException;
/**
* DEPRECATED, use getFrameCoordinator().changeFrame(...) with
* IFrameCoordinator.FrameChangeOperation/FrameChangeMode

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.core.map;
import org.geotools.coverage.grid.GeneralGridGeometry;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.TransformException;
@ -141,16 +140,6 @@ public interface IMapDescriptor extends IDescriptor {
Coordinate ur) throws FactoryException, TransformException,
VizException;
/**
* Set the grid geometry
*
* @param gridGeometry
* the gridGeometry to set
* @throws VizException
*/
public abstract void setGridGeometry(GeneralGridGeometry gridGeometry)
throws VizException;
/**
* Get the current map width
*

View file

@ -351,10 +351,12 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
*
*/
public final void dispose() {
status = ResourceStatus.DISPOSED;
disposeInternal();
for (IDisposeListener listener : disposeListeners) {
listener.disposed(this);
if (status == ResourceStatus.INITIALIZED) {
status = ResourceStatus.DISPOSED;
disposeInternal();
for (IDisposeListener listener : disposeListeners) {
listener.disposed(this);
}
}
}

View file

@ -374,6 +374,10 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
// eat exception
}
}
synchronized (resourcesToInstantiate) {
resourcesToInstantiate.clear();
}
}
/*

View file

@ -442,9 +442,8 @@ public class DrawingToolLayer implements IRenderable {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Could not add line, bad geometry", e);
}
currentDrawingLine = null;
}
currentDrawingLine = null;
}
}

View file

@ -99,6 +99,9 @@ public class DrawingToolUIManager extends InputAdapter {
pencil.dispose();
container.unregisterMouseHandler(this);
if (currentShell != null) {
currentShell.setCursor(null);
}
}
/*

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,8 +0,0 @@
#Thu Apr 26 12:40:33 CDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,14 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Notification
Bundle-SymbolicName: com.raytheon.uf.viz.notification
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.notification.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.notification,
com.raytheon.uf.viz.notification.notifier

Some files were not shown because too many files have changed in this diff Show more