Byte-Welt Forum

Zurück   Byte-Welt Forum > Projekte > DockingFrames

DockingFrames DockingFrames An extension of Swing, used to flexibly arrange windows. - Ist eine Erweiterung von Swing, mit der flexibel Panels angeordnet werden können.

Antwort
 
Themen-Optionen Thema durchsuchen
Alt 03.06.2010, 11:17   #1
ley starter
 
Registriert seit: 22.04.2009
Beiträge: 30
ley befindet sich auf einem aufstrebenden Ast
Standard EclipseTabPane customization

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,
ley ist offline   Mit Zitat antworten
Alt 03.06.2010, 18:15   #2
Beni
Moderator
 
Benutzerbild von Beni
 
Registriert seit: 27.08.2006
Beiträge: 571
Beni befindet sich auf einem aufstrebenden Ast
Beni eine Nachricht über Skype™ schicken
Standard AW: EclipseTabPane customization

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).
Beni ist offline   Mit Zitat antworten
Alt 10.06.2010, 09:55   #3
ley starter
 
Registriert seit: 22.04.2009
Beiträge: 30
ley befindet sich auf einem aufstrebenden Ast
Standard Re: EclipseTabPane customization

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
ley ist offline   Mit Zitat antworten
Alt 10.06.2010, 20:25   #4
Beni
Moderator
 
Benutzerbild von Beni
 
Registriert seit: 27.08.2006
Beiträge: 571
Beni befindet sich auf einem aufstrebenden Ast
Beni eine Nachricht über Skype™ schicken
Standard Re: EclipseTabPane customization

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:
  • Have a look at this LineTabsLayoutBlock and its "getSizes" method. Replacing the LineSizes by some other class that keeps track of "default sizes" surely is part of the solution.
  • And then all the methods of PaneLayout need to be updated. They have to use the tabs default sizes (that somehow gets stored in the replacement of LineSize).
__________________
Beni ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
-


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche

Forumregeln
Es ist Ihnen erlaubt, neue Themen zu verfassen.
Es ist Ihnen erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.



Alle Zeitangaben in WEZ +1. Es ist jetzt 02:10 Uhr.


Powered by vBulletin® Version 3.8.2 (Deutsch)
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.