tcMenuJavaAPI
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
com.thecoderscorner.menu.mgr.DialogManager Class Referenceabstract
Inheritance diagram for com.thecoderscorner.menu.mgr.DialogManager:
com.thecoderscorner.menu.mgr.EmptyDialogManager

Public Member Functions

boolean isDialogVisible ()
 
void updateStateFromCommand (MenuCommand cmd)
 
DialogManager withTitle (String title, boolean silent)
 
DialogManager withMessage (String message, boolean silent)
 
DialogManager withDelegate (DialogShowMode mode, Function< MenuButtonType, Boolean > delegate)
 
void showDialogWithButtons (MenuButtonType b1, MenuButtonType b2)
 
void hideDialog ()
 
DialogShowMode getDialogShowMode ()
 
MenuButtonType getButtonType (int btnNum)
 

Protected Member Functions

String toPrintableText (MenuButtonType type)
 
abstract void dialogDidChange ()
 
void buttonWasPressed (MenuButtonType btn)
 

Protected Attributes

final Object lock = new Object()
 
DialogMode mode = DialogMode.HIDE
 
String title = ""
 
String message = ""
 
MenuButtonType button1 = MenuButtonType.NONE
 
MenuButtonType button2 = MenuButtonType.NONE
 
Function< MenuButtonType, Boolean > delegate
 

Detailed Description

Dialog Manager provides the capability to work with dialogs, to present them, change the values of them and also to update them from a remote command arriving. This includes being able to deal with activation from a remote.

Usually, for local or remote activities this class is extended and the dialogDidChange method is implemented to update the UI accordingly and optionally, the buttonWasPressed method may need to be overridden.

Member Function Documentation

◆ buttonWasPressed()

void com.thecoderscorner.menu.mgr.DialogManager.buttonWasPressed ( MenuButtonType  btn)
protected

This can be overridden if needed, it will be called whenever a button is pressed.

Parameters
btnthe button type

◆ dialogDidChange()

abstract void com.thecoderscorner.menu.mgr.DialogManager.dialogDidChange ( )
abstractprotected

this should be overridden to update the UI, it signifies that the dialog has changed

Reimplemented in com.thecoderscorner.menu.mgr.EmptyDialogManager.

◆ getButtonType()

MenuButtonType com.thecoderscorner.menu.mgr.DialogManager.getButtonType ( int  btnNum)

the button type for a given button number - 0 or 1

Parameters
btnNumthe button number
Returns
the button type

◆ getDialogShowMode()

DialogShowMode com.thecoderscorner.menu.mgr.DialogManager.getDialogShowMode ( )
Returns
the mode in which the dialog is being shown

◆ hideDialog()

void com.thecoderscorner.menu.mgr.DialogManager.hideDialog ( )

Remove the dialog from display

◆ isDialogVisible()

boolean com.thecoderscorner.menu.mgr.DialogManager.isDialogVisible ( )
Returns
true if the dialog is on display, otherwise false

◆ showDialogWithButtons()

void com.thecoderscorner.menu.mgr.DialogManager.showDialogWithButtons ( MenuButtonType  b1,
MenuButtonType  b2 
)

Actually shows the dialog with the buttons provided

Parameters
b1one of the button types
b2one of the button types

◆ updateStateFromCommand()

void com.thecoderscorner.menu.mgr.DialogManager.updateStateFromCommand ( MenuCommand  cmd)

Update the dialog from an incoming remote command, checking first if the command is a dialog event, and then updating all the fields and calling dialogDidChange.

Parameters
cmdthe command

◆ withDelegate()

DialogManager com.thecoderscorner.menu.mgr.DialogManager.withDelegate ( DialogShowMode  mode,
Function< MenuButtonType, Boolean >  delegate 
)

Using builder syntax you can show dialog using the with commands this sets the delegate and mode

Parameters
modethe mode in which the dialog should show, regular, or locally
delegatethe delegate to call on a button being pressed
Returns
itself for chaining

◆ withMessage()

DialogManager com.thecoderscorner.menu.mgr.DialogManager.withMessage ( String  message,
boolean  silent 
)

Using builder syntax you can show dialog using the with commands this sets the message

Parameters
messagethe message field
silentif an update should be triggered
Returns
itself for chaining

◆ withTitle()

DialogManager com.thecoderscorner.menu.mgr.DialogManager.withTitle ( String  title,
boolean  silent 
)

Using builder syntax you can show dialog using the with commands, this sets the title

Parameters
titlethe new title
silentif an update should be triggered
Returns
itself for chaining

The documentation for this class was generated from the following file: