de.lessvoid.nifty.controls
Class AbstractController

java.lang.Object
  extended by de.lessvoid.nifty.controls.AbstractController
All Implemented Interfaces:
Controller, NiftyControl
Direct Known Subclasses:
MenuItemControl

public abstract class AbstractController
extends Object
implements Controller, NiftyControl


Constructor Summary
AbstractController()
           
 
Method Summary
protected  void bind(Element element)
           
 void disable()
          Disable the control.
 void enable()
          Enable the control.
 Element getElement()
          Get the attached internal Nifty element for this Nifty control.
 int getHeight()
          Get height as SizeValue.
 String getId()
          Get the id.
 String getStyle()
          Get current style.
 int getWidth()
          Get width as SizeValue.
 boolean hasFocus()
          Returns true if this control has the focus.
 void init(Properties parameter, Attributes controlDefinitionAttributes)
          Init the Controller.
 boolean isBound()
          Returns true when this NiftyControl is already bound (e.g. its Controllers bind() method has been called).
 boolean isEnabled()
          Get the current enabled state of the control.
 void layoutCallback()
          This method is called after the element this control is attached too has been layouted.
 void onFocus(boolean getFocus)
          This controller gets the focus.
 void setEnabled(boolean enabled)
          Set the enabled state from the given boolean.
 void setFocus()
          Set the focus to this control.
 void setFocusable(boolean focusable)
          Change if this control is focusable (if it can get the focus or not).
 void setHeight(SizeValue height)
          Set Height as SizeValue.
 void setId(String id)
          Set the id.
 void setStyle(String style)
          Set style.
 void setWidth(SizeValue width)
          Set width as SizeValue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lessvoid.nifty.controls.Controller
bind, inputEvent, onStartScreen
 

Constructor Detail

AbstractController

public AbstractController()
Method Detail

bind

protected void bind(Element element)

init

public void init(Properties parameter,
                 Attributes controlDefinitionAttributes)
Description copied from interface: Controller
Init the Controller. You can assume that bind() has been called for all other controls on the screen.

Specified by:
init in interface Controller

getElement

public Element getElement()
Description copied from interface: NiftyControl
Get the attached internal Nifty element for this Nifty control.

Specified by:
getElement in interface NiftyControl
Returns:
the element

enable

public void enable()
Description copied from interface: NiftyControl
Enable the control.

Specified by:
enable in interface NiftyControl

disable

public void disable()
Description copied from interface: NiftyControl
Disable the control.

Specified by:
disable in interface NiftyControl

setEnabled

public void setEnabled(boolean enabled)
Description copied from interface: NiftyControl
Set the enabled state from the given boolean.

Specified by:
setEnabled in interface NiftyControl
Parameters:
enabled - the new enabled state

isEnabled

public boolean isEnabled()
Description copied from interface: NiftyControl
Get the current enabled state of the control.

Specified by:
isEnabled in interface NiftyControl
Returns:

getId

public String getId()
Description copied from interface: NiftyControl
Get the id.

Specified by:
getId in interface NiftyControl
Returns:
id

setId

public void setId(String id)
Description copied from interface: NiftyControl
Set the id.

Specified by:
setId in interface NiftyControl
Parameters:
id - new id

getWidth

public int getWidth()
Description copied from interface: NiftyControl
Get width as SizeValue.

Specified by:
getWidth in interface NiftyControl
Returns:
width

setWidth

public void setWidth(SizeValue width)
Description copied from interface: NiftyControl
Set width as SizeValue.

Specified by:
setWidth in interface NiftyControl
Parameters:
width - width

getHeight

public int getHeight()
Description copied from interface: NiftyControl
Get height as SizeValue.

Specified by:
getHeight in interface NiftyControl
Returns:
height

setHeight

public void setHeight(SizeValue height)
Description copied from interface: NiftyControl
Set Height as SizeValue.

Specified by:
setHeight in interface NiftyControl
Parameters:
height - new height

getStyle

public String getStyle()
Description copied from interface: NiftyControl
Get current style.

Specified by:
getStyle in interface NiftyControl
Returns:
current style

setStyle

public void setStyle(String style)
Description copied from interface: NiftyControl
Set style. Please note that currently not all style attributes are processed.

Specified by:
setStyle in interface NiftyControl
Parameters:
style - new style to apply

setFocus

public void setFocus()
Description copied from interface: NiftyControl
Set the focus to this control.

Specified by:
setFocus in interface NiftyControl

setFocusable

public void setFocusable(boolean focusable)
Description copied from interface: NiftyControl
Change if this control is focusable (if it can get the focus or not). Usually controls are set up with focusable="true" but you can change this here if necessary.

Specified by:
setFocusable in interface NiftyControl
Parameters:
focusable - true when this element can get the focus and false when not

onFocus

public void onFocus(boolean getFocus)
Description copied from interface: Controller
This controller gets the focus.

Specified by:
onFocus in interface Controller
Parameters:
getFocus - get focus (true) or loose focus (false)

hasFocus

public boolean hasFocus()
Description copied from interface: NiftyControl
Returns true if this control has the focus.

Specified by:
hasFocus in interface NiftyControl
Returns:
true, when the control has the focus and false if not

layoutCallback

public void layoutCallback()
Description copied from interface: NiftyControl
This method is called after the element this control is attached too has been layouted. This callback allows the control to update any layout related things if necessary.

Specified by:
layoutCallback in interface NiftyControl

isBound

public boolean isBound()
Description copied from interface: NiftyControl
Returns true when this NiftyControl is already bound (e.g. its Controllers bind() method has been called).

Specified by:
isBound in interface NiftyControl
Returns:
true if bound and false if not


Copyright © 2012. All Rights Reserved.