Пример #1
1
  /**
   * Sets the mute status icon to the status panel.
   *
   * @param isMute indicates if the call with this peer is muted
   */
  public void setMute(final boolean isMute) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setMute(isMute);
            }
          });
      return;
    }

    if (isMute) {
      muteStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.MUTE_STATUS_ICON)));
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
    } else {
      muteStatusLabel.setIcon(null);
      muteStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    }

    // Update input volume control button state to reflect the current
    // mute status.
    if (localLevel.isSelected() != isMute) localLevel.setSelected(isMute);

    this.revalidate();
    this.repaint();
  }
Пример #2
0
  /**
   * Creates an instance of <tt>CallManager</tt>.
   *
   * @param mainFrame The main application window.
   */
  public CallManager(MainFrame mainFrame) {
    super(new BorderLayout());

    this.mainFrame = mainFrame;

    this.phoneNumberCombo = new CallComboBox(this);

    this.accountSelectorBox = new AccountSelectorBox(this);

    this.buttonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));

    this.comboPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));

    this.init();
  }
  /**
   * Creates an instance of the <tt>LoginWindow</tt>.
   *
   * @param chatRoom the chat room for which we're authenticating
   */
  public ChatRoomAuthenticationWindow(ChatRoomWrapper chatRoom) {
    this.chatRoom = chatRoom;

    ImageIcon logoImage = new ImageIcon(chatRoom.getParentProvider().getImage());

    backgroundPanel = new LoginWindowBackground(logoImage);

    this.backgroundPanel.setPreferredSize(new Dimension(420, 230));

    this.backgroundPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    this.backgroundPanel.setBorder(BorderFactory.createEmptyBorder(20, 5, 5, 5));

    this.getContentPane().setLayout(new BorderLayout());

    this.init();

    this.getContentPane().add(backgroundPanel, BorderLayout.CENTER);

    this.setResizable(false);

    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    this.setTitle(
        GuiActivator.getResources()
            .getI18NString(
                "service.gui.AUTHENTICATION_WINDOW_TITLE",
                new String[] {chatRoom.getParentProvider().getName()}));

    this.enableKeyActions();
  }
Пример #4
0
  /**
   * Creates the <tt>Component</tt> hierarchy of the area of status-related information such as
   * <tt>CallPeer</tt> display name, call duration, security status.
   *
   * @return the root of the <tt>Component</tt> hierarchy of the area of status-related information
   *     such as <tt>CallPeer</tt> display name, call duration, security status
   */
  private Component createStatusBar() {
    // stateLabel
    callStatusLabel.setForeground(Color.WHITE);
    dtmfLabel.setForeground(Color.WHITE);
    callStatusLabel.setText(callPeer.getState().getLocalizedStateString());

    PeerStatusPanel statusPanel = new PeerStatusPanel(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.gridx = 0;
    constraints.gridy = 0;
    statusPanel.add(securityStatusLabel, constraints);
    initSecurityStatusLabel();

    constraints.gridx++;
    statusPanel.add(holdStatusLabel, constraints);

    constraints.gridx++;
    statusPanel.add(muteStatusLabel, constraints);

    constraints.gridx++;
    callStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 12));
    statusPanel.add(callStatusLabel, constraints);

    constraints.gridx++;
    constraints.weightx = 1f;
    statusPanel.add(dtmfLabel, constraints);

    return statusPanel;
  }
 /** Sets the correct border depending on the contained object. */
 private void setBorder() {
   /*
    * !!! When changing border values we should make sure that we
    * recalculate the X and Y coordinates of the buttons added in
    * initButtonsPanel and initContactActionButtons functions. If not
    * correctly calculated problems may occur when clicking buttons!
    */
   if (treeNode instanceof ContactNode
       && !(((ContactNode) treeNode).getContactDescriptor() instanceof ShowMoreContact)) {
     this.setBorder(
         BorderFactory.createEmptyBorder(TOP_BORDER, LEFT_BORDER, BOTTOM_BORDER, RIGHT_BORDER));
   } else // GroupNode || ShowMoreContact
   {
     this.setBorder(BorderFactory.createEmptyBorder(0, LEFT_BORDER, 0, RIGHT_BORDER));
   }
 }
  private int addButton(SIPCommButton button, int gridX, int xBounds, boolean isLast) {
    lastAddedButton = button;

    constraints.insets = new Insets(0, 0, V_GAP, 0);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridx = gridX;
    constraints.gridy = 2;
    constraints.gridwidth = 1;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    this.add(button, constraints);

    int yBounds =
        TOP_BORDER
            + BOTTOM_BORDER
            + 2 * V_GAP
            + ComponentUtils.getStringSize(nameLabel, nameLabel.getText()).height
            + ComponentUtils.getStringSize(displayDetailsLabel, displayDetailsLabel.getText())
                .height;

    button.setBounds(xBounds, yBounds, BUTTON_WIDTH, BUTTON_HEIGHT);

    button.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    setButtonBg(button, gridX, isLast);

    return button.getWidth();
  }
