Esempio n. 1
0
  private synchronized void display(ExtSed sed) {

    manageAssociatedManagerWindows(sed);

    try {

      SpectrumContainer container =
          (SpectrumContainer) sed.getAttachment(IrisDisplayManager.FIT_MODEL);

      // There is no Sed attachment, so build a model manager and attach it.

      if (container == null) {
        if (buildAttachment(sed)) {
          return;
        }
      }

      // VAOPD-879: spectrum name must be identical with Sed name.
      if (container != null) {
        container.getSpectrum().setName(sed.getId());
      }

      // Now display the Sed.

      idm.display(sed, sed.getId());

      // and add its frame to the workspace.

      JInternalFrame frame = idm.getInternalFrame();

      // VAOPD-863
      frame.setTitle(sed.getId());

      if (container != null) {
        JFrame modelManagerFrame = container.getModelManager().getFrame();
        if (modelManagerFrame != null) {
          modelManagerFrame.setTitle(sed.getId());
        }
      }

      if (frame != currentFrame) {
        lastLocation = null;
        disposeCurrentFrame();
        currentFrame = frame;
        currentFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
        if (lastLocation != null) {
          currentFrame.setLocation(lastLocation);
        }
        frame.setTitle("Iris Visualizer");
        ws.addFrame(frame);
      }

    } catch (Exception ex) {
      LogEvent.getInstance().fire(this, new LogEntry("Error: " + ex.getMessage(), sed));
      Logger.getLogger("IrisVisualizer").log(Level.SEVERE, null, ex);
    }
  }
  /**
   * Adds a component to the middle layer of the desktop--that is, the layer for session node
   * editors. Note: The comp is a SessionEditor
   */
  public void addSessionEditor(SessionEditorIndirectRef editorRef) {
    SessionEditor editor = (SessionEditor) editorRef;

    JInternalFrame frame = new TetradInternalFrame(null);

    frame.getContentPane().add(editor);
    framesMap.put(editor, frame);
    editor.addPropertyChangeListener(this);

    // Set the "small" size of the frame so that it has sensible
    // bounds when the users unmazimizes it.
    Dimension fullSize = desktopPane.getSize();
    int smallSize = Math.min(fullSize.width - MARGIN, fullSize.height - MARGIN);
    Dimension size = new Dimension(smallSize, smallSize);
    setGoodBounds(frame, desktopPane, size);
    desktopPane.add(frame);

    // Set the frame to be maximized. This step must come after the frame
    // is added to the desktop. -Raul. 6/21/01
    try {
      frame.setMaximum(true);
    } catch (Exception e) {
      throw new RuntimeException("Problem setting frame to max: " + frame);
    }

    desktopPane.setLayer(frame, 0);
    frame.moveToFront();
    frame.setTitle(editor.getName());
    frame.setVisible(true);

    setMainTitle(editor.getName());
  }
  /**
   * Reacts to property change events 'editorClosing', 'closeFrame', and 'name'.
   *
   * @param e the property change event.
   */
  public void propertyChange(PropertyChangeEvent e) {

    // Handles the removal of editor frames from desktop
    String name = e.getPropertyName();

    if ("editorClosing".equals(name)) {

      // find NewValue in String array, and remove
      for (int n = 0; n < sessionNodeKeys.size(); n++) {
        if (e.getNewValue().equals((sessionNodeKeys.get(n)))) {
          sessionNodeKeys.remove(n);
        }
      }
    } else if ("closeFrame".equals(e.getPropertyName())) {
      if (getFramesMap().containsKey(e.getSource())) {
        Object frameObject = getFramesMap().get(e.getSource());
        JInternalFrame frame = (JInternalFrame) frameObject;
        frame.setVisible(false);
        frame.dispose();
      }
    } else if ("name".equals(e.getPropertyName())) {
      if (getFramesMap().containsKey(e.getSource())) {
        Object frameObject = getFramesMap().get(e.getSource());
        JInternalFrame frame = (JInternalFrame) frameObject;
        String _name = (String) (e.getNewValue());
        frame.setTitle(_name);
        setMainTitle(_name);
      }
    }
  }
