void addButton_actionPerformed(ActionEvent e) {
   GenericEditor editor = tableModel.getEditor();
   editor.editNew();
   MainFrame w = (MainFrame) this.getTopLevelAncestor();
   w.addToDesktop(editor);
   editor.show();
 }
 private void editCurrent() {
   GenericEditor editor = tableModel.getEditor();
   editor.edit(tableModel.getRowData(objectTable.getSelectedRow()));
   MainFrame w = (MainFrame) this.getTopLevelAncestor();
   w.addToDesktop(editor);
   editor.show();
 }
Exemple #3
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();
  }
Exemple #4
0
  private String getTextFor(OpenDefinitionsDocument doc) {
    DefinitionsPane pane = _frame.getDefPaneGivenODD(doc);
    String endl = "\n"; // was StringOps.EOL; but Swing uses '\n' for newLine
    int loc = pane.getCaretPosition();
    int start = loc;
    int end = loc;
    String text;
    text = doc.getText();

    /* get the starting point of 2 lines up... */
    for (int i = 0; i < 4; i++) {
      if (start > 0) start = text.lastIndexOf(endl, start - endl.length());
    }
    if (start == -1) start = 0;

    // skip the end line, if we're at one
    //    if (doc.getLength() >= endl.length() && text.substring(start, start+endl.length()) ==
    // endl)
    //    start += endl.length();
    if (doc.getLength() >= endl.length()
        && text.substring(start, start + endl.length()).equals(endl)) start += endl.length();
    /* get the ending point 2 lines down */
    int index;
    for (int i = 0; i < 4; i++) {
      if (end < doc.getLength()) {
        index = text.indexOf(endl, end + endl.length());
        if (index != -1) end = index;
      }
    }
    if (end < start) end = start;
    text = text.substring(start, end);
    return text;
  }
Exemple #5
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());
  }
Exemple #6
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));
  }
Exemple #7
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();
  }
Exemple #8
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);
   }
 }
Exemple #9
0
  /** Ensure that all key events are disabled when the glass pane is up. */
  public void testGlassPaneHidesKeyEvents() {
    SingleDisplayModel model = _frame.getModel();

    final OpenDefinitionsDocument doc1 = model.newFile();
    final OpenDefinitionsDocument doc2 = model.newFile();

    // doc2 is now active
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _pane1 = _frame._createDefScrollPane(doc1);
            _pane2 = _frame._createDefScrollPane(doc2);
            _defPane1 = (DefinitionsPane) _pane1.getViewport().getView();
            _defPane2 = (DefinitionsPane) _pane2.getViewport().getView();
            _frame.validate();
            _frame.hourglassOn();
            _defPane1.processKeyEvent(makeFindKeyEvent(_defPane1, 70));
            _frame.validate();
          }
        });
    Utilities.clearEventQueue();

    assertTrue(
        "the find replace dialog should not come up", !_frame.getFindReplaceDialog().isDisplayed());
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _frame
                .getInteractionsPane()
                .processKeyEvent(makeFindKeyEvent(_frame.getInteractionsPane(), 0));
            _frame.validate();
          }
        });
    Utilities.clearEventQueue();

    assertTrue(
        "the find replace dialog should not come up", !_frame.getFindReplaceDialog().isDisplayed());

    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _frame.hourglassOff();
          }
        });
    _log.log("testGlassPaneHidesKeyEvents completed");
  }
 public void switchToOriginalColor() {
   MainFrame.printLog("swiching back to original color", Color.white);
   Appearance ap = new Appearance();
   for (int z = 0; z < CanvasActionListener.colorCubeArrayList.size(); z++) {
     DNAColorCube pickedCube = CanvasActionListener.colorCubeArrayList.get(z).canvasDNAColorCube;
     pickedCube.setAppearance(ap);
   }
 }
Exemple #11
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();
  }
