Can dragging of dockables be disabled?

Hi,

I know, sounds like a silly question and you may ask: why use dockables if you don’t want to behave them like dockables.

Well, the response is almost academic nature.
I like the theme-support of docking frames and I’m going to change every JPanel, that needs visual separation to become a dockable. Most of them will really be dockable.

Just to give the application a consistent look …

but now I started to change the JTabbedPane to become dockables too.
Its awesome to see them take part in theme-changing.
I know, its a big overhead, use CControls if there are no plans to use it, but as CDockables are no JComponents, I think I need CControl and CGrid to get CDockables painted.

Anyway - is there a way, I can disable drag support?
I already have DefaultSingleCDockable subclassed …

Any hint is welcome.

BR

Gero

The feature is a little bit hidden, and it is part of Core, but drag and drop can be disabled:

  • Make a class implementing “VetoableDockRelocatorListener”
  • Register the listener using “CControl.getController().getRelocator().addVetoableDockRelocatorListener(…)”
  • The listener will now receive events whenever the user does something related to drag and drop
  • You just “cancel” any event that involves your dockables beeing dragged, and you “forbid” any event where your DockStations are the target.

You should use code like this to find our whether your CDockables are involved:

if( dockable instanceof CommonDockable ){
  CDockable cdockable = ((CommonDockable)dockable).getDockable();
  if( cdockable instanceof MySpecialCustomDockable ){
    // do whatever is appropriate
  }
}```

Kuhl!

Tschänk ju wärri matsch :wink: