Java Doc for TabState.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) 


java.lang.Object
   org.netbeans.swing.tabcontrol.plaf.TabState

TabState
abstract public class TabState (Code)
Used by BasicTabDisplayerUI and its subclasses. Tracks and manages the state of tabs, mainly which one currently contains the mouse, if the mouse is in the close button, if the tab is adjacent to a selected tab, if it is leftmost, rightmost, active, etc. This class hides most of the complexity of deciding what mouse events should trigger a repaint of what areas in an optimized way. It provides setters which a mouse listener can call to indicate that the mouse has, say, moved into a tab, or from one tab to another, or the selection has changed, etc.

Essentially, this class is fed indices of tabs that have various states (selected, contains mouse, etc.), figures out if this affects one tab, two tabs (a different tab had the state, such as the mouse moving from one tab to another) or all tabs (activated). It determines a change type, and consults a repaint policy (an integer bitmask) to decide if one, both, all or no tabs should be repainted.

The typical use case is to implement a subclass, and override getState() to mix in bitmasks for things like whether a tab is clipped, etc. - things the base implementation can't know about.

Subclasses implement the repaintTab() method to do the actual repainting, and implement getRepaintPolicy(). The repainting will be called if an event happens that changes the state in a way that the repaint policy bitmask indicates should cause a repaint.

BasicTabDisplayerUI implements a mouse listener which will call the appropriate methods when the mouse enters/exits tabs, etc.

Details

State is composed as an integer bitmask which covers all of the supported states of a tab that may affect the way they paint. These are also the values that are passed to the methods of a TabCellRenderer to tell it how to paint itself. Two other integer bitmasks are used: The changeType, which indicates whether a change was from one tab to another tab, one tab to no tab (i.e. selection set to -1), one tab to the same tab (i.e. the mouse moved out of the tab control, and so the tab with the mouse in it is now no tab). RepaintPolicy is an integer bitmask composed of conditions under which the control should repaint one or all tabs, and determines what types of changes actually trigger repaints.

Subclasses are expected to override getState() to provide information about non-mouse-or-focus related states, such as clipping of scrollable tabs. Predefined states for tabs are: CLIP_RIGHT, CLIP_LEFT, ARMED, PRESSED, SELECTED, ACTIVE, NOT_ONSCREEN, LEFTMOST, RIGHTMOST, CLOSE_BUTTON_ARMED, BEFORE_SELECTED, AFTER_SELECTED, MOUSE_IN_TABS_AREA, MOUSE_PRESSED_IN_CLOSE_BUTTON. Subclasses must handle returning the following states if they wish to, which are not handled directly in TabState: LEFTMOST, RIGHTMOST, CLIP_LEFT, CLIP_RIGHT, NOT_ONSCREEN.

Most of the states are fairly self-explanatory; NOT_ONSCREEN is useful as an optimization so that no work is done for events that would try to produce a repaint for something not visible; CLIP_* refers to the case in scrollable tab UIs, in which a tab may only be partially visible; MOUSE_PRESSED_IN_CLOSE_BUTTON is distinct because the CLOSE_BUTTON_ARMED state will be reset if the mouse moves out of the close button area, but UIs should perform a close action if the mouse was pressed over the close button, moved away from the close button and then back to it, so this state preserves the information that the originating location of a mouse press was in the close button.



Field Summary
final public static  intACTIVE
    
final public static  intAFTER_SELECTED
    
final public static  intALL_TABS
    
final public static  intARMED
    
final public static  intATTENTION
     Bitmask indicating that the tab is in "attention" mode - blinking or flashing to get the user's attention.
final public static  intBEFORE_ARMED
    
final public static  intBEFORE_SELECTED
    
final public static  intCHANGE_NONE_TO_TAB
    
final public static  intCHANGE_TAB_TO_NONE
    
final public static  intCHANGE_TAB_TO_SELF
    
final public static  intCHANGE_TAB_TO_TAB
    
final public static  intCLIP_LEFT
    
final public static  intCLIP_RIGHT
    
final public static  intCLOSE_BUTTON_ARMED
    
final public static  intLEFTMOST
    
final public static  intMOUSE_IN_TABS_AREA
    
final public static  intMOUSE_PRESSED_IN_CLOSE_BUTTON
     Bitmask indicating that the mouse is inside the close button and has been pressed.
final public static  intNOT_ONSCREEN
     State bitmask indicating a tab is not displayed at all and shouldn't be painted.