Exemple #12
0
  /**
   * Tests that the current location of a document is equal to the caret Position after switching to
   * another document and back.
   */
  public void testDocLocationAfterSwitch() throws BadLocationException {
    final DefinitionsPane pane = _frame.getCurrentDefPane();
    final OpenDefinitionsDocument doc = pane.getOpenDefDocument();
    setDocText(doc.getDocument(), "abcd");
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            doc.setCurrentLocation(3);
            pane.setCaretPosition(3); // The caret is not affected by setCurrentLocation
          }
        });

    assertEquals("Location of old doc before switch", 3, doc.getCurrentLocation());
    assertEquals("Location of cursor in old document", 3, pane.getCaretPosition());

    // Create a new file
    SingleDisplayModel model = _frame.getModel();
    final OpenDefinitionsDocument oldDoc = doc;
    final DefinitionsPane oldPane = pane;
    final OpenDefinitionsDocument newDoc = model.newFile();

    // Current pane should be new doc, pos 0
    DefinitionsPane curPane;
    OpenDefinitionsDocument curDoc;
    curPane = _frame.getCurrentDefPane();
    curDoc = curPane.getOpenDefDocument(); // .getDocument();
    assertEquals("New curr DefPane's document", newDoc, curDoc);
    assertEquals("Location in new document", 0, newDoc.getCurrentLocation());

    // Switch back to old document
    model.setActiveNextDocument();
    Utilities.clearEventQueue();
    assertEquals("Next active doc", oldDoc, model.getActiveDocument());

    // Current pane should be old doc, pos 3
    curPane = _frame.getCurrentDefPane();
    curDoc = curPane.getOpenDefDocument(); // .getDocument();
    assertEquals("Next active pane", oldPane, curPane);
    assertEquals("Current document is old document", oldDoc, curDoc);
    assertEquals("Location of caret in old document", 3, curPane.getCaretPosition());
    _log.log("testDocLocationAfterSwitch completed");
  }
  private void loadWindowState() {
    // load size, location and state of window
    int lastHeight = Core.frostSettings.getIntValue("helpBrowser.lastFrameHeight");
    int lastWidth = Core.frostSettings.getIntValue("helpBrowser.lastFrameWidth");
    final int lastPosX = Core.frostSettings.getIntValue("helpBrowser.lastFramePosX");
    final int lastPosY = Core.frostSettings.getIntValue("helpBrowser.lastFramePosY");
    final boolean lastMaximized = Core.frostSettings.getBoolValue("helpBrowser.lastFrameMaximized");

    if (lastHeight <= 0 || lastWidth <= 0) {
      // first call
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    final Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize();

    if (lastWidth < 100) {
      lastWidth = 780;
    }
    if (lastHeight < 100) {
      lastHeight = 550;
    }

    if ((lastPosX + lastWidth) > scrSize.width) {
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    if ((lastPosY + lastHeight) > scrSize.height) {
      setSize(780, 550);
      setLocationRelativeTo(MainFrame.getInstance());
      return;
    }

    setBounds(lastPosX, lastPosY, lastWidth, lastHeight);

    if (lastMaximized) {
      setExtendedState(getExtendedState() | Frame.MAXIMIZED_BOTH);
    }
  }
 @Override
 public void actionPerformed(ActionEvent e) {
   try {
     if (e.getSource() == ok_button) {
       if (mainFrame != null) {
         Client client =
             new Client(serverAddress.getText(), Integer.parseInt(serverPort.getText()), 0);
         if (client.getClientThread().getClientSocket().isConnected()) mainFrame.setClient(client);
       }
       this.setVisible(false);
       this.dispose();
     } else if (e.getSource() == cancel_button) {
       mainFrame.setClient(null);
       this.setVisible(false);
       this.dispose();
     }
   } catch (NumberFormatException exception) {
     JOptionPane.showMessageDialog(this, "Invalid value: " + exception.getMessage());
   }
 }
Exemple #15
0
 public void tearDown() throws Exception {
   //    Utilities.invokeLater(new Runnable() {
   //      public void run() {
   _frame.dispose();
   _frame = null;
   /* try { */ MainFrameTest.super.tearDown(); /* } */
   //        catch(Exception e) { throw new UnexpectedException(e); }
   //      }
   //    });
   super.tearDown();
 }
Exemple #16
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);
  }
