Пример #1
0
  /**
   * Creates a call to the given list of contacts.
   *
   * @param contacts the list of contacts to call to
   */
  public void createCall(Vector contacts) {
    CallPanel callPanel = new CallPanel(this, contacts);

    mainFrame.addCallPanel(callPanel);

    new CreateCallThread(contacts, callPanel).start();
  }
Пример #2
0
  /** Save the settings of this panel */
  private void saveSettings() {
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD, uploadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD, downloadPrioTextField.getText());
    settings.setValue(
        SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES,
        useOneConnectionForMessagesCheckBox.isSelected());

    settings.setValue(SettingsClass.MAX_MESSAGE_DISPLAY, displayDaysTextField.getText());
    settings.setValue(SettingsClass.MAX_MESSAGE_DOWNLOAD, downloadDaysTextField.getText());
    settings.setValue(
        SettingsClass.MESSAGE_BASE, messageBaseTextField.getText().trim().toLowerCase());
    settings.setValue(
        SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD,
        alwaysDownloadBackloadCheckBox.isSelected());

    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES, concurrentUpdatesTextField.getText());
    settings.setValue(
        SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL, minimumIntervalTextField.getText());

    // settings.setValue(SettingsClass.BOARD_AUTOUPDATE_ENABLED,
    // automaticBoardUpdateCheckBox.isSelected());
    // we change setting in MainFrame, this is auto-saved during frostSettings.save()
    MainFrame.getInstance()
        .setAutomaticBoardUpdateEnabled(automaticBoardUpdateCheckBox.isSelected());

    settings.setValue(
        SettingsClass.STORAGE_STORE_SENT_MESSAGES, storeSentMessagesCheckBox.isSelected());
    settings.setValue(SettingsClass.SILENTLY_RETRY_MESSAGES, silentlyRetryCheckBox.isSelected());

    settings.setValue(SettingsClass.ALTERNATE_EDITOR_ENABLED, altEditCheckBox.isSelected());
    settings.setValue(SettingsClass.ALTERNATE_EDITOR_COMMAND, altEditTextField.getText());
  }
Пример #3
0
  /**
   * Creates a call to the contact represented by the given string.
   *
   * @param contact the contact to call to
   */
  public void createCall(String contact) {
    CallPanel callPanel = new CallPanel(this, contact);

    mainFrame.addCallPanel(callPanel);

    new CreateCallThread(contact, callPanel).start();
  }
Пример #4
0
  /** Load the settings of this panel */
  private void loadSettings() {
    uploadPrioTextField.setText(settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_UPLOAD));
    downloadPrioTextField.setText(
        settings.getValue(SettingsClass.FCP2_DEFAULT_PRIO_MESSAGE_DOWNLOAD));
    useOneConnectionForMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.FCP2_USE_ONE_CONNECTION_FOR_MESSAGES));

    displayDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DISPLAY));
    downloadDaysTextField.setText(settings.getValue(SettingsClass.MAX_MESSAGE_DOWNLOAD));
    messageBaseTextField.setText(settings.getValue(SettingsClass.MESSAGE_BASE));
    alwaysDownloadBackloadCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.ALWAYS_DOWNLOAD_MESSAGES_BACKLOAD));

    minimumIntervalTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_MIN_INTERVAL));
    concurrentUpdatesTextField.setText(
        settings.getValue(SettingsClass.BOARD_AUTOUPDATE_CONCURRENT_UPDATES));

    // this setting is in MainFrame
    automaticBoardUpdateCheckBox.setSelected(
        MainFrame.getInstance().isAutomaticBoardUpdateEnabled());
    refreshUpdateState();

    storeSentMessagesCheckBox.setSelected(
        settings.getBoolValue(SettingsClass.STORAGE_STORE_SENT_MESSAGES));
    silentlyRetryCheckBox.setSelected(settings.getBoolValue(SettingsClass.SILENTLY_RETRY_MESSAGES));

    altEditCheckBox.setSelected(settings.getBoolValue(SettingsClass.ALTERNATE_EDITOR_ENABLED));
    altEditTextField.setEnabled(altEditCheckBox.isSelected());
    altEditTextField.setText(settings.getValue(SettingsClass.ALTERNATE_EDITOR_COMMAND));
  }
