Element modelElement = getElement(element, "layout");
if (modelElement == null)
continue;
String text = modelElement.getTextContent();
XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(text.getBytes()));
final MultiSplitLayout.Node model = (MultiSplitLayout.Node) decoder.readObject();
sharedWindows.addSharedWindow(model, ids);
}
}
// Load contents..
NodeList contents = element.getElementsByTagName("content");
Content selectedContent = null;
Content maximizedContent = null;
// load contents properties
for (int i = 0, size = contents.getLength(); i < size; i++) {
Element contentElement = (Element) contents.item(i);
String contentId = contentElement.getAttribute("id");
Content content = context.get(ToolWindowManager.class).getContentManager().getContent(contentId);
if (content == null)
content = context.get(PersistenceDelegateCallback.class).contentNotFound(context.get(ToolWindowManager.class),
contentId,
node.setElement(contentElement));
if (content != null) {
if (getBoolean(context, contentElement, "selected", false))
selectedContent = content;
if (getBoolean(context, contentElement, "maximized", false))
maximizedContent = content;
content.setEnabled(getBoolean(context, contentElement, "enabled", true));
boolean detached = getBoolean(context, contentElement, "detached", false);
content.setMaximized(false);
content.setMinimized(getBoolean(context, contentElement, "minimized", false));
content.setFlashing(getBoolean(context, contentElement, "flashing", false));
// Load "minimizedState" sub element if any
Element minimizedStateElem = getElement(contentElement, "minimizedState");
if (minimizedStateElem != null && content.isMinimized()) {
ContentDescriptor contentDescriptor = (ContentDescriptor) toolWindowManager.getDockableDescriptor(content.getId());
contentDescriptor.setAnchor(getToolWindowAnchor(context, minimizedStateElem, "anchor", ToolWindowAnchor.LEFT),
getInteger(context, minimizedStateElem, "anchorIndex", -1)
);
}
// Load contentUI
ContentUI contentUI = content.getContentUI();
contentUI.setCloseable(getBoolean(context, contentElement, "closeable", true));
contentUI.setDetachable(getBoolean(context, contentElement, "detachable", true));
contentUI.setMinimizable(getBoolean(context, contentElement, "minimizable", true));
contentUI.setMaximizable(getBoolean(context, contentElement, "maximizable", true));
contentUI.setTransparentMode(getBoolean(context, contentElement, "transparentMode", true));
contentUI.setTransparentDelay(getInteger(context, contentElement, "transparentDelay", 0));
contentUI.setTransparentRatio(getFloat(context, contentElement, "transparentRatio", 0.7f));
contentUI.setAddToTaskBarWhenDetached(getBoolean(context, contentElement, "addToTaskBarWhenDetached", false));
contentUI.setAlwaysOnTop(getBoolean(context, contentElement, "alwaysOnTop", false));
// Load detachedBounds if any
NodeList list = contentElement.getElementsByTagName("detachedBounds");
if (list.getLength() > 0) {
Element detachedBoundsElm = (Element) list.item(0);
contentUI.setDetachedBounds(new Rectangle(getInteger(context, detachedBoundsElm, "x", 100),
getInteger(context, detachedBoundsElm, "y", 100),
getInteger(context, detachedBoundsElm, "width", 320),
getInteger(context, detachedBoundsElm, "height", 200)));
}
if (detached) {
if (sharedWindows.isInSharedWindow(content)) {
Dockable refDockable = sharedWindows.getRefDockable(content);
if (refDockable != null)
content.detachByReference((Content) refDockable, AggregationPosition.DEFAULT);
else
content.setDetached(true);
} else
content.setDetached(true);
} else
content.setDetached(false);
}
}
// Load layout
Element modelElement = getElement(element, "layout");
if (modelElement != null && !toolWindowManager.getContentManager().isEnabled()) {
String text = modelElement.getTextContent();
XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(text.getBytes()));
final MultiSplitLayout.Node model = (MultiSplitLayout.Node) decoder.readObject();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MultiSplitDockableContainer dockableContainer = (MultiSplitDockableContainer) ((DockableDropPanel) context.get(MyDoggyToolWindowManager.class).getMainContent()).getComponent();
dockableContainer.setMultiSplitLayout(model);