Issue #448 slight changes to data provider and session leader indicators

Former-commit-id: 61bcce04de9bf4e4756140903ed3dd861333fd2b
This commit is contained in:
Matt Nash 2012-04-25 15:06:59 -05:00
parent 069f809596
commit 06d71f13ad
4 changed files with 71 additions and 7 deletions

View file

@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import com.google.common.eventbus.Subscribe;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.core.VizApp;
/** /**
* TODO Add Description * TODO Add Description
@ -115,6 +117,7 @@ public class CollaborationSessionView extends SessionView {
IRosterEntry selectedUser = (IRosterEntry) selection IRosterEntry selectedUser = (IRosterEntry) selection
.getFirstElement(); .getFirstElement();
switchLeader(selectedUser.getUser()); switchLeader(selectedUser.getUser());
usersTable.refresh();
}; };
}; };
ActionContributionItem leaderItem = new ActionContributionItem( ActionContributionItem leaderItem = new ActionContributionItem(
@ -130,6 +133,7 @@ public class CollaborationSessionView extends SessionView {
IRosterEntry selectedUser = (IRosterEntry) selection IRosterEntry selectedUser = (IRosterEntry) selection
.getFirstElement(); .getFirstElement();
switchDataProvider(selectedUser.getUser()); switchDataProvider(selectedUser.getUser());
usersTable.refresh();
}; };
}; };
ActionContributionItem dataProviderItem = new ActionContributionItem( 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 @Override
protected String getSessionImageName() { protected String getSessionImageName() {
return COLLABORATION_SESSION_IMAGE_NAME; return COLLABORATION_SESSION_IMAGE_NAME;

View file

@ -74,6 +74,10 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
private Font boldFont; private Font boldFont;
private Font underlinedFont;
private Font combinedFont;
public ParticipantsLabelProvider() { public ParticipantsLabelProvider() {
listeners = new ArrayList<ILabelProviderListener>(); listeners = new ArrayList<ILabelProviderListener>();
imageMap = new HashMap<String, Image>(); imageMap = new HashMap<String, Image>();
@ -95,6 +99,16 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
col.dispose(); col.dispose();
} }
} }
if (boldFont != null && !boldFont.isDisposed()) {
boldFont.dispose();
}
if (underlinedFont != null && !underlinedFont.isDisposed()) {
underlinedFont.dispose();
}
if (combinedFont != null && !combinedFont.isDisposed()) {
combinedFont.dispose();
}
} }
@Override @Override
@ -194,11 +208,42 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
@Override @Override
public Font getFont(Object element) { public Font getFont(Object element) {
if (boldFont == null) { IRosterEntry user = (IRosterEntry) element;
Font currFont = Display.getCurrent().getSystemFont(); IVenueSession session = CollaborationDataManager.getInstance()
boldFont = new Font(Display.getCurrent(), currFont.toString(), .getSession(sessionId);
currFont.getFontData()[0].getHeight(), SWT.BOLD); 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; return boldFont;
} }

View file

@ -234,7 +234,12 @@ public class SessionView extends AbstractSessionView {
@Subscribe @Subscribe
public void handleModifiedPresence(IRosterEntry rosterEntry) { public void handleModifiedPresence(IRosterEntry rosterEntry) {
usersTable.refresh(); VizApp.runAsync(new Runnable() {
@Override
public void run() {
usersTable.refresh();
}
});
} }
@Subscribe @Subscribe

View file

@ -790,8 +790,8 @@ public class CollaborationConnection implements IEventPublisher {
} }
} catch (SerializationException e) { } catch (SerializationException e) {
aliases = null; aliases = null;
statusHandler.handle(Priority.PROBLEM, statusHandler
"Unable to retrieve aliases", e); .handle(Priority.WARN, "Unable to retrieve aliases", e);
} }
if (aliases == null) { if (aliases == null) {
aliases = new ArrayList<UserIdAlias>(); aliases = new ArrayList<UserIdAlias>();