View Javadoc
1   package com.jsql.view.swing.panel.split;
2   
3   import com.jsql.view.swing.util.MediatorHelper;
4   
5   import java.awt.event.ActionEvent;
6   import java.awt.event.ActionListener;
7   
8   /**
9    * MouseAdapter to show/hide bottom panel.
10   */
11  public class ActionHideShowResult implements ActionListener {
12      
13      /**
14       * Hide bottom panel if both main and bottom are visible, also
15       * displays an ersatz bar replacing tabbedpane.
16       * Or else if only main panel is visible then displays bottom panel
17       * and hide ersatz panel.
18       */
19      @Override
20      public void actionPerformed(ActionEvent e) {
21          
22          var splitHorizontalTopBottom = MediatorHelper.frame().getSplitHorizontalTopBottom();
23          
24          if (
25              splitHorizontalTopBottom.getTopComponent().isVisible()
26              && splitHorizontalTopBottom.getBottomComponent().isVisible()
27          ) {
28              
29              MediatorHelper.panelConsoles().setDividerLocation(splitHorizontalTopBottom.getDividerLocation());
30              splitHorizontalTopBottom.getTopComponent().setVisible(false);
31              splitHorizontalTopBottom.disableDragSize();
32              MediatorHelper.panelConsoles().getButtonShowNorth().setVisible(false);
33              
34          } else if (
35              splitHorizontalTopBottom.getTopComponent().isVisible()
36              && !splitHorizontalTopBottom.getBottomComponent().isVisible()
37          ) {
38              
39              splitHorizontalTopBottom.setDividerLocation(MediatorHelper.panelConsoles().getDividerLocation());
40              splitHorizontalTopBottom.getBottomComponent().setVisible(true);
41              splitHorizontalTopBottom.getTopComponent().setVisible(true);
42              splitHorizontalTopBottom.enableDragSize();
43          }
44      }
45  }