Ich habe seit einpaar Tagen die Source tief angeschaut. Ich brauche Docking Frames, welche ähnlich wie Netbeans ausschauen soll. Dazu habe ich EclipseTabStrip umgeschrieben, so dass er verwendet jetzt Gridlayout als layout manager. Alle Action’s sind als @EclipseTabDockAction annotated. Als Tabpainter verwende ich RectGradientPainter.FACTORY.
Das schaut ziemlich schön aus. Das einzige Problem ist, die Action icons sind direkt nach dem Title platziert, sie sollen eigentlich rechts ausgerichtet sein.
These icons are painted by a “ButtonPanel”. “RectGradientPainter” has one such panel (can be accessed trough the method “getButton”) which is placed just after the title.
I suggest you make a new class which extends RectGradientPainter and override the method “doLayout” (maybe “getPreferredSize” as well), in the new “doLayout”-method you can place the button-panel at the right side. You should be able to copy almost anything from RectGradientPainter…
Then you make a copy of “RectGradientPainter.FACTORY” and you replace any “new RectGradientPainter” with your new class.
[Edit]
By the way, instead of upgrading each action with an “EclipseTabDockAction” you can also use this code below:
new DefaultEclipseThemeConnector(){
@Override
public boolean isTabAction( Dockable dockable, DockAction action ) {
return true;
}
});```
In the constructor code of BaseTabComponent class ButtonPanel is created as follows. While buttons has private access, i can’t change ButtonPanel. I need ButtonPanel with menu.
buttons = new ButtonPanel( false );
Maybe you have a suggestion to change this behavior, too. I copied whole class, and changed code above.
The issue with the menu is: the preferred size of the button-panel would depend on its current size since the number of visible actions is no longer constant. The parent of the button-panel must support this behavior and tell the panel how many actions to show. Something that BaseTabComponent cannot do.
It could be possible to have a “static menu” (a menu that does not change its content) rather than the dynamic menu which is offered by the button-panel.
You would need to implement an “ActionOffer” and add this new offer to the controller using “DockController.addActionOffer”. This offer would be required to create a new “MenuDockAction”, and this menu-action then would show the original actions (An “ActionOffer” tells what exactly shows up as action, it can modify the original set of actions in any way it likes).
On the other hand you could try to write a DockTitle and use it as tab. You already said that “DockTitleTab.FACTORY” works the way you would like.
You would do that by writing a new class extending “AbstractDockTitle” (that gives the dynamic menu in the button-panel), overriding “paintBackground” (and use some of the code of RectGradientPainter there), finally overriding “getInnerInsets” to have enough space for the extended border of your new title.
Apply the title using this code, where the … stands for the DockTitleFactory that creates your title.
getVersion( EclipseTheme.TAB_DOCK_TITLE, null );
version.setFactory( ..., Priority.CLIENT );```
Personally I think that is the way with the highest chances of success.