Ejemplo n.º 1
0
 /**
  * Allow internal frames to go behind other frames (i.e. code windows).
  *
  * @author susiefu
  */
 protected void moveToBackLayer() {
   editFrame.setLayer(1);
   buttonFrame.setLayer(1);
   triangleFrame.setLayer(1);
   editFrame.moveToFront();
   triangleFrame.moveToFront();
   buttonFrame.moveToFront();
 }
Ejemplo n.º 2
0
  /**
   * Gerenciador de JInternalFrames
   *
   * @param jIFrame JInternalFrame : InternalFrame que se deseja gerenciar
   */
  public void manager(JInternalFrame jIFrame) {

    boolean isActive = false;
    JInternalFrame[] frames = dPane.getAllFrames();
    for (JInternalFrame jif : frames) {

      if (!reply) {
        if (jif.getClass().equals(jIFrame.getClass())) {
          isActive = true;
          jif.moveToFront();
          try {
            jif.setMaximum(true);
            jif.setMaximum(false);
          } catch (PropertyVetoException e) {
            e.printStackTrace();
          }
        }
      }
    }
    if (!isActive) {
      if (frames.length > 0) {
        cascata(jIFrame, frames[0]);
        jIFrame.setLocation(x, y);
      } else {
        jIFrame.setLocation(minX, minY);
      }

      dPane.add(jIFrame);
      jIFrame.setVisible(true);
    }
  }
  /**
   * 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());
  }
Ejemplo n.º 4
0
 // Aqui no creo que deba ir un TaskFrame por si se quiere activar otro tipo de JinternalFrame
 public void activateFrame(JInternalFrame frame) {
   frame.moveToFront();
   frame.requestFocus();
   try {
     frame.setSelected(true);
     if (!(frame instanceof TaskFrame)) {
       frame.setMaximum(false);
     }
   } catch (PropertyVetoException e) {
     warnUser(StringUtil.stackTrace(e));
   }
 }
  /** Adds the given componet to the given layer. */
  public void addEditorWindow(EditorWindowIndirectRef windowRef) {
    final JInternalFrame window = (JInternalFrame) windowRef;

    Dimension desktopSize = desktopPane.getSize();
    Dimension preferredSize = window.getPreferredSize();

    int x = desktopSize.width / 2 - preferredSize.width / 2;
    int y = desktopSize.height / 2 - preferredSize.height / 2;

    window.setBounds(x, y, preferredSize.width, preferredSize.height);

    // This line sometimes hangs, so I'm putting it in a watch process
    // so it can be stopped by the user. Not ideal.
    //        Window owner = (Window) getTopLevelAncestor();
    //
    //        new WatchedProcess(owner) {
    //            public void watch() {
    getDesktopPane().add(window);
    window.setLayer(100);
    window.moveToFront();

    try {
      window.setVisible(true);
    } catch (Exception e) {
      if (e instanceof ClassCastException || e instanceof NullPointerException) {
        // skip. These is being caused apparently the workbench
        // having labeled nodes and edges. Can't find a
        // workaround--probably a Java bug. jdramsey
      } else {
        e.printStackTrace();
      }
    }

    // prevents the component from being hidden.
    //                window.addComponentListener(new PositionListener());
    //            }
    //        };
  }
Ejemplo n.º 6
0
 @Override
 public void show() {
   if (super.isShowing()) super.moveToFront();
   else super.show();
 }