org.formaria.svg
Class SvgButtonStateHelper

java.lang.Object
  extended by org.formaria.svg.SvgStateHelper
      extended by org.formaria.svg.SvgButtonStateHelper

public class SvgButtonStateHelper
extends SvgStateHelper

A helper for an AbstractButton's state. The helper controls a number of layers, including 'mask', 'rollover' and 'pressed'. The mask layer or group element contains a shape that is used to define the client area of the component. The 'rollover' layer includes graphical elements that are shown when the mouse is over the component

Copyright (c) Formaria 2008, see license.txt for more details


Field Summary
protected  SvgElementState[][] states
           
 
Fields inherited from class org.formaria.svg.SvgStateHelper
component, containsMouse, defaultIds, ids, mask, MASK_ID, NUM_IDS, PRESSED_ID, ROLLOVER_ID
 
Constructor Summary
SvgButtonStateHelper()
          Creates a new instance of SvgButtonStateHelper
 
Method Summary
 SvgElementState[][] getStates(SVGDiagram diagram)
          Get the managed states in the svg diagram.
 void setComponent(javax.swing.JComponent comp)
          Set the component instance
 boolean updateState(int itemId)
          Update the svg state to be consistent with the button's state
 
Methods inherited from class org.formaria.svg.SvgStateHelper
contains, getSelectedId, setElementIds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

states

protected SvgElementState[][] states
Constructor Detail

SvgButtonStateHelper

public SvgButtonStateHelper()
Creates a new instance of SvgButtonStateHelper

Method Detail

setComponent

public void setComponent(javax.swing.JComponent comp)
Set the component instance

Overrides:
setComponent in class SvgStateHelper
Parameters:
comp - the component instacne

getStates

public SvgElementState[][] getStates(SVGDiagram diagram)
Get the managed states in the svg diagram. In the case of this button helper the managed states are 'pressed' and 'rollover'.

Overrides:
getStates in class SvgStateHelper
Parameters:
diagram - the svg diagram
Returns:
an array of state objects

updateState

public boolean updateState(int itemId)
Update the svg state to be consistent with the button's state

Overrides:
updateState in class SvgStateHelper
Parameters:
itemId - the item index or -1 to update all items
Returns:
true if the state has changed