Issue #429 color final fixes
Former-commit-id: 51b937b9be5c9f1a1e17317e241cd93337e9fd0c
This commit is contained in:
parent
001c52bd3a
commit
9bc3f0c75d
8 changed files with 261 additions and 22 deletions
|
@ -341,7 +341,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
};
|
||||
changeStatusMessageAction.setEnabled(false);
|
||||
|
||||
changePasswordAction = new Action("Change password...") {
|
||||
changePasswordAction = new Action("Change Password...") {
|
||||
public void run() {
|
||||
changePassword();
|
||||
};
|
||||
|
@ -522,9 +522,19 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
*/
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
entry.getUser().setAlias(treeEditor.getItem().getText());
|
||||
// TODO, persist this back to the xmpp server so that the alias
|
||||
// is used next time you login
|
||||
List<String> groups = new ArrayList<String>();
|
||||
for (IRosterGroup grp : entry.getGroups()) {
|
||||
groups.add(grp.getName());
|
||||
}
|
||||
|
||||
CollaborationDataManager
|
||||
.getInstance()
|
||||
.getCollaborationConnection()
|
||||
.addAlias(entry.getUser(),
|
||||
treeEditor.getItem().getText());
|
||||
CollaborationDataManager.getInstance()
|
||||
.getCollaborationConnection().getEventPublisher()
|
||||
.post(entry.getUser());
|
||||
}
|
||||
});
|
||||
newEditor.selectAll();
|
||||
|
@ -893,9 +903,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
|
|||
manager.add(new Separator());
|
||||
manager.add(createSessionAction);
|
||||
}
|
||||
manager.add(aliasAction);
|
||||
// manager.add(aliasAction);
|
||||
} else if (o instanceof IRosterGroup) {
|
||||
IRosterGroup group = (IRosterGroup) o;
|
||||
manager.add(createSessionAction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.swt.SWT;
|
|||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.ImageData;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
@ -71,6 +72,8 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
private SessionColorManager manager;
|
||||
|
||||
private Font boldFont;
|
||||
|
||||
public ParticipantsLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
imageMap = new HashMap<String, Image>();
|
||||
|
@ -125,10 +128,59 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
return getImageModifier(session, element, image);
|
||||
}
|
||||
|
||||
private Image getImageModifier(IVenueSession session, Object element,
|
||||
Image image) {
|
||||
if (session instanceof SharedDisplaySession) {
|
||||
boolean isSessionLeader = ((IRosterEntry) element).getUser()
|
||||
.equals(((SharedDisplaySession) session)
|
||||
.getCurrentSessionLeader());
|
||||
boolean isDataProvider = ((IRosterEntry) element).getUser().equals(
|
||||
((SharedDisplaySession) session).getCurrentDataProvider());
|
||||
if (isSessionLeader) {
|
||||
drawSessionLeader(image);
|
||||
}
|
||||
if (isDataProvider) {
|
||||
drawDataProvider(image);
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
private void drawSessionLeader(Image image) {
|
||||
// TODO draw session leader here
|
||||
// image = new Image(Display.getCurrent(), image.getBounds());
|
||||
ImageData data = image.getImageData();
|
||||
int whitePixel = data.palette.getPixel(new RGB(0, 255, 255));
|
||||
int redPixel = data.palette.getPixel(new RGB(255, 0, 0));
|
||||
data.transparentPixel = whitePixel;
|
||||
for (int i = 0; i < data.data.length; i++) {
|
||||
if (data.data[i] == -1) {
|
||||
data.data[i] = (byte) redPixel;
|
||||
}
|
||||
}
|
||||
image = new Image(Display.getCurrent(), data);
|
||||
// for (int i = 0; i < data.data.length; i++) {
|
||||
// if (data.data[i] == -1) {
|
||||
// data.data[i] = 0;
|
||||
// }
|
||||
// }
|
||||
// image = new Image(Display.getCurrent(), data);
|
||||
// GC gc = new GC(image);
|
||||
// Rectangle rect = image.getBounds();
|
||||
// image.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
|
||||
// // gc.drawImage(image, 0, 0);
|
||||
// gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
|
||||
// gc.fillRectangle(5, 5, rect.width - 3, rect.height - 3);
|
||||
// gc.dispose();
|
||||
}
|
||||
|
||||
private void drawDataProvider(Image image) {
|
||||
// TODO draw data provider here
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
IRosterEntry user = (IRosterEntry) element;
|
||||
|
@ -136,18 +188,18 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
&& !user.getUser().getAlias().isEmpty()) {
|
||||
return user.getUser().getAlias();
|
||||
}
|
||||
// TODO, XXX, FIXME? do we need this, it is REALLY good for debugging
|
||||
String name = user.getUser().getName();
|
||||
if (CollaborationDataManager.getInstance().getCollaborationConnection()
|
||||
.getAccount().equals(user.getUser())) {
|
||||
name += " (YOU)";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Font getFont(Object element) {
|
||||
return null;
|
||||
if (boldFont == null) {
|
||||
Font currFont = Display.getCurrent().getSystemFont();
|
||||
boldFont = new Font(Display.getCurrent(), currFont.toString(),
|
||||
currFont.getFontData()[0].getHeight(), SWT.BOLD);
|
||||
}
|
||||
return boldFont;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,6 +71,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventTyp
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterItem;
|
||||
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.data.CollaborationDataManager;
|
||||
|
@ -142,6 +143,8 @@ public class SessionView extends AbstractSessionView {
|
|||
@Override
|
||||
protected void initComponents(Composite parent) {
|
||||
initColorManager();
|
||||
CollaborationDataManager.getInstance().getCollaborationConnection()
|
||||
.getEventPublisher().register(this);
|
||||
super.initComponents(parent);
|
||||
}
|
||||
|
||||
|
@ -234,6 +237,18 @@ public class SessionView extends AbstractSessionView {
|
|||
usersTable.refresh();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void updateUserAlias(UserId id) {
|
||||
List<IRosterEntry> entries = (List<IRosterEntry>) usersTable.getInput();
|
||||
for (IRosterEntry entry : entries) {
|
||||
if (entry.getUser().getFQName().equals(id.getFQName())) {
|
||||
((RosterItem) entry).setName(id.getAlias());
|
||||
break;
|
||||
}
|
||||
}
|
||||
usersTable.refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ties the view to a session.
|
||||
*
|
||||
|
@ -643,7 +658,8 @@ public class SessionView extends AbstractSessionView {
|
|||
+ participant.getName() + ", " + participant.getFQName());
|
||||
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
|
||||
for (int i = 0; i < users.size(); ++i) {
|
||||
if (participant.equals(users.get(i).getUser())) {
|
||||
if (users.get(i) == null
|
||||
|| participant.equals(users.get(i).getUser())) {
|
||||
users.remove(i);
|
||||
usersTable.refresh();
|
||||
break;
|
||||
|
|
|
@ -138,8 +138,10 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
colorManager = SharedDisplaySessionMgr.getSessionContainer(sessionId)
|
||||
.getColorManager();
|
||||
color = colorManager.getColors().get(userId);
|
||||
if (color != null) {
|
||||
getCapability(ColorableCapability.class).setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -192,6 +194,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
case DISABLE:
|
||||
allowDraw = !allowDraw;
|
||||
getEventBus().post(event);
|
||||
break;
|
||||
case UNDO:
|
||||
UserId userName = event.getUserName();
|
||||
Collection<ShapeContainer> container = collaboratorShapes
|
||||
|
@ -387,6 +390,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
public void sendDisableOthers() {
|
||||
CollaborationDrawingEvent event = new CollaborationDrawingEvent();
|
||||
event.setType(CollaborationEventType.DISABLE);
|
||||
event.setUserName(userId);
|
||||
sendGenericEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
|
||||
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.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
|
||||
|
@ -97,10 +98,14 @@ public class CollaborationPathToolbar extends PathToolbar {
|
|||
public void run() {
|
||||
if (event instanceof CollaborationDrawingEvent) {
|
||||
CollaborationDrawingEvent cde = (CollaborationDrawingEvent) event;
|
||||
if (!cde.getUserName().equals(
|
||||
CollaborationDataManager.getInstance()
|
||||
.getCollaborationConnection().getAccount())) {
|
||||
if (cde.getType() == CollaborationEventType.DISABLE) {
|
||||
disableAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
CollaborationPathToolbar.super.handleMessage(event);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,11 +19,15 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.comm.provider.session;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import org.eclipse.ecf.core.ContainerConnectException;
|
||||
import org.eclipse.ecf.core.ContainerCreateException;
|
||||
import org.eclipse.ecf.core.ContainerFactory;
|
||||
|
@ -48,6 +52,14 @@ import org.eclipse.ecf.presence.roster.IRosterListener;
|
|||
import org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID;
|
||||
|
||||
import com.google.common.eventbus.EventBus;
|
||||
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.LocalizationOpFailedException;
|
||||
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;
|
||||
|
@ -76,6 +88,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterEntry;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.RosterManager;
|
||||
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.comm.provider.user.UserIdAlias;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueId;
|
||||
|
||||
/**
|
||||
|
@ -146,6 +159,9 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
|
||||
private IRosterEventSubscriber rosterEventSubscriber = null;
|
||||
|
||||
@XmlElement
|
||||
private List<UserIdAlias> aliases;
|
||||
|
||||
// Debug -- event viewer ----------------
|
||||
// private IRosterEventSubscriber rosterEventHandler = null;
|
||||
|
||||
|
@ -218,6 +234,8 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
user = new UserId(name, host, resource);
|
||||
}
|
||||
|
||||
readAliases();
|
||||
|
||||
setupAccountManager();
|
||||
|
||||
setupInternalConnectionListeners();
|
||||
|
@ -360,6 +378,7 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
*
|
||||
*/
|
||||
public void closeManager() {
|
||||
persistAliases();
|
||||
if (container != null) {
|
||||
// Close any created sessions.
|
||||
for (ISession session : sessions.values()) {
|
||||
|
@ -721,4 +740,61 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nicknames
|
||||
*/
|
||||
public String getAlias(UserId user) {
|
||||
for (UserIdAlias alias : aliases) {
|
||||
if (alias.getId().equals(user)) {
|
||||
return alias.getAlias();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addAlias(UserId user, String name) {
|
||||
UserIdAlias alias = new UserIdAlias();
|
||||
alias.setAlias(name);
|
||||
alias.setId(user);
|
||||
aliases.add(alias);
|
||||
}
|
||||
|
||||
private void persistAliases() {
|
||||
LocalizationContext context = new LocalizationContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER,
|
||||
"collaboration");
|
||||
LocalizationFile file = PathManagerFactory.getPathManager()
|
||||
.getLocalizationFile(context, "collaborationAliases.xml");
|
||||
try {
|
||||
SerializationUtil.jaxbMarshalToXmlFile(aliases, file.getFile()
|
||||
.getAbsolutePath());
|
||||
file.save();
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to persist aliases",
|
||||
e);
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private void readAliases() {
|
||||
LocalizationContext context = new LocalizationContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER,
|
||||
"collaboration");
|
||||
File file = PathManagerFactory.getPathManager().getFile(context,
|
||||
"collaborationAliases.xml");
|
||||
try {
|
||||
if (file.exists()) {
|
||||
aliases = (List<UserIdAlias>) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(file);
|
||||
}
|
||||
} catch (SerializationException e) {
|
||||
aliases = null;
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to retrieve aliases", e);
|
||||
}
|
||||
if (aliases == null) {
|
||||
aliases = new ArrayList<UserIdAlias>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* 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.user;
|
||||
|
||||
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 javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 25, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@XmlRootElement(name = "user")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class UserIdAlias {
|
||||
@XmlAttribute
|
||||
private UserId id;
|
||||
|
||||
@XmlElement
|
||||
private String alias;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public UserId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the id to set
|
||||
*/
|
||||
public void setId(UserId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the alias
|
||||
*/
|
||||
public String getAlias() {
|
||||
return alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param alias
|
||||
* the alias to set
|
||||
*/
|
||||
public void setAlias(String alias) {
|
||||
this.alias = alias;
|
||||
}
|
||||
}
|
|
@ -77,10 +77,6 @@ public class DrawingLayer extends
|
|||
|
||||
protected LayerState state;
|
||||
|
||||
// protected boolean erase = false;
|
||||
//
|
||||
// private boolean draw = true;
|
||||
|
||||
protected PaintProperties paintProps = null;
|
||||
|
||||
private boolean needsRefresh = false;
|
||||
|
@ -280,8 +276,6 @@ public class DrawingLayer extends
|
|||
descriptor);
|
||||
drawTempLinePrimitive(lString, eraseWireframeShape);
|
||||
this.wireframeShapes.put(lString, eraseWireframeShape);
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
tempGeometries.clear();
|
||||
|
|
Loading…
Add table
Reference in a new issue