Issue #427 legend for shared editor
Change-Id: I98832ade44f7019f108e125d4bfefe6e37e4e9f7 Former-commit-id:a1d56fae3f
[formerly71ff27c001
[formerly c0fc780c73d16055b022af269628dfa0b3e5591e]] Former-commit-id:71ff27c001
Former-commit-id:392818bb51
This commit is contained in:
parent
559bae6041
commit
a1b258a4b4
6 changed files with 135 additions and 42 deletions
|
@ -1,4 +1,4 @@
|
|||
com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor
|
||||
com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData
|
||||
com.raytheon.uf.viz.collaboration.ui.editor.SharedResource
|
||||
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData
|
||||
com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResourceData
|
||||
|
|
|
@ -19,17 +19,19 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.editor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
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.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationWrapperResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.SharedEditorIndicatorRsc;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||
|
@ -38,7 +40,7 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
import com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.uf.viz.core.rsc.GenericResourceData;
|
||||
import com.raytheon.viz.ui.UiUtil;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
@ -65,8 +67,6 @@ public class EditorSetup {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(EditorSetup.class);
|
||||
|
||||
public static final String PATH = "/tmp/sharedEditor.xml"; // TODO delete
|
||||
|
||||
/**
|
||||
* Extracts a SharedEditor object from the editor passed in.
|
||||
*
|
||||
|
@ -74,10 +74,10 @@ public class EditorSetup {
|
|||
* the editor to extract a shared editor for.
|
||||
* @return
|
||||
*/
|
||||
public static SharedEditor extractSharedEditor(AbstractEditor editor) {
|
||||
public static SharedEditorData extractSharedEditor(AbstractEditor editor) {
|
||||
// AbstractEditor editor = (AbstractEditor) EditorUtil
|
||||
// .findEditor(editorId);
|
||||
SharedEditor se = new SharedEditor();
|
||||
SharedEditorData se = new SharedEditorData();
|
||||
|
||||
// extract grid geometry
|
||||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
||||
|
@ -108,7 +108,7 @@ public class EditorSetup {
|
|||
return se;
|
||||
}
|
||||
|
||||
public static CollaborationEditor createEditor(SharedEditor sharedEditor) {
|
||||
public static CollaborationEditor createEditor(SharedEditorData sharedEditor) {
|
||||
CollaborationEditor editor = null;
|
||||
AbstractRenderableDisplay[] displays = new AbstractRenderableDisplay[1];
|
||||
try {
|
||||
|
@ -135,35 +135,33 @@ public class EditorSetup {
|
|||
return editor;
|
||||
}
|
||||
|
||||
// TODO delete
|
||||
public static void testSaveEditorData() {
|
||||
AbstractEditor editor = (AbstractEditor) EditorUtil.getActiveEditor();
|
||||
SharedEditor se = extractSharedEditor(editor);
|
||||
try {
|
||||
SerializationUtil.jaxbMarshalToXmlFile(se, PATH);
|
||||
} catch (SerializationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
public static void shareEditor(String sessionId, AbstractEditor editor)
|
||||
throws CollaborationException {
|
||||
ISharedDisplaySession session = (ISharedDisplaySession) CollaborationDataManager
|
||||
.getInstance().getSession(sessionId);
|
||||
if (!session.getUserID().equals(session.getCurrentDataProvider())) {
|
||||
throw new CollaborationException(
|
||||
"Incorrect role to share an editor");
|
||||
} else if (editor instanceof CollaborationEditor) {
|
||||
throw new CollaborationException(
|
||||
"Cannot share a CollaborationEditor");
|
||||
}
|
||||
|
||||
}
|
||||
IDescriptor desc = editor.getActiveDisplayPane().getRenderableDisplay()
|
||||
.getDescriptor();
|
||||
GenericResourceData grd = new GenericResourceData(
|
||||
SharedEditorIndicatorRsc.class);
|
||||
ResourcePair rp = new ResourcePair();
|
||||
rp.setResourceData(grd);
|
||||
desc.getResourceList().add(rp);
|
||||
desc.getResourceList().instantiateResources(desc, true);
|
||||
SharedEditorIndicatorRsc rsc = (SharedEditorIndicatorRsc) rp
|
||||
.getResource();
|
||||
rsc.setSubject(((IVenueSession) session).getSubject());
|
||||
|
||||
// TODO delete
|
||||
public static SharedEditor testLoadEditorData() {
|
||||
File file = new File(PATH);
|
||||
if (!file.exists()) {
|
||||
testSaveEditorData();
|
||||
}
|
||||
// TODO this method should be called by the ShareEditorAction
|
||||
|
||||
SharedEditor se = null;
|
||||
try {
|
||||
se = (SharedEditor) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(PATH);
|
||||
} catch (SerializationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
return se;
|
||||
// TODO should max's target injection be over here too?
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,9 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
|||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
/**
|
||||
* A SharedEditor is a POJO to be sent out by the Data Provider that contains
|
||||
* enough information to create the CollaborationEditor for the participants.
|
||||
* A SharedEditorData is a POJO to be sent out by the Data Provider that
|
||||
* contains enough information to create the CollaborationEditor for the
|
||||
* participants.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -56,7 +57,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
public class SharedEditor implements ISerializableObject, IInitData {
|
||||
public class SharedEditorData implements ISerializableObject, IInitData {
|
||||
|
||||
/** The geometry of the descriptor */
|
||||
private GeneralGridGeometry geometry;
|
|
@ -34,7 +34,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData;
|
||||
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.rsc.CollaborationWrapperResource;
|
||||
|
@ -89,7 +89,7 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
// specifically shared with this session
|
||||
AbstractEditor editor = EditorUtil
|
||||
.getActiveEditorAs(AbstractEditor.class);
|
||||
SharedEditor se = EditorSetup.extractSharedEditor(editor);
|
||||
SharedEditorData se = EditorSetup.extractSharedEditor(editor);
|
||||
try {
|
||||
session.sendObjectToPeer(event.getParticipant()
|
||||
.getQualifiedId(), se);
|
||||
|
@ -256,6 +256,15 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
return dispatcher;
|
||||
}
|
||||
});
|
||||
try {
|
||||
EditorSetup.shareEditor(this.session.getSessionId(),
|
||||
(AbstractEditor) container);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
|||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData;
|
||||
|
@ -67,7 +67,7 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void editorDataArrived(final SharedEditor se) {
|
||||
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
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.rsc;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.GenericResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
||||
/**
|
||||
* A resource for displaying to the user that they are currently sharing this
|
||||
* editor with a particular session.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 13, 2012 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SharedEditorIndicatorRsc extends
|
||||
AbstractVizResource<GenericResourceData, IDescriptor> {
|
||||
|
||||
protected String subject;
|
||||
|
||||
public SharedEditorIndicatorRsc(GenericResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposeInternal() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "Sharing with " + subject;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue