Exemplo n.º 1
0
  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;
  }
Exemplo n.º 2
0
 public void addToShare(VuzeBuddy buddy) {
   AvatarWidget widget = findWidget(buddy);
   if (null != widget) {
     if (false == widget.isSharedAlready()) {
       addToShare(widget);
     }
   }
 }
Exemplo n.º 3
0
  public void addSelectionToShare() {

    for (Iterator iterator = avatarWidgets.iterator(); iterator.hasNext(); ) {
      AvatarWidget widget = (AvatarWidget) iterator.next();
      if (true == widget.isSelected()) {
        addToShare(widget);
      }
    }
  }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
  /**
   * 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;
  }
Exemplo n.º 6
0
  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;
  }
Exemplo n.º 7
0
  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);
      }
    }
  }
Exemplo n.º 8
0
  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;
          }
        }
      }
    }
  }
Exemplo n.º 9
0
  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);
  }
Exemplo n.º 10
0
  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);
      }
    }
  }
Exemplo n.º 11
0
 public void removeFromShare(AvatarWidget widget) {
   if (sharePage != null) {
     sharePage.removeBuddy(widget.getVuzeBuddy());
   }
   widget.setSharedAlready(false);
 }
Exemplo n.º 12
0
  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();
        }
      }
    }
  }