![]() |
|
|||||||
| Registrieren | Benutzerliste | Interessengemeinschaften | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren | ||
| Java Link Base | Wiki | NoPaste | Chat | Boardregeln | F.A.Q. |
| DockingFrames DockingFrames An extension of Swing, used to flexibly arrange windows. - Ist eine Erweiterung von Swing, mit der flexibel Panels angeordnet werden können. |
![]() |
|
|
Themen-Optionen | Thema durchsuchen |
|
|
#1 |
|
Registriert seit: 22.04.2009
Beiträge: 30
|
Hi,
I have a StackDockStation and I'm using the eclipse theme and I want to customize the size of the tab info [I mean by the tab info the part that can be clicked to be able to move between tabs]. I want set a default tab width, and base on the available space in the panel that holds those tab info, I will set the number of tab info that can be displayed once. If the tab preferred width < default tab width. I will use the tab preferred width If the tab preferred width > default tab width · If available space > tab preferred width. I will use the tab preferred width. · If available space < tab preferred width. I will use the tab default size. For example, if the default tab size = 20 and the tab holder panel size is 100, then I want 5 tabs to be shown together. If I add a first tab[preferred width = 30], then the tab will have as a displayed width 30 If I add a second tab[preferred width = 35], then the second tab will have a displayed width 35 If I add a third tab [preferred width = 50], then the third tab will have a displayed width of 35 = (100 – (30+35)) If I add a fourth tab [preferred width = 15], then all tab will be resized to a width of 25 If I add a fifth one, then all tab should be resized to a width of 20 Is it possible to implement this behavior? If yes, which class should I extend? Where I should define my default tab width, how can I retrieve the tab info panel holder size and where I should implement my logic? Thanks, |
|
|
|
|
|
#2 |
|
Moderator
|
There are two things to do here:
- For the behavior you'll need to implement a TabLayoutManager. The TabLayoutManager gets all the tabs (and other stuff) and tells how to arrange them. The EclipseTheme makes use of the "MenuLineLayout", but I would suggest to have a look at the "RowLayout" first. You can use it as an example. To install your new layout-manager use the property-key TabPane.LAYOUT_MANAGER. - To transport the information (preferred/default size) you'll need to implement new tabs. Subclass one of the "TabComponent"s, for example the "ArchGradientPainter" and add some new methods (getDefaultSize...). Create a new "TabPainter" which will create your new TabComponent, you can copy the code from ArchGradientPainter.FACTORY to get this done quickly. Install the new factory using the property-key EclipseTheme.TAB_PAINTER. [Edit: or just ask the Dockables. A Dockable should know such stuff like the default size, and a TabLayoutManager needs to known Dockables and tabs anyway]
__________________
Geändert von Beni (03.06.2010 um 18:32 Uhr). |
|
|
|
|
|
#3 |
|
Registriert seit: 22.04.2009
Beiträge: 30
|
Hi Beni,
After looking to both "TabLayoutManager" impelmentations, I noticed that I want a behavior like the "MenuLineLayout", but I want to add a small feature it it, which is 1.Adding a default tab size [As you suggest I have subclass "TabComponent" and add getDefaultSize which return the desired default size] 2.Based on the available area of the eclipse tab pane define the maximum number of tabs to be visible at once 3.Based on the number of visible action, shrink to the default size or keep the preferred action size [Where I should do that, if I'm using an implementation copied from "MenuLineLayout"? When inserting the tab, when calling getSizes?] Thank you for you help |
|
|
|
|
|
#4 |
|
Moderator
|
Don't know if this is going to be a great help... let's base your work on the MenuLineLayout.
The MenuLineLayout keeps a map TabPane->Layout with one entry for each TabPane it manages. All the heavy work is done in the inner class "Layout". If the MenuLineLayout needs to do anything, it first creates a list of "PaneLayout"s. Each PaneLayout is an attempt to position the different elements (there can be attempts that make no sense at all). The MenuLineLayout then chooses the one PaneLayout that fits best into the available space and continous working with it. The set of PaneLayouts is created using different "LineSize"s, each LineSize represents a different set of tabs. These LineSizes are created by a helper-class called "LineTabsLayoutBlock". My suggestion would be to:
__________________
|
|
|
|
![]() |
| Lesezeichen |
| Stichworte |
| - |
| Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
| Themen-Optionen | Thema durchsuchen |
|
|