Пример #5
0
 /** Updates call and hangup buttons' states aa */
 private void updateButtonsStateAccordingToSelectedPanel() {
   Component selectedPanel = mainFrame.getSelectedTab();
   if (selectedPanel != null && selectedPanel instanceof CallPanel) {
     this.hangupButton.setEnabled(true);
   } else {
     this.hangupButton.setEnabled(false);
   }
 }
Пример #6
0
  /**
   * Removes the given call panel tab.
   *
   * @param callPanel the CallPanel to remove
   */
  private void removeCallPanel(CallPanel callPanel) {
    if (callPanel.getCall() != null && activeCalls.contains(callPanel.getCall())) {
      this.activeCalls.remove(callPanel.getCall());
    }

    mainFrame.removeCallPanel(callPanel);
    updateButtonsStateAccordingToSelectedPanel();
  }
Пример #7
0
  /**
   * Implements CallListener.incomingCallReceived. When a call is received creates a call panel and
   * adds it to the main tabbed pane and plays the ring phone sound to the user.
   */
  public void incomingCallReceived(CallEvent event) {
    Call sourceCall = event.getSourceCall();

    CallPanel callPanel = new CallPanel(this, sourceCall, GuiCallParticipantRecord.INCOMING_CALL);

    mainFrame.addCallPanel(callPanel);

    if (mainFrame.getState() == JFrame.ICONIFIED) mainFrame.setState(JFrame.NORMAL);

    if (!mainFrame.isVisible()) mainFrame.setVisible(true);

    mainFrame.toFront();

    this.callButton.setEnabled(true);
    this.hangupButton.setEnabled(true);

    NotificationManager.fireNotification(
        NotificationManager.INCOMING_CALL,
        null,
        "Incoming call recived from: " + sourceCall.getCallParticipants().next());

    activeCalls.put(sourceCall, callPanel);

    this.setCallPanelVisible(true);
  }
Пример #8
0
  /**
   * Implements ChangeListener.stateChanged. Enables the hangup button if ones selects a tab in the
   * main tabbed pane that contains a call panel.
   */
  public void stateChanged(ChangeEvent e) {
    this.updateButtonsStateAccordingToSelectedPanel();

    Component selectedPanel = mainFrame.getSelectedTab();
    if (selectedPanel == null || !(selectedPanel instanceof CallPanel)) {
      Iterator callPanels = activeCalls.values().iterator();

      while (callPanels.hasNext()) {
        CallPanel callPanel = (CallPanel) callPanels.next();

        callPanel.removeDialogs();
      }
    }
  }
Пример #9
0
  /**
   * Implements ListSelectionListener.valueChanged. Enables or disables call and hangup buttons
   * depending on the selection in the contactlist.
   */
  public void valueChanged(ListSelectionEvent e) {
    Object o = mainFrame.getContactListPanel().getContactList().getSelectedValue();

    if ((e.getFirstIndex() != -1 || e.getLastIndex() != -1) && (o instanceof MetaContact)) {
      setCallMetaContact(true);

      // Switch automatically to the appropriate pps in account selector
      // box and enable callButton if telephony is supported.
      Contact contact = ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

      if (contact != null) {
        callButton.setEnabled(true);

        if (contact.getProtocolProvider().isRegistered())
          getAccountSelectorBox().setSelected(contact.getProtocolProvider());
      } else {
        callButton.setEnabled(false);
      }
    } else if (phoneNumberCombo.isComboFieldEmpty()) {
      callButton.setEnabled(false);
    }
  }
Пример #10
0
  /** Set view selection to user's choice. */
  public void setSelect() throws DatabaseException {
    JList list = getList();
    View original = null;
    View view = null;
    long id = _collection.getDatabase().getCurrentSetting().getViewID();
    if (id != -1) {
      for (int i = 0; i < list.getModel().getSize(); i++) {
        View vw = (View) list.getModel().getElementAt(i);
        if (id == vw.getID()) {
          view = vw;
          break;
        } else if (vw.getName().equals("Original")) {
          original = view;
        }
      }
    }
    // default Original
    if (view == null) view = original;

    list.setSelectedValue(view, true);
    MainFrame.getInstance().updateStatus();
  }
Пример #11
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();
  }
