titleBarMouseAdapter = new TitleBarMouseAdapter();
// Container
container = (JPanel) resourceManager.createComponent(MyDoggyKeySpace.TOOL_WINDOW_CONTAINER, null);
container.setLayout(new ExtendedTableLayout(new double[][]{{TableLayout.FILL}, {16, TableLayout.FILL}}, false));
container.setName("toolWindow.container." + toolWindow.getId());
container.setFocusCycleRoot(true);
container.putClientProperty(ToolWindow.class, toolWindow);
String id = toolWindow.getId();
// Title Bar
ExtendedTableLayout titleBarLayout = new ExtendedTableLayout(new double[][]{{3, TableLayout.FILL, 2, -2, 3}, {0, 16, 0}}, false);
titleBar = (JPanel) resourceManager.createComponent(
MyDoggyKeySpace.TOOL_WINDOW_TITLE_BAR, descriptor.getManager(),
descriptor,
this
);
titleBar.setLayout(titleBarLayout);
titleBar.setName("toolWindow.titleBar." + toolWindow.getId());
titleBar.setEnabled(false);
titleBar.setBorder(null);
titleBar.addMouseListener(titleBarMouseAdapter);
if (descriptor.getDockedTypeDescriptor().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, descriptor, this);
// Set TitleBar content
titleBar.add(titleBarTabs, "1,1");
titleBar.add(titleBarButtons.getButtonsContainer(), "3,1");
// 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");