Class Shell


  extended by Object
      extended by Component
          extended by Shell
Direct Known Subclasses:
Popup

public class Shell
extends Component

Shell is a root of single user interface screen. Shells are placed on stack which manipulated by pushShell(Shell) and pushShell(Shell).

Popup is special case of Shell that is placed on window so that previous shell(s) on stack will be partly visible as well.

See Also:
Popup

Constructor Summary
Shell(Component child)
          Creates a new Shell with specified component as content.
 
Method Summary
 void computeLayout()
          Computes the actual position and dimensions of every component on the screen.
 Component focused()
          Returns the currently focused component on shell.
 void setActionHandler(ActionCallback callback)
          Sets the action callback for this Shell.
 void setFocused(Component focused)
          Sets the focused component.
 void setFocused(Component focused, boolean ensureVisibility)
          Sets the focused component.
 void setKeyHandler(KeyCallback callback)
          Sets the key callback for this Shell.
 void setMenuHandler(MenuCallback callback)
          Sets the menu callback for this Shell.
 void setSoftKeyHandler(SoftKeyCallback callback)
          Sets the soft key callback for this Shell.
 void updateMenu()
          Updates SOFTKEY_OK, SOFTKEY_MIDDLE and SOFTKEY_BACK assosiations.
 
Methods inherited from class Component
add, appendText, clear, find, first, get, getAction, getData, getElement, getFlags, getImage, getLocation, getParent, getShell, getSize, getStyle, getText, getViewPort, hasLinefeed, indexOf, insert, isFocusable, isShown, isVisible, isWrapping, last, operator_get, operator_set, remove, remove, repaint, set, setAction, setData, setElement, setFlags, setImage, setLocation, setPreferredHeight, setPreferredSize, setPreferredWidth, setStyle, setText, size
 
Methods inherited from class Object
toString, equals, hashCode
 
Methods inherited from
equals, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shell

public Shell(Component child)
Creates a new Shell with specified component as content.

Parameters:
child - Content of shell
Method Detail

focused

public Component focused()
Returns the currently focused component on shell. Only single component on component tree can receive focus.

Returns:
focused component, or null if no components are currently focused

setFocused

public void setFocused(Component focused)
Sets the focused component. Only single component on component tree can receive focus. Calling this methos is same as setFocused(focused, true).

Parameters:
focused - Component to receive focus
See Also:
setFocused(Component, boolean)

setFocused

public void setFocused(Component focused,
                       boolean ensureVisibility)
Sets the focused component. Only single component on component tree can receive focus.

Parameters:
focused - Component to receive focus
ensureVisibility - If true the system will attempt to align enclosing Scrollable (if any) so that component is visible. Setting this parameter to false will prevent that behaviour, but then the view port must be aligned manually.
Since:
3.0.0
See Also:
setFocused(Component)

computeLayout

public void computeLayout()
Computes the actual position and dimensions of every component on the screen. Layout computation occurs automatically prior the Shell is painted to screen.

Sometimes it is necessary to know the position or dimensions of Components before the Shell is made visible and this method is provided to serve that purpose. Computation is potentionally a slow operation and it should only be done when absolutely necessary.


setActionHandler

public void setActionHandler(ActionCallback callback)
Sets the action callback for this Shell. Callback is used instead of generic Script.actionPerformed(Shell, Component, int).

Parameters:
callback - Callback to use or null to use the generic callback
See Also:
Callbacks

setMenuHandler

public void setMenuHandler(MenuCallback callback)
Sets the menu callback for this Shell. Callback is used instead of generic Script.getMenu(Shell, Component).

Parameters:
callback - Callback to use or null to use the generic callback
See Also:
Callbacks

setSoftKeyHandler

public void setSoftKeyHandler(SoftKeyCallback callback)
Sets the soft key callback for this Shell. Callback is used instead of generic Script.getSoftKey(Shell, Component, int).

Parameters:
callback - Callback to use or null to use the generic callback
See Also:
Callbacks

setKeyHandler

public void setKeyHandler(KeyCallback callback)
Sets the key callback for this Shell. Callback is used instead of generic Script.keyAction(Component, int, int).

Parameters:
callback - Callback to use or null to use the generic callback
See Also:
Callbacks

updateMenu

public void updateMenu()
Updates SOFTKEY_OK, SOFTKEY_MIDDLE and SOFTKEY_BACK assosiations. The Script.getSoftKey(Shell, Component, int) callback is used to obtain the MenuItems.

This method does not call the flushScreen(boolean) automatically so it might be necessary to call that function as well.

Key associations are assigned when Shell is pushed on screen, but this method is provided in case the they need to be changed on the fly.