Hi,
first of all I would like to thank you for this great framework and especially the extensive documentation which helps a lot when starting with such a complex API.
I just started playing around with DockingFrames and I was able to come up with something useful quite fast using the CControl.getContentArea() as you can see in the attached screenshot.
I would like to implement additional things and need some help:
- How do I disable the north area which in the screenshot contains the minimized Tool3?
- How do I configure DF to always minimize to the nearest border (except the north) when clicking the minimize button?
- When multiple dockables are stacked and display tabs for selection the toolbar buttons behave unexpected for me because some of them only are only applied on the currently visible dockable (ie. the close button) while some others are applied on all stacked dockables (for example the minimize button). I would like to configure a behaviour that all buttons are always only applied on the currently active and visible dockable. How can I achieve this?
Here is the code I have so far:
{
public ClientPro ()
{
super ("C 2013.0.0");
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
addWindowListener (new WindowAdapter ()
{
@Override
public void windowClosing (WindowEvent e)
{
ComponentHelper.storeComponentPosition (ClientPro.this, getPrefsKey ());
}
});
initDocking ();
}
private void initDocking ()
{
final CControl control = new CControl (this);
control.setTheme (ThemeMap.KEY_FLAT_THEME);
this.add (control.getContentArea ());
final DefaultSingleCDockable dockable = create ("v", "Non-moving Content");
control.addDockable (dockable);
dockable.setVisible (true);
dockable.setExternalizable (false);
dockable.setMinimizable (false);
dockable.setCloseable (false);
dockable.setStackable (false);
createTool (control, "Tool 1");
createTool (control, "Tool 2");
createTool (control, "Tool 3");
DockController dockController = control.getController ();
dockController.getRelocator ().addVetoableDockRelocatorListener (new VetoableDockRelocatorAdapter ()
{
@Override
public void grabbing (DockRelocatorEvent event)
{
final Dockable dockable = event.getDockable ();
final DockElement component = dockable.getElement ();
if (component instanceof DefaultCommonDockable)
{
DefaultCommonDockable defaultCommonDockable = (DefaultCommonDockable) component;
final String uniqueId = ((DefaultSingleCDockable) defaultCommonDockable.getDockable ()).getUniqueId ();
if (uniqueId.equals ("v"))
{
event.cancel ();
}
}
}
});
}
private DefaultSingleCDockable createTool (CControl control, final String title)
{
final DefaultSingleCDockable dockableTool = create (UUID.randomUUID ().toString (), title);
dockableTool.setLocation (CLocation.base ().normalWest (0.2));
dockableTool.setMaximizable (false);
dockableTool.setResizeLocked (true);
dockableTool.setCloseable (true);
control.addDockable (dockableTool);
dockableTool.setVisible (true);
return dockableTool;
}
private static DefaultSingleCDockable create (String key, String title)
{
DefaultSingleCDockable dockable = new DefaultSingleCDockable (key, title);
JPanel panel = new JPanel (new GridBagLayout ());
panel.add (new JButton ("test " + title), new GridBagConstraints (0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets (0, 0, 0, 0), 0, 0));
dockable.add (panel);
dockable.setFocusComponent (panel);
return dockable;
}
public static void main (String[] args)
{
ClientPro clientPro = new ClientPro ();
clientPro.showDialogAndKeepMinimumSize (new Dimension (800, 600));
}
}
Thanks a lot,
Campus