Пример #7
0
  /**
   * Sets the "on hold" property value.
   *
   * @param isOnHold indicates if the call with this peer is put on hold
   */
  public void setOnHold(final boolean isOnHold) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setOnHold(isOnHold);
            }
          });
      return;
    }

    if (isOnHold) {
      holdStatusLabel.setIcon(new ImageIcon(ImageLoader.getImage(ImageLoader.HOLD_STATUS_ICON)));
      holdStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 3, 2, 3));
    } else {
      holdStatusLabel.setIcon(null);
      holdStatusLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    }

    this.revalidate();
    this.repaint();
  }
Пример #8
0
  /**
   * Indicates that the security has gone off.
   *
   * @param evt the <tt>CallPeerSecurityOffEvent</tt> that notified us
   */
  public void securityOff(final CallPeerSecurityOffEvent evt) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              securityOff(evt);
            }
          });
      return;
    }

    if (evt.getSessionType() == CallPeerSecurityOffEvent.AUDIO_SESSION) {
      securityStatusLabel.setText("");
      securityStatusLabel.setSecurityOff();
      if (securityStatusLabel.getBorder() == null)
        securityStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 3));
    }

    securityPanel.securityOff(evt);
  }
Пример #9
0
  /** Initializes the security status label, shown in the call status bar. */
  private void initSecurityStatusLabel() {
    securityStatusLabel.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 5));

    securityStatusLabel.addMouseListener(
        new MouseAdapter() {
          /** Invoked when a mouse button has been pressed on a component. */
          @Override
          public void mousePressed(MouseEvent e) {
            // Only show the security details if the security is on.
            SrtpControl ctrl = securityPanel.getSecurityControl();
            if (ctrl instanceof ZrtpControl && ctrl.getSecureCommunicationStatus()) {
              setSecurityPanelVisible(
                  !callRenderer
                      .getCallContainer()
                      .getCallWindow()
                      .getFrame()
                      .getGlassPane()
                      .isVisible());
            }
          }
        });
  }
