Exemplo n.º 1
0
  public AppWindow(int flags) {
    super();
    final Application app = AbstractApplication.getApplication();
    final int type = flags & TYPES_MASK;
    wh = (BasicWindowHandler) app.getWindowHandler();

    switch (type) {
      case REGULAR:
      case SUPPORT:
        if (wh.usesInternalFrames()) {
          c = jc = jif = new JInternalFrame(null, true, true, true, true);
          w = f = jf = null;
          d = jd = null;
          wh.getDesktop().add(jif);
          ownMenuBar = type == REGULAR;

        } else {
          c = w = f = jf = new JFrame();
          jc = jif = null;
          d = jd = null;
          ownMenuBar = wh.usesScreenMenuBar() || (type == REGULAR);
        }
        //			floating			= false;
        tempFloating = (type == SUPPORT) && wh.usesFloating();
        floating = tempFloating;
        borrowMenuBar = false;
        ggTitle = null;
        break;

      case PALETTE:
        floating = wh.usesFloating();
        tempFloating = false;
        ownMenuBar = false;

        if (wh.usesInternalFrames()) {
          c = jc = jif = new JInternalFrame(null, true, true, true, true);
          w = f = jf = null;
          d = jd = null;
          borrowMenuBar = true;
          ggTitle = null;

          if (floating) jif.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
          wh.getDesktop()
              .add(jif, floating ? JLayeredPane.PALETTE_LAYER : JLayeredPane.DEFAULT_LAYER);

        } else {

          c = w = f = jf = new JFrame();
          jc = jif = null;
          d = jd = null;
          //				borrowMenuBar	= wh.usesScreenMenuBar();

          if (floating) {
            ggTitle = new AquaWindowBar(this, true);
            ggTitle.setAlwaysOnTop(true);
            borrowMenuBar = false;
            jf.setUndecorated(true);

            final Container cp = jf.getContentPane();

            //					cp.add( ggTitle, orient == HORIZONTAL ? BorderLayout.NORTH : BorderLayout.WEST );
            cp.add(ggTitle, BorderLayout.NORTH);

            //					if( resizable ) {
            //						final JPanel p = new JPanel( new BorderLayout() );
            //						p.add( new AquaResizeGadget(), BorderLayout.EAST );
            //						cp.add( p, BorderLayout.SOUTH );
            //					}
            //				} else {
            //					if( prefs.getBoolean( PrefsUtil.KEY_INTRUDINGSIZE, false )) {
            //						getContentPane().add( Box.createVerticalStrut( 16 ), BorderLayout.SOUTH );
            //					}
          } else {
            borrowMenuBar = wh.usesScreenMenuBar();
            ggTitle = null;
          }
        }
        break;

      default:
        throw new IllegalArgumentException("Unsupported window type : " + (flags & TYPES_MASK));
    }

    initTempFloating();
  }