Problem with layout

Hello,
I have some problem with the layout. My application has three dockables (I use Core), two of them are identical. When application closes I save the layout and restore it on load. My default layout is to have two identical dockables in stack on top taking most of the application real estate and the third to be beneath of them. Unfortunately, when I load this layout the result is as in the following image

Two top dockables are collapsed. If I close one of them, the layout automatically becomes the one that I want
.

The same result I get when I save layout in this state, without stacked dockables - it restores perfectly. This leads me to conclusion, that the problem is not with dockable itself (minimum / preferred sizes) but with the framework or more probably with the way that I use it. I was unable to find what causes this behavior and maybe you can help. Here is the layout with stacked dockables:[XML]<?xml version='1.0'?>







true



0
dock.PlaceholderList
















1

0
dock.PlaceholderList


true

id
index

0
0



true

id
index

1
1



























0
dock.PlaceholderList









[/XML]
And this is what I get with one of the dockables closed:[XML]<?xml version='1.0'?>







true



0
dock.PlaceholderList




























0
dock.PlaceholderList














1













[/XML]
I use 1.1.0 version (tried the latest 1.1.1 as well). The relevant code is:

dockFrontend.setDefaultHideable(true);
ScreenDockStation screenDockStation = new ScreenDockStation( dockFrontend.getOwner() );
SplitDockStation splitDockStation = new SplitDockStation();
dockFrontend.addRoot("root", splitDockStation);
dockFrontend.addRoot("floating", screenDockStation);
screenDockStation.setShowing(true);
dockFrontend.getController().setTheme(new EclipseTheme());
dockFrontend.setShowHideAction(true);
contentPane.add(splitDockStation, BorderLayout.CENTER);
//Create dockables
eventsPanel = new EventsDockable();
dockFrontend.addDockable("Events", eventsPanel);
customerPositionsPanel = new CustomerPositionsPanel();
customerPositionDockable = new DefaultDockable(customerPositionsPanel, "Customer Positions", icon);
dockFrontend.addDockable("Customer", customerPositionDockable);
globalPositionPanel = new GlobalPositionsPanel();
globalPositionDockable = new DefaultDockable(globalPositionPanel, "Currency Pair Positions", icon);
dockFrontend.addDockable("Global", globalPositionDockable);

This is an interesting line, the “divider” value is always between 0 and 1, but 0.93 is already an extreme value.

You are certain you did not have a bad layout when you stored it? Because the file very much indicates that.

About the minimum/preferred size: they have caused many problems. I would manually set them to a small value in any case (Unfortunatelly JTables in JScrollPanes are not very small).

I removed all minimum / preferred size settings and this line looks now but the behavior didn’t change :frowning:
The layout being saved on application exit, and it looks OK then.

Ok, to eliminate some possible sources of errors: what happens if you completely omit any content on the Dockables (never call something like “add(Component)”), is the loaded layout still a mess?

(If yes:
Would it be possible for you to write a small application that reproduces the error and that I can test? Because I can’t think of any other issue than minimum/preferred size (there are too many clients where loading a layout works without problem).
)

Ok, good news is that the problem is solved. The bad news is that I don’t completely understand what happened.
Bottom line, I moved frame’s setSize() to be before loadLayout() and it is working now.
Some things that I discovered following your suggestion to remove content from dockables and to create the test case.
The problem was in the bottom dockable as opposed to my thought that it is top dockable which causing the problem.
I recreated the problem in my application when there were empty dockables on top and the bottom contained just the JScrollPane. However I am unable to recreate this behavior in some simple test. And another strange thing, that I already wrote, is that everything was working good with one dockable on the top part but failed with two…

Bottom line, I moved frame’s setSize() to be before loadLayout() and it is working now.

There is some code that prevents Dockables from having illegal sizes like -8/-48, it may be (I’m just guessing) that this code caused the problem. If this code is „repairing“ a layout it assigns a weight to a dockable depending on its minimum size. The top dockables did have a small minimum size because the StackDockStation (the Components showing the tabs) has a small minimum size, the bottom Dockable may have had a size that was a bit bigger…

If the frame already has a size, this code may never have been called (it was not necessary to repair anything, as there were no illegal sizes).

… as I said, I’m just guessing here

The things that you said make sense. Thank you for the support.