Java Doc for BasicTabDisplayerUI.java in  » IDE-Netbeans » library » org » netbeans » swing » tabcontrol » plaf » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » library » org.netbeans.swing.tabcontrol.plaf 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
   org.netbeans.swing.tabcontrol.plaf.BasicTabDisplayerUI

All known Subclasses:   org.netbeans.swing.tabcontrol.plaf.BasicScrollingTabDisplayerUI,
BasicTabDisplayerUI
abstract public class BasicTabDisplayerUI extends AbstractTabDisplayerUI (Code)
Base class for tab displayer UIs which use cell renderers to display tabs. This class does not contain much logic itself, but rather acts to connect events and data from various objects relating to the tab displayer, which it creates and installs. Basically, the things that are involved are:
  • A layout model ( TabLayoutModel ) - A data model providing the positions and sizes of tabs
  • A state model ( TabState ) - A data model which tracks state data (selected, pressed, etc.) for each tab, and can be queried when a tab is painted to determine how that should be done.
  • A selection model ( javax.swing.SingleSelectionModel ) - Which tracks which tab is selected
  • The TabDisplayer component itself
  • The TabDisplayer 's data model, which contains the list of tab names, their icons and tooltips and the user object (or java.awt.Component ) they identify
  • Assorted listeners on the component and data models, specifically
    • A mouse listener that tells the state model when a state-affecting event has happened, such as the mouse entering a tab
    • A change listener that repaints appropriately when the selection changes
    • A property change listener to trigger any repaints needed due to property changes on the displayer component
    • A component listener to attach and detach listeners when the component is shown/ hidden, and if neccessary, notify the layout model when the component is resized
    • A default TabCellRenderer , which is what will actually paint the tabs, and which is also responsible for providing some miscellaneous data such as the number of pixels the layout model should add to tab widths to make room for decorations, etc.
The usage pattern of this class is similar to other javax.swing.plaf.ComponentUI subclasses - javax.swing.plaf.ComponentUI.installUI is called via JComponent.updateUI . installUI initializes protected fields which subclasses will need, in a well defined way; abstract methods are provided for subclasses to create these objects (such as the things listed above), and convenience implementations of some are provided. Under no circumstances should subclasses modify these protected fields - due to the circuitousness of the way Swing installs UIs, they cannot be declared final, but should be treated as read-only.

The goal of this class is to make it quite easy to implement new appearances for tabs: To create a new appearance, implement a TabCellRenderer that can paint individual tabs as desired. This is made even easier via the TabPainter interface - simply create the painting logic needed there. Then subclass BasicTabDisplayerUI and include any painting logic for the background, scroll buttons, etc. needed. A good example is AquaEditorTabDisplayerUI .


Inner Class :protected class BasicTabState extends TabState
Inner Class :protected class BasicDisplayerMouseListener implements MouseListener,MouseMotionListener,MouseWheelListener
Inner Class :protected class BasicSelectionListener implements ChangeListener
Inner Class :protected class BasicModelListener extends AbstractTabDisplayerUI.ModelListener

Field Summary
protected  TabCellRendererdefaultRenderer
    
 intpixelsToAdd
    
protected  intrepaintPolicy
    
protected  TabStatetabState
    

Constructor Summary
public  BasicTabDisplayerUI(TabDisplayer displayer)
    

Method Summary
final protected  voidcancelRequestAttention(int tab)
    
abstract protected  TabCellRenderercreateDefaultRenderer()
     Create the default cell renderer for this control.
public  ImagecreateImageOfTab(int index)
    
protected  ModelListenercreateModelListener()
    
protected  MouseListenercreateMouseListener()
    
protected  PropertyChangeListenercreatePropertyChangeListener()
    
protected  intcreateRepaintPolicy()
     Create the policy that will determine what types of events trigger a repaint of one or more tabs. This is a bitmask composed of constants defined in TabState.
protected  ChangeListenercreateSelectionListener()
    
protected  TabStatecreateTabState()
     Create a TabState instance.
public  intdropIndexOfPoint(Point p)
    
public  PolygongetExactTabIndication(int index)
    
protected  intgetFirstVisibleTab()
     Scrollable implementations will override this method to provide the first visible (even if clipped) tab.
public  PolygongetInsertTabIndication(int index)
    
final protected  PointgetLastKnownMouseLocation()
    
protected  intgetLastVisibleTab()
     Scrollable implementations will override this method to provide the last visible (even if clipped) tab.
