org.pushingpixels.substance.internal.ui
Class SubstanceToggleButtonUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ButtonUI
          extended by javax.swing.plaf.basic.BasicButtonUI
              extended by javax.swing.plaf.basic.BasicToggleButtonUI
                  extended by org.pushingpixels.substance.internal.ui.SubstanceToggleButtonUI
All Implemented Interfaces:
TransitionAwareUI

public class SubstanceToggleButtonUI
extends javax.swing.plaf.basic.BasicToggleButtonUI
implements TransitionAwareUI

UI for toggle buttons in Substance look and feel.


Field Summary
protected  GlowingIcon glowingIcon
          The matching glowing icon.
protected  java.beans.PropertyChangeListener substancePropertyListener
          Property change listener.
protected  ButtonVisualStateTracker substanceVisualStateTracker
          Tracker for visual state transitions.
protected  javax.swing.JToggleButton toggleButton
           
 
Fields inherited from class javax.swing.plaf.basic.BasicButtonUI
defaultTextIconGap, defaultTextShiftOffset
 
Constructor Summary
SubstanceToggleButtonUI(javax.swing.JToggleButton toggleButton)
          Simple constructor.
 
Method Summary
 boolean contains(javax.swing.JComponent c, int x, int y)
           
protected  javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
           
static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)
           
 java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
           
 StateTransitionTracker getTransitionTracker()
          Returns the model for tracking the transitions.
 void installDefaults(javax.swing.AbstractButton b)
           
protected  void installListeners(javax.swing.AbstractButton b)
           
 boolean isInside(java.awt.event.MouseEvent me)
          Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.
 void paint(java.awt.Graphics g, javax.swing.JComponent c)
           
protected  void paintButtonText(java.awt.Graphics g, javax.swing.AbstractButton button, java.awt.Rectangle textRect, java.lang.String text)
          Paints the text.
protected  void paintIcon(java.awt.Graphics g, javax.swing.AbstractButton b, java.awt.Rectangle iconRect)
           
protected  void trackGlowingIcon()
          Tracks possible usage of glowing icon.
 void uninstallDefaults(javax.swing.AbstractButton b)
           
protected  void uninstallListeners(javax.swing.AbstractButton b)
           
 void update(java.awt.Graphics g, javax.swing.JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicToggleButtonUI
getPropertyPrefix, getTextShiftOffset
 
Methods inherited from class javax.swing.plaf.basic.BasicButtonUI
clearTextShiftOffset, getBaseline, getBaselineResizeBehavior, getDefaultTextIconGap, getMaximumSize, getMinimumSize, installKeyboardActions, installUI, paintButtonPressed, paintFocus, paintIcon, paintText, paintText, setTextShiftOffset, uninstallKeyboardActions, uninstallUI
 
Methods inherited from class javax.swing.plaf.ComponentUI
getAccessibleChild, getAccessibleChildrenCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

glowingIcon

protected GlowingIcon glowingIcon
The matching glowing icon. Is used only when AnimationConfigurationManager.isAnimationAllowed(AnimationFacet, Component) returns true on AnimationFacet.ICON_GLOW.


substancePropertyListener

protected java.beans.PropertyChangeListener substancePropertyListener
Property change listener. Listens on changes to the SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY property and AbstractButton.MODEL_CHANGED_PROPERTY property.


substanceVisualStateTracker

protected ButtonVisualStateTracker substanceVisualStateTracker
Tracker for visual state transitions.


toggleButton

protected javax.swing.JToggleButton toggleButton
Constructor Detail

SubstanceToggleButtonUI

public SubstanceToggleButtonUI(javax.swing.JToggleButton toggleButton)
Simple constructor.

Method Detail

createUI

public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent comp)

installDefaults

public void installDefaults(javax.swing.AbstractButton b)
Overrides:
installDefaults in class javax.swing.plaf.basic.BasicButtonUI

uninstallDefaults

public void uninstallDefaults(javax.swing.AbstractButton b)
Overrides:
uninstallDefaults in class javax.swing.plaf.basic.BasicButtonUI

createButtonListener

protected javax.swing.plaf.basic.BasicButtonListener createButtonListener(javax.swing.AbstractButton b)
Overrides:
createButtonListener in class javax.swing.plaf.basic.BasicButtonUI

installListeners

protected void installListeners(javax.swing.AbstractButton b)
Overrides:
installListeners in class javax.swing.plaf.basic.BasicButtonUI

uninstallListeners

protected void uninstallListeners(javax.swing.AbstractButton b)
Overrides:
uninstallListeners in class javax.swing.plaf.basic.BasicButtonUI

paint

public void paint(java.awt.Graphics g,
                  javax.swing.JComponent c)
Overrides:
paint in class javax.swing.plaf.basic.BasicToggleButtonUI

getPreferredSize

public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
Overrides:
getPreferredSize in class javax.swing.plaf.basic.BasicButtonUI

contains

public boolean contains(javax.swing.JComponent c,
                        int x,
                        int y)
Overrides:
contains in class javax.swing.plaf.ComponentUI

paintIcon

protected void paintIcon(java.awt.Graphics g,
                         javax.swing.AbstractButton b,
                         java.awt.Rectangle iconRect)
Overrides:
paintIcon in class javax.swing.plaf.basic.BasicToggleButtonUI

paintButtonText

protected void paintButtonText(java.awt.Graphics g,
                               javax.swing.AbstractButton button,
                               java.awt.Rectangle textRect,
                               java.lang.String text)
Paints the text.

Parameters:
g - Graphic context
button - Button
textRect - Text rectangle
text - Text to paint

trackGlowingIcon

protected void trackGlowingIcon()
Tracks possible usage of glowing icon.


update

public void update(java.awt.Graphics g,
                   javax.swing.JComponent c)
Overrides:
update in class javax.swing.plaf.ComponentUI

isInside

public boolean isInside(java.awt.event.MouseEvent me)
Description copied from interface: TransitionAwareUI
Checks whether the mouse position of the specified event lies inside the area of the component designated for transition effects.

Specified by:
isInside in interface TransitionAwareUI
Parameters:
me - Mouse event.
Returns:
true if the mouse position of the specified event lies inside the area of the component designated for transition effects, false otherwise.

getTransitionTracker

public StateTransitionTracker getTransitionTracker()
Description copied from interface: TransitionAwareUI
Returns the model for tracking the transitions.

Specified by:
getTransitionTracker in interface TransitionAwareUI
Returns:
Model for tracking the transitions.