From 06d71f13ad531439b339ab7e251ba77be12a76f7 Mon Sep 17 00:00:00 2001 From: Matt Nash Date: Wed, 25 Apr 2012 15:06:59 -0500 Subject: [PATCH] Issue #448 slight changes to data provider and session leader indicators Former-commit-id: 61bcce04de9bf4e4756140903ed3dd861333fd2b --- .../ui/session/CollaborationSessionView.java | 14 +++++ .../ui/session/ParticipantsLabelProvider.java | 53 +++++++++++++++++-- .../collaboration/ui/session/SessionView.java | 7 ++- .../session/CollaborationConnection.java | 4 +- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java index ffd67ae6f7..8f935a0ab7 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/CollaborationSessionView.java @@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; import org.eclipse.ui.IWorkbenchPart; +import com.google.common.eventbus.Subscribe; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -47,6 +48,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; +import com.raytheon.uf.viz.core.VizApp; /** * TODO Add Description @@ -115,6 +117,7 @@ public class CollaborationSessionView extends SessionView { IRosterEntry selectedUser = (IRosterEntry) selection .getFirstElement(); switchLeader(selectedUser.getUser()); + usersTable.refresh(); }; }; ActionContributionItem leaderItem = new ActionContributionItem( @@ -130,6 +133,7 @@ public class CollaborationSessionView extends SessionView { IRosterEntry selectedUser = (IRosterEntry) selection .getFirstElement(); switchDataProvider(selectedUser.getUser()); + usersTable.refresh(); }; }; ActionContributionItem dataProviderItem = new ActionContributionItem( @@ -188,6 +192,16 @@ public class CollaborationSessionView extends SessionView { } } + @Subscribe + public void refreshAfterTransfer(TransferRoleCommand command) { + VizApp.runAsync(new Runnable() { + @Override + public void run() { + usersTable.refresh(); + } + }); + } + @Override protected String getSessionImageName() { return COLLABORATION_SESSION_IMAGE_NAME; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java index 4111feb0ca..5641065ea5 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java @@ -74,6 +74,10 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider { private Font boldFont; + private Font underlinedFont; + + private Font combinedFont; + public ParticipantsLabelProvider() { listeners = new ArrayList(); imageMap = new HashMap(); @@ -95,6 +99,16 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider { col.dispose(); } } + + if (boldFont != null && !boldFont.isDisposed()) { + boldFont.dispose(); + } + if (underlinedFont != null && !underlinedFont.isDisposed()) { + underlinedFont.dispose(); + } + if (combinedFont != null && !combinedFont.isDisposed()) { + combinedFont.dispose(); + } } @Override @@ -194,11 +208,42 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider { @Override public Font getFont(Object element) { - if (boldFont == null) { - Font currFont = Display.getCurrent().getSystemFont(); - boldFont = new Font(Display.getCurrent(), currFont.toString(), - currFont.getFontData()[0].getHeight(), SWT.BOLD); + IRosterEntry user = (IRosterEntry) element; + IVenueSession session = CollaborationDataManager.getInstance() + .getSession(sessionId); + if (session instanceof SharedDisplaySession) { + boolean isSessionLeader = user.getUser().equals( + ((SharedDisplaySession) session).getCurrentSessionLeader()); + boolean isDataProvider = user.getUser().equals( + ((SharedDisplaySession) session).getCurrentDataProvider()); + if (isSessionLeader && isDataProvider) { + Font currFont = Display.getCurrent().getSystemFont(); + if (combinedFont == null) { + combinedFont = new Font(Display.getCurrent(), + currFont.toString(), + currFont.getFontData()[0].getHeight(), SWT.BOLD + | SWT.ITALIC); + } + return combinedFont; + } else if (isSessionLeader) { + if (boldFont == null) { + Font currFont = Display.getCurrent().getSystemFont(); + boldFont = new Font(Display.getCurrent(), + currFont.toString(), + currFont.getFontData()[0].getHeight(), SWT.BOLD); + } + return boldFont; + } else if (isDataProvider) { + if (underlinedFont == null) { + Font currFont = Display.getCurrent().getSystemFont(); + underlinedFont = new Font(Display.getCurrent(), + currFont.toString(), + currFont.getFontData()[0].getHeight(), SWT.ITALIC); + } + return underlinedFont; + } } + return boldFont; } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java index 87095b8b36..bc65c93ff6 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java @@ -234,7 +234,12 @@ public class SessionView extends AbstractSessionView { @Subscribe public void handleModifiedPresence(IRosterEntry rosterEntry) { - usersTable.refresh(); + VizApp.runAsync(new Runnable() { + @Override + public void run() { + usersTable.refresh(); + } + }); } @Subscribe diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java index 6e4993fcc8..24f09f0c4e 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java @@ -790,8 +790,8 @@ public class CollaborationConnection implements IEventPublisher { } } catch (SerializationException e) { aliases = null; - statusHandler.handle(Priority.PROBLEM, - "Unable to retrieve aliases", e); + statusHandler + .handle(Priority.WARN, "Unable to retrieve aliases", e); } if (aliases == null) { aliases = new ArrayList();