Dockable sizes and dockable closing in common API

Hi,

first let me say that Docking Frames is excellent framework. I’ve tested many others and I must say that it was frustrating till I found Docking Frames which is small, powerfull and easy to use (mainly with Common API).

I have two questions regarding to dockable sizes in SplitDockStation. First, it seems that dockables sizes are defined as percentage internally, but I prefer optional pixel-based sizes in my application because some dockables display elements of fixed size (image thumbnails for example). It would be nice if I can specifiy size of some dockables in pixels or if I can lock their size across window resizes (keeping ability to resize them by user). Is this possible with Docking Frames?

The second question is if there is a possibility to change sizes of existing dockables? Many dockables can be opened in my application and I would like to allow user to easily force them to use equal size in split station (similar to Tile command in MDI appliations).

The last question is if there is a way how my application can be notified when dockable is closed using Common API?

Thank you in advance.

Sorry, not possible (yet).

The second question is if there is a possibility to change sizes of existing dockables? Many dockables can be opened in my application and I would like to allow user to easily force them to use equal size in split station (similar to Tile command in MDI appliations).

There is no simple command to call, but it is possible to implement this.
You could ask a SplitDockStation for its SplitDockTree. When you have the tree, you could read it out and create a new tree where the Dockables have the same size. Then you could drop the tree onto the station again. Not a very nice way, but it might work.

The last question is if there is a way how my application can be notified when dockable is closed using Common API?

When using common: Add a CDockableListener to your CDockable. The listeners method „visibilityChanged“ will be called every time when the CDockable is either opened or closed.
Otherwise: DockController# getRegister(). addDockRegisterListener(…) The DockRegisterListener gets informed whenever a Dockable joins or leaves the realm of a controller (which is the same as opening and closing).

I like the idea with the locked size, that goes onto the eternal todo-list for the next version. :slight_smile:

Thank you for your helpful answer, I’ll be awaiting future release with locked size support :slight_smile:

A follow up (I doubt anyone will read this…)

This feature has been added to version 1.0.3.

The DefaultSingle/MultipleCDockable have now additional methods:
„setResizeLocked“ locks the size
„setResizeRequest“ can be used to change the size based on a measurement in pixels.

Hi,

thank you for implementing this :slight_smile: I was pretty busy with other projects so I delayed testing of new features till now. I’m playing with resize locking and it seems to work partialy only. My application starts with following layout:


  | A |       |
  |---|  C  |
  | B |       |
  

both A and B are locked with setResizeLocked(true)
Everything works fine if user changes layout of dockables in following ways:


  | A | B | C |
  

or


  | A | C | B |
  

etc. But if layout changes like this:


  | A | C |
  |-------|
  |   B    |
  

dockable B size is no longer locked and its height changes on window resize. Maybe I’m doing something wrong?

Following code snippet is used to create dockables:


          final CWorkingArea area = control.createWorkingArea("C");
          area.setVisible(true);
  
          DefaultSingleCDockable dockA;
          dockA = new DefaultSingleCDockable("A", "Title", panel1);
          dockA.setLocation(CLocation.base().normalWest(0.17).north(0.25));
          control.add(dockA);
          dockA.setVisible(true);
  
          DefaultSingleCDockable dockB;
          dockB = new DefaultSingleCDockable("B", "Title", panel2);
          dockB.setLocation(CLocation.base().normalWest(0.17).south(0.75));
          control.add(dockB);
          dockB.setVisible(true);
  

[quote=Unregistered]Hi,
both A and B are locked with setResizeLocked(true)


  | A | C |
  |-------|
  |   B    |
  

dockable B size is no longer locked and its height changes on window resize.[/quote]

As I understand, A is locked as well. That means that there is a conflict when the height changes, should A or B remain with their height? In that case the conflict is resolved by just resizing both of them.

You are right, it was conflict between size of A and B (both locked). It seems the only solution of this problem is probably locking dynamicaly width or height of dockables only, but there is probably no easy way how to determine which axis should be locked.

I don’t understand what exactly you mean with dynamic locking. For example: how would dynamic locking solve the current conflict?

In following example

**| A | C |
|-------|
|    B    |**

the requested behaviour is that dockable A keeps its width and dockable B keeps its height across window resize (and dockable C, which is not locked, should grow to fill remaining space of window). When user swaps A and B dockables to following layout

**| B | C |
|-------|
|    A    |**

dockable A should keep its height and dockable B its width on window resize. This is what I ment with term „dynamic locking“ :slight_smile:

It seems that similar bevaiour is not implemented in many docking frameworks available. One exception from this rule seems to be VLDocking framework. If you run their demo application 1 (Text Editor) and resize window, you can see that Editing History, Image Gallery and Image Tools dockables keep their widths while editors in center of window resize. If you drag Image Tools dockable down to fill bottom edge of window and resizes window again, Editing History and Image Gallery keep their widths again and Image Tools keeps its height. This is nice, but I prefer Docking Frames over VLDocking so I’d like to find way how to get similar result using Docking Frames :slight_smile:

Ok, implementing that behavior is not that easy.

If you are in desperate need of that feature and must have it within this week, than you have to do it yourself. In that case: make a class that extends CLockedResizeLayoutManager (or one of its super classes) and I wish you much luck because I have no idea how to continue. When you are finished, install the new layout-manager using: “CControl.putProperty( SplitDockStation.LAYOUT_MANAGER, new YourNewLayoutManager() );”

On the other hand, I like the way VLDocking handles that. I’ll put it onto the todo-list, and it might (no guarantees) be ready in version 1.0.6.

Thank you for your response. Maybe, I’ll try to look at layout managers - currently I can live without that behaviour, but my application will probably need it later before release :slight_smile:

BTW, let me say that your support on this forum is another great reason for using DockingFrames :slight_smile:

A late answer to this one.

In version 1.0.6 the behavior can be changed using

ConflictResolver<RequestDimension> resolver = new FullLockConflictResolver();
control.putProperty( CControl.RESIZE_LOCK_CONFLICT_RESOLVER, resolver );```