Issue #448 slight changes to data provider and session leader indicators
Former-commit-id: 61bcce04de9bf4e4756140903ed3dd861333fd2b
This commit is contained in:
parent
069f809596
commit
06d71f13ad
4 changed files with 71 additions and 7 deletions
|
@ -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;
|
||||
|
|
|
@ -74,6 +74,10 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
|
|||
|
||||
private Font boldFont;
|
||||
|
||||
private Font underlinedFont;
|
||||
|
||||
private Font combinedFont;
|
||||
|
||||
public ParticipantsLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
imageMap = new HashMap<String, Image>();
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<UserIdAlias>();
|
||||
|
|
Loading…
Add table
Reference in a new issue