abstract public  InsetsgetTabAreaInsets()
     Return a set of insets defining the margins into which tabs should not be painted.
protected  TabCellRenderergetTabCellRenderer(int tab)
     Get the cell renderer for a given tab.
public  RectanglegetTabRect(int idx, Rectangle rect)
    
protected  RectanglegetTabRectForRepaint(int tab, Rectangle rect)
    
 TabStategetTabState()
    
final protected  voidgetTabsVisibleArea(Rectangle rect)
     Set the passed rectangle's bounds to the recangle in which tabs will be painted; if your look and feel reserves some part of the tab area for its own painting.
protected  voidinstall()
     Overridden to initialize the tabState and defaultRenderer.
protected  booleanisAntialiased()
    
protected  voidmodelChanged()
    
final public  voidpaint(Graphics g, JComponent c)
     Paints the tab control.
protected  voidpaintAfterTabs(Graphics g)
    
protected  voidpaintBackground(Graphics g)
     Fill in the background of the component prior to painting the tabs.
protected  voidprocessMouseWheelEvent(MouseWheelEvent e)
     Convenience method to override for handling mouse wheel events.
final protected  voidrequestAttention(int tab)
    
public  inttabForCoordinate(Point p)
    
protected  voiduninstall()
    

Field Detail
defaultRenderer
protected TabCellRenderer defaultRenderer(Code)



pixelsToAdd
int pixelsToAdd(Code)



repaintPolicy
protected int repaintPolicy(Code)



tabState
protected TabState tabState(Code)




Constructor Detail
BasicTabDisplayerUI
public BasicTabDisplayerUI(TabDisplayer displayer)(Code)




Method Detail
cancelRequestAttention
final protected void cancelRequestAttention(int tab)(Code)



createDefaultRenderer
abstract protected TabCellRenderer createDefaultRenderer()(Code)
Create the default cell renderer for this control. If it is desirable to have more than one renderer, override getTabCellRenderer()



createImageOfTab
public Image createImageOfTab(int index)(Code)



createModelListener
protected ModelListener createModelListener()(Code)



createMouseListener
protected MouseListener createMouseListener()(Code)



createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()(Code)



createRepaintPolicy
protected int createRepaintPolicy()(Code)
Create the policy that will determine what types of events trigger a repaint of one or more tabs. This is a bitmask composed of constants defined in TabState. The default value is
 TabState.REPAINT_SELECTION_ON_ACTIVATION_CHANGE
 | TabState.REPAINT_ON_SELECTION_CHANGE
 | TabState.REPAINT_ON_MOUSE_ENTER_TAB
 | TabState.REPAINT_ON_MOUSE_ENTER_CLOSE_BUTTON
 | TabState.REPAINT_ON_MOUSE_PRESSED;
 
The repaint policy that should be used in conjunction with mouse events to determine when arepaint is needed.



createSelectionListener
protected ChangeListener createSelectionListener()(Code)



createTabState
protected TabState createTabState()(Code)
Create a TabState instance. TabState manages the state of tabs - that is, which one contains the mouse, which one is pressed, and so forth, providing methods such as setMouseInTab(int tab). Its getState() method returns a bitmask of states a tab may have which affect the way it is painted.

Usage: It is expected that UIs will subclass TabState, to implement the repaint methods, and possibly override getState(int tab) to mix additional state bits into the bitmask. For example, scrollable tabs have the possible states CLIP_LEFT and CLIP_RIGHT; BasicScrollingTabDisplayerUI's implementation of this determines these states by consulting its layout model, and adds them in when appropriate. An implementation of TabState
See Also:   BasicTabDisplayerUI.BasicTabState
See Also:   BasicScrollingTabDisplayerUI.ScrollingTabState




dropIndexOfPoint
public int dropIndexOfPoint(Point p)(Code)



getExactTabIndication
public Polygon getExactTabIndication(int index)(Code)



getFirstVisibleTab
protected int getFirstVisibleTab()(Code)
Scrollable implementations will override this method to provide the first visible (even if clipped) tab. The default implementation returns 0 if there is at least one tab in the data model, or -1 to indicate the model is completely empty



getInsertTabIndication
public Polygon getInsertTabIndication(int index)(Code)



getLastKnownMouseLocation
final protected Point getLastKnownMouseLocation()(Code)



getLastVisibleTab
protected int getLastVisibleTab()(Code)
Scrollable implementations will override this method to provide the last visible (even if clipped) tab. The default implementation returns 0 if there is at least one tab in the data model, or -1 to indicate the model is completely empty



getTabAreaInsets
abstract public Insets getTabAreaInsets()(Code)
Return a set of insets defining the margins into which tabs should not be painted. Subclasses that want to paint some controls to the right of the tabs should include space for those controls in these insets. If a bottom margin under the tabs is to be painted, include that as well.



getTabCellRenderer
protected TabCellRenderer getTabCellRenderer(int tab)(Code)
Get the cell renderer for a given tab. The default implementation simply returns the renderer created by createDefaultRenderer().



getTabRect
public Rectangle getTabRect(int idx, Rectangle rect)(Code)



getTabRectForRepaint
protected Rectangle getTabRectForRepaint(int tab, Rectangle rect)(Code)
Rectangle of the tab to be repainted



getTabState
TabState getTabState()(Code)
Used by unit tests



getTabsVisibleArea
final protected void getTabsVisibleArea(Rectangle rect)(Code)
Set the passed rectangle's bounds to the recangle in which tabs will be painted; if your look and feel reserves some part of the tab area for its own painting. The rectangle is determined by what is returned by getTabAreaInsets() - this is simply a convenience method for finding the rectange into which tabs will be painted.



install
protected void install()(Code)
Overridden to initialize the tabState and defaultRenderer.



isAntialiased
protected boolean isAntialiased()(Code)



modelChanged
protected void modelChanged()(Code)



paint
final public void paint(Graphics g, JComponent c)(Code)
Paints the tab control. Calls paintBackground(), then paints the tabs using their cell renderers, then calls paintAfterTabs



paintAfterTabs
protected void paintAfterTabs(Graphics g)(Code)
Override this method to provide painting of areas outside the tabs rectangle, such as margins and controls



paintBackground
protected void paintBackground(Graphics g)(Code)
Fill in the background of the component prior to painting the tabs. The default implementation does nothing. If it's just a matter of filling in a background color, setOpaque (true) on the displayer, and ComponentUI.update() will take care of the rest.



processMouseWheelEvent
protected void processMouseWheelEvent(MouseWheelEvent e)(Code)
Convenience method to override for handling mouse wheel events. The defualt implementation does nothing.



requestAttention
final protected void requestAttention(int tab)(Code)



tabForCoordinate
public int tabForCoordinate(Point p)(Code)



uninstall
protected void uninstall()(Code)



Fields inherited from org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
protected ComponentListener componentListener(Code)(Java Doc)
protected HierarchyListener hierarchyListener(Code)(Java Doc)
protected TabLayoutModel layoutModel(Code)(Java Doc)
protected ModelListener modelListener(Code)(Java Doc)
protected MouseListener mouseListener(Code)(Java Doc)
protected PropertyChangeListener propertyChangeListener(Code)(Java Doc)
protected ChangeListener selectionListener(Code)(Java Doc)

Methods inherited from org.netbeans.swing.tabcontrol.plaf.AbstractTabDisplayerUI
protected ComponentListener createComponentListener()(Code)(Java Doc)
protected Font createFont()(Code)(Java Doc)
protected HierarchyListener createHierarchyListener()(Code)(Java Doc)
abstract protected TabLayoutModel createLayoutModel()(Code)(Java Doc)
protected ModelListener createModelListener()(Code)(Java Doc)
abstract protected MouseListener createMouseListener()(Code)(Java Doc)
protected PropertyChangeListener createPropertyChangeListener()(Code)(Java Doc)
abstract protected ChangeListener createSelectionListener()(Code)(Java Doc)
protected SingleSelectionModel createSelectionModel()(Code)(Java Doc)
public int dropIndexOfPoint(Point p)(Code)(Java Doc)
protected void install()(Code)(Java Doc)
final protected void installListeners()(Code)(Java Doc)
final public void installUI(JComponent c)(Code)(Java Doc)
protected void modelChanged()(Code)(Java Doc)
public void registerShortcuts(JComponent comp)(Code)(Java Doc)
protected Point toDropPoint(Point location)(Code)(Java Doc)
protected void uninstall()(Code)(Java Doc)
final protected void uninstallListeners()(Code)(Java Doc)
final public void uninstallUI(JComponent c)(Code)(Java Doc)
public void unregisterShortcuts(JComponent comp)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.