Exemple #1
0
  /** Initializes and constructs this panel. */
  private void init() {
    this.phoneNumberCombo.setEditable(true);

    this.callViaPanel.add(callViaLabel);
    this.callViaPanel.add(accountSelectorBox);

    this.comboPanel.add(phoneNumberCombo, BorderLayout.CENTER);

    this.callButton.setName("call");
    this.hangupButton.setName("hangup");
    this.minimizeButton.setName("minimize");
    this.restoreButton.setName("restore");

    this.minimizeButton.setToolTipText(
        Messages.getI18NString("hideCallPanel").getText() + " Ctrl - H");
    this.restoreButton.setToolTipText(
        Messages.getI18NString("showCallPanel").getText() + " Ctrl - H");

    this.callButton.addActionListener(this);
    this.hangupButton.addActionListener(this);
    this.minimizeButton.addActionListener(this);
    this.restoreButton.addActionListener(this);

    this.buttonsPanel.add(callButton);
    this.buttonsPanel.add(hangupButton);

    this.callButton.setEnabled(false);

    this.hangupButton.setEnabled(false);

    this.add(minimizeButtonPanel, BorderLayout.SOUTH);

    this.setCallPanelVisible(ConfigurationManager.isCallPanelShown());
  }
Exemple #2
0
  /** Hides the panel containing call and hangup buttons. */
  public void setCallPanelVisible(boolean isVisible) {
    if (isVisible) {
      this.add(comboPanel, BorderLayout.NORTH);
      this.add(buttonsPanel, BorderLayout.CENTER);

      this.minimizeButtonPanel.removeAll();
      this.minimizeButtonPanel.add(minimizeButton);
    } else {
      this.remove(comboPanel);
      this.remove(buttonsPanel);

      this.minimizeButtonPanel.removeAll();
      this.minimizeButtonPanel.add(restoreButton);

      if (mainFrame.isVisible())
        this.mainFrame.getContactListPanel().getContactList().requestFocus();
    }

    if (ConfigurationManager.isCallPanelShown() != isVisible)
      ConfigurationManager.setShowCallPanel(isVisible);

    this.mainFrame.validate();
  }
  /**
   * Handles the <tt>ActionEvent</tt>. Determines which menu item was selected and makes the
   * appropriate operations.
   *
   * @param e the event.
   */
  public void actionPerformed(ActionEvent e) {
    JMenuItem menuItem = (JMenuItem) e.getSource();
    String itemName = menuItem.getName();

    ConferenceChatManager conferenceManager =
        GuiActivator.getUIService().getConferenceChatManager();

    if (itemName.equals("removeChatRoom")) {
      conferenceManager.removeChatRoom(chatRoomWrapper);
    } else if (itemName.equals("leaveChatRoom")) {
      conferenceManager.leaveChatRoom(chatRoomWrapper);
    } else if (itemName.equals("joinChatRoom")) {
      String nickName = null;

      nickName =
          ConfigurationManager.getChatRoomProperty(
              chatRoomWrapper.getParentProvider().getProtocolProvider(),
              chatRoomWrapper.getChatRoomID(),
              "userNickName");
      if (nickName == null) nickName = getNickname();

      if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null);
      else conferenceManager.joinChatRoom(chatRoomWrapper);
    } else if (itemName.equals("openChatRoom")) {
      if (chatRoomWrapper.getChatRoom() != null) {
        if (!chatRoomWrapper.getChatRoom().isJoined()) {
          String nickName = null;

          nickName =
              ConfigurationManager.getChatRoomProperty(
                  chatRoomWrapper.getParentProvider().getProtocolProvider(),
                  chatRoomWrapper.getChatRoomID(),
                  "userNickName");
          if (nickName == null) nickName = getNickname();

          if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null);
          else conferenceManager.joinChatRoom(chatRoomWrapper);
        }
      } else {
        // this is not a server persistent room we must create it
        // and join
        chatRoomWrapper =
            GuiActivator.getUIService()
                .getConferenceChatManager()
                .createChatRoom(
                    chatRoomWrapper.getChatRoomName(),
                    chatRoomWrapper.getParentProvider().getProtocolProvider(),
                    new ArrayList<String>(),
                    "",
                    false,
                    true);

        String nickName = null;

        nickName =
            ConfigurationManager.getChatRoomProperty(
                chatRoomWrapper.getParentProvider().getProtocolProvider(),
                chatRoomWrapper.getChatRoomID(),
                "userNickName");

        if (nickName == null) nickName = getNickname();

        if (nickName != null) conferenceManager.joinChatRoom(chatRoomWrapper, nickName, null);
        else conferenceManager.joinChatRoom(chatRoomWrapper);
      }

      ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager();
      ChatPanel chatPanel = chatWindowManager.getMultiChat(chatRoomWrapper, true);

      chatWindowManager.openChat(chatPanel, true);
    } else if (itemName.equals("joinAsChatRoom")) {
      ChatRoomAuthenticationWindow authWindow = new ChatRoomAuthenticationWindow(chatRoomWrapper);

      authWindow.setVisible(true);
    } else if (itemName.equals("nickNameChatRoom")) {
      String nickName = null;

      nickName =
          ConfigurationManager.getChatRoomProperty(
              chatRoomWrapper.getParentProvider().getProtocolProvider(),
              chatRoomWrapper.getChatRoomID(),
              "userNickName");

      ChatOperationReasonDialog reasonDialog =
          new ChatOperationReasonDialog(
              GuiActivator.getResources().getI18NString("service.gui.CHANGE_NICKNAME"),
              GuiActivator.getResources().getI18NString("service.gui.CHANGE_NICKNAME_LABEL"));

      reasonDialog.setReasonFieldText(
          nickName == null
              ? chatRoomWrapper.getParentProvider().getProtocolProvider().getAccountID().getUserID()
              : nickName);

      int result = reasonDialog.showDialog();

      if (result == MessageDialog.OK_RETURN_CODE) {
        nickName = reasonDialog.getReason().trim();
      }

      ConfigurationManager.updateChatRoomProperty(
          chatRoomWrapper.getParentProvider().getProtocolProvider(),
          chatRoomWrapper.getChatRoomID(),
          "userNickName",
          nickName);
    }
  }