// Prepare common panel
floatingLiveComponent.setBorder(BorderFactory.createEtchedBorder());
if (lastBounds == null) {
FloatingLiveTypeDescriptor typeDescriptor = (FloatingLiveTypeDescriptor) descriptor.getTypeDescriptor(ToolWindowType.FLOATING_LIVE);
// Set Size
if (typeDescriptor.getSize() == null) {
Component managerCmp = descriptor.getManager();
switch (toolWindow.getAnchor()) {
case LEFT:
case RIGHT:
floatingLiveWindow.setSize(descriptor.getDockedTypeDescriptor().getDockLength(),
(int) (managerCmp.getHeight() / 1.5));
break;
case TOP:
case BOTTOM:
floatingLiveWindow.setSize((int) (managerCmp.getWidth() / 1.5),
descriptor.getDockedTypeDescriptor().getDockLength());
break;
}
} else
floatingLiveWindow.setSize(typeDescriptor.getSize());
SwingUtil.validateBounds(floatingLiveComponent, descriptor.getManager().getMainContainer().getBounds());
// Set Location
if (typeDescriptor.getLocation() == null ||
typeDescriptor.getLocation().x > descriptor.getManager().getWidth() ||
typeDescriptor.getLocation().y > descriptor.getManager().getHeight() ||
typeDescriptor.getLocation().x < 0 ||
typeDescriptor.getLocation().y < 0) {
Component managerCmp = descriptor.getManager();
switch (toolWindow.getAnchor()) {
case LEFT:
floatingLiveWindow.setLocation(50, 50);
break;
case RIGHT:
floatingLiveWindow.setLocation(managerCmp.getWidth() - 50 - floatingLiveWindow.getWidth(),
50);
break;
case TOP:
floatingLiveWindow.setLocation(50, 50);
break;
case BOTTOM:
floatingLiveWindow.setLocation(50,
managerCmp.getHeight() - 50 - floatingLiveWindow.getHeight());
break;
}
} else
floatingLiveWindow.setLocation(typeDescriptor.getLocation());
} else {
floatingLiveWindow.setBounds(lastBounds);
lastBounds = null;
}