jcontrol.ui.wombat
Class AbstractFocusComponent

java.lang.Object
  extended by jcontrol.ui.wombat.Component
      extended by jcontrol.ui.wombat.AbstractFocusComponent
All Implemented Interfaces:
java.util.EventListener, ActionProducer, KeyListener, TouchListener, IFocusable
Direct Known Subclasses:
AbstractScrolledComponent, Button, CheckBox, KeyPad, Menu, NumberChooser, RadioButton, RockerSwitch, Slider, TextInputField, ToggleSwitch, TypeWriter

public abstract class AbstractFocusComponent
extends Component
implements IFocusable, TouchListener, ActionProducer

Abstract superclass for components that can be controlled by the keyboard.

(C) DOMOLOGIC Home Automation GmbH 2005

Author:
Marcus Timmermann

Field Summary
 
Fields inherited from class jcontrol.ui.wombat.Component
backgroundColor, COLOR_COMPONENT_BACKGROUND, COLOR_COMPONENT_BACKGROUND_HIGHLIGHTED, COLOR_COMPONENT_DARK_SHADOW, COLOR_COMPONENT_FOREGROUND, COLOR_COMPONENT_FOREGROUND_INACTIVE, COLOR_COMPONENT_HIGHLIGHT_SHADOW, COLOR_COMPONENT_LIGHT_SHADOW, COLOR_COMPONENT_LIST_BACKGROUND, COLOR_COMPONENT_NORMAL_SHADOW, COLOR_COMPONENT_SELECTION_TEXT, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND, COLOR_COMPONENT_SELECTION_TEXT_BACKGROUND_INACTIVE, COLOR_COMPONENT_SELECTION_TEXT_INACTIVE, foregroundColor, frame, height, parent, state, transparentColor, width, x, y
 
Fields inherited from interface jcontrol.ui.wombat.IFocusable
TRANSFER_FOCUS_BACKWARD, TRANSFER_FOCUS_FORWARD
 
Fields inherited from interface jcontrol.ui.wombat.event.TouchListener
RESULT_ACCEPTED, RESULT_EXECUTED, RESULT_NONE
 
Constructor Summary
AbstractFocusComponent()
           
 
Method Summary
 ActionListener getActionListener()
          Returns the ActionListener of this Component.
abstract  KeyEvent onKeyEvent(KeyEvent event)
          This method is called when a keyboard action has been performed.
abstract  int onTouchEvent(TouchEvent event)
          Every time a touch event is fired, this method will be called.
 boolean requestFocus()
          Sets the focus to this Component.
 void setActionListener(ActionListener listener)
          Add an ActionListener to the component.
 void setEnabled(boolean enabled)
          Sets the enabled state of this component.
 void setVisible(boolean visible)
          Turns the component visible or invisible.
 
Methods inherited from class jcontrol.ui.wombat.Component
getFrame, isEnabled, isVisible, paint, repaint, repaintAll, safeExec, setBackgroundColor, setBounds, setDirty, setFont, setForegroundColor, setRedraw, setTransparentColor, unsafeExec, update
 
Methods inherited from class java.lang.Object
equals, getClass, notifyAll, toString, wait
 

Constructor Detail

AbstractFocusComponent

public AbstractFocusComponent()
Method Detail

getActionListener

public ActionListener getActionListener()
Returns the ActionListener of this Component.

Specified by:
getActionListener in interface ActionProducer
Returns:
the ActionListener of this Component.

onKeyEvent

public abstract KeyEvent onKeyEvent(KeyEvent event)
This method is called when a keyboard action has been performed.

Specified by:
onKeyEvent in interface KeyListener
Parameters:
event - the event that contains information about the key.
Returns:
null if the KeyEvent has been consumed by the KeyListener,
or the the specified KeyEvent if it should be passed on to the next KeyListener.

onTouchEvent

public abstract int onTouchEvent(TouchEvent event)
Description copied from interface: TouchListener
Every time a touch event is fired, this method will be called.

Specified by:
onTouchEvent in interface TouchListener
Parameters:
event - The touch event.
Returns:
RESULT_ACCEPTED if the TouchEvent has been consumed by the TouchListener,
RESULT_EXECUTED if the TouchEvent has been consumed by the TouchListener and some important action has been performed, e.g. an action event has been invoked,
RESULT_NONE if the TouchEvent should be passed on to the next TouchListener.

requestFocus

public boolean requestFocus()
Sets the focus to this Component.

Specified by:
requestFocus in interface IFocusable
Returns:
true if the component has got the focus.

setActionListener

public void setActionListener(ActionListener listener)
Add an ActionListener to the component. It will receive ActionEvents when the component is selected.

Specified by:
setActionListener in interface ActionProducer
Parameters:
listener - an ActionListener

setEnabled

public void setEnabled(boolean enabled)
Sets the enabled state of this component. Disabled components are no longer able to receive user (keyboard or touch) input. Some components get a "grayed" look in disabled state.

Overrides:
setEnabled in class Component
Parameters:
enabled - the enabled state.

setVisible

public void setVisible(boolean visible)
Turns the component visible or invisible.

Overrides:
setVisible in class Component
Parameters:
visible - the visible state to set.