final public static  intNO_CHANGE
     Change type indicating no change happened (i.e.
final public static  intPRESSED
    
final public static  intREPAINT_ALL_ON_MOUSE_ENTER_TABS_AREA
    
final public static  intREPAINT_ALL_TABS_ON_ACTIVATION_CHANGE
    
final public static  intREPAINT_ALL_TABS_ON_SELECTION_CHANGE
    
final public static  intREPAINT_ON_CLOSE_BUTTON_PRESSED
    
final public static  intREPAINT_ON_MOUSE_ENTER_CLOSE_BUTTON
    
final public static  intREPAINT_ON_MOUSE_ENTER_TAB
    
final public static  intREPAINT_ON_MOUSE_PRESSED
    
final public static  intREPAINT_ON_SELECTION_CHANGE
    
final public static  intREPAINT_SELECTION_ON_ACTIVATION_CHANGE
    
final public static  intRIGHTMOST
    
final public static  intSELECTED
    
public static  intSTATE_LAST
    


Method Summary
final public  voidaddAlarmTab(int alarmTab)
    
protected  voidchange(int lastTab, int currTab, int type, int changeType)
     Called when a setter for a tab index has produced a change in a state-affecting property, such as which tab contains the mouse.
final static  StringchangeToString(int change)
    
public  voidclearTransientStates()
     Clear all mouse position related state information.
 voidcontentsChanged(ListDataEvent evt)
    
 int[]getAlarmTabs()
    
abstract public  intgetRepaintPolicy(int tab)
     Get the repaint policy that will be used to determine what tabs to repaint, based on state changes.
public  intgetState(int tab)
     Get the state of a given tab.
 StringgetStateString(int tab)
    
 booleanhasAlarmTabs()
    
 voidindicesAdded(ComplexListDataEvent e)
    
 voidindicesChanged(ComplexListDataEvent e)
    
 voidindicesRemoved(ComplexListDataEvent e)
    
 voidintervalAdded(ListDataEvent evt)
    
 voidintervalRemoved(ListDataEvent evt)
    
protected  voidmaybeRepaint(int tab, int type)
    
protected  voidpossibleChange(boolean prevVal, boolean currVal, int type)
    
protected  voidpossibleChange(int lastTab, int currTab, int type)
    
 voidpruneAlarmTabs(int max)
    
final public  voidremoveAlarmTab(int alarmTab)
    
abstract protected  voidrepaintAllTabs()
    
static  StringrepaintPolicyToString(int policy)
    
abstract protected  voidrepaintTab(int tab)
    
final public  booleansetActive(boolean b)
     Set the condition for all tabs of the component being activated.
final public  intsetCloseButtonContainsMouse(int i)
     Set the index of the tab whose close button contains the mouse cursor.
final public  intsetContainsMouse(int i)
     Set the index of the tab which currently contains the mouse cursor.
final public  booleansetMouseInTabsArea(boolean b)
     Set the condition for all tabs of the mouse being in the tabs area.
final public  intsetMousePressedInCloseButton(int i)
     Set the index of the tab in which the mouse button has been pressed in the close button.
final public  intsetPressed(int i)
     Set the index of the tab over which a mouse button has been pressed.
final public  intsetSelected(int i)
     Set the index of the tab which is currently selected.
final static  StringstateToString(int st)
    
final static  StringtabToString(int tab)
    
public  StringtoString()
    

Field Detail
ACTIVE
final public static int ACTIVE(Code)
Bitmask indicating the tab is activated



AFTER_SELECTED
final public static int AFTER_SELECTED(Code)
Bitmask indicating that the tab's index is that of the selected index plus one



ALL_TABS
final public static int ALL_TABS(Code)
Change type indicating one of the boolean state changes, such as STATE_ACTIVE



ARMED
final public static int ARMED(Code)
Bitmask indicating the tab contains the mouse



ATTENTION
final public static int ATTENTION(Code)
Bitmask indicating that the tab is in "attention" mode - blinking or flashing to get the user's attention.



BEFORE_ARMED
final public static int BEFORE_ARMED(Code)
Bitmask indicating that the tab's index is that of the armed index less one



BEFORE_SELECTED
final public static int BEFORE_SELECTED(Code)
Bitmask indicating that the tab's index is that of the selected index less one



CHANGE_NONE_TO_TAB
final public static int CHANGE_NONE_TO_TAB(Code)
Change type indicating that a state was added that no tab previously had



CHANGE_TAB_TO_NONE
final public static int CHANGE_TAB_TO_NONE(Code)
Change type indicating a change happened (such as the mouse leaving a tab) such that now no tab has the state previously held by the affected tab



CHANGE_TAB_TO_SELF
final public static int CHANGE_TAB_TO_SELF(Code)



CHANGE_TAB_TO_TAB
final public static int CHANGE_TAB_TO_TAB(Code)
Change type indicating a change of state for two tabs



CLIP_LEFT
final public static int CLIP_LEFT(Code)
Bitmask for state of tabs clipped on the right side - that is, partially displayed



CLIP_RIGHT
final public static int CLIP_RIGHT(Code)
Bitmask for state of tabs clipped on the right side - that is, partially displayed



CLOSE_BUTTON_ARMED
final public static int CLOSE_BUTTON_ARMED(Code)
Bitmask indicating that the tab contains the mouse and the mouse is in the close button



LEFTMOST
final public static int LEFTMOST(Code)
Bitmask indicating the tab is at the extreme left and not clipped



MOUSE_IN_TABS_AREA
final public static int MOUSE_IN_TABS_AREA(Code)
Bitmask indicating that the mouse is in the tabs area



MOUSE_PRESSED_IN_CLOSE_BUTTON
final public static int MOUSE_PRESSED_IN_CLOSE_BUTTON(Code)
Bitmask indicating that the mouse is inside the close button and has been pressed.



NOT_ONSCREEN
final public static int NOT_ONSCREEN(Code)
State bitmask indicating a tab is not displayed at all and shouldn't be painted. Implementations may more simply avoid not painting a tab by not including it in the range returned by getFirstVisibleTab()/getLastVisibleTab(). This state exists so that implementations have the option of returning the entire range of tabs as visible and determining if one is truly visble or not in getTabState() - sometimes doing it this way will be less expensive.



NO_CHANGE
final public static int NO_CHANGE(Code)
Change type indicating no change happened (i.e. calling setSelected() with the same value it was previously called with).



PRESSED
final public static int PRESSED(Code)
Bitmask indicating the tab contains the mouse and the mouse button has been pressed



REPAINT_ALL_ON_MOUSE_ENTER_TABS_AREA
final public static int REPAINT_ALL_ON_MOUSE_ENTER_TABS_AREA(Code)
Repaint policy bitmask indicating that all tabs should be repainted whenever the mouse enters or leaves the area in which tabs are painted



REPAINT_ALL_TABS_ON_ACTIVATION_CHANGE
final public static int REPAINT_ALL_TABS_ON_ACTIVATION_CHANGE(Code)
Repaint policy bitmask indicating that all tabs should be repainted when the activated state changes



REPAINT_ALL_TABS_ON_SELECTION_CHANGE
final public static int REPAINT_ALL_TABS_ON_SELECTION_CHANGE(Code)
Repaint policy bitmask indicating that all tabs should be repainted whenever the selection changes



REPAINT_ON_CLOSE_BUTTON_PRESSED
final public static int REPAINT_ON_CLOSE_BUTTON_PRESSED(Code)
Repaint policy bitmask indicating that the tab should be repainted when the close button is pressed



REPAINT_ON_MOUSE_ENTER_CLOSE_BUTTON
final public static int REPAINT_ON_MOUSE_ENTER_CLOSE_BUTTON(Code)
Repaint policy bitmask indicating that the tab should be repainted when the mouse enters or exits the close button region



REPAINT_ON_MOUSE_ENTER_TAB
final public static int REPAINT_ON_MOUSE_ENTER_TAB(Code)
Repaint policy bitmask indicating that a tab should be repainted whenever the mouse enters or exits it



REPAINT_ON_MOUSE_PRESSED
final public static int REPAINT_ON_MOUSE_PRESSED(Code)
Repaint policy bitmask indicating that the tab should be repainted on mouse pressed events



REPAINT_ON_SELECTION_CHANGE
final public static int REPAINT_ON_SELECTION_CHANGE(Code)
Repaint policy bitmask indicating that a tab should be repainted when it becomes selected/unselected



REPAINT_SELECTION_ON_ACTIVATION_CHANGE
final public static int REPAINT_SELECTION_ON_ACTIVATION_CHANGE(Code)
Repaint policy bitmask indicating that the selected tab should be repainted when the activated state changes



RIGHTMOST
final public static int RIGHTMOST(Code)
Bitmask indicating the tab is at the extreme right and not clipped



SELECTED
final public static int SELECTED(Code)
Bitmask indicating the tab is selected



STATE_LAST
public static int STATE_LAST(Code)
Indicates the last constant defined - renderers that wish to add their own bitmasks should use multiples of this number





Method Detail
addAlarmTab
final public void addAlarmTab(int alarmTab)(Code)
Add a tab to the list of those which should "flash" or otherwise give some notification to the user to get their attention



change
protected void change(int lastTab, int currTab, int type, int changeType)(Code)
Called when a setter for a tab index has produced a change in a state-affecting property, such as which tab contains the mouse. Fetches the repaint policies, and if the change is one that the policy says should produce a repaint, calls repaintTab for the appropriate tabs.
Parameters:
  lastTab - The tab previously holding the state which has changed,or -1
Parameters:
  currTab - The tab currently holding the state which has changed,or -1
Parameters:
  type - The thing that changed. This will be one of the stateconstants.
Parameters:
  changeType - This is one of the defined change types such asALL_TABS, TAB_TO_TAB, etc.



changeToString
final static String changeToString(int change)(Code)



clearTransientStates
public void clearTransientStates()(Code)
Clear all mouse position related state information. This should be done following events in the model that alter the state sufficiently that the cached information is probably wrong.



contentsChanged
void contentsChanged(ListDataEvent evt)(Code)



getAlarmTabs
int[] getAlarmTabs()(Code)



getRepaintPolicy
abstract public int getRepaintPolicy(int tab)(Code)
Get the repaint policy that will be used to determine what tabs to repaint, based on state changes. The default implementation in BasicTabDisplayerUI simply ignores the tab argument and returns a single policy for all tabs created in BasicTabDisplayerUI.createRepaintPolicy()
Parameters:
  tab - Index of tab in question Type of repaint policy for given tab



getState
public int getState(int tab)(Code)
Get the state of a given tab. Subclasses are expected to override this to provide information about states such as clipping which can only be found out via layout information, such as LEFTMOST, RIGHTMOST, CLIP_LEFT and CLIP_RIGHT. The state is used by tab renderers to determine how they should paint themselves.
Parameters:
  tab - The index of the tab The state



getStateString
String getStateString(int tab)(Code)
For debugging, enables fetching tab state as a string



hasAlarmTabs
boolean hasAlarmTabs()(Code)



indicesAdded
void indicesAdded(ComplexListDataEvent e)(Code)



indicesChanged
void indicesChanged(ComplexListDataEvent e)(Code)



indicesRemoved
void indicesRemoved(ComplexListDataEvent e)(Code)



intervalAdded
void intervalAdded(ListDataEvent evt)(Code)



intervalRemoved
void intervalRemoved(ListDataEvent evt)(Code)



maybeRepaint
protected void maybeRepaint(int tab, int type)(Code)



possibleChange
protected void possibleChange(boolean prevVal, boolean currVal, int type)(Code)



possibleChange
protected void possibleChange(int lastTab, int currTab, int type)(Code)



pruneAlarmTabs
void pruneAlarmTabs(int max)(Code)



removeAlarmTab
final public void removeAlarmTab(int alarmTab)(Code)
Remove a tab to the list of those which should "flash" or otherwise give some notification to the user to get their attention



repaintAllTabs
abstract protected void repaintAllTabs()(Code)



repaintPolicyToString
static String repaintPolicyToString(int policy)(Code)



repaintTab
abstract protected void repaintTab(int tab)(Code)



setActive
final public boolean setActive(boolean b)(Code)
Set the condition for all tabs of the component being activated.
Parameters:
  b - Whether or not the component is activated The previous state with regard to the component being activated



setCloseButtonContainsMouse
final public int setCloseButtonContainsMouse(int i)(Code)
Set the index of the tab whose close button contains the mouse cursor.
Parameters:
  i - The index of the tab whose close button contains the mousecursor, or -1 to clear CLOSE_BUTTON_CONTAINS_MOUSE from thestate of the tab which previously had it Index of the tab which formerly had the stateCLOSE_BUTTON_CONTAINS_MOUSE, or -1



setContainsMouse
final public int setContainsMouse(int i)(Code)
Set the index of the tab which currently contains the mouse cursor.
Parameters:
  i - The tab which contains the mouse cursor, or -1 to clear ARMEDfrom the state of the tab Index of the tab which previously had the state ARMED, or -1



setMouseInTabsArea
final public boolean setMouseInTabsArea(boolean b)(Code)
Set the condition for all tabs of the mouse being in the tabs area.
Parameters:
  b - Whether the mouse is in the tabs area or not The previous state with regard to the mouse being in the tabsarea



setMousePressedInCloseButton
final public int setMousePressedInCloseButton(int i)(Code)
Set the index of the tab in which the mouse button has been pressed in the close button. This is distinct from the combination of CLOSE_BUTTON_ARMED and PRESSED, since the user may press the close button and then drag away from the close button (clearing the CLOSE_BUTTON_ARMED state) to abort closing a tab.
Parameters:
  i - The tab in which the mouse was pressed while over the closebutton Index of the tab which previously had the stateMOUSE_PRESSED_IN_CLOSE_BUTTON, or -1



setPressed
final public int setPressed(int i)(Code)
Set the index of the tab over which a mouse button has been pressed.
Parameters:
  i - The tab which is pressed, or -1 to clear PRESSED from the stateof the previously pressed tab Index of the tab which previously had the state PRESSED, or -1



setSelected
final public int setSelected(int i)(Code)
Set the index of the tab which is currently selected. Note that users of this class must ensure that this value stays up to date when changes occur in the model such as inserting tabs before the selected one.
Parameters:
  i - The tab index which is selected Index of the tab which previously was selected, or -1 if none



stateToString
final static String stateToString(int st)(Code)
Static utility method to get a string representation of a state



tabToString
final static String tabToString(int tab)(Code)



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(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.