Flap not closing when container is minimized

I’m using 2 levels of DockingFrames.

Level 1 - To manage CDockables that can be re-arranged and docked
Level 2 - Inside each CDockable I’m using a FlapDockStation (set to the west side of a BorderLayout) to manage a control panel that can be displayed. It might be overkill using the FlapDockStation just to manage a simple popout panel, but I liked the look and ability to ‘stick’ the panel open.

Here is where the problem starts. If I call minimize on the outer CDockable when the inner flap is displayed, the CDockable minimizes correctly, but the flap remains open (essentially hanging in the middle by itself). I’m guessing this is related to the title bar (or another dockstation / dockable) never gaining focus.

My workaround is to call FlapDockStation.setFrontDockable(null) when dockableAdding() is called on the CContentArea’s minimize area. Let me know if you have a better suggestion

thanks!

The FlapDockStation is not prepared to handle the case when it becomes invisible. Hm, how about adding a ComponentListener to the station itself, when the “componentHidden” method is called you call “setFrontDockable(null)”? This may be a bit more robust, as the Dockable could be hidden of other reason than minimization too (like being in a stack, but not at the front).

Yes, my earlier post was not robust enough. Some users found some occasions where the flap would be left open. Listening for componentHidden() also doesn’t seem to work. Here is my solution. Not ideal but it works. All 3 steps are needed.

  1. To handle CDockable closing - override setVisible of my CDockable with
  public void setVisible(boolean visible) {
      closeFlap();
      super.setVisible(visible);
  }```

2) To handle CDockable minimizing - add a CDockableStateListener 
     ``` addCDockableStateListener(new CDockableAdapter() {
          @Override
          public void minimized(CDockable dockable) {
              closeFlap();
          }
      });
  1. To handle when a user opens a flap in one window, but then goes to maximize another window

    ``` control.getContentArea().getCenter().addSplitDockStationListener(new SplitDockListener() {
         @Override
         public void fullScreenDockableChanged(SplitDockStation station, Dockable oldFullScreen, Dockable newFullScreen) {
             if (newFullScreen != null){
                  // drillDownRepository is a repository of all open Dockables
                 for (DrillDownFrame frame : drillDownRepository.getFrames()) {
                     if (!newFullScreen.getTitleText().equals(frame.getTitleText())){
                         frame.closeFlap();
                     }
                 }
             }
         }
     });```
    

[QUOTE=morgandev]I’m using 2 levels of DockingFrames.

Level 1 - To manage CDockables that can be re-arranged and docked
Level 2 - Inside each CDockable I’m using a FlapDockStation (set to the west side of a BorderLayout) to manage a control panel that can be displayed. It might be overkill using the FlapDockStation just to manage a simple popout panel, but I liked the look and ability to ‘stick’ the panel open.

Here is where the problem starts. If I call minimize on the outer CDockable when the inner flap is displayed, the CDockable minimizes correctly, but the flap remains open (essentially hanging in the middle by itself). I’m guessing this is related to the title bar (or another dockstation / dockable) never gaining focus.

My workaround is to call FlapDockStation.setFrontDockable(null) when dockableAdding() is called on the CContentArea’s minimize area. Let me know if you have a better suggestion

thanks![/QUOTE]

Ok, good to know. Some more points you might want to test too:

  • What if the user drags another Dockable over your Dockable with the FlapDockStation, such that they stack? Or if it is already stacked and the user switches the Dockable at the front? Although using “DefaultCDockable.setStackable(false)” you can ensure that this never happens.
  • What if the user tries to drag a Dockable to the FlapDockStation that is in itself (that would create a loop, something that cannot work well).