final String icon = treeNode.getIcon();
String userId = panel.ensureUserLoggedIn();
if (userId == null) {
// Log out, then show sample:
Authentication.getInstance().logout(new BooleanCallback() {
public void execute(Boolean value) {
if (value) {
showSample(panel, name, icon);
}
}
});
} else if (userId.equals(Authentication.getInstance().getUserId())) {
showSample(panel, treeNode.getName(), treeNode.getIcon());
} else {
// Switch user, then show sample:
Authentication.getInstance().login(userId, userId, new BooleanCallback() {
public void execute(Boolean value) {
if (value) {
showSample(panel, name, icon);
}