private AvatarWidget createBuddyControls(Composite composite, final VuzeBuddySWT vuzeBuddy) { AvatarWidget avatarWidget = new AvatarWidget(this, avatarSize, avatarImageSize, avatarNameSize, vuzeBuddy); avatarWidget.setBorderWidth(avatarHightLightBorder); avatarWidget.setTextColor(textColor); avatarWidget.setSelectedTextColor(selectedTextColor); avatarWidget.setTextLinkColor(textLinkColor); avatarWidget.setImageBorderColor(imageBorderColor); avatarWidget.setImageBorder(avatarImageBorder); avatarWidget.setSelectedColor(selectedColor); avatarWidget.setHighlightedColor(highlightedColor); /* UNCOMMENT THIS SECTION TO REVERT TO A ROW LAYOUT*/ // RowData rData = new RowData(); // rData.width = avatarSize.x; // rData.height = avatarSize.y; // avatarWidget.getControl().setLayoutData(rData); // COMMENT THIS SECTION TO REVERT TO A ROW LAYOUT SimpleReorderableListLayoutData rData = new SimpleReorderableListLayoutData(); rData.width = avatarSize.x; rData.height = avatarSize.y; rData.position = (int) VuzeBuddyManager.getBuddyPosition(vuzeBuddy); avatarWidget.getControl().setLayoutData(rData); avatarWidgets.add(avatarWidget); chat.checkBuddy(vuzeBuddy); return avatarWidget; }
public BuddiesViewer() { chat = new Chat(); chat.addChatListener( new ChatListener() { public void newMessage(final VuzeBuddy from, final ChatMessage message) { final AvatarWidget avatarWidget = findWidget(from); if (avatarWidget != null) { avatarWidget.setChatDiscussion(chat.getChatDiscussionFor(from)); BuddyPlugin plugin = VuzeBuddyManager.getBuddyPlugin(); if (plugin != null) { BooleanParameter enabledNotifictions = plugin.getEnableChatNotificationsParameter(); if (!message.isMe() && enabledNotifictions.getValue()) { avatarWidget .getControl() .getDisplay() .asyncExec( new Runnable() { public void run() { boolean isVisible = true; if (avatarsPanel != null) { if (!avatarsPanel.isVisible()) { isVisible = false; } /*Shell mainShell = avatarsPanel.getShell(); boolean mVisible = mainShell.isVisible(); boolean mEnabled = mainShell.isEnabled(); boolean mGetEnabled = mainShell.getEnabled(); boolean isFC = mainShell.isFocusControl(); Shell activeShell = mainShell.getDisplay().getActiveShell();*/ if (avatarsPanel.getShell().getDisplay().getActiveShell() == null) { isVisible = false; } } // boolean isVisible = BuddiesViewer.this.isEnabled(); // avatarWidget.isChatWindowVisible(); if (!isVisible) { new MessageNotificationWindow(avatarWidget, message); /* * KN: MessageNotificationWindow above should really be moved into requestUserAttention() * so it can be handled in a platform-specific way if need be */ UserAlerts.requestUserAttention( PlatformManager.USER_REQUEST_INFO, null); } } }); } } } } public void updatedChat(VuzeBuddy buddy) { final AvatarWidget avatarWidget = findWidget(buddy); if (avatarWidget != null) { avatarWidget.setChatDiscussion(chat.getChatDiscussionFor(buddy)); } } }); /* * backed this change out as the desired behaviour is to continue showing * buddies when logged out as all attempts to do something with buddy will * prompt for login * LoginInfoManager.getInstance().addListener( new ILoginInfoListener() { public void loginUpdate( LoginInfo info, boolean isNewLoginID ) { Utils.execSWTThreadLater(0, new AERunnable() { public void runSupport() { boolean logged_in = LoginInfoManager.getInstance().isLoggedIn(); boolean show_no_buddies = avatarWidgets.size() < 1 || !logged_in; showNoBuddiesPanel( show_no_buddies ); } }); } }); */ }