com.birosoft.liquid.skin
Class SkinToggleButtonIndexModel

java.lang.Object
  extended by com.birosoft.liquid.skin.SkinToggleButtonIndexModel

public class SkinToggleButtonIndexModel
extends java.lang.Object

A Simple Index Model for a button. Use it to calculate which of the subimages of a skin should be used for rendering. The order of evaluation of the states is: 1 Test if button is selected 1.1 Test if button is disabled 1.2. Test if button is pressed 1.3. Test if button is in rollover state 1.4. Button must be in normal state then. 2. If not selected 2.1 Test if button is disabled 2.2. Test if button is pressed 2.3. Test if button is in rollover state 2.4. If checkForDefaultButton is true there check whether it's the default button. If it's not or checkForDefaultButton is false return the normal state. The first test that evaluates to true determines the index of the skin to be used. If the component is not a subclass of AbstractButton one can explicitly pass the relevant states to getIndexForState but use the same logic.


Constructor Summary
SkinToggleButtonIndexModel()
          Creates a SkinIndexModel for the button with the indices normal=0, rollover=1, pushed=2 and disabled=3, selected=4, selectedRollover=5, selectedPressed=6, selectedDisabled=7; There's no check concering the default button
SkinToggleButtonIndexModel(boolean checkForDefaultButton)
          Creates a SkinIndexModel for the button with the indices normal=0, rollover=1, pushed=2 and disabled=3, selected=4, selectedRollover=5, selectedPressed=6, selectedDisabled=7;
SkinToggleButtonIndexModel(int normal, int rollover, int pressed, int disabled, int selected, int selectedRollover, int selectedPressed, int selectedDisabled)
          Creates a SkinIndexModel for the button with the states normal, rollover, pushed and disabled
 
Method Summary
 javax.swing.AbstractButton getButton()
          Returns the button.
 int getIndexForState()
           
 int getIndexForState(boolean isSelected, boolean isEnabled, boolean isPressed, boolean isRollover)
          This methode can be used for Non-AbstractButtons.
 boolean isCheckForDefaultButton()
          Returns the checkForDefaultButton.
 void setButton(javax.swing.AbstractButton button)
          Sets the button.
 void setCheckForDefaultButton(boolean hasToggleButton)
          Sets the checkForDefaultButton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkinToggleButtonIndexModel

public SkinToggleButtonIndexModel()
Creates a SkinIndexModel for the button with the indices normal=0, rollover=1, pushed=2 and disabled=3, selected=4, selectedRollover=5, selectedPressed=6, selectedDisabled=7; There's no check concering the default button


SkinToggleButtonIndexModel

public SkinToggleButtonIndexModel(boolean checkForDefaultButton)
Creates a SkinIndexModel for the button with the indices normal=0, rollover=1, pushed=2 and disabled=3, selected=4, selectedRollover=5, selectedPressed=6, selectedDisabled=7;

Parameters:
checkForDefaultButton - if true the button is checked whether it's the default button. The component used for the index model must be a JButton.

SkinToggleButtonIndexModel

public SkinToggleButtonIndexModel(int normal,
                                  int rollover,
                                  int pressed,
                                  int disabled,
                                  int selected,
                                  int selectedRollover,
                                  int selectedPressed,
                                  int selectedDisabled)
Creates a SkinIndexModel for the button with the states normal, rollover, pushed and disabled

Parameters:
button -
Method Detail

getIndexForState

public int getIndexForState()
See Also:
com.stefankrause.xplookandfeel.skin.SkinOffsetModel#getIndexForState()

getIndexForState

public int getIndexForState(boolean isSelected,
                            boolean isEnabled,
                            boolean isPressed,
                            boolean isRollover)
This methode can be used for Non-AbstractButtons. The states are passed directly, but the logic to decide which index to use remains the same.

Parameters:
isSelected -
isEnabled -
isPressed -
isRollover -
Returns:
int

getButton

public javax.swing.AbstractButton getButton()
Returns the button.

Returns:
AbstractButton

setButton

public void setButton(javax.swing.AbstractButton button)
Sets the button.

Parameters:
button - The button to set

isCheckForDefaultButton

public boolean isCheckForDefaultButton()
Returns the checkForDefaultButton.

Returns:
boolean

setCheckForDefaultButton

public void setCheckForDefaultButton(boolean hasToggleButton)
Sets the checkForDefaultButton.

Parameters:
checkForDefaultButton - The checkForDefaultButton to set