Exemple #1
0
  /**
   * Creates all the controls (including encoding) for a type(AUDIO or VIDEO)
   *
   * @param type the type.
   * @return the build Component.
   */
  private static Component createControls(int type) {
    ConfigurationService cfg = NeomediaActivator.getConfigurationService();
    SIPCommTabbedPane container = new SIPCommTabbedPane();
    ResourceManagementService res = NeomediaActivator.getResources();

    if ((cfg == null) || !cfg.getBoolean(DEVICES_DISABLED_PROP, false)) {
      container.insertTab(
          res.getI18NString("impl.media.configform.DEVICES"),
          null,
          createBasicControls(type),
          null,
          0);
    }
    if ((cfg == null) || !cfg.getBoolean(ENCODINGS_DISABLED_PROP, false)) {
      container.insertTab(
          res.getI18NString("impl.media.configform.ENCODINGS"),
          null,
          new PriorityTable(
              new EncodingConfigurationTableModel(mediaService.getEncodingConfiguration(), type),
              100),
          null,
          1);
    }
    if ((type == DeviceConfigurationComboBoxModel.VIDEO)
        && ((cfg == null) || !cfg.getBoolean(VIDEO_MORE_SETTINGS_DISABLED_PROP, false))) {
      container.insertTab(
          res.getI18NString("impl.media.configform.VIDEO_MORE_SETTINGS"),
          null,
          createVideoAdvancedSettings(),
          null,
          2);
    }
    return container;
  }
  /** 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());
    }
  }
  /**
   * 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);
  }
  /**
   * 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);
  }