Пример #12
0
  /**
   * Handles the <tt>ActionEvent</tt> generated when user presses one of the buttons in this panel.
   */
  public void actionPerformed(ActionEvent evt) {
    JButton button = (JButton) evt.getSource();
    String buttonName = button.getName();

    if (buttonName.equals("call")) {
      Component selectedPanel = mainFrame.getSelectedTab();

      // call button is pressed over an already open call panel
      if (selectedPanel != null
          && selectedPanel instanceof CallPanel
          && ((CallPanel) selectedPanel).getCall().getCallState()
              == CallState.CALL_INITIALIZATION) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Iterator participantPanels = callPanel.getParticipantsPanels();

        while (participantPanels.hasNext()) {
          CallParticipantPanel panel = (CallParticipantPanel) participantPanels.next();

          panel.setState("Connecting");
        }

        Call call = callPanel.getCall();

        answerCall(call);
      }
      // call button is pressed over the call list
      else if (selectedPanel != null
          && selectedPanel instanceof CallListPanel
          && ((CallListPanel) selectedPanel).getCallList().getSelectedIndex() != -1) {

        CallListPanel callListPanel = (CallListPanel) selectedPanel;

        GuiCallParticipantRecord callRecord =
            (GuiCallParticipantRecord) callListPanel.getCallList().getSelectedValue();

        String stringContact = callRecord.getParticipantName();

        createCall(stringContact);
      }
      // call button is pressed over the contact list
      else if (selectedPanel != null && selectedPanel instanceof ContactListPanel) {
        // call button is pressed when a meta contact is selected
        if (isCallMetaContact) {
          Object[] selectedContacts =
              mainFrame.getContactListPanel().getContactList().getSelectedValues();

          Vector telephonyContacts = new Vector();

          for (int i = 0; i < selectedContacts.length; i++) {

            Object o = selectedContacts[i];

            if (o instanceof MetaContact) {

              Contact contact =
                  ((MetaContact) o).getDefaultContact(OperationSetBasicTelephony.class);

              if (contact != null) telephonyContacts.add(contact);
              else {
                new ErrorDialog(
                        this.mainFrame,
                        Messages.getI18NString("warning").getText(),
                        Messages.getI18NString(
                                "contactNotSupportingTelephony",
                                new String[] {((MetaContact) o).getDisplayName()})
                            .getText())
                    .showDialog();
              }
            }
          }

          if (telephonyContacts.size() > 0) createCall(telephonyContacts);

        } else if (!phoneNumberCombo.isComboFieldEmpty()) {

          // if no contact is selected checks if the user has chosen
          // or has
          // writen something in the phone combo box

          String stringContact = phoneNumberCombo.getEditor().getItem().toString();

          createCall(stringContact);
        }
      } else if (selectedPanel != null && selectedPanel instanceof DialPanel) {
        String stringContact = phoneNumberCombo.getEditor().getItem().toString();
        createCall(stringContact);
      }
    } else if (buttonName.equalsIgnoreCase("hangup")) {
      Component selectedPanel = this.mainFrame.getSelectedTab();

      if (selectedPanel != null && selectedPanel instanceof CallPanel) {

        NotificationManager.stopSound(NotificationManager.BUSY_CALL);
        NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
        NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);

        CallPanel callPanel = (CallPanel) selectedPanel;

        Call call = callPanel.getCall();

        if (removeCallTimers.containsKey(callPanel)) {
          ((Timer) removeCallTimers.get(callPanel)).stop();
          removeCallTimers.remove(callPanel);
        }

        removeCallPanel(callPanel);

        if (call != null) {
          ProtocolProviderService pps = call.getProtocolProvider();

          OperationSetBasicTelephony telephony = mainFrame.getTelephonyOpSet(pps);

          Iterator participants = call.getCallParticipants();

          while (participants.hasNext()) {
            try {
              // now we hang up the first call participant in the
              // call
              telephony.hangupCallParticipant((CallParticipant) participants.next());
            } catch (OperationFailedException e) {
              logger.error("Hang up was not successful: " + e);
            }
          }
        }
      }
    } else if (buttonName.equalsIgnoreCase("minimize")) {
      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (!hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(true);

      this.setCallPanelVisible(false);
    } else if (buttonName.equalsIgnoreCase("restore")) {

      JCheckBoxMenuItem hideCallPanelItem =
          mainFrame.getMainMenu().getViewMenu().getHideCallPanelItem();

      if (hideCallPanelItem.isSelected()) hideCallPanelItem.setSelected(false);

      this.setCallPanelVisible(true);
    }
  }
