Issue #427 login data stored in preferences
Change-Id: I0ac9d34f6a7eaf8f6db80d6c573115bd43e2e11c Former-commit-id: 287dae35ae3566f22a2d9e5a22760f3ef9d29ca2
This commit is contained in:
parent
f4193b0e4e
commit
c4afe61f01
15 changed files with 277 additions and 433 deletions
|
@ -176,4 +176,8 @@
|
|||
class="com.raytheon.uf.viz.collaboration.ui.rsc.rendering.WireframeShapeRenderingHandler">
|
||||
</renderingExtension>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<initializer class="com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefInitializer"/>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -48,6 +48,7 @@ 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.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
|
@ -63,14 +64,12 @@ import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterItem;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
|
||||
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.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
|
@ -102,11 +101,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
/**
|
||||
* The connection to the server.
|
||||
*/
|
||||
private CollaborationConnection sessionManager;
|
||||
|
||||
private UserId loginId;
|
||||
|
||||
private LoginData loginData;
|
||||
private CollaborationConnection connection;
|
||||
|
||||
Shell shell;
|
||||
|
||||
|
@ -139,21 +134,6 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
return instance;
|
||||
}
|
||||
|
||||
public LoginData getLoginData() {
|
||||
return loginData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the venu's Id into a string that usable for a view's secondary
|
||||
* ID. This is the used as the key in the session Map.
|
||||
*
|
||||
* @param venueId
|
||||
* @return sessionId
|
||||
*/
|
||||
public String venueIdToSessionId(String venueId) {
|
||||
return venueId.replace(':', ';');
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor to for singleton class.
|
||||
*/
|
||||
|
@ -166,7 +146,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
}
|
||||
|
||||
private void populateGroups() {
|
||||
IRoster roster = sessionManager.getRosterManager().getRoster();
|
||||
IRoster roster = connection.getRosterManager().getRoster();
|
||||
|
||||
for (IRosterGroup rosterGroup : roster.getGroups()) {
|
||||
groups.add(rosterGroup);
|
||||
|
@ -179,6 +159,9 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
for (IRosterEntry rosterEntry : roster.getEntries()) {
|
||||
usersMap.put(rosterEntry.getUser(), rosterEntry);
|
||||
}
|
||||
|
||||
usersMap.put(connection.getUser(),
|
||||
new RosterEntry(connection.getUser()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -219,10 +202,6 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
return display;
|
||||
}
|
||||
|
||||
public UserId getLoginId() {
|
||||
return loginId;
|
||||
}
|
||||
|
||||
public void setLinkCollaboration(boolean state) {
|
||||
this.linkCollaboration = state;
|
||||
}
|
||||
|
@ -258,21 +237,20 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
}
|
||||
LoginDialog dlg = new LoginDialog(shell,
|
||||
CollaborationDataManager.this);
|
||||
loginData = null;
|
||||
loginData = (LoginData) dlg.open();
|
||||
CollaborationConnection newConn = null;
|
||||
newConn = (CollaborationConnection) dlg.open();
|
||||
dlg.close();
|
||||
if (loginData != null) {
|
||||
sessionManager = dlg.getSessionManager();
|
||||
loginId = loginData.getAccount();
|
||||
if (newConn != null) {
|
||||
connection = newConn;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (isConnected()) {
|
||||
// Register handlers and events for the new sessionManager.
|
||||
sessionManager.registerEventHandler(this);
|
||||
connection.registerEventHandler(this);
|
||||
try {
|
||||
ISession p2pSession = sessionManager.getPeerToPeerSession();
|
||||
ISession p2pSession = connection.getPeerToPeerSession();
|
||||
p2pSession.registerEventHandler(this);
|
||||
} catch (CollaborationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
|
@ -290,9 +268,9 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
|
||||
@Override
|
||||
public void postShutdown(IWorkbench workbench) {
|
||||
if (sessionManager != null) {
|
||||
if (connection != null) {
|
||||
try {
|
||||
ISession p2pSession = sessionManager
|
||||
ISession p2pSession = connection
|
||||
.getPeerToPeerSession();
|
||||
p2pSession.unRegisterEventHandler(this);
|
||||
} catch (CollaborationException e) {
|
||||
|
@ -301,32 +279,25 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
sessionManager.unRegisterEventHandler(this);
|
||||
sessionManager.closeManager();
|
||||
sessionManager = null;
|
||||
connection.unRegisterEventHandler(this);
|
||||
connection.closeManager();
|
||||
connection = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
PlatformUI.getWorkbench().addWorkbenchListener(wbListener);
|
||||
IPresence presence = sessionManager.getPresence();
|
||||
if (sessionManager.getPresence() == null) {
|
||||
presence = new Presence();
|
||||
presence.setProperty("dummy", "dummy");
|
||||
sessionManager.setPresence(presence);
|
||||
}
|
||||
fireModifiedPresence();
|
||||
populateGroups();
|
||||
}
|
||||
}
|
||||
|
||||
return sessionManager;
|
||||
return connection;
|
||||
}
|
||||
|
||||
synchronized public void closeManager() {
|
||||
if (sessionManager != null) {
|
||||
if (connection != null) {
|
||||
// The close unRegisters the event handler
|
||||
sessionManager.closeManager();
|
||||
sessionManager = null;
|
||||
connection.closeManager();
|
||||
connection = null;
|
||||
}
|
||||
if (wbListener != null) {
|
||||
PlatformUI.getWorkbench().removeWorkbenchListener(wbListener);
|
||||
|
@ -487,7 +458,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
}
|
||||
|
||||
public boolean isConnected() {
|
||||
return sessionManager != null && sessionManager.isConnected();
|
||||
return connection != null && connection.isConnected();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -530,7 +501,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
IVenueSession session = sessionManager
|
||||
IVenueSession session = connection
|
||||
.joinCollaborationVenue(invitation);
|
||||
String sessionId = session.getSessionId();
|
||||
sessionsMap.put(sessionId, session);
|
||||
|
@ -615,14 +586,18 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
});
|
||||
}
|
||||
|
||||
public void fireModifiedPresence() {
|
||||
IPresence presence = sessionManager.getPresence();
|
||||
presence.setMode(loginData.getMode());
|
||||
public void fireModifiedPresence(Mode mode, String msg) {
|
||||
IPresence presence = connection.getPresence();
|
||||
if (mode != null) {
|
||||
presence.setMode(mode);
|
||||
}
|
||||
presence.setType(Type.AVAILABLE);
|
||||
presence.setStatusMessage(loginData.getModeMessage());
|
||||
if (msg != null) {
|
||||
presence.setStatusMessage(msg);
|
||||
}
|
||||
try {
|
||||
sessionManager.getAccountManager().sendPresence(presence);
|
||||
UserId id = sessionManager.getUser();
|
||||
connection.getAccountManager().sendPresence(presence);
|
||||
UserId id = connection.getUser();
|
||||
RosterEntry rosterEntry = new RosterEntry(id);
|
||||
rosterEntry.setPresence(presence);
|
||||
handleModifiedPresence(rosterEntry);
|
||||
|
|
|
@ -20,7 +20,10 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -48,11 +51,13 @@ public class Activator extends AbstractUIPlugin {
|
|||
.getHandler(Activator.class);
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "com.raytheon.uf.viz.collaboration"; //$NON-NLS-1$
|
||||
public static final String PLUGIN_ID = "com.raytheon.uf.viz.collaboration.ui"; //$NON-NLS-1$
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
private ScopedPreferenceStore prefs;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
|
@ -80,6 +85,7 @@ public class Activator extends AbstractUIPlugin {
|
|||
*/
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
this.prefs.save();
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
|
@ -92,4 +98,13 @@ public class Activator extends AbstractUIPlugin {
|
|||
return plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPersistentPreferenceStore getPreferenceStore() {
|
||||
if (prefs == null) {
|
||||
prefs = new ScopedPreferenceStore(new InstanceScope(), PLUGIN_ID);
|
||||
}
|
||||
|
||||
return prefs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ChangePasswordDialog extends CaveSWTDialog {
|
|||
private Control createDialogArea(Composite parent) {
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
UserId user = manager.getLoginId();
|
||||
UserId user = manager.getCollaborationConnection().getUser();
|
||||
Composite body = new Composite(parent, SWT.NONE);
|
||||
body.setLayout(new GridLayout(2, false));
|
||||
// body.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.raytheon.uf.viz.collaboration.ui;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -76,6 +77,7 @@ 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.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
|
@ -98,8 +100,7 @@ import com.raytheon.uf.viz.collaboration.data.SessionGroupContainer;
|
|||
import com.raytheon.uf.viz.collaboration.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.LoginData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
|
@ -350,7 +351,9 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
changeStatusAction = new Action("Change Status",
|
||||
Action.AS_DROP_DOWN_MENU) {
|
||||
public void run() {
|
||||
changeStatus(getId());
|
||||
Activator.getDefault().getPreferenceStore()
|
||||
.setValue(CollabPrefConstants.P_STATUS, this.getId());
|
||||
changeStatus();
|
||||
};
|
||||
};
|
||||
changeStatusAction.setEnabled(false);
|
||||
|
@ -433,24 +436,15 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
ChangeStatusDialog dialog = new ChangeStatusDialog(Display.getCurrent()
|
||||
.getActiveShell());
|
||||
dialog.open();
|
||||
|
||||
LoginData loginData = (LoginData) dialog.getReturnValue();
|
||||
if (loginData != null) {
|
||||
CollaborationDataManager.getInstance().fireModifiedPresence();
|
||||
}
|
||||
changeStatus();
|
||||
}
|
||||
|
||||
private void changeStatus(String status) {
|
||||
CollaborationDataManager manager = CollaborationDataManager
|
||||
.getInstance();
|
||||
LoginData loginData = manager.getLoginData();
|
||||
int index = Integer.parseInt(status);
|
||||
IPresence.Mode mode = CollaborationUtils.statusModes[index];
|
||||
if (mode != loginData.getMode()) {
|
||||
loginData.setMode(mode);
|
||||
manager.fireModifiedPresence();
|
||||
LoginDialog.saveUserLoginData(loginData);
|
||||
}
|
||||
private void changeStatus() {
|
||||
Mode mode = Mode.valueOf(Activator.getDefault().getPreferenceStore()
|
||||
.getString(CollabPrefConstants.P_STATUS));
|
||||
String msg = Activator.getDefault().getPreferenceStore()
|
||||
.getString(CollabPrefConstants.P_MESSAGE);
|
||||
CollaborationDataManager.getInstance().fireModifiedPresence(mode, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -489,6 +483,12 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
.getActivePage().hideEditor(ref);
|
||||
}
|
||||
}
|
||||
try {
|
||||
Activator.getDefault().getPreferenceStore().save();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Unable to save preferences", e);
|
||||
}
|
||||
CollaborationDataManager.getInstance().closeManager();
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
changeStatusAction.run();
|
||||
};
|
||||
};
|
||||
action.setId(Integer.toString(index));
|
||||
action.setId(mode.toString());
|
||||
ActionContributionItem item = new ActionContributionItem(action);
|
||||
action.setImageDescriptor(IconUtil.getImageDescriptor(Activator
|
||||
.getDefault().getBundle(), mode.name().toLowerCase()
|
||||
|
@ -934,7 +934,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
// make the first thing to show up in the list, which happens to be the
|
||||
// user's name and gives the user options to modify status and other
|
||||
// things
|
||||
UserId user = manager.getLoginId();
|
||||
UserId user = manager.getCollaborationConnection().getUser();
|
||||
topLevel.addObject(user);
|
||||
|
||||
activeSessionGroup = new SessionGroupContainer();
|
||||
|
@ -1124,8 +1124,9 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
IRosterEntry user = (IRosterEntry) node;
|
||||
if (user.getPresence().getType() == Type.AVAILABLE) {
|
||||
UserId loginUserId = CollaborationDataManager
|
||||
.getInstance().getLoginId();
|
||||
if (loginUserId.equals(user) == false) {
|
||||
.getInstance().getCollaborationConnection()
|
||||
.getUser();
|
||||
if (!loginUserId.equals(user)) {
|
||||
createP2PChat(user.getUser());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,21 +57,6 @@ public class CollaborationUtils {
|
|||
|
||||
private static final String PREFIX_CONFERENCE = "conference.";
|
||||
|
||||
/**
|
||||
* Get the statusModes' index for desired mode.
|
||||
*
|
||||
* @param mode
|
||||
* @return index - the mode's index or -1 if not in statusModes
|
||||
*/
|
||||
public static int statusModesIndex(IPresence.Mode mode) {
|
||||
for (int index = 0; index < statusModes.length; ++index) {
|
||||
if (mode.equals(statusModes[index])) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an image associated with the node.
|
||||
*
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.collaboration.ui.login;
|
|||
**/
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -35,8 +36,10 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
@ -120,14 +123,13 @@ public class ChangeStatusDialog extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
LoginData loginData = CollaborationDataManager.getInstance()
|
||||
.getLoginData();
|
||||
userLabel.setText(loginData.getAccount().getFQName());
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
.getMode()));
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
.getMode()));
|
||||
messageTF.setText(loginData.getModeMessage());
|
||||
IPreferenceStore prefStore = Activator.getDefault()
|
||||
.getPreferenceStore();
|
||||
userLabel.setText(prefStore.getString(CollabPrefConstants.P_USERNAME)
|
||||
+ "@" + prefStore.getString(CollabPrefConstants.P_SERVER));
|
||||
statusCombo.select(statusCombo.indexOf(prefStore
|
||||
.getString(CollabPrefConstants.P_STATUS)));
|
||||
messageTF.setText(prefStore.getString(CollabPrefConstants.P_MESSAGE));
|
||||
messageTF.selectAll();
|
||||
statusCombo.setFocus();
|
||||
}
|
||||
|
@ -179,26 +181,15 @@ public class ChangeStatusDialog extends CaveSWTDialog {
|
|||
if (val != IDialogConstants.OK_ID) {
|
||||
setReturnValue(null);
|
||||
} else {
|
||||
LoginData loginData = CollaborationDataManager
|
||||
.getInstance().getLoginData();
|
||||
boolean modified = false;
|
||||
IPresence.Mode mode = CollaborationUtils.statusModes[statusCombo
|
||||
.getSelectionIndex()];
|
||||
if (mode != loginData.getMode()) {
|
||||
modified = true;
|
||||
}
|
||||
IPresence.Mode mode = Mode.valueOf(statusCombo
|
||||
.getItem(statusCombo.getSelectionIndex()));
|
||||
String modeMessage = messageTF.getText().trim();
|
||||
if (modeMessage.equals(loginData.getModeMessage()) == false) {
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
loginData.setMode(mode);
|
||||
loginData.setModeMessage(modeMessage);
|
||||
LoginDialog.saveUserLoginData(loginData);
|
||||
setReturnValue(loginData);
|
||||
} else {
|
||||
setReturnValue(null);
|
||||
}
|
||||
IPreferenceStore prefStore = Activator.getDefault()
|
||||
.getPreferenceStore();
|
||||
prefStore.setValue(CollabPrefConstants.P_STATUS,
|
||||
mode.toString());
|
||||
prefStore.setValue(CollabPrefConstants.P_MESSAGE,
|
||||
modeMessage);
|
||||
}
|
||||
ChangeStatusDialog.this.getShell().dispose();
|
||||
}
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui.login;
|
||||
|
||||
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 com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Data class that provides log on information. All but the password may be
|
||||
* saved in a localized file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2012 rferrel Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author rferrel
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement(name = "CollaborationLogon")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class LoginData implements ISerializableObject {
|
||||
@XmlElement(name = "user")
|
||||
private String user;
|
||||
|
||||
@XmlElement(name = "server")
|
||||
private String server;
|
||||
|
||||
private transient String password;
|
||||
|
||||
@XmlElement(name = "mode")
|
||||
private IPresence.Mode mode;
|
||||
|
||||
@XmlElement(name = "modeMessage")
|
||||
private String modeMessage;
|
||||
|
||||
public LoginData() {
|
||||
this.user = "";
|
||||
this.server = "";
|
||||
this.password = "";
|
||||
this.mode = IPresence.Mode.AVAILABLE;
|
||||
this.modeMessage = "";
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void clearPassword() {
|
||||
password = null;
|
||||
}
|
||||
|
||||
public IPresence.Mode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public String getModeMessage() {
|
||||
return modeMessage;
|
||||
}
|
||||
|
||||
public UserId getAccount() {
|
||||
return new UserId(user, server);
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setMode(IPresence.Mode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public void setModeMessage(String statusMessage) {
|
||||
this.modeMessage = statusMessage;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "userId: \"" + user + "\", server \"" + server + "\", mode:\""
|
||||
+ mode.toString() + "\", modeMessage: \"" + modeMessage
|
||||
+ "\", pw: "
|
||||
+ ((password == null) ? "null" : password.length());
|
||||
}
|
||||
}
|
|
@ -20,14 +20,12 @@ package com.raytheon.uf.viz.collaboration.ui.login;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.preference.IPersistentPreferenceStore;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -43,21 +41,18 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
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.IPresence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
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.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
@ -77,13 +72,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class LoginDialog extends CaveSWTDialog {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LoginDialog.class);
|
||||
|
||||
private static final String LOGIN_FILE_NAME = "collaboration"
|
||||
+ File.separator + "config" + File.separator + "gui"
|
||||
+ File.separator + "LoginData.xml";
|
||||
|
||||
private Text userTF;
|
||||
|
||||
private Text serverTF;
|
||||
|
@ -98,23 +90,22 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
|
||||
private Button logOnButton;
|
||||
|
||||
private String DEFAULT_SERVER = "awipscm.omaha.us.ray.com";
|
||||
|
||||
private Control[] noServerList;
|
||||
|
||||
private Control[] withServerList;
|
||||
|
||||
private LoginData loginData;
|
||||
|
||||
private IRosterEventSubscriber rosterEventSubscriber;
|
||||
|
||||
private CollaborationConnection sessionManager;
|
||||
|
||||
private IPersistentPreferenceStore prefStore;
|
||||
|
||||
public LoginDialog(Shell parentShell,
|
||||
IRosterEventSubscriber rosterEventSubscriber) {
|
||||
super(parentShell, SWT.DIALOG_TRIM);
|
||||
setText("Collaboration Server Login");
|
||||
this.rosterEventSubscriber = rosterEventSubscriber;
|
||||
this.prefStore = Activator.getDefault().getPreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,7 +132,6 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
// Set minimum width one time and the fill will handle the other fields.
|
||||
gd.minimumWidth = 200;
|
||||
serverTF.setLayoutData(gd);
|
||||
serverTF.setText(DEFAULT_SERVER);
|
||||
serverTF.setEditable(false);
|
||||
serverTF.setBackground(parent.getBackground());
|
||||
serverButton = new Button(body, SWT.PUSH);
|
||||
|
@ -160,12 +150,7 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
serverTF.setEditable(false);
|
||||
serverTF.setBackground(serverTF.getParent().getBackground());
|
||||
String server = serverTF.getText().trim();
|
||||
if (server.length() == 0) {
|
||||
serverTF.setText(DEFAULT_SERVER);
|
||||
} else {
|
||||
serverTF.setText(server);
|
||||
DEFAULT_SERVER = server;
|
||||
}
|
||||
serverTF.clearSelection();
|
||||
serverTF.getParent().setTabList(noServerList);
|
||||
logOnButton.setEnabled(true);
|
||||
|
@ -259,13 +244,12 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
this.loginData = LoginDialog.openUserLoginData();
|
||||
userTF.setText(loginData.getUser());
|
||||
serverTF.setText(loginData.getServer());
|
||||
userTF.setText(prefStore.getString(CollabPrefConstants.P_USERNAME));
|
||||
serverTF.setText(prefStore.getString(CollabPrefConstants.P_SERVER));
|
||||
|
||||
statusCombo.select(CollaborationUtils.statusModesIndex(loginData
|
||||
.getMode()));
|
||||
messageTF.setText(loginData.getModeMessage());
|
||||
statusCombo.select(statusCombo.indexOf(prefStore
|
||||
.getString(CollabPrefConstants.P_STATUS)));
|
||||
messageTF.setText(prefStore.getString(CollabPrefConstants.P_MESSAGE));
|
||||
userTF.selectAll();
|
||||
userTF.setFocus();
|
||||
}
|
||||
|
@ -349,38 +333,31 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
passwordTF.setText("");
|
||||
}
|
||||
if (focusField == null) {
|
||||
boolean doSaveLoginData = false;
|
||||
if (!loginData.getUser().equals(user)) {
|
||||
doSaveLoginData = true;
|
||||
loginData.setUser(user);
|
||||
}
|
||||
if (!loginData.getServer().equals(server)) {
|
||||
doSaveLoginData = true;
|
||||
loginData.setServer(server);
|
||||
}
|
||||
loginData.setPassword(password);
|
||||
if (!loginData.getMode().equals(mode)) {
|
||||
doSaveLoginData = true;
|
||||
loginData.setMode(mode);
|
||||
}
|
||||
if (!loginData.getModeMessage().equals(modeMessage)) {
|
||||
doSaveLoginData = true;
|
||||
loginData.setModeMessage(modeMessage);
|
||||
}
|
||||
if (doSaveLoginData) {
|
||||
LoginDialog.saveUserLoginData(loginData);
|
||||
prefStore
|
||||
.setValue(CollabPrefConstants.P_SERVER, server);
|
||||
prefStore
|
||||
.setValue(CollabPrefConstants.P_USERNAME, user);
|
||||
prefStore.setValue(CollabPrefConstants.P_STATUS,
|
||||
mode.toString());
|
||||
prefStore.setValue(CollabPrefConstants.P_MESSAGE,
|
||||
modeMessage);
|
||||
try {
|
||||
prefStore.save();
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Unable to save login preferences", e);
|
||||
}
|
||||
|
||||
// loginData = new LoginData(user, server, password,
|
||||
// CollaborationUtils.statusModes[statusCombo
|
||||
// .getSelectionIndex()], messageTF
|
||||
// .getText().trim());
|
||||
IPresence initialPres = new Presence();
|
||||
initialPres.setMode(mode);
|
||||
initialPres.setType(Type.AVAILABLE);
|
||||
initialPres.setStatusMessage(modeMessage);
|
||||
|
||||
try {
|
||||
sessionManager = new CollaborationConnection(
|
||||
loginData.getAccount(), loginData
|
||||
.getPassword(),
|
||||
rosterEventSubscriber);
|
||||
setReturnValue(loginData);
|
||||
new UserId(user, server), password,
|
||||
rosterEventSubscriber, initialPres);
|
||||
setReturnValue(sessionManager);
|
||||
close();
|
||||
} catch (Exception e) {
|
||||
if (focusField == null) {
|
||||
|
@ -421,69 +398,6 @@ public class LoginDialog extends CaveSWTDialog {
|
|||
return button;
|
||||
}
|
||||
|
||||
public static LoginData openUserLoginData() {
|
||||
LoginData loginData = null;
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File fname = pm.getStaticFile(LOGIN_FILE_NAME);
|
||||
try {
|
||||
if (fname != null) {
|
||||
loginData = JAXB.unmarshal(fname, LoginData.class);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
} finally {
|
||||
if (loginData == null) {
|
||||
loginData = new LoginData();
|
||||
}
|
||||
}
|
||||
return loginData;
|
||||
}
|
||||
|
||||
public static void saveUserLoginData(LoginData loginData) {
|
||||
try {
|
||||
LocalizationFile lFile = getFile(LOGIN_FILE_NAME);
|
||||
File file = lFile.getFile(false);
|
||||
file.getParentFile().mkdirs();
|
||||
JAXB.marshal(loginData, file);
|
||||
lFile.save();
|
||||
} catch (FileNotFoundException ex) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM, ex.getLocalizedMessage(), ex);
|
||||
} catch (LocalizationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as appropriate.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains a localization file for desired file name.
|
||||
*
|
||||
* @param filename
|
||||
* @return lFile
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
private static LocalizationFile getFile(String filename)
|
||||
throws FileNotFoundException {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
LocalizationFile lFile = pm.getLocalizationFile(context, filename);
|
||||
if (lFile == null) {
|
||||
String user = LocalizationManager.getInstance().getCurrentUser();
|
||||
throw new FileNotFoundException("Unable to find \"" + filename
|
||||
+ "\" under the directory for user " + user + ".");
|
||||
|
||||
}
|
||||
return lFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the loginData
|
||||
*/
|
||||
public LoginData getLoginData() {
|
||||
return loginData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sessionManager
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* 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.prefs;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 24, 2012 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollabPrefConstants {
|
||||
|
||||
public static final String P_SERVER = "collaborationServer";
|
||||
|
||||
public static final String P_USERNAME = "username";
|
||||
|
||||
public static final String P_STATUS = "status";
|
||||
|
||||
public static final String P_MESSAGE = "message";
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/**
|
||||
* 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.prefs;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 24, 2012 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CollabPrefInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
|
||||
* initializeDefaultPreferences()
|
||||
*/
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
|
||||
|
||||
store.setDefault(CollabPrefConstants.P_SERVER, "");
|
||||
|
||||
// TODO better default?
|
||||
store.setDefault(CollabPrefConstants.P_USERNAME,
|
||||
System.getProperty("user.name"));
|
||||
|
||||
store.setDefault(CollabPrefConstants.P_STATUS,
|
||||
Mode.AVAILABLE.toString());
|
||||
store.setDefault(CollabPrefConstants.P_MESSAGE, "");
|
||||
}
|
||||
|
||||
}
|
|
@ -95,11 +95,12 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
|
||||
@Subscribe
|
||||
public void participantChanged(IVenueParticipantEvent event) {
|
||||
if (event.getEventType().equals(ParticipantEventType.ARRIVED)) {
|
||||
// TODO this seems to trigger when you create the room, in which
|
||||
// case you don't need to send it for yourself
|
||||
// TODO instead of going to active editor, should get ones
|
||||
// specifically shared with this session
|
||||
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);
|
||||
|
|
|
@ -115,8 +115,8 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
IPeerToPeer p2p = (IPeerToPeer) manager
|
||||
.getCollaborationConnection().getPeerToPeerSession();
|
||||
p2p.sendPeerToPeer(peer, message);
|
||||
appendMessage(manager.getLoginId(), System.currentTimeMillis(),
|
||||
message);
|
||||
appendMessage(manager.getCollaborationConnection().getUser(),
|
||||
System.currentTimeMillis(), message);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to send message to " + peer.getName(), e);
|
||||
|
@ -127,7 +127,8 @@ public class PeerToPeerView extends AbstractSessionView {
|
|||
protected void styleAndAppendText(StringBuilder sb, int offset,
|
||||
String name, UserId userId, List<StyleRange> ranges) {
|
||||
Color color = null;
|
||||
if (!userId.equals(CollaborationDataManager.getInstance().getLoginId())) {
|
||||
if (!userId.equals(CollaborationDataManager.getInstance()
|
||||
.getCollaborationConnection().getUser())) {
|
||||
color = chatterColor;
|
||||
} else {
|
||||
color = userColor;
|
||||
|
|
|
@ -38,7 +38,6 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
|||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
|
||||
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.IGraphicsTarget;
|
||||
|
@ -89,6 +88,8 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
|
||||
private String sessionId;
|
||||
|
||||
private UserId userId;
|
||||
|
||||
private SessionColorManager colorManager;
|
||||
|
||||
private IWireframeShape tempRemoteShape = null;
|
||||
|
@ -109,6 +110,8 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
for (String str : mgr.getSessions().keySet()) {
|
||||
mgr.getSession(str).registerEventHandler(this);
|
||||
}
|
||||
userId = mgr.getCollaborationConnection().getUser();
|
||||
;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -134,9 +137,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
.synchronizedMultimap(this.deletedCollaboratorShapes);
|
||||
colorManager = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getColorManager();
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId id = new UserId(data.getUser(), data.getServer());
|
||||
color = colorManager.getColors().get(id);
|
||||
color = colorManager.getColors().get(userId);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -367,8 +368,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
super.undoAdd();
|
||||
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
|
||||
event.setType(CollaborationEventType.UNDO);
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId userId = new UserId(data.getUser(), data.getServer());
|
||||
event.setUserName(userId);
|
||||
sendGenericEvent(event);
|
||||
}
|
||||
|
@ -383,8 +382,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
super.redoAdd();
|
||||
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
|
||||
event.setType(CollaborationEventType.REDO);
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId userId = new UserId(data.getUser(), data.getServer());
|
||||
event.setUserName(userId);
|
||||
sendGenericEvent(event);
|
||||
}
|
||||
|
@ -401,8 +398,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
CollaborationDrawingEvent eObject = new CollaborationDrawingEvent();
|
||||
eObject.setType(CollaborationEventType.ERASE);
|
||||
eObject.setContainer(container);
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId userId = new UserId(data.getUser(), data.getServer());
|
||||
eObject.setUserName(userId);
|
||||
sendGenericEvent(eObject);
|
||||
}
|
||||
|
@ -413,8 +408,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
CollaborationDrawingEvent tObject = new CollaborationDrawingEvent();
|
||||
tObject.setType(CollaborationEventType.DRAW);
|
||||
tObject.setContainer(container);
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId userId = new UserId(data.getUser(), data.getServer());
|
||||
tObject.setUserName(userId);
|
||||
sendGenericEvent(tObject);
|
||||
}
|
||||
|
@ -429,8 +422,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
super.reset();
|
||||
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
|
||||
event.setType(CollaborationEventType.CLEAR);
|
||||
LoginData data = CollaborationDataManager.getInstance().getLoginData();
|
||||
UserId userId = new UserId(data.getUser(), data.getServer());
|
||||
event.setUserName(userId);
|
||||
sendGenericEvent(event);
|
||||
}
|
||||
|
|
|
@ -147,40 +147,10 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
private IRosterEventSubscriber rosterEventSubscriber = null;
|
||||
|
||||
// Debug -- event viewer ----------------
|
||||
private IRosterEventSubscriber rosterEventHandler = null;
|
||||
// private IRosterEventSubscriber rosterEventHandler = null;
|
||||
|
||||
// Debug -- event viewer ----------------
|
||||
|
||||
/**
|
||||
* @throws CollaborationException
|
||||
* @throws ContainerCreateException
|
||||
*
|
||||
*/
|
||||
public CollaborationConnection(UserId account, String password)
|
||||
throws CollaborationException {
|
||||
this(account, password, (IRosterEventSubscriber) null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param account
|
||||
* The account name to connect to.
|
||||
* @param password
|
||||
* The password to use for connection.
|
||||
* @param initialPresence
|
||||
* The initial presence for the account name.
|
||||
* @throws ContainerCreateException
|
||||
*
|
||||
*/
|
||||
public CollaborationConnection(UserId account, String password,
|
||||
IPresence initialPresence) throws Exception {
|
||||
this(account, password, (IRosterEventSubscriber) null);
|
||||
if (accountManager != null) {
|
||||
userPresence = initialPresence;
|
||||
accountManager.sendPresence(initialPresence);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* The roster event subscriber must be ready to accept events before this
|
||||
|
@ -192,11 +162,13 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
* The password to use for connection.
|
||||
* @param rosterEventSubscriber
|
||||
* A roster event subscriber.
|
||||
* @param initialPresence
|
||||
* the initial presence
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public CollaborationConnection(UserId account, String password,
|
||||
IRosterEventSubscriber rosterEventSubscriber)
|
||||
throws CollaborationException {
|
||||
IRosterEventSubscriber rosterEventSubscriber,
|
||||
IPresence initialPresence) throws CollaborationException {
|
||||
eventBus = new EventBus();
|
||||
if (rosterEventSubscriber != null) {
|
||||
this.rosterEventSubscriber = rosterEventSubscriber;
|
||||
|
@ -253,6 +225,11 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
setupP2PComm(presenceAdapter);
|
||||
getPeerToPeerSession();
|
||||
|
||||
if (accountManager != null && initialPresence != null) {
|
||||
userPresence = initialPresence;
|
||||
accountManager.sendPresence(initialPresence);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue