Control size allocation when stacking dockables

I have read through the documentation but I am very rusty on how to use the dockingframes libraries and the terminology so please forgive my ignorance. I am trying to change some behavior (that our QA and usability people have reported) involving dragging a dockable onto another dockable such that they stack (where each dockable then shows as a tab). Under the situation where there are many dockables visible (not stacked) and one dockable is dragged to another dockable to stack them upon release of the mouse the stacking occurs but the height of the stacked dockables automatically adjusts and is very small.

I am looking for a way to take control of this behavior and when I drop a dockable onto another one the height of the dockable being dropped is added to the height of the dockable being dropped on.

I am thinking I may need a custom ConflictResolver. Does anyone know the extension points for telling the framework to use a custom ConflictResolver?

Usually such behavior is caused because some Components have a „preferred size“ (calculated by their LayoutManager), and the sum of all the sizes is bigger than the parent JFrame. The stack just gets the space that is left, which is basically nothing. I would first try to unset the „preferred“ and the „minimum“ size of the other Components.

ConflictResolver is pobably not an answer, because it deals with Dockables that request to have a specific size (see AbstractCDockable.setResizeRequest).

The Interface you are looking for is SplitLayoutManager, which may be set using CControl.putProperty( SplitDockStation.LAYOUT_MANAGER, yourLayoutManager ). Extending DefaultSplitLayoutManager and overriding „validateDivider“ might be a good start for solving your issue. First try getting rid of the „preferred sizes“ :wink:

*** Edit ***

Edit: it should not be „preferred size“ but „minimum size“.

*** Edit ***

By the way, there might be another, easier solution. Setting the property „smallMinimumSize“ on „StackDockStation“ to „false“ (the default is „true“).

I have not tested the code below (because I am at my workplace, and should not be playing with DockingFrames right now…), but it should be easy for you to plug this code in and see if it has any effect.

			private DockStationListener listener = new DockStationAdapter(){
				@Override
				public void dockableAdding(DockStation station, Dockable dockable) {
					if( dockable instanceof StackDockStation){
						((StackDockStation) dockable).setSmallMinimumSize(false);
					}
				}
			};
			
			@Override
			public void dockStationRegistering(DockController controller, DockStation station) {
				// maybe calling "station.setSmallMinimumSize" here would work as well, and "listener" is not necessary. 
				
				station.addDockStationListener(listener);
			}
			@Override
			public void dockStationUnregistered(DockController controller, DockStation station) {
				station.removeDockStationListener(listener);
			}
		});```

Thank you! Using the DockRegisterAdapter without the listener worked nicely. When stacking they are now given a bit more vertical space such that it is more apparent to the user what is going on.

This is what I ended up doing:


	@Override
	public void dockStationRegistering(DockController controller, DockStation station) {
		if (station instanceof StackDockStation) {
			((StackDockStation) station).setSmallMinimumSize(false);
		}
	}

	@Override
	public void dockStationUnregistered(DockController controller, DockStation station) {

	}
});```

Thank you again for your help.