Exemple #17
0
  /**
   * Tests that the clipboard is modified after a "cut line" action. NOTE: Commented out for commit
   * because of failures, despite proper behavior in GUI. This may not work unless ActionEvents are
   * dropped in the event queue
   */
  public void testCutLine() throws BadLocationException {
    // First, copy some data out of the main document.

    final DefinitionsPane pane = _frame.getCurrentDefPane();
    final OpenDefinitionsDocument doc = pane.getOpenDefDocument();
    //    _frame.setVisible(true);
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {

            try {
              doc.insertString(0, "abcdefg", null);
              pane.setCaretPosition(5);
              _frame.validate();
              //          _frame.paint(_frame.getGraphics());
              //          ActionMap actionMap = _pane.getActionMap();
              //          String selString = DefaultEditorKit.selectionEndLineAction;
              //          actionMap.get(selString).actionPerformed(new ActionEvent(pane, 0,
              // "SelectionEndLine"));
              pane.setSelectionStart(2);
              pane.setSelectionEnd(7);
              _frame.validate();
              pane.cut();
              //          _frame.cutAction.actionPerformed(new ActionEvent(pane, 0, "Cut"));

              // Get a copy of the current clipboard.

              // Trigger the Cut Line action from a new position.
              //          _pane.setCaretPosition(2);
              _frame.validate();
              //          _frame.paint(_frame.getGraphics());

              //          _frame._cutLineAction.actionPerformed(new ActionEvent(this, 0, "Cut
              // Line"));
              //          _frame.dispatchEvent(new ActionEvent(this, 0, "Cut Line"));

              // Verify that the clipboard contents are what we expect.
              Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
              Transferable contents = clip.getContents(null);
              _data = (String) contents.getTransferData(DataFlavor.stringFlavor);
            } catch (Throwable t) {
              listenerFail(t.getMessage());
            }
          }
        });
    Utilities.clearEventQueue();
    assertEquals("Clipboard contents should be changed after Cut Line.", "cdefg", _data);

    // Verify that the document text is what we expect.
    assertEquals("Current line of text should be truncated by Cut Line.", "ab", doc.getText());
    _log.log("testCutLine completed");
  }
  /** Creates the text area. */
  private void initTextArea() {
    textArea.setOpaque(false);
    textArea.setEditable(false);
    StyledDocument doc = textArea.getStyledDocument();

    MutableAttributeSet standard = new SimpleAttributeSet();
    StyleConstants.setAlignment(standard, StyleConstants.ALIGN_CENTER);
    StyleConstants.setFontFamily(standard, textArea.getFont().getFamily());
    StyleConstants.setFontSize(standard, 12);
    doc.setParagraphAttributes(0, 0, standard, true);

    parentWindow.addSearchFieldListener(this);
  }
Exemple #19
0
  /**
   * Make sure that the InteractionsPane is displaying the correct InteractionsDocument.
   * (SourceForge bug #681547) Also make sure this document cannot be edited before the prompt.
   */
  public void testCorrectInteractionsDocument() throws EditDocumentException {
    InteractionsPane pane = _frame.getInteractionsPane();
    final SingleDisplayModel model = _frame.getModel();
    InteractionsDJDocument doc = model.getSwingInteractionsDocument();

    // Make the test silent
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            model.getInteractionsModel().getDocument().setBeep(new TestBeep());
          }
        });
    Utilities.clearEventQueue();

    // Test for strict == equality
    assertTrue("UI's int. doc. should equals Model's int. doc.", pane.getDocument() == doc);

    int origLength = doc.getLength();
    doc.insertText(1, "typed text", ConsoleDocument.DEFAULT_STYLE);
    Utilities.clearEventQueue();
    assertEquals("Document should not have changed.", origLength, doc.getLength());
    _log.log("testCorrectInteractionsDocument completed");
  }
  public void disconnected() {
    isConnected = false;

    MainFrame.getInstance().setDisconnected();

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            uploadModel.removeExternalUploads();
            downloadModel.removeExternalDownloads();
          }
        });
    logger.severe("disconnected!");
  }
