propertyChangeSupport.addPropertyChangeListener("visible.FLOATING", new VisibleFloatingListener());
propertyChangeSupport.addPropertyChangeListener("visible.FLOATING_FREE", new VisibleFloatingFreeListener());
propertyChangeSupport.addPropertyChangeListener("visible.SLIDING", new VisibleSlidingListener());
propertyChangeSupport.addPropertyChangeListener("visible.after", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
ToolWindow sourceTool = ((ToolWindowDescriptor) evt.getSource()).getToolWindow();
if (sourceTool.getType() != ToolWindowType.DOCKED ||
sourceTool.getAnchor() != anchor ||
!(getSplitPaneContent() instanceof MultiSplitContainer))
return;
MultiSplitContainer multiSplitContainer = (MultiSplitContainer) getSplitPaneContent();
if (multiSplitContainer.getContentCount() <= 1)
return;
java.util.List<Component> components = Arrays.asList(contentPane.getComponents());
Collections.sort(components, new Comparator<Component>() {
public int compare(Component o1, Component o2) {
TableLayoutConstraints c1 = contentPaneLayout.getConstraints(o1);
TableLayoutConstraints c2 = contentPaneLayout.getConstraints(o2);
if (horizontal) {
if (c1.col1 < c2.col1)
return -1;
else if (c1.col1 == c2.col1)
return 0;
} else {
if (c1.row1 < c2.row1)
return -1;
else if (c1.row1 == c2.row1)
return 0;
}
return 1;
}
});
int i = 0;
for (Component component : components) {
if (component instanceof JLabel) {
JLabel anchorLabel = (JLabel) component;
ToolWindowDescriptor d = ((AnchorLabelUI) anchorLabel.getUI()).getDescriptor();
if (d.getToolWindow().isVisible()) {
Component content = ((DockedContainer) d.getToolWindowContainer()).getContentContainer();
multiSplitContainer.setComponentAt(content, i++);
}
}
}
}
});
propertyChangeSupport.addPropertyChangeListener("visible", new VisibleListener());
propertyChangeSupport.addPropertyChangeListener("active.before", new ActiveBeforeListener());
propertyChangeSupport.addPropertyChangeListener("active", new ActiveListener());
propertyChangeSupport.addPropertyChangeListener("type", new TypeListener());
propertyChangeSupport.addPropertyChangeListener("index", new IndexListener());
propertyChangeSupport.addPropertyChangeListener("title", new TitleListener());
propertyChangeSupport.addPropertyChangeListener("icon", new IconListener());
propertyChangeSupport.addPropertyChangeListener("dockLength", new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
ToolWindow toolWindow = (ToolWindow) evt.getSource();
if (toolWindow.isVisible()) {
setSplitDividerLocation((Integer) evt.getNewValue());
SwingUtil.repaint(splitPane);
}
}
});