Пример #10
0
  /** Initializes the <tt>NewStatusMessageDialog</tt> by adding the buttons, fields, etc. */
  private void init() {
    JLabel messageLabel =
        new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    JPanel dataPanel = new TransparentPanel(new BorderLayout(5, 5));

    JTextArea infoArea =
        new JTextArea(GuiActivator.getResources().getI18NString("service.gui.STATUS_MESSAGE_INFO"));

    JLabel infoTitleLabel =
        new JLabel(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    JPanel labelsPanel = new TransparentPanel(new GridLayout(0, 1));

    JButton okButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.OK"));

    JPanel buttonsPanel = new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));

    this.setTitle(GuiActivator.getResources().getI18NString("service.gui.NEW_STATUS_MESSAGE"));

    this.getRootPane().setDefaultButton(okButton);

    this.setPreferredSize(new Dimension(500, 200));

    infoArea.setEditable(false);
    infoArea.setLineWrap(true);
    infoArea.setWrapStyleWord(true);
    infoArea.setOpaque(false);

    dataPanel.add(messageLabel, BorderLayout.WEST);

    messageTextField.setText(presenceOpSet.getCurrentStatusMessage());
    dataPanel.add(messageTextField, BorderLayout.CENTER);

    infoTitleLabel.setHorizontalAlignment(JLabel.CENTER);
    infoTitleLabel.setFont(infoTitleLabel.getFont().deriveFont(Font.BOLD, 18.0f));

    labelsPanel.add(infoTitleLabel);
    labelsPanel.add(infoArea);
    labelsPanel.add(dataPanel);

    messagePanel = new TransparentPanel(new GridBagLayout());
    GridBagConstraints messagePanelConstraints = new GridBagConstraints();
    messagePanelConstraints.anchor = GridBagConstraints.NORTHWEST;
    messagePanelConstraints.fill = GridBagConstraints.NONE;
    messagePanelConstraints.gridx = 0;
    messagePanelConstraints.gridy = 0;
    messagePanelConstraints.insets = new Insets(5, 0, 5, 10);
    messagePanelConstraints.weightx = 0;
    messagePanelConstraints.weighty = 0;
    messagePanel.add(
        new ImageCanvas(ImageLoader.getImage(ImageLoader.RENAME_DIALOG_ICON)),
        messagePanelConstraints);

    messagePanelConstraints.anchor = GridBagConstraints.NORTH;
    messagePanelConstraints.fill = GridBagConstraints.HORIZONTAL;
    messagePanelConstraints.gridx = 1;
    messagePanelConstraints.insets = new Insets(0, 0, 0, 0);
    messagePanelConstraints.weightx = 1;
    messagePanel.add(labelsPanel, messagePanelConstraints);

    okButton.setName("ok");
    cancelButton.setName("cancel");

    okButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.OK"));
    cancelButton.setMnemonic(GuiActivator.getResources().getI18nMnemonic("service.gui.CANCEL"));

    okButton.addActionListener(this);
    cancelButton.addActionListener(this);

    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);

    JPanel mainPanel = new TransparentPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 0, 10));

    GridBagConstraints mainPanelConstraints = new GridBagConstraints();
    mainPanelConstraints.anchor = GridBagConstraints.NORTH;
    mainPanelConstraints.fill = GridBagConstraints.BOTH;
    mainPanelConstraints.gridx = 0;
    mainPanelConstraints.gridy = 0;
    mainPanelConstraints.weightx = 1;
    mainPanelConstraints.weighty = 1;
    mainPanel.add(messagePanel, mainPanelConstraints);

    mainPanelConstraints.anchor = GridBagConstraints.SOUTHEAST;
    mainPanelConstraints.fill = GridBagConstraints.NONE;
    mainPanelConstraints.gridy = 1;
    mainPanelConstraints.weightx = 0;
    mainPanelConstraints.weighty = 0;
    mainPanel.add(buttonsPanel, mainPanelConstraints);

    this.getContentPane().add(mainPanel);
  }
Пример #11
0
 /**
  * Prints the given DTMG character through this <tt>CallPeerRenderer</tt>.
  *
  * @param dtmfChar the DTMF char to print
  */
 public void printDTMFTone(char dtmfChar) {
   dtmfLabel.setText(dtmfLabel.getText() + dtmfChar);
   if (dtmfLabel.getBorder() == null)
     dtmfLabel.setBorder(BorderFactory.createEmptyBorder(2, 1, 2, 5));
 }
Пример #12
0
 /** Creates the Renderer. */
 public ProtocolProviderTableCellRenderer() {
   this.setHorizontalAlignment(JLabel.LEFT);
   this.setOpaque(true);
   this.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));
 }