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 void addToShare(VuzeBuddy buddy) { AvatarWidget widget = findWidget(buddy); if (null != widget) { if (false == widget.isSharedAlready()) { addToShare(widget); } } }
public void addSelectionToShare() { for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (true == widget.isSelected()) { addToShare(widget); } } }
/** * Return a list of <code>VuzeBuddySWT</code> that are currently selected * * @return */ public List getSelection() { List selected = new ArrayList(); for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (true == widget.isSelected()) { selected.add(widget.getVuzeBuddy()); } } return selected; }
/** * Returns whether the given <code>AvatarWidget</code> is fully visible in the view port of the * viewer */ public boolean isFullyVisible(AvatarWidget avatarWidget) { if (null != avatarWidget && null != avatarWidget.getControl() && false == avatarWidget.getControl().isDisposed()) { Rectangle controlBounds = avatarWidget.getControl().getBounds(); if (controlBounds.x + controlBounds.width < avatarsPanel.getBounds().width - avatarsPanel.getBounds().x) { return true; } } return false; }
private AvatarWidget findWidget(VuzeBuddy buddy) { if (null != buddy) { for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (null != widget.getVuzeBuddy()) { if (true == buddy.getLoginID().equals(widget.getVuzeBuddy().getLoginID())) { return widget; } } } } return null; }
public void setEditMode(boolean value) { if (isEditMode != value) { isEditMode = value; for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); widget.refreshVisual(); } if (true == value) { setShareMode(false, null); setAddBuddyMode(false); } } }
public void removeFromShare(VuzeBuddy buddy) { if (null != buddy) { for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (null != widget.getVuzeBuddy()) { if (true == buddy.getLoginID().equals(widget.getVuzeBuddy().getLoginID())) { if (sharePage != null) { sharePage.removeBuddy(widget.getVuzeBuddy()); } widget.setSharedAlready(false); break; } } } } }
public void addToShare(AvatarWidget widget) { /*if (null == sharePage) { SkinView detailPanelView = SkinViewManager.getByClass(DetailPanel.class); if (detailPanelView instanceof DetailPanel) { DetailPanel detailPanel = ((DetailPanel) detailPanelView); sharePage = (SharePage) detailPanel.getPage(SharePage.PAGE_ID); } else { throw new IllegalArgumentException( "Oops.. looks like the DetailPanel skin is not properly initialized"); } }*/ if (sharePage != null) { sharePage.addBuddy(widget.getVuzeBuddy()); } widget.setSharedAlready(true); }
public void setShareMode(boolean isShareMode, SharePage sharePage) { this.sharePage = sharePage; if (this.isShareMode != isShareMode) { this.isShareMode = isShareMode; for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (false == isShareMode) { widget.setSharedAlready(false); } widget.refreshVisual(); } if (true == isShareMode) { setEditMode(false); setAddBuddyMode(false); } } }
public void removeFromShare(AvatarWidget widget) { if (sharePage != null) { sharePage.removeBuddy(widget.getVuzeBuddy()); } widget.setSharedAlready(false); }
public void select(VuzeBuddySWT buddy, boolean value, boolean appendSelection) { if (null != buddy) { for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (true == buddy.equals(widget.getVuzeBuddy())) { widget.setSelected(value); if (true == appendSelection) { break; } } else if (false == appendSelection) { if (true == value) { if (widget.isSelected() != false) { widget.setSelected(false); widget.refreshVisual(); } } else { widget.setSelected(false); widget.refreshVisual(); } } } } /* * De-select all buddies if the given 'buddy' is null */ else { for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) { AvatarWidget widget = (AvatarWidget) iterator.next(); if (true == widget.isSelected()) { widget.setSelected(false); widget.refreshVisual(); } } } }