Esempio n. 4
0
 private void configureControl() {
   internalFrame.setTitle(getPageComponent().getTitle());
   internalFrame.setFrameIcon(getPageComponent().getIcon());
 }
Esempio n. 5
0
  /** The graphic handling and deployment. */
  private void initComponents() {
    jDesktopPane1 = new javax.swing.JDesktopPane();
    jInternalFrame1 = new javax.swing.JInternalFrame();
    tf = new javax.swing.JTextField();
    b1 = new javax.swing.JButton();
    jInternalFrame3 = new javax.swing.JInternalFrame();
    ta = new javax.swing.JTextArea();
    jsp_ta = new javax.swing.JScrollPane(ta);
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenuItem3 = new javax.swing.JMenuItem();
    jSeparator1 = new javax.swing.JSeparator();
    jMenuItem4 = new javax.swing.JMenuItem();

    jInternalFrame1
        .getContentPane()
        .setLayout(
            new javax.swing.BoxLayout(
                jInternalFrame1.getContentPane(), javax.swing.BoxLayout.X_AXIS));

    jInternalFrame1.setIconifiable(true);
    jInternalFrame1.setMaximizable(true);
    jInternalFrame1.setResizable(true);
    jInternalFrame1.setTitle("Message editor");
    jInternalFrame1.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame1.setVisible(true);
    tf.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    jInternalFrame1.getContentPane().add(tf);

    b1.setText("Send Message");
    jInternalFrame1.getContentPane().add(b1);

    jInternalFrame1.setBounds(10, 10, 440, 60);
    jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);

    jInternalFrame3.setIconifiable(true);
    jInternalFrame3.setMaximizable(true);
    jInternalFrame3.setResizable(true);
    jInternalFrame3.setTitle("Messages");
    jInternalFrame3.setToolTipText(
        "Move and resize all of these to make the chat room appearance match your preferences.");
    jInternalFrame3.setVisible(true);
    ta.setBackground(new Color(255, 255, 255));
    ta.setEditable(false);
    ta.setFont(new java.awt.Font("Lucida Sans", 0, 12));
    // jsp_ta.setAutoscrolls(true);
    jsp_ta.setDoubleBuffered(true);

    jInternalFrame3.getContentPane().add(jsp_ta, java.awt.BorderLayout.CENTER);

    jInternalFrame3.setBounds(10, 80, 420, 240);

    jDesktopPane1.add(jInternalFrame3, javax.swing.JLayeredPane.DEFAULT_LAYER);

    getContentPane().add(jDesktopPane1, java.awt.BorderLayout.CENTER);

    jMenu1.setText("Private room options");
    jMenu1.setMnemonic(KeyEvent.VK_O);
    jMenu1.setToolTipText("Choose some options.");
    jMenuItem3.setText("Save conversation");
    jMenuItem3.setMnemonic(KeyEvent.VK_S);
    jMenuItem3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem3);
    jMenu1.add(jSeparator1);
    jMenuItem4.setText("Exit");
    jMenuItem4.setMnemonic(KeyEvent.VK_E);
    jMenuItem4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, ActionEvent.CTRL_MASK));
    jMenu1.add(jMenuItem4);
    jMenuBar1.add(jMenu1);
    setJMenuBar(jMenuBar1);

    this.pack();

    b1.addActionListener(this);
    tf.addActionListener(this);
    jMenuItem3.addActionListener(this);
    jMenuItem4.addActionListener(this);

    posx = (int) Math.random() * 640;
    posy = (int) Math.random() * 480;

    this.pack();
    this.setSize(dimx, dimy);
    this.setLocation(posx, posy);
    this.show();
  }