Merge "Omaha #3709 Add icon that displays text colors next to color change menu items" into omaha_14.4.1
Former-commit-id: 2baba567db90a6f3fe4f9cbf440798454d88fbaf
This commit is contained in:
commit
6812dc291c
6 changed files with 217 additions and 39 deletions
|
@ -61,13 +61,11 @@ public abstract class AbstractColorConfigManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorInfo colorInfo = colors.get(key);
|
ColorInfo colorInfo = colors.get(key);
|
||||||
if (colorInfo != null) {
|
if (colorInfo == null) {
|
||||||
colorInfo.setColors(foreground, background);
|
colorInfo = new ColorInfo();
|
||||||
} else {
|
colors.put(key, colorInfo);
|
||||||
ColorInfo newColorInfo = new ColorInfo();
|
|
||||||
newColorInfo.setColors(foreground, background);
|
|
||||||
colors.put(key, newColorInfo);
|
|
||||||
}
|
}
|
||||||
|
colorInfo.setColors(foreground, background);
|
||||||
|
|
||||||
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
IPathManager pathMgr = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext lContext = pathMgr.getContext(
|
LocalizationContext lContext = pathMgr.getContext(
|
||||||
|
|
|
@ -22,7 +22,9 @@ package com.raytheon.uf.viz.collaboration.ui;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
|
@ -57,6 +59,7 @@ import org.eclipse.swt.events.MouseTrackAdapter;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
@ -164,6 +167,7 @@ import com.raytheon.viz.ui.views.CaveWorkbenchPageManager;
|
||||||
* Oct 14, 2014 3709 mapeters Added change background/foreground color actions to menu.
|
* Oct 14, 2014 3709 mapeters Added change background/foreground color actions to menu.
|
||||||
* Nov 14, 2014 3709 mapeters Removed change background/foreground color actions from menu.
|
* Nov 14, 2014 3709 mapeters Removed change background/foreground color actions from menu.
|
||||||
* Dec 08, 2014 3709 mapeters Added MB3 change user text color actions to contacts list.
|
* Dec 08, 2014 3709 mapeters Added MB3 change user text color actions to contacts list.
|
||||||
|
* Dec 12, 2014 3709 mapeters Store {@link ChangeTextColorAction}s in map, dispose them.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -204,6 +208,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
|
|
||||||
private Action roomSearchAction;
|
private Action roomSearchAction;
|
||||||
|
|
||||||
|
private Map<String, ChangeTextColorAction> userColorActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent
|
* @param parent
|
||||||
*/
|
*/
|
||||||
|
@ -278,6 +284,10 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
inactiveImage.dispose();
|
inactiveImage.dispose();
|
||||||
activeImage.dispose();
|
activeImage.dispose();
|
||||||
pressedImage.dispose();
|
pressedImage.dispose();
|
||||||
|
|
||||||
|
for (ChangeTextColorAction userColorAction : userColorActions.values()) {
|
||||||
|
userColorAction.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -287,6 +297,8 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
Bundle bundle = Activator.getDefault().getBundle();
|
Bundle bundle = Activator.getDefault().getBundle();
|
||||||
final IUserSelector userSelector = this;
|
final IUserSelector userSelector = this;
|
||||||
|
|
||||||
|
userColorActions = new HashMap<>();
|
||||||
|
|
||||||
createSessionAction = new CreateSessionAction(userSelector);
|
createSessionAction = new CreateSessionAction(userSelector);
|
||||||
|
|
||||||
aliasAction = new Action("Alias", IconUtil.getImageDescriptor(Activator
|
aliasAction = new Action("Alias", IconUtil.getImageDescriptor(Activator
|
||||||
|
@ -464,8 +476,15 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
}
|
}
|
||||||
manager.add(new AddNotifierAction(this));
|
manager.add(new AddNotifierAction(this));
|
||||||
manager.add(new Separator());
|
manager.add(new Separator());
|
||||||
manager.add(new ChangeTextColorAction(user.getName(), false, false,
|
String name = user.getName();
|
||||||
null, new UserColorConfigManager()));
|
ChangeTextColorAction userColorAction = userColorActions.get(name);
|
||||||
|
if (userColorAction == null) {
|
||||||
|
userColorAction = ChangeTextColorAction
|
||||||
|
.createChangeUserTextColorAction(name, false, new RGB(
|
||||||
|
0, 0, 255), new UserColorConfigManager());
|
||||||
|
userColorActions.put(name, userColorAction);
|
||||||
|
}
|
||||||
|
manager.add(userColorAction);
|
||||||
} else if (o instanceof UserId) {
|
} else if (o instanceof UserId) {
|
||||||
// the user
|
// the user
|
||||||
UserId user = (UserId) o;
|
UserId user = (UserId) o;
|
||||||
|
@ -474,9 +493,17 @@ public class CollaborationGroupView extends CaveFloatingView implements
|
||||||
UserId me = connection.getUser();
|
UserId me = connection.getUser();
|
||||||
if (me.isSameUser(user)) {
|
if (me.isSameUser(user)) {
|
||||||
createMenu(manager);
|
createMenu(manager);
|
||||||
manager.insertBefore("afterFont", new ChangeTextColorAction(
|
String name = user.getName();
|
||||||
user.getName(), true, true, null,
|
ChangeTextColorAction userColorAction = userColorActions
|
||||||
new UserColorConfigManager()));
|
.get(name);
|
||||||
|
if (userColorAction == null) {
|
||||||
|
userColorAction = ChangeTextColorAction
|
||||||
|
.createChangeUserTextColorAction(name, true,
|
||||||
|
new RGB(0, 0, 255),
|
||||||
|
new UserColorConfigManager());
|
||||||
|
userColorActions.put(name, userColorAction);
|
||||||
|
}
|
||||||
|
manager.insertBefore("afterFont", userColorAction);
|
||||||
}
|
}
|
||||||
} else if (o instanceof RosterGroup || o instanceof SharedGroup) {
|
} else if (o instanceof RosterGroup || o instanceof SharedGroup) {
|
||||||
Action inviteAction = new InviteAction(getSelectedUsers());
|
Action inviteAction = new InviteAction(getSelectedUsers());
|
||||||
|
|
|
@ -19,18 +19,25 @@ package com.raytheon.uf.viz.collaboration.ui.actions;
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
* further licensing information.
|
* further licensing information.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.Device;
|
||||||
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.provider.connection.CollaborationConnection;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.AbstractColorConfigManager;
|
import com.raytheon.uf.viz.collaboration.ui.AbstractColorConfigManager;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.ColorInfoMap.ColorInfo;
|
import com.raytheon.uf.viz.collaboration.ui.ColorInfoMap.ColorInfo;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.FeedColorConfigManager;
|
import com.raytheon.uf.viz.collaboration.ui.FeedColorConfigManager;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.ForegroundBackgroundColorDlg;
|
import com.raytheon.uf.viz.collaboration.ui.ForegroundBackgroundColorDlg;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.UserColorConfigManager;
|
import com.raytheon.uf.viz.collaboration.ui.UserColorConfigManager;
|
||||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
|
||||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +53,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* 12/02/14 3709 mapeters Initial creation.
|
* 12/02/14 3709 mapeters Initial creation.
|
||||||
* 12/09/14 3709 mapeters Uses {@link ForegroundBackgroundColorDlg}, renamed from
|
* 12/09/14 3709 mapeters Uses {@link ForegroundBackgroundColorDlg}, renamed from
|
||||||
* ChangeUserColorAction, support both user and site colors.
|
* ChangeUserColorAction, support both user and site colors.
|
||||||
|
* 12/12/14 3709 mapeters Use static methods to call constructor, icon displays
|
||||||
|
* current foreground and background colors.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -60,59 +69,85 @@ public class ChangeTextColorAction extends Action {
|
||||||
|
|
||||||
private AbstractColorConfigManager colorConfigManager;
|
private AbstractColorConfigManager colorConfigManager;
|
||||||
|
|
||||||
|
private Image icon;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for changing user colors.
|
* Create and return new action for changing user colors.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param me
|
|
||||||
* @param displayName
|
* @param displayName
|
||||||
* @param defaultForeground
|
* @param defaultForeground
|
||||||
* @param colorConfigManager
|
* @param colorConfigManager
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public ChangeTextColorAction(String user, boolean me, boolean displayName,
|
public static ChangeTextColorAction createChangeUserTextColorAction(
|
||||||
RGB defaultForeground, UserColorConfigManager colorConfigManager) {
|
String user, boolean displayName, RGB defaultForeground,
|
||||||
this("Change " + (displayName ? (me ? "Your" : (user + "'s")) : "User")
|
UserColorConfigManager colorConfigManager) {
|
||||||
+ " Text Colors...", user, defaultForeground,
|
String text = "Change ";
|
||||||
|
if (displayName) {
|
||||||
|
boolean me = CollaborationConnection.getConnection().getUser()
|
||||||
|
.getName().equals(user);
|
||||||
|
text += me ? "Your" : (user + "'s");
|
||||||
|
} else {
|
||||||
|
text += "User";
|
||||||
|
}
|
||||||
|
text += " Text Colors...";
|
||||||
|
|
||||||
|
return new ChangeTextColorAction(text, user, defaultForeground,
|
||||||
colorConfigManager);
|
colorConfigManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for changing site colors.
|
* Create and return new action for changing site colors.
|
||||||
*
|
*
|
||||||
* @param site
|
* @param site
|
||||||
* @param defaultForeground
|
* @param defaultForeground
|
||||||
* @param colorConfigManager
|
* @param colorConfigManager
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public ChangeTextColorAction(String site, RGB defaultForeground,
|
public static ChangeTextColorAction createChangeSiteTextColorAction(
|
||||||
|
String site, RGB defaultForeground,
|
||||||
FeedColorConfigManager colorConfigManager) {
|
FeedColorConfigManager colorConfigManager) {
|
||||||
this("Change Site Text Colors...", site, defaultForeground,
|
return new ChangeTextColorAction("Change Site Text Colors...", site,
|
||||||
colorConfigManager);
|
defaultForeground, colorConfigManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ChangeTextColorAction(String text, String key,
|
private ChangeTextColorAction(String text, String key,
|
||||||
RGB defaultForeground, AbstractColorConfigManager colorConfigManager) {
|
RGB defaultForeground, AbstractColorConfigManager colorConfigManager) {
|
||||||
super(text, IconUtil.getImageDescriptor(Activator.getDefault()
|
super(text);
|
||||||
.getBundle(), "change_color.gif"));
|
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.defaultForeground = defaultForeground;
|
this.defaultForeground = defaultForeground;
|
||||||
this.colorConfigManager = colorConfigManager;
|
this.colorConfigManager = colorConfigManager;
|
||||||
|
|
||||||
|
ColorInfo colorInfo = colorConfigManager.getColor(key);
|
||||||
|
RGB foreground;
|
||||||
|
RGB background;
|
||||||
|
if (colorInfo != null) {
|
||||||
|
foreground = colorInfo.getColor(SWT.FOREGROUND);
|
||||||
|
background = colorInfo.getColor(SWT.BACKGROUND);
|
||||||
|
} else {
|
||||||
|
foreground = defaultForeground;
|
||||||
|
background = new RGB(255, 255, 255);
|
||||||
|
}
|
||||||
|
setIconColors(foreground, background);
|
||||||
|
|
||||||
|
CollaborationConnection.getConnection().registerEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ColorInfo colorInfo = colorConfigManager.getColor(key);
|
ColorInfo colorInfo = colorConfigManager.getColor(key);
|
||||||
RGB background;
|
|
||||||
RGB foreground;
|
RGB foreground;
|
||||||
|
RGB background;
|
||||||
if (colorInfo != null) {
|
if (colorInfo != null) {
|
||||||
background = colorInfo.getColor(SWT.BACKGROUND);
|
|
||||||
foreground = colorInfo.getColor(SWT.FOREGROUND);
|
foreground = colorInfo.getColor(SWT.FOREGROUND);
|
||||||
|
background = colorInfo.getColor(SWT.BACKGROUND);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Set dialog to display default colors (if defaultForeground is
|
* Set dialog to display default colors
|
||||||
* null, ForegroundBackgroundColorDlg uses blue)
|
|
||||||
*/
|
*/
|
||||||
background = new RGB(255, 255, 255);
|
|
||||||
foreground = defaultForeground;
|
foreground = defaultForeground;
|
||||||
|
background = new RGB(255, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
ForegroundBackgroundColorDlg dialog = new ForegroundBackgroundColorDlg(
|
ForegroundBackgroundColorDlg dialog = new ForegroundBackgroundColorDlg(
|
||||||
|
@ -129,9 +164,72 @@ public class ChangeTextColorAction extends Action {
|
||||||
if (returnValue instanceof RGB[]) {
|
if (returnValue instanceof RGB[]) {
|
||||||
RGB[] colors = (RGB[]) returnValue;
|
RGB[] colors = (RGB[]) returnValue;
|
||||||
colorConfigManager.setColors(key, colors[0], colors[1]);
|
colorConfigManager.setColors(key, colors[0], colors[1]);
|
||||||
|
CollaborationConnection connection = CollaborationConnection
|
||||||
|
.getConnection();
|
||||||
|
connection.postEvent(new ChangeIconEvent(key, colors[0],
|
||||||
|
colors[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog.open();
|
dialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void changeIcon(ChangeIconEvent event) {
|
||||||
|
if (event.key.equals(this.key)) {
|
||||||
|
setIconColors(event.foreground, event.background);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setIconColors(RGB foreground, RGB background) {
|
||||||
|
Device device = Display.getCurrent();
|
||||||
|
Color fg = new Color(device, foreground);
|
||||||
|
Color bg = new Color(device, background);
|
||||||
|
|
||||||
|
Image oldIcon = icon;
|
||||||
|
icon = new Image(device, 15, 15);
|
||||||
|
Rectangle bounds = icon.getBounds();
|
||||||
|
|
||||||
|
GC gc = new GC(icon);
|
||||||
|
gc.setForeground(fg);
|
||||||
|
gc.setBackground(bg);
|
||||||
|
gc.fillRectangle(bounds);
|
||||||
|
gc.drawText("A", 4, 0);
|
||||||
|
|
||||||
|
setImageDescriptor(ImageDescriptor.createFromImage(icon));
|
||||||
|
|
||||||
|
gc.dispose();
|
||||||
|
fg.dispose();
|
||||||
|
bg.dispose();
|
||||||
|
if (oldIcon != null) {
|
||||||
|
oldIcon.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ChangeIconEvent {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
private RGB foreground;
|
||||||
|
|
||||||
|
private RGB background;
|
||||||
|
|
||||||
|
private ChangeIconEvent(String key, RGB foreground, RGB background) {
|
||||||
|
this.key = key;
|
||||||
|
this.foreground = foreground;
|
||||||
|
this.background = background;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
CollaborationConnection connection = CollaborationConnection
|
||||||
|
.getConnection();
|
||||||
|
if (connection != null) {
|
||||||
|
connection.unregisterEventHandler(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (icon != null) {
|
||||||
|
icon.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -75,6 +75,8 @@ import com.raytheon.uf.viz.core.sounds.SoundUtil;
|
||||||
* settings for each user
|
* settings for each user
|
||||||
* Nov 26, 2014 3709 mapeters add colorConfigManager, use parent's colors map
|
* Nov 26, 2014 3709 mapeters add colorConfigManager, use parent's colors map
|
||||||
* Dec 08, 2014 3709 mapeters move color change actions to menu bar.
|
* Dec 08, 2014 3709 mapeters move color change actions to menu bar.
|
||||||
|
* Dec 12, 2014 3709 mapeters Store {@link ChangeTextColorAction}s as fields,
|
||||||
|
* dispose them.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -105,6 +107,10 @@ public class PeerToPeerView extends AbstractSessionView<IUser> implements
|
||||||
|
|
||||||
private static UserColorConfigManager colorConfigManager;
|
private static UserColorConfigManager colorConfigManager;
|
||||||
|
|
||||||
|
private ChangeTextColorAction userColorAction;
|
||||||
|
|
||||||
|
private ChangeTextColorAction peerColorAction;
|
||||||
|
|
||||||
public PeerToPeerView() {
|
public PeerToPeerView() {
|
||||||
super();
|
super();
|
||||||
CollaborationConnection.getConnection().registerEventHandler(this);
|
CollaborationConnection.getConnection().registerEventHandler(this);
|
||||||
|
@ -123,6 +129,10 @@ public class PeerToPeerView extends AbstractSessionView<IUser> implements
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
conn.unregisterEventHandler(this);
|
conn.unregisterEventHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userColorAction.dispose();
|
||||||
|
peerColorAction.dispose();
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +401,10 @@ public class PeerToPeerView extends AbstractSessionView<IUser> implements
|
||||||
String myName = CollaborationConnection.getConnection().getUser()
|
String myName = CollaborationConnection.getConnection().getUser()
|
||||||
.getName();
|
.getName();
|
||||||
RGB defaultUserForeground = DEFAULT_USER_FOREGROUND_COLOR.getRGB();
|
RGB defaultUserForeground = DEFAULT_USER_FOREGROUND_COLOR.getRGB();
|
||||||
mgr.add(new ChangeTextColorAction(myName, true, true,
|
userColorAction = ChangeTextColorAction
|
||||||
defaultUserForeground, colorConfigManager));
|
.createChangeUserTextColorAction(myName, true,
|
||||||
|
defaultUserForeground, colorConfigManager);
|
||||||
|
mgr.add(userColorAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,7 +414,9 @@ public class PeerToPeerView extends AbstractSessionView<IUser> implements
|
||||||
IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
|
IMenuManager mgr = getViewSite().getActionBars().getMenuManager();
|
||||||
String peerName = peer.getName();
|
String peerName = peer.getName();
|
||||||
RGB defaultPeerForeground = DEFAULT_PEER_FOREGROUND_COLOR.getRGB();
|
RGB defaultPeerForeground = DEFAULT_PEER_FOREGROUND_COLOR.getRGB();
|
||||||
mgr.add(new ChangeTextColorAction(peerName, false, true,
|
peerColorAction = ChangeTextColorAction
|
||||||
defaultPeerForeground, colorConfigManager));
|
.createChangeUserTextColorAction(peerName, true,
|
||||||
|
defaultPeerForeground, colorConfigManager);
|
||||||
|
mgr.add(peerColorAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
|
@ -75,6 +77,7 @@ import com.raytheon.uf.viz.collaboration.ui.prefs.CollabPrefConstants;
|
||||||
* Oct 10, 2014 3708 bclement SiteConfigurationManager refactor
|
* Oct 10, 2014 3708 bclement SiteConfigurationManager refactor
|
||||||
* Nov 26, 2014 3709 mapeters support foreground/background color preferences for each site
|
* Nov 26, 2014 3709 mapeters support foreground/background color preferences for each site
|
||||||
* Dec 08, 2014 3709 mapeters Removed ChangeSiteColorAction, uses {@link ChangeTextColorAction}.
|
* Dec 08, 2014 3709 mapeters Removed ChangeSiteColorAction, uses {@link ChangeTextColorAction}.
|
||||||
|
* Dec 12, 2014 3709 mapeters Store {@link ChangeTextColorAction}s in map, dispose them.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -103,6 +106,8 @@ public class SessionFeedView extends SessionView {
|
||||||
|
|
||||||
private volatile boolean initialized = false;
|
private volatile boolean initialized = false;
|
||||||
|
|
||||||
|
private Map<String, ChangeTextColorAction> siteColorActions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -127,6 +132,8 @@ public class SessionFeedView extends SessionView {
|
||||||
|
|
||||||
colorConfigManager = new FeedColorConfigManager();
|
colorConfigManager = new FeedColorConfigManager();
|
||||||
usersTable.refresh();
|
usersTable.refresh();
|
||||||
|
|
||||||
|
siteColorActions = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -201,8 +208,14 @@ public class SessionFeedView extends SessionView {
|
||||||
String site = getSelectedSite();
|
String site = getSelectedSite();
|
||||||
RGB defaultForeground = colorManager
|
RGB defaultForeground = colorManager
|
||||||
.getColorForUser(getSelectedParticipant());
|
.getColorForUser(getSelectedParticipant());
|
||||||
manager.add(new ChangeTextColorAction(site, defaultForeground,
|
ChangeTextColorAction siteColorAction = siteColorActions.get(site);
|
||||||
colorConfigManager));
|
if(siteColorAction == null) {
|
||||||
|
siteColorAction = ChangeTextColorAction
|
||||||
|
.createChangeSiteTextColorAction(site, defaultForeground,
|
||||||
|
colorConfigManager);
|
||||||
|
siteColorActions.put(site, siteColorAction);
|
||||||
|
}
|
||||||
|
manager.add(siteColorAction);
|
||||||
if (!SiteConfigurationManager.isVisible(actingSite, site)) {
|
if (!SiteConfigurationManager.isVisible(actingSite, site)) {
|
||||||
userAddSiteAction
|
userAddSiteAction
|
||||||
.setText("Show Messages from " + getSelectedSite());
|
.setText("Show Messages from " + getSelectedSite());
|
||||||
|
@ -471,4 +484,13 @@ public class SessionFeedView extends SessionView {
|
||||||
super.participantDeparted(participant, description);
|
super.participantDeparted(participant, description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
for (ChangeTextColorAction siteColorAction : siteColorActions.values()) {
|
||||||
|
siteColorAction.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,9 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.jface.action.IContributionItem;
|
import org.eclipse.jface.action.IContributionItem;
|
||||||
import org.eclipse.jface.action.IMenuListener;
|
import org.eclipse.jface.action.IMenuListener;
|
||||||
|
@ -119,6 +121,7 @@ import com.raytheon.uf.viz.core.sounds.SoundUtil;
|
||||||
* Nov 26, 2014 3709 mapeters added styleAndAppendText() taking fg and bg colors,
|
* Nov 26, 2014 3709 mapeters added styleAndAppendText() taking fg and bg colors,
|
||||||
* use parent's colors map.
|
* use parent's colors map.
|
||||||
* Dec 02, 2014 3709 mapeters added color actions for group chats without shared display.
|
* Dec 02, 2014 3709 mapeters added color actions for group chats without shared display.
|
||||||
|
* Dec 12, 2014 3709 mapeters Store {@link ChangeTextColorAction}s in map, dispose them.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -154,6 +157,8 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
|
|
||||||
private static UserColorConfigManager colorConfigManager;
|
private static UserColorConfigManager colorConfigManager;
|
||||||
|
|
||||||
|
private Map<String, ChangeTextColorAction> userColorActions;
|
||||||
|
|
||||||
protected boolean enableUserColors = true;
|
protected boolean enableUserColors = true;
|
||||||
|
|
||||||
public SessionView() {
|
public SessionView() {
|
||||||
|
@ -179,6 +184,7 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
super.initComponents(parent);
|
super.initComponents(parent);
|
||||||
if (enableUserColors) {
|
if (enableUserColors) {
|
||||||
colorConfigManager = new UserColorConfigManager();
|
colorConfigManager = new UserColorConfigManager();
|
||||||
|
userColorActions = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// unfortunately this code cannot be a part of createToolbarButton
|
// unfortunately this code cannot be a part of createToolbarButton
|
||||||
|
@ -237,8 +243,14 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
// add color actions if in group chat room without shared display
|
// add color actions if in group chat room without shared display
|
||||||
String user = entry.getName();
|
String user = entry.getName();
|
||||||
RGB defaultForeground = colorManager.getColorForUser(entry);
|
RGB defaultForeground = colorManager.getColorForUser(entry);
|
||||||
manager.add(new ChangeTextColorAction(user, me, me,
|
ChangeTextColorAction userColorAction = userColorActions.get(user);
|
||||||
defaultForeground, colorConfigManager));
|
if (userColorAction == null) {
|
||||||
|
userColorAction = ChangeTextColorAction
|
||||||
|
.createChangeUserTextColorAction(user, me,
|
||||||
|
defaultForeground, colorConfigManager);
|
||||||
|
userColorActions.put(user, userColorAction);
|
||||||
|
}
|
||||||
|
manager.add(userColorAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +440,13 @@ public class SessionView extends AbstractSessionView<VenueParticipant>
|
||||||
colorManager.clearColors();
|
colorManager.clearColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userColorActions != null) {
|
||||||
|
for (ChangeTextColorAction userColorAction : userColorActions
|
||||||
|
.values()) {
|
||||||
|
userColorAction.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// clean up event handlers
|
// clean up event handlers
|
||||||
session.unregisterEventHandler(this);
|
session.unregisterEventHandler(this);
|
||||||
session.close();
|
session.close();
|
||||||
|
|
Loading…
Add table
Reference in a new issue