es.prodevelop.gvsig.mobile.gui.tool
Class TBSwitcherButton

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byes.prodevelop.gvsig.mobile.gui.tool.GenericButton
              extended byes.prodevelop.gvsig.mobile.gui.tool.TBWidget
                  extended byes.prodevelop.gvsig.mobile.gui.tool.TBButton
                      extended byes.prodevelop.gvsig.mobile.gui.tool.TBSwitcherButton
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class TBSwitcherButton
extends TBButton

This button have 2 states, activated or deactivaded changing with turnOn() and turnOff() This state is not affected by other buttons in toolbar

Author:
jcarrasco
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TBSwitcherButton(IToolContainer _owner, java.awt.Image _icon, java.awt.Image _selectedIcon, java.lang.String _helpText, java.awt.event.MouseListener _mouseListener)
          Creates an instance of a TBSelecteable button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g.
TBSwitcherButton(IToolContainer _owner, java.lang.String _icon, java.lang.String _selectedIcon, java.lang.String _helpText, Behavior _behavior, java.awt.event.MouseListener _mouseListener)
          Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g.
TBSwitcherButton(IToolContainer _owner, java.lang.String _icon, java.lang.String _selectedIcon, java.lang.String _helpText, Behavior _behavior, java.awt.event.MouseListener _mouseListener, int _index)
          Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g.
TBSwitcherButton(IToolContainer _owner, java.lang.String _icon, java.lang.String _selectedIcon, java.lang.String _helpText, java.awt.event.MouseListener _mouseListener)
          Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g.
TBSwitcherButton(java.lang.String _icon, java.lang.String _selectedIcon, java.lang.String _helpText, Behavior _behavior, java.awt.event.MouseListener _mouseListener)
          Creates an instance of a TBSelecteable button by calling to the superclass constructor given the icons and the listener of the events for this new instance
 
Method Summary
 Behavior getBehavior()
          Get the Behavior object that handles TBSwitcherButton
 boolean isOn()
          Returns true if switcher is Activated false if switcher is deactivated
 void paint(java.awt.Graphics g)
          Forces the paint of the object.
 void reverse()
          Sets switcher On if it is Off and Off if it is On
 void switchButton()
          Changes the selected/unselected state of the button.
 void turnOff()
          Sets switcher Off
 void turnOn()
          Sets switcher On
 
Methods inherited from class es.prodevelop.gvsig.mobile.gui.tool.TBButton
buttonClone, equals, getHeight, getHelpText, getStatusBarId, getWidth, setHeight, setStatusBarId, setWidth
 
Methods inherited from class es.prodevelop.gvsig.mobile.gui.tool.TBWidget
getOwner, setOwner
 
Methods inherited from class es.prodevelop.gvsig.mobile.gui.tool.GenericButton
isSelected, setSelected
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TBSwitcherButton

public TBSwitcherButton(IToolContainer _owner,
                        java.lang.String _icon,
                        java.lang.String _selectedIcon,
                        java.lang.String _helpText,
                        Behavior _behavior,
                        java.awt.event.MouseListener _mouseListener)
Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g. ToolBar), the icons, the behavior and the listener of the events for this new instance

Parameters:
_owner - Parent of the TBSwitcherButton (IToolContainer compliant, e.g. a ToolBar) where the button is to be added
_icon - Name of the image to be loaded as normal image
_selectedIcon - Name of the image to be loaded as selected image. Used when the button is selected
_helpText - String with a short help description of the button. it shouldn't be longer than 2 words.
_behavior - Behavior of the action to listen
_mouseListener - Listener of Mouse Events, which must be a MouseListener

TBSwitcherButton

public TBSwitcherButton(IToolContainer _owner,
                        java.lang.String _icon,
                        java.lang.String _selectedIcon,
                        java.lang.String _helpText,
                        Behavior _behavior,
                        java.awt.event.MouseListener _mouseListener,
                        int _index)
Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g. ToolBar), the icons, the listener of the events for this new instance and the position of the new button in the ToolBar

Parameters:
_owner - Parent of the TBSwitcherButton (IToolContainer compliant, e.g. a ToolBar) where the button is to be added
_icon - Name of the image to be loaded as normal image
_selectedIcon - Name of the image to be loaded as selected image. Used when the button is selected
_helpText - String with a short help description of the button. it shouldn't be longer than 2 words.
_behavior - Behavior of the action to listen
_mouseListener - Listener of Mouse Events, which must be a MousListener
_index - Position of the new button in the ToolBar. It must be an int between 0 and the actual size of the array.

TBSwitcherButton

public TBSwitcherButton(IToolContainer _owner,
                        java.awt.Image _icon,
                        java.awt.Image _selectedIcon,
                        java.lang.String _helpText,
                        java.awt.event.MouseListener _mouseListener)
Creates an instance of a TBSelecteable button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g. ToolBar, TBMenu,...),the icons and the listener of the events for this new instance

Parameters:
_owner - Parent of the TBSelecteable (IToolContainer compliant, e.g. a ToolBar) where the button is to be added
_icon - Name of the image to be loaded as normal image
_selectedIcon - Name of the image to be loaded as selected image. Used when the button is selected
_helpText - String with a short help description of the button. it shouldn't be longer than 2 words.
_mouseListener - Listener of Mouse Events, which must be a MousListener

TBSwitcherButton

public TBSwitcherButton(IToolContainer _owner,
                        java.lang.String _icon,
                        java.lang.String _selectedIcon,
                        java.lang.String _helpText,
                        java.awt.event.MouseListener _mouseListener)
Creates an instance of a TBSwitcherButton button by calling to the superclass constructor given the owner where it should be placed (which must accomplish a IToolContainer interface,e.g. ToolBar), the icons and the listener of the events for this new instance

Parameters:
_owner - Parent of the TBSwitcherButton (IToolContainer compliant, e.g. a ToolBar) where the button is to be added
_icon - Name of the image to be loaded as normal image
_selectedIcon - Name of the image to be loaded as selected image. Used when the button is selected
_helpText - String with a short help description of the button. it shouldn't be longer than 2 words.
_mouseListener - Listener of Mouse Events, which must be a MousListener

TBSwitcherButton

public TBSwitcherButton(java.lang.String _icon,
                        java.lang.String _selectedIcon,
                        java.lang.String _helpText,
                        Behavior _behavior,
                        java.awt.event.MouseListener _mouseListener)
Creates an instance of a TBSelecteable button by calling to the superclass constructor given the icons and the listener of the events for this new instance

Parameters:
_icon - Name of the image to be loaded as normal image
_selectedIcon - Name of the image to be loaded as selected image. Used when the button is selected
_helpText - String with a short help description of the button. it shouldn't be longer than 2 words.
_behavior - Behavior of the action to listen
_mouseListener - Listener of Mouse Events, which must be a MouseListener
Method Detail

turnOn

public void turnOn()
Sets switcher On


turnOff

public void turnOff()
Sets switcher Off


isOn

public boolean isOn()
Returns true if switcher is Activated false if switcher is deactivated


reverse

public void reverse()
Sets switcher On if it is Off and Off if it is On


switchButton

public void switchButton()
Changes the selected/unselected state of the button. If it's selected, the new status will be selected and vice versa


getBehavior

public Behavior getBehavior()
Get the Behavior object that handles TBSwitcherButton

Returns:
Behavior of the object

paint

public void paint(java.awt.Graphics g)
Forces the paint of the object. This method should be called when the content of the TBSwitcherButton needs to be painted. This method overrides the paint method of the TBWidget superclass parent by painting a different image if the selected is set to true or not

Overrides:
paint in class GenericButton