bluegammon.gui
Class BluetoothDevicePage

java.lang.Object
  extended bybluegammon.gui.menu.MenuPage
      extended bybluegammon.gui.BluetoothDevicePage
All Implemented Interfaces:
javax.microedition.lcdui.CommandListener, FocusablePage, java.lang.Runnable

public class BluetoothDevicePage
extends MenuPage
implements FocusablePage, javax.microedition.lcdui.CommandListener, java.lang.Runnable

A page that presents nearby devices, and gives feedback when search is active. Presentation and callhandler to the underlying workflow, an instance of BluetoothClientWorkflow.

Author:
Peter Andersson
See Also:
BluetoothClientWorkflow

Field Summary
 
Fields inherited from class bluegammon.gui.menu.MenuPage
LAYOUT_LEFT, LAYOUT_RIGHT
 
Constructor Summary
BluetoothDevicePage(char[] title, Menu menu, PopupCanvas canvas, SoftButtonControl softButtons)
          Creates the nearby bluetooth devices page.
 
Method Summary
 void addItem(PageItem item)
          Adds an item and repaints.
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          Called from softbutton control.
 boolean isSearching()
          Returns whether this page displays the icon indicating device search or not.
 void onEnter()
          Called when this page shows up.
 void onLeave()
          Called when this page is hidden for something else.
 void run()
          Bluetooth search animation.
 void setClientWorkflow(BluetoothClientWorkflow bch)
          Registers the behaviour to enable when user wants to connect as client to a device listed in this page.
 void setSearching(boolean on)
          Enables or disables the searching
 
Methods inherited from class bluegammon.gui.menu.MenuPage
getIndex, getLayout, getSelectedIndex, getTitle, getTitleImage, itemAt, removeAllItems, removeItem, removeItem, setLayout, setSelectedIndex, setTitle, setTitleImage, size
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BluetoothDevicePage

public BluetoothDevicePage(char[] title,
                           Menu menu,
                           PopupCanvas canvas,
                           SoftButtonControl softButtons)
Creates the nearby bluetooth devices page.

Parameters:
title - The title of the page.
menu - The menu this page belongs to.
canvas - The canvas this page is drawed upon.
softButtons - The softbutton control used in above canvas.
Method Detail

addItem

public void addItem(PageItem item)
Adds an item and repaints.

Overrides:
addItem in class MenuPage
Parameters:
item - The item to add.

setClientWorkflow

public void setClientWorkflow(BluetoothClientWorkflow bch)
Registers the behaviour to enable when user wants to connect as client to a device listed in this page.

Parameters:
bch - The workflow for connecting to a device as client.

isSearching

public boolean isSearching()
Returns whether this page displays the icon indicating device search or not.

Returns:
true for searching, false otherwise.

setSearching

public void setSearching(boolean on)
Enables or disables the searching

Parameters:
on -

onEnter

public void onEnter()
Called when this page shows up. Sets specific softbuttons.

Specified by:
onEnter in interface FocusablePage

onLeave

public void onLeave()
Called when this page is hidden for something else. Resets softbuttons.

Specified by:
onLeave in interface FocusablePage

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Called from softbutton control.

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener

run

public void run()
Bluetooth search animation.

Specified by:
run in interface java.lang.Runnable