The original recommended means of integrating the JIDE Docking Framework consisted of a two-part process.
1. Make JDAF aware of the Docking Framework
application.getApplicationUIManager().setUseJideDockingFramework(true);
2. Add DockableFrames using a DataViewListener
addDataViewListener(new DataViewAdapter() {
public void dataViewOpening(DataViewEvent e) {
if(getApplicationUIManager().isUseJideDockingFramework()) {
DockableHolder holder = (DockableHolder)e.getWindow();
holder.getDockingManager().setInitSplitPriority(DockingManager.
SPLIT_EAST_WEST_SOUTH_NORTH);
installDockableFrame(holder, null, "Frame1", DockContext.
DOCK_SIDE_WEST);
installDockableFrame(holder, null, "Frame2", DockContext.
DOCK_SIDE_SOUTH);
//...
}
}
});
This is still a valid approach if your application opens a new DataView on run. However, starting with JDAF 1.2, if you use the
setNewDataOnRun(false) option, JDAF no longer fires a
dataViewOpening() event, because it no longer opens a temporary DataView. Therefore, we have a new recommendation that you use a
WindowCustomizer instead of a
DataViewListener , like so:
getApplicationUIManager().getWindowsUI().addWindowCustomizer(new WindowCustomizer() {
public void customizeWindow(ApplicationWindowsUI windowsUI, Container window) {
if(getApplicationUIManager().isUseJideDockingFramework()) {
DockableHolder holder = (DockableHolder)window;
holder.getDockingManager().setInitSplitPriority(DockingManager. SPLIT_EAST_WEST_SOUTH_NORTH);
installDockableFrame(holder, null, "Frame1", DockContext. DOCK_SIDE_WEST);
installDockableFrame(holder, null, "Frame2", DockContext. DOCK_SIDE_SOUTH);
}
}
public void disposingWindow(ApplicationWindowsUI windowsUI, Container window) {
}
});
The
disposingWindow() can be used to save the layout data.
Layout Management
Pre-JDAF 1.2 is was not clear how the Docking Framework layout was handled. Basically, JDAF called
loadLayout() when the window was opened and did no customization otherwise. You would simply reload your own layout and manage a save layout when the DataView closed using a
DataViewListener.
With the recommendation of using a
WindowCustomizer you can use a similar strategy with one caveat, you must tell JDAF not to manage its own layout. This is done with a call to
getApplicationUIManager().setManageLayoutPersistence(false) from your
customizeWindow() method. This is because JDAF now manages a layout file called "default.layout" from which it will load and save layout data. The JDAF layout file can be found in the platform-specific data directory returned from
GUIApplication.getDataDirectory().
|