Beispiel #1
0
  /** Toggles the panel between maximized and normal state */
  public void toggleMaximize() {

    if (isMaximized()) dockManager.undoMaximize(true);
    else dockManager.maximize(this);

    updatePanel();
  }
Beispiel #2
0
  /** Display this panel in an external window. */
  public void windowPanel() {

    // try to hide the panel
    if (dockManager.hide(this, false)) {

      // move the toolbar from the main window to the panel
      if (hasToolbar()) {
        if (toolbarContainer == null) {
          toolbarContainer = new ToolbarContainer(app, false);
        }

        toolbarContainer.addToolbar(toolbar);
        toolbarContainer.buildGui();
        toolbarContainer.setActiveToolbar(getViewId());
        toolbarPanel.add(toolbarContainer, BorderLayout.CENTER);

        ToolbarContainer mainContainer = ((GuiManagerD) app.getGuiManager()).getToolbarPanel();
        mainContainer.removeToolbar(toolbar);
        mainContainer.updateToolbarPanel();
      }

      setVisible(true);
      createFrame();
    }
  }
Beispiel #3
0
  /** Display this panel in the main window. */
  public void unwindowPanel() {
    // hide the frame
    dockManager.hide(this, false);

    // don't display this panel in a frame the next time
    setOpenInFrame(false);

    // show the panel in the main window
    dockManager.show(this);

    // as this view already *had* focus and will retain focus
    // DockManager::show()
    // won't be able to update the active toolbar
    if (hasToolbar()) {
      ((GuiManagerD) app.getGuiManager()).getToolbarPanel().setActiveToolbar(toolbar);
    }
  }
Beispiel #4
0
 /** Update fonts. */
 public void updateFonts() {
   if (hasFocus && dockManager.hasFullFocusSystem()) {
     titleLabel.setFont(app.getBoldFont());
   } else {
     titleLabel.setFont(app.getPlainFont());
   }
   updateIcons();
 }
Beispiel #5
0
  /**
   * Start dragging if the mouse was pressed while it was on the title panel. Or toggle the stylebar
   * on double-click.
   */
  public void mousePressed(MouseEvent arg0) {

    // double-click opens the stylebar and shows the button panel
    if (arg0.getClickCount() == 2) {
      // toggleStyleBar();
      toggleMaximize();
    }

    // otherwise start drag if the view is in the main window
    else {
      if (frame == null) {
        dockManager.drag(this);
      }
    }
  }
Beispiel #6
0
 /**
  * Close this panel.
  *
  * @param isPermanent true for permanent closing (also detach the view)
  */
 protected void closePanel(boolean isPermanent) {
   dockManager.closePanel(this, isPermanent);
 }
Beispiel #7
0
  /**
   * Bind this view to a dock manager. Also initializes the whole GUI as just at this point the
   * application is available.
   *
   * @param dockManager1 dock manager
   */
  public void register(DockManagerD dockManager1) {
    this.dockManager = dockManager1;
    setApp(dockManager1.getLayout().getApplication());
    // create buttons for the panels
    createButtons();

    // create button panel
    buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(app.flowRight(), 0, 1));
    if (app.getLocalization().isRightToLeftReadingOrder()) {
      buttonPanel.add(closeButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(windowButton);
      buttonPanel.add(unwindowButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(maximizeButton);
    } else {
      buttonPanel.add(maximizeButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(unwindowButton);
      buttonPanel.add(windowButton);
      buttonPanel.add(Box.createHorizontalStrut(4));
      buttonPanel.add(closeButton);
    }

    // Custom border for the major panels (title, stylebar and toolbar)
    Border panelBorder =
        BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 0, 1, 0, SystemColor.controlShadow),
            BorderFactory.createEmptyBorder(0, 2, 0, 2));

    // create style bar panel
    styleBarPanel = new JPanel(new BorderLayout(1, 2));
    styleBarPanel.setBorder(panelBorder);
    styleBarPanel.addMouseListener(this);

    styleBarButtonPanel = new JPanel(new BorderLayout());
    JPanel p = new JPanel(new FlowLayout(0, 0, app.flowLeft()));
    if (this.hasStyleBar) {
      p.add(toggleStyleBarButton2);
    }
    p.add(Box.createHorizontalStrut(4));

    styleBarButtonPanel.add(p, BorderLayout.NORTH);
    styleBarPanel.add(styleBarButtonPanel, loc.borderWest());
    styleBarPanel.add(LayoutUtil.flowPanelRight(0, 0, 4, unwindowButton2), loc.borderEast());

    // construct the title panel and add all elements
    titlePanel = new JPanel();
    titlePanel.setBorder(panelBorder);
    titlePanel.setLayout(new BorderLayout());

    titlePanel.add(createFocusPanel(), loc.borderWest());
    titlePanel.add(buttonPanel, loc.borderEast());
    titlePanel.addMouseListener(this); // dragging to reconfigure
    titlePanel.addMouseListener(new MyButtonHider());

    // create toolbar panel
    if (hasToolbar()) {
      toolbarPanel = new JPanel(new BorderLayout());
      toolbarPanel.setBorder(panelBorder);
    }

    // construct a meta panel to hold the title, tool bar and style bar
    // panels

    JPanel titleBar = new JPanel(new BorderLayout());
    titleBar.add(styleBarPanel, BorderLayout.SOUTH);
    titleBar.add(titlePanel, BorderLayout.NORTH);

    JPanel metaPanel = new JPanel(new BorderLayout());
    metaPanel.add(titleBar, BorderLayout.SOUTH);
    if (hasToolbar()) metaPanel.add(toolbarPanel, BorderLayout.CENTER);

    // make titlebar visible if necessary
    updatePanel();

    add(metaPanel, BorderLayout.NORTH);
  }
Beispiel #8
0
 /** @return true if the layout has been maximized */
 public boolean isMaximized() {
   return dockManager.isMaximized();
 }
Beispiel #9
0
 /** sets the title label when this has not the focus */
 protected void setTitleLabelFocus() {
   if (dockManager.hasFullFocusSystem()) {
     if (titleIsBold()) titleLabel.setFont(app.getBoldFont());
     else titleLabel.setFont(app.getPlainFont());
   }
 }