Issue #427 cleanup and fix errors

Change-Id: I4d949cf2e5a874793df875de8eed9b296801e32c

Former-commit-id: 2daf829da1 [formerly 82906d1200] [formerly ee90af8052] [formerly 6b0d3a958c [formerly ee90af8052 [formerly ae78675364b412d2b06da0819e87618b8c9ab6a8]]]
Former-commit-id: 6b0d3a958c
Former-commit-id: 80b0af7b683700c0174333695c2e49c7398a7663 [formerly e6bce354e8]
Former-commit-id: 5aeccb9ed5
This commit is contained in:
Nate Jensen 2012-04-17 18:05:24 -05:00
parent 142730720e
commit 4c83cb567c
11 changed files with 141 additions and 209 deletions

View file

@ -625,22 +625,23 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
} else {
createTextOnlyView(result);
}
try {
if (result.isInviteUsers()) {
IVenueSession session = CollaborationDataManager
.getInstance().getSession(result.getSessionId());
List<String> usersList = new ArrayList<String>();
for (CollaborationUser user : getSelectedUsers()) {
usersList.add(user.getId());
}
String b = result.getInviteMessage();
session.sendInvitation(usersList, b);
}
} catch (Exception e) {
statusHandler.error("Error sending invitation", e);
}
}
try {
if (result.isInviteUsers()) {
IVenueSession session = CollaborationDataManager.getInstance()
.getSession(result.getSessionId());
List<String> usersList = new ArrayList<String>();
for (CollaborationUser user : getSelectedUsers()) {
usersList.add(user.getId());
}
String b = result.getInviteMessage();
session.sendInvitation(usersList, b);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void createCollaborationView(CreateSessionData result) {

View file

@ -32,7 +32,6 @@ 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.collaboration.comm.identity.event.IInitData;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.vividsolutions.jts.geom.Envelope;
@ -57,7 +56,7 @@ import com.vividsolutions.jts.geom.Envelope;
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class SharedEditorData implements ISerializableObject, IInitData {
public class SharedEditorData implements ISerializableObject {
/** The geometry of the descriptor */
private GeneralGridGeometry geometry;

View file

@ -26,7 +26,6 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
/**
@ -48,7 +47,7 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class SharedResource implements ISerializableObject, IInitData {
public class SharedResource implements ISerializableObject {
@XmlAttribute
private boolean removeResource = false;

View file

@ -26,7 +26,6 @@ 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.IDisplayEvent;
import com.raytheon.uf.viz.collaboration.ui.editor.event.InputEvent.EventType;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
@ -64,9 +63,9 @@ public class EventForwardingInputHandler implements IInputHandler {
this.displayPane = displayPane;
}
private void sendEvent(IDisplayEvent event) {
private void sendEvent(InputEvent event) {
try {
session.sendEvent(session.getCurrentDataProvider(), event);
session.sendObjectToPeer(session.getCurrentDataProvider(), event);
} catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, "Error sending input event",
e);

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.viz.collaboration.ui.editor.event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
/**
* An input event that holds necessary information to recreate the event on a
@ -42,7 +41,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
*/
@DynamicSerialize
public class InputEvent implements IDisplayEvent {
public class InputEvent {
public enum EventType {
MOUSE_DOWN, MOUSE_DOWN_MOVE, MOUSE_UP, MOUSE_HOVER, MOUSE_MOVE, DOUBLE_CLICK, MOUSE_WHEEL, KEY_UP, KEY_DOWN

View file

@ -32,9 +32,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
@ -61,9 +59,9 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
private List<ILabelProviderListener> listeners;
private String sessionId = null;
protected String sessionId = null;
private Map<String, Image> imageMap;
protected Map<String, Image> imageMap;
public ParticipantsLabelProvider() {
listeners = new ArrayList<ILabelProviderListener>();
@ -114,25 +112,6 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
}
}
if (image != null) {
ISharedDisplaySession sdSession = session
.spawnSharedDisplaySession();
String userId = user.getId();
String sessionLeaderId = CollaborationUtils.makeUserId(sdSession
.getCurrentSessionLeader());
String dataProviderId = CollaborationUtils.makeUserId(sdSession
.getCurrentDataProvider());
List<ParticipantRole> roleList = new ArrayList<ParticipantRole>();
if (userId.equals(sessionLeaderId)) {
roleList.add(ParticipantRole.SESSION_LEADER);
}
if (userId.equals(dataProviderId)) {
roleList.add(ParticipantRole.DATA_PROVIDER);
}
if (roleList.size() > 0) {
image = getModifier(roleList, user);
}
}
return image;
}
@ -171,38 +150,4 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
public String getSessionId() {
return sessionId;
}
/**
* Modify image image to indicate Session Leader and/or DataProvider.
*
* @param roles
* - non-empty list indicate the role(s)
* @param user
* -
* @return image - modified with indicator(s)
*/
private Image getModifier(List<ParticipantRole> roles,
CollaborationUser user) {
String key = user.getImageKey();
StringBuilder modKey = new StringBuilder(key);
int roleCnt = 0;
if (roles.contains(ParticipantRole.SESSION_LEADER)) {
++roleCnt;
modKey.append(":")
.append(ParticipantRole.SESSION_LEADER.toString());
}
if (roles.contains(ParticipantRole.DATA_PROVIDER)) {
++roleCnt;
modKey.append(":").append(ParticipantRole.DATA_PROVIDER.toString());
}
Image image = imageMap.get(modKey.toString());
if (image == null) {
image = CollaborationUtils.getNodeImage(user);
// original image is 16x16
image.getImageData();
imageMap.put(modKey.toString(), image);
}
return image;
}
}

View file

@ -384,8 +384,7 @@ public class SessionView extends AbstractSessionView {
StringBuilder builder = new StringBuilder();
builder.append("Status : ").append(user.getMode().getMode())
.append("\n");
builder.append("Message : \"").append(user.getStatusMessage())
.append("\"\n");
builder.append("Message : \"").append(user.getStatusMessage());
return builder.toString();
}

View file

@ -0,0 +1,114 @@
/**
* 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.session;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.graphics.Image;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
/**
* Generate the labels and images for a shared display session
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 17, 2012 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class SharedDisplayParticipantsLabelProvider extends
ParticipantsLabelProvider {
@Override
public Image getColumnImage(Object element, int columnIndex) {
Image image = super.getColumnImage(element, columnIndex);
if (image != null) {
ISharedDisplaySession sdSession = SharedDisplaySessionMgr
.getSessionContainer(sessionId).getSession();
CollaborationUser user = (CollaborationUser) element;
String userId = user.getId();
String sessionLeaderId = CollaborationUtils.makeUserId(sdSession
.getCurrentSessionLeader());
String dataProviderId = CollaborationUtils.makeUserId(sdSession
.getCurrentDataProvider());
List<ParticipantRole> roleList = new ArrayList<ParticipantRole>();
if (userId.equals(sessionLeaderId)) {
roleList.add(ParticipantRole.SESSION_LEADER);
}
if (userId.equals(dataProviderId)) {
roleList.add(ParticipantRole.DATA_PROVIDER);
}
if (roleList.size() > 0) {
image = getModifier(roleList, user);
}
}
return image;
}
/**
* Modify image image to indicate Session Leader and/or DataProvider.
*
* @param roles
* - non-empty list indicate the role(s)
* @param user
* -
* @return image - modified with indicator(s)
*/
private Image getModifier(List<ParticipantRole> roles,
CollaborationUser user) {
String key = user.getImageKey();
StringBuilder modKey = new StringBuilder(key);
int roleCnt = 0;
if (roles.contains(ParticipantRole.SESSION_LEADER)) {
++roleCnt;
modKey.append(":")
.append(ParticipantRole.SESSION_LEADER.toString());
}
if (roles.contains(ParticipantRole.DATA_PROVIDER)) {
++roleCnt;
modKey.append(":").append(ParticipantRole.DATA_PROVIDER.toString());
}
Image image = imageMap.get(modKey.toString());
if (image == null) {
image = CollaborationUtils.getNodeImage(user);
// original image is 16x16
image.getImageData();
imageMap.put(modKey.toString(), image);
}
return image;
}
}

View file

@ -21,7 +21,6 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IEventPublisher;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
@ -71,15 +70,6 @@ public interface ISharedDisplaySession extends IEventPublisher {
*/
void sendEvent(IDisplayEvent event) throws CollaborationException;
void sendEvent(IQualifiedID participant, IDisplayEvent event)
throws CollaborationException;
/**
*
*/
void sendRenderableObject(IRenderable renderable)
throws CollaborationException;
/**
* Sends the object to the other collaborators on the session. The object
* must be serializable and once received by the others, will be posted to
@ -126,26 +116,26 @@ public interface ISharedDisplaySession extends IEventPublisher {
* @param role
* @return
*/
boolean hasRole(ParticipantRole role);
public boolean hasRole(ParticipantRole role);
/**
*
* @return
*/
IQualifiedID getUserID();
public IQualifiedID getUserID();
/**
* Gets the connection status of the session.
*
* @return The connection status.
*/
boolean isConnected();
public boolean isConnected();
/**
* Get the session identifier.
*
* @return The session identifier.
*/
String getSessionId();
public String getSessionId();
}

View file

@ -1,72 +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.comm.provider.session;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 27, 2012 jkorman Initial creation
*
* </pre>
*
* @author jkorman
* @version 1.0
*/
@DynamicSerialize
public class DisplayEvent implements IDisplayEvent {
@DynamicSerializeElement
private String name;
public DisplayEvent() {
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View file

@ -48,7 +48,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IDisplayEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable;
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.info.IVenue;
@ -328,30 +327,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
// ISharedDisplaySession
// ***************************
/**
*
* @param participant
* @param event
* @throws CollaborationException
*/
@Override
public void sendEvent(
com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant,
IDisplayEvent event) throws CollaborationException {
PeerToPeerChat session = null;
session = getP2PSession();
if (session != null) {
String message = Tools.marshallData(event);
if (message != null) {
TextMessage msg = new TextMessage(participant, message);
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
session.sendPeerToPeer(msg);
}
}
}
/**
*
* @param event
@ -368,22 +343,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
}
}
/**
* @param renderable
* @throws CollaborationException
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#sendRenderableObject(com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable)
*/
@Override
public void sendRenderableObject(IRenderable renderable)
throws CollaborationException {
if (renderable != null) {
String message = Tools.marshallData(renderable);
if (message != null) {
sendTextMessage(message);
}
}
}
@Override
public void sendObjectToVenue(Object obj) throws CollaborationException {
if (obj != null) {