Esempio n. 1
0
  /** Reloads status icons. */
  public void loadSkin() {
    super.loadSkin();

    int count = getTabCount();

    for (int i = 0; i < count; i++) {
      Component c = this.getComponentAt(i);

      if (c instanceof ChatPanel)
        setIconAt(i, ((ChatPanel) c).getChatSession().getChatStatusIcon());
    }
  }
Esempio n. 2
0
  /**
   * When a tab is highlighted sets an indicator of the number of unread messages in this tab.
   *
   * @param tabIndex the index of the tab
   * @param unreadMessageNumber the number of messages that the user hasn't yet read
   */
  public void highlightTab(int tabIndex, int unreadMessageNumber) {
    Component c = this.getComponentAt(tabIndex);

    String tabTitle = "";
    if (c instanceof ChatPanel) tabTitle = ((ChatPanel) c).getChatSession().getChatName();
    else if (c instanceof CallPanel) tabTitle = ((CallPanel) c).getCallTitle();

    if (unreadMessageNumber > 0) tabTitle = "(" + unreadMessageNumber + ") " + tabTitle;

    this.setTitleAt(tabIndex, tabTitle);

    super.highlightTab(tabIndex);
  }
Esempio n. 3
0
  /**
   * Overrides setSelectedIndex in SIPCommTabbedPane in order to remove the indicator of number of
   * unread messages previously set.
   *
   * @param tabIndex the index of the tab to be selected
   */
  public void setSelectedIndex(int tabIndex) {
    if (tabIndex < 0) return;

    Component c = this.getComponentAt(tabIndex);

    if (c instanceof ChatPanel) {
      ChatPanel chatPanel = (ChatPanel) c;

      int unreadMessageNumber = chatPanel.unreadMessageNumber;

      if (unreadMessageNumber > 0) {
        String tabTitle = chatPanel.getChatSession().getChatName();
        this.setTitleAt(tabIndex, tabTitle);
      }

      chatPanel.unreadMessageNumber = 0;
    }

    super.setSelectedIndex(tabIndex);
  }