Пример #13
0
 /** Shows the "about OLS" dialog on screen. the parent window to use, can be <code>null</code>. */
 public void showAboutBox() {
   MainFrame.showAboutBox(this.host.getVersion());
 }
Пример #14
0
  ViewsPane(WordCollection collection) {
    super(null, true, true, false);
    final Messages messages = AppPrefs.getInstance().getMessages();

    // change find label
    setFindButtonLabel(messages.getString("btnFindViews"));

    _collection = collection;
    getList().setModel(new BasicListModel());

    final MainFrame mf = MainFrame.getInstance();
    ListSelectionModel model = getList().getSelectionModel();
    model.addListSelectionListener(
        new ListSelectionListener() {
          public synchronized void valueChanged(ListSelectionEvent evt) {
            try {
              View view = (View) getList().getSelectedValue();
              if (view != null) {
                Setting setting = _collection.getDatabase().getCurrentSetting();
                setting.setViewID(view.getID());
                setting.save();
                mf.updateStatus();
              }
            } catch (DatabaseException e) {
              Dialogs.genericError(e);
            }
          }
        });

    addAddEditDeleteListener(
        new AddEditDeleteListener() {
          public void doAdd(ActionEvent evt) throws DatabaseException {
            final View view = _collection.makeView();
            AddDialog dialog = new AddDialog("lblAddView", view);
            dialog.setVisible(true);
            if (!dialog.isCancelled()) {
              // add default groups and alignments
              AddRunnable task =
                  new AddRunnable() {
                    public void run() {
                      try {
                        ViewDuplicator.makeGroupsAndAlignments(view, view, _collection, false);

                        // update collection view list
                        List views = _collection.getViews();
                        views.add(view);

                        _collection.getDatabase().getCurrentSetting().setViewID(view.getID());
                        refresh();
                      } catch (DatabaseException ex) {
                        exception = ex;
                      }
                    }

                    DatabaseException exception = null;

                    public DatabaseException getException() {
                      return exception;
                    }
                  };
              Messages m = AppPrefs.getInstance().getMessages();
              Dialogs.indeterminateProgressDialog(
                  task,
                  m.getString("pgbWaitString"),
                  m.getString("pgbCurrentTask") + m.getString("lblAddView"));
              if (task.getException()
                  != null) { // so we don't swallow the exception from the other thread.
                throw task.getException();
              }
            }
          }

          public void doCopy(ActionEvent evt) throws DatabaseException {
            ViewDuplicator duplicator =
                new ViewDuplicator((View) getList().getSelectedValue(), _collection);
            TaskDialog dialog = new TaskDialog("lblViewCopy", duplicator);
            dialog.setVisible(true);
            if (!dialog.isCancelled()) {
              // update collection view list
              List views = _collection.getViews();
              View view = duplicator.getDuplicate();
              if (view != null) { // view will be null if attempted duplicate view name.
                views.add(view);
                _collection.getDatabase().getCurrentSetting().setViewID(view.getID());
                refresh();
              }
            }
          }

          public void doDelete(ActionEvent evt) throws DatabaseException {
            View view = (View) getList().getSelectedValue();

            // check for Original view
            View original = _collection.getOriginalView();
            if (view.equals(original)) {
              Dialogs.error(messages.getString("msgErrDeletingOriginalView"));
            } else {
              view.delete();

              // update collection view list
              List views = _collection.getViews();
              views.remove(view);
              changeView(original);

              JSplitPane split = (JSplitPane) getMainComponent();
              int loc = split.getDividerLocation();
              split.setRightComponent(new JLabel(""));
              split.setDividerLocation(loc);
              refresh();
            }
          }

          public void doValidate(ActionEvent evt) {}

          public void doMoveUp(ActionEvent evt) {}

          public void doMoveDown(ActionEvent evt) {}
        });

    getList().setCellRenderer(new ViewNameListCellRenderer());
  }