Exemple #21
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();
      }
    }
  }
Exemple #22
0
  public static Map[] showOpenMapDialog(final JFrame owner) throws IOException {
    final JFileChooser ch = new JFileChooser();
    if (config.getFile("mapLastOpenDir") != null) {
      ch.setCurrentDirectory(config.getFile("mapLastOpenDir"));
    }
    ch.setDialogType(JFileChooser.OPEN_DIALOG);
    ch.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    if (ch.showOpenDialog(MainFrame.getInstance()) != JFileChooser.APPROVE_OPTION) {
      return null;
    }
    final File dir = ch.getSelectedFile();
    config.set("mapLastOpenDir", dir);
    final String[] maps = dir.list(FILTER_TILES);
    for (int i = 0; i < maps.length; ++i) {
      maps[i] = maps[i].substring(0, maps[i].length() - MapIO.EXT_TILE.length());
    }
    final JDialog dialog = new JDialog(owner, Lang.getMsg("gui.chooser"));
    dialog.setModal(true);
    dialog.setLocationRelativeTo(null);
    dialog.setLayout(new BorderLayout());

    final JList list = new JList(maps);
    final JButton btn = new JButton(Lang.getMsg("gui.chooser.Ok"));

    btn.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(final ActionEvent e) {
            if (list.getSelectedValue() != null) {
              dialog.setVisible(false);
            }
          }
        });

    dialog.add(new JScrollPane(list), BorderLayout.CENTER);
    dialog.add(btn, BorderLayout.SOUTH);
    dialog.pack();
    dialog.setVisible(true);
    dialog.dispose();

    Map[] loadedMaps = new Map[list.getSelectedIndices().length];
    for (int i = 0; i < list.getSelectedIndices().length; i++) {
      loadedMaps[i] = MapIO.loadMap(dir.getPath(), (String) list.getSelectedValues()[i]);
    }
    return loadedMaps;
  }
  /** Konstruktor */
  public TutorToEventFrame(TutorPanel tut) {
    super("Veranstaltungen zuordnen");
    this.tutorPanel = tut;
    setLayout(new BorderLayout());
    try {
      tm =
          new TableModel(
              prakColumnNames, Workspace.getInstance().getDatabase().getUnassignedEvents());
      table = new Table(tm);
      setTableSize();
      getContentPane().add(new JScrollPane(table), BorderLayout.CENTER);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // Hinzufuegen
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              addEvents();
              ((TutorPanel) tutorPanel).rewritePrakTable();
              setVisible(false);
            } catch (Exception err) {
              err.printStackTrace();
            }
          }
        });

    // Schliessen Button
    btnClose.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false);
          }
        });

    actionPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));
    actionPanel.add(btnOk);
    actionPanel.add(btnClose);
    getContentPane().add(actionPanel, BorderLayout.SOUTH);
    this.setLocation(MainFrame.getInstance().getLocation());
    this.pack();
    this.setVisible(true);
  }
  /** Initializes the call button. */
  private void initSMSButton() {
    if (!parentWindow.hasOperationSet(OperationSetSmsMessaging.class)) return;

    smsButton = new JButton(GuiActivator.getResources().getI18NString("service.gui.SEND_SMS"));

    smsButton.setIcon(GuiActivator.getResources().getImage("service.gui.icons.SMS_BUTTON_ICON"));

    buttonPanel.add(smsButton);

    smsButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            final String searchText = parentWindow.getCurrentSearchText();

            if (searchText == null) return;

            SMSManager.sendSMS(smsButton, searchText);
          }
        });
  }
