/**
* Detaches a <code>view</code> at the given location and size.
*/
private void detachView(final View view, int x, int y, int width, int height) {
JComponent component = (JComponent)view;
Container parent = component.getParent();
if (parent instanceof JViewport) {
component = (JComponent)parent.getParent();
parent = component.getParent();
}
// Replace component by a dummy label to find easily where to attach back the component
JLabel dummyLabel = new JLabel();
dummyLabel.setMaximumSize(new Dimension());
dummyLabel.setName(view.getClass().getName());
dummyLabel.setBorder(component.getBorder());
if (parent instanceof JSplitPane) {
JSplitPane splitPane = (JSplitPane)parent;
splitPane.setDividerSize(0);
if (splitPane.getLeftComponent() == component) {
splitPane.setLeftComponent(dummyLabel);
splitPane.setDividerLocation(0f);
} else {
splitPane.setRightComponent(dummyLabel);
splitPane.setDividerLocation(1f);
}
} else {
int componentIndex = parent.getComponentZOrder(component);
parent.remove(componentIndex);
parent.add(dummyLabel, componentIndex);
}
// Display view in a separate non modal dialog
Window window = SwingUtilities.getWindowAncestor(this);
if (!(window instanceof JFrame)) {