titleBarMouseAdapter = new TitleBarMouseAdapter();
// Container
container = (JPanel) resourceManager.createComponent(MyDoggyKeySpace.TOOL_WINDOW_CONTAINER,
descriptor.getManager().getContext());
container.setLayout(new ExtendedTableLayout(new double[][]{{TableLayout.FILL}, {resourceManager.getFloat("toolwindow.title.font.size", 12) + 4,
TableLayout.FILL}}, false));
container.setName("toolWindow.container." + toolWindow.getId());
container.setFocusTraversalPolicyProvider(true);
container.setFocusTraversalPolicy(new ContainerOrderFocusTraversalPolicy());
container.setFocusCycleRoot(true);
container.setFocusable(false);
container.putClientProperty(ToolWindow.class, toolWindow);
String id = toolWindow.getId();
// Title Bar
ExtendedTableLayout titleBarLayout = new ExtendedTableLayout(new double[][]{{3, TableLayout.FILL, 2, -2, 3},
{0, resourceManager.getFloat("toolwindow.title.font.size", 12) + 4, 0}}, false);
titleBar = (JPanel) resourceManager.createComponent(
MyDoggyKeySpace.TOOL_WINDOW_TITLE_BAR,
descriptor.getManager().getContext(ToolWindowDescriptor.class, descriptor,
ToolWindowContainer.class, this)
);
titleBar.setLayout(titleBarLayout);
titleBar.setName("toolWindow.titleBar." + toolWindow.getId());
titleBar.setEnabled(false);
titleBar.setBorder(null);
titleBar.addMouseListener(titleBarMouseAdapter);
if (descriptor.isIdVisibleOnTitleBar())
titleBarLayout.setColumn(0, titleBar.getFontMetrics(
titleBar.getFont()
).stringWidth(resourceManager.getUserString(id)) + 12);
// Tabs
titleBarTabs = new ToolWindowTabPanel(this, descriptor);
toolWindow.getToolWindowTabs()[0].setSelected(true);
// Buttons
titleBarButtons = resourceManager.createInstance(TitleBarButtons.class,
new DefaultMutableContext(ToolWindowDescriptor.class, descriptor,
ToolWindowContainer.class, this
));
// Set TitleBar content
titleBar.add(titleBarTabs, "1,1");
titleBar.add(titleBarButtons.getComponent(), "3,1,right,c");
// Set Component container
componentContainer = new JPanel();
componentContainer.setLayout(new ExtendedTableLayout(new double[][]{{-1}, {-1}}));
componentContainer.setOpaque(false);
componentContainer.add(descriptor.getComponent(), "0,0,FULL,FULL");
// Set Container content
container.add(titleBar, "0,0");