Exemple #25
0
  public void actionPerformed(ActionEvent e) {
    // Ask user to confirm exit.
    int reply =
        JOptionPane.showConfirmDialog(
            main,
            bundle.getString("Exit_application_?"),
            bundle.getString("Exit"),
            JOptionPane.YES_NO_OPTION);
    if (reply != JOptionPane.YES_OPTION) return;

    // Save MainFrame's bounds
    Rectangle r = main.getBounds();
    Main.setProperty("window.bounds.width", Integer.toString(r.width));
    Main.setProperty("window.bounds.height", Integer.toString(r.height));
    Main.setProperty("window.bounds.x", Integer.toString(r.x));
    Main.setProperty("window.bounds.y", Integer.toString(r.y));

    // System Exit
    Main.saveProperties();
    Main.exit(0);
  }
  /**
   * Creates the <tt>UnknownContactPanel</tt> by specifying the parent window.
   *
   * @param window the parent window
   */
  public UnknownContactPanel(MainFrame window) {
    super(new BorderLayout());

    this.parentWindow = window;

    TransparentPanel mainPanel = new TransparentPanel(new BorderLayout());

    this.add(mainPanel, BorderLayout.NORTH);

    if (!ConfigurationUtils.isAddContactDisabled()) {
      initAddContactButton();
    }

    initCallButton();

    initSMSButton();

    initTextArea();
    mainPanel.add(textArea, BorderLayout.CENTER);

    if (callButton.getParent() != null) {
      textArea.setText(
          GuiActivator.getResources()
              .getI18NString(
                  "service.gui.NO_CONTACTS_FOUND",
                  new String[] {'"' + parentWindow.getCurrentSearchText() + '"'}));
    } else {
      textArea.setText(
          GuiActivator.getResources().getI18NString("service.gui.NO_CONTACTS_FOUND_SHORT"));
    }

    if (buttonPanel.getComponentCount() > 0) {
      TransparentPanel southPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
      southPanel.add(buttonPanel);

      mainPanel.add(southPanel, BorderLayout.SOUTH);
    }

    loadSkin();
  }
Exemple #27
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();
  }
Exemple #28
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);
    }
  }
Exemple #29
0
  /** Tests that the save button does not set itself as enabled immediately after opening a file. */
  public void testSaveButtonEnabled() throws IOException {
    String user = System.getProperty("user.name");
    _tempDir = IOUtil.createAndMarkTempDirectory("DrJava-test-" + user, "");
    File forceOpenClass1_file = new File(_tempDir, "ForceOpenClass1.java");
    String forceOpenClass1_string =
        "public class ForceOpenClass1 {\n"
            + "  ForceOpenClass2 class2;\n"
            + "  ForceOpenClass3 class3;\n\n"
            + "  public ForceOpenClass1() {\n"
            + "    class2 = new ForceOpenClass2();\n"
            + "    class3 = new ForceOpenClass3();\n"
            + "  }\n"
            + "}";

    IOUtil.writeStringToFile(forceOpenClass1_file, forceOpenClass1_string);
    forceOpenClass1_file.deleteOnExit();

    // _frame.setVisible(true);
    Utilities.invokeAndWait(
        new Runnable() {
          public void run() {
            _frame.pack();
            _frame.open(
                new FileOpenSelector() {
                  public File[] getFiles() {
                    File[] return_me = new File[1];
                    return_me[0] = new File(_tempDir, "ForceOpenClass1.java");
                    return return_me;
                  }
                });
          }
        });
    Utilities.clearEventQueue();

    assertTrue(
        "the save button should not be enabled after opening a document", !_frame.isSaveEnabled());
    _log.log("testSaveButtonEnabled completed");
  }
Exemple #30
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();
  }