private static JMenu getMoveToMenuItems(final DockingWindow window) {
    JMenu moveToMenu = new JMenu("Move to Window Bar");

    if (window.isMinimizable()) {
      final RootWindow root = window.getRootWindow();
      final Direction[] directions = Direction.getDirections();

      for (int i = 0; i < 4; i++) {
        final Direction dir = directions[i];

        if (!DockingUtil.isAncestor(root.getWindowBar(dir), window)
            && root.getWindowBar(dir).isEnabled()) {
          moveToMenu
              .add(new JMenuItem(dir.getName(), ARROW_ICONS[i]))
              .addActionListener(
                  new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      root.getWindowBar(dir).addTab(window);
                    }
                  });
        }
      }
    }

    return moveToMenu;
  }
 private static AbstractTabWindow getTabWindowFor(DockingWindow window) {
   return (AbstractTabWindow)
       (window instanceof AbstractTabWindow
           ? window
           : window.getWindowParent() != null
                   && window.getWindowParent() instanceof AbstractTabWindow
               ? window.getWindowParent()
               : null);
 }
 private DockingWindowAction getActionProvider(DockingWindow window) {
   if (window.isMinimized()) return minimizedAction;
   else {
     TabWindow tabWindow = DockingUtil.getTabWindowFor(window);
     return tabWindow != null && tabWindow.isMaximized() ? maximizedAction : normalAction;
   }
 }
  private static void addWindowMenuItems(JPopupMenu menu, DockingWindow window) {
    menu.add(UndockWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());
    menu.add(DockWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());
    menu.add(RestoreWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());
    menu.add(MinimizeWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());

    if (window instanceof TabWindow)
      menu.add(MaximizeWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());

    menu.add(CloseWithAbortWindowAction.INSTANCE.getAction(window).toSwingAction());

    if (window.getWindowParent() instanceof AbstractTabWindow)
      menu.add(CloseOthersWindowAction.INSTANCE.getAction(window).toSwingAction());

    JMenu moveToMenu = getMoveToMenuItems(window);

    if (moveToMenu.getItemCount() > 0) {
      menu.add(moveToMenu);
    }
  }
 /**
  * Writes the childs of the window to the stream
  *
  * @param out the stream to write the childs window to
  */
 public void content(Writer out) {
   for (int i = 0; i < window.getChildWindowCount(); i++) {
     ExporterProvider.getExporter(window.getChildWindow(i)).save(out);
   }
 }
 /**
  * Returns the name of the class of the window
  *
  * @return base name of the window class, ie "RootWindow" for instances of the RootWindow class
  */
 protected String getTag() {
   return window.getClass().getSimpleName();
 }
 /**
  * Indicates whether the window has child windows
  *
  * @return does the window have child windows
  */
 protected boolean hasChilds() {
   return window.getChildWindowCount() != 0;
 }
 public boolean set(DockingWindow parent, DockingWindow child) {
   parent.split(child, direction, dividerLocation);
   return true;
 }