I use the Common interface. I have my main window (text editor) surrounded by 4 docking areas. For some reason, resizing the dockables to the right and left of the main window is very limited - only a number of pixels, and when I increase the width of one of them to the maximum possible, I cannot increase the width of the other at all.
Any idea what the problem is? Is this due to the saved layout, or to the preferred (or minimum) size that is determined at runtime for the windows?
Hi Shlomy,
did you check the MinimumSize and the PreferredSize of the panel you are embedding in the docking views?
I remember the i ran i similar problem some time ago.
This is definitely not related to the preferred/minimum size of the panels I add. I use DockingFrames inside a text editor (jEdit). A while ago, I changed jEdit to allow for any docking framework to be plugged in (using an interface plugin), and I currently have two other docking frameworks that work with the same panels with no resize limitations. So it seems that the resize limitations do not come directly from my panels, but somehow from the parent panels (dock stations?).
This is definitely not related to the preferred/minimum size of the panels I add.
Not knowing how your program looks: have you a hard proof for this? Because for me this sounds like a problem with minimum-size too.
Question: you say you use other docking frameworks and they work, but do they actually check the minimum-size or just ignore it? What happens if you put a panel with minimum size set to 0/0 between the dockables and the editor components?
(You could also change the algorithm that decides which sizes are allowed and which not: a new class extending DefaultSplitLayoutManager and overriding validateDivider, registered with the property key SplitDockStation.LAYOUT_MANAGER, would do the trick.)
First, you are right about the minimum size issue. Other docking frameworks seem to ignore it… But the issue I brought here is somewhat strange. It pretty much depends on how I drag my dockable windows around. Sometimes I see a thin border around my dockable, and sometimes not. The capability to shrink the dockable is different between the two cases, which means that the wrapper panels of DockingFrames also play a role in how much I can resize.
Just now, I reached a state where DockingFrames also seems to ignore the minimum size (unless “JComponent.getMinimumSize()” is not the way to check it), and allows me to shrink the dockable to width 0 when its getMinimumSize() returns java.awt.Dimension[width=101,height=108].
Sometimes I see a thin border around my dockable, and sometimes not.
Really? That should not happen, can you reproduce this? How?
And yes, the wrapper panels do play a role. For example if one of these panels shows something like a title, then the minimum size of the title can also influence the behavior.
If your Dockables are stacked, then the minimum size is also ignored.
I am not sure how to reproduce the non-thin-border case now. I recall having seen it.
If you’re interested, you can easily get the source of the application and try it. The editor is jEdit (www.jedit.org), and the plugin is named, how else, DockingFramesPlugin. Both all stored in SVN, in the same repository. https://sourceforge.net/scm/?type=svn&group_id=588
I have attached a saved layout file with the resize problem. Note that the window on the left cannot grow much. However the window on the right can shrink to 0 size, and then the window on the left can grow. This is very annoying for me as a user (being unable to enlarge the left window to see all its content).
I downloaded your plugin and played around. The cause for the limited resizing is indeed the minimum size of the dockables. I “repaired” this with two modifications, both in DfWindowManager:
public void setMainPanel(JPanel panel)
{
mainDockable = new DefaultSingleCDockable("mainPanel", panel);
///// this one
mainDockable.getContentPane().setMinimumSize( new Dimension( 10, 10 ) );
mainArea.add(mainDockable);
mainDockable.setTitleShown(false);
mainDockable.setVisible(true);
}```
And this one:
``` public JEditDockable(JEditDockableFactory factory, String name,
String title, JComponent window, boolean fake)
{
super( factory, title, window );
// here
getContentPane().setMinimumSize( new Dimension( 10, 10 ) );```
I’m curios about the DockingFrames behavior - you wrote that if the dockable is stacked with others, the minimum size is ignored. If it is not stacked, the minimum size is effective. Why?
About the sizes: I was a bit incorrect, the minimum size of stacked Dockables are ignored if they are not selected (visible). The reason is simple: it was easier to implement that way…
Well, this would explain what I wrote earlier, that you said is strange. If the only minimum size that is effective in a stack of dockables is that of the visible one, then suppose I have another dockable in the stack with a larger minimum size than the visible one, and I shrink the current visible one to its minimum, then clicking on the other dockable will make the stack grow, on the expense of some other dockable, because the dockable that is now visible in the stack has a larger minimum size. Am I wrong?