Example #1
0
 private void configureControl() {
   internalFrame.setTitle(getPageComponent().getTitle());
   internalFrame.setFrameIcon(getPageComponent().getIcon());
 }
  // REVISAR: No parece necesario evitar el JInternalFrame
  // public void addInternalFrame(final TaskComponent internalFrame,
  public void addInternalFrame(
      final JInternalFrame internalFrame, boolean alwaysOnTop, boolean autoUpdateToolBar) {
    if (internalFrame instanceof LayerManagerProxy) {
      setClosingBehaviour((LayerManagerProxy) internalFrame);
      installTitleBarModifiedIndicator((LayerManagerProxy) internalFrame);
    }

    // <<TODO:IMPROVE>> Listen for when the frame closes, and when it does,
    // activate the topmost frame. Because Swing does not seem to do this
    // automatically. [Jon Aquino]
    internalFrame.setFrameIcon(icon);

    // Call JInternalFrame#setVisible before JDesktopPane#add; otherwise,
    // the
    // TreeLayerNamePanel starts too narrow (100 pixels or so) for some
    // reason.
    // <<TODO>>Investigate. [Jon Aquino]
    internalFrame.setVisible(true);
    desktopPane.add(
        (Component) internalFrame,
        alwaysOnTop ? JLayeredPane.PALETTE_LAYER : JLayeredPane.DEFAULT_LAYER);
    if (autoUpdateToolBar) {
      internalFrame.addInternalFrameListener(
          new InternalFrameListener() {
            public void internalFrameActivated(InternalFrameEvent e) {
              toolBar.updateEnabledState();

              // Associate current cursortool with the new frame [Jon
              // Aquino]
              toolBar.reClickSelectedCursorToolButton();
            }

            public void internalFrameClosed(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameClosing(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameDeactivated(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameDeiconified(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameIconified(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }

            public void internalFrameOpened(InternalFrameEvent e) {
              toolBar.updateEnabledState();
            }
          });

      // Call #activateFrame *after* adding the listener. [Jon Aquino]
      activateFrame(internalFrame);
      position(internalFrame);
    }
  }