org.universAAL.ui.dm
Class UserDialogManager

Package class diagram package UserDialogManager
java.lang.Object
  extended by org.universAAL.ui.dm.UserDialogManager
All Implemented Interfaces:
IDialogManager, IUIPreferencesChangeListener

public class UserDialogManager
extends Object
implements IDialogManager, IUIPreferencesChangeListener

Dialog Management per user. This delegate of DialogManagerImpl cares for Interaction with just one user.

Author:
amedrano, eandgrg created: 26-sep-2012 13:03:50

Constructor Summary
UserDialogManager(User user, AbsLocation location, IUIPreferencesBuffer uiPreferencesBuffer)
          Constructor.
 
Method Summary
 void adaptationParametersChanged(String parameter)
          change the AdaptationParameters of the current dialog.
 void add(ISubmitGroupListener sgl)
          Add a ISubmitGroupListener to listen to UIResponses.
 void changedUIPreferences(UIPreferencesSubProfile subProfile)
          Callback when the UIPreferencesSubProfile is changed.
 boolean checkNewDialog(UIRequest request)
          This method is called by the UI bus and determines whether a dialog can be shown directly (e.g. by comparing the dialogs priority with the priority of a dialog that is currently shown).
 void dialogAborted(String dialogID, Resource data)
          This method is called when an event on the bus occurs indicating that a dialog was aborted.
 void dialogFinished(String dialogID)
          This method is called by the UI bus to inform the dialog manager that a dialog was successfully finished.
 AbsLocation getCurrentUserLocation()
          Last estimated location of the user.
 IUIRequestPool getDialogPool()
           
 MessageLocaleHelper getLocaleHelper()
          Get the MessageLocaleHelper, to access internationalized strings and user locale.
 IUIRequestPool getMessagePool()
           
 UIRequest getSuspendedDialog(String dialogID)
          Get a suspended dialog.
 UIPreferencesSubProfile getUiPreferencesSubProfile()
           
 String getUserId()
          Get the user's URI for this UserDialogManager target User .
 void handleUIResponse(UIResponse response)
          Handle the response.
 void openPendingDialogsDialog()
           
 void openPendingMessagedDialog()
           
 void pushDialog(Form form)
          Present a dialog to the user.
 void pushUIRequest(UIRequest req)
          Order a UIRequest to be sent. pushing a UIRequest through this method will skip the priority check and the UIRequest will be sent Immediately to any UIHandler.
 void refreshMainMenu()
          Re send the main menu, if the current dialog is the main menu.
 void resumeUIRequest(UIRequest req)
          Resume an existing dialog.
 void setCurrentUserLocation(AbsLocation currentUserLocation)
          This method is for the context susbscriber to update the user's location.
 void showMainMenu()
          Trigger a main menu.
 void showSomething()
          Find something to show.
 void suspendDialog(String dialogID)
          Suspend a dialog.
 void userLogIn(Resource user, AbsLocation location)
          A User has logged in at a location resend the appropriate dialog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserDialogManager

public UserDialogManager(User user,
                         AbsLocation location,
                         IUIPreferencesBuffer uiPreferencesBuffer)
Constructor.

Parameters:
user - the User this DM is only attending.
location - the initial location for this user.
Method Detail

changedUIPreferences

public void changedUIPreferences(UIPreferencesSubProfile subProfile)
Callback when the UIPreferencesSubProfile is changed.

Specified by:
changedUIPreferences in interface IUIPreferencesChangeListener
Parameters:
subProfile - the new changed UIPreferencesSubProfile

getUserId

public final String getUserId()
Get the user's URI for this UserDialogManager target User .

Returns:
the user's URI.

getMessagePool

public final IUIRequestPool getMessagePool()
Returns:
the messagePool.

getDialogPool

public final IUIRequestPool getDialogPool()
Returns:
the dialogPool

checkNewDialog

public boolean checkNewDialog(UIRequest request)
This method is called by the UI bus and determines whether a dialog can be shown directly (e.g. by comparing the dialogs priority with the priority of a dialog that is currently shown). Additionally, it adds adaptation parameters.

Specified by:
checkNewDialog in interface IDialogManager
Parameters:
request - The UI request containing a dialog.
Returns:
true, if the dialog can be shown directly.
See Also:
IDialogManager.checkNewDialog(UIRequest)

dialogAborted

public void dialogAborted(String dialogID,
                          Resource data)
This method is called when an event on the bus occurs indicating that a dialog was aborted. It removes the dialog from the list (it searches the lists DialogManagerImpl#runningDialogs, DialogManagerImpl#suspendedDialogs, and DialogManagerImpl#waitingDialogs).

Parameters:
dialogID -

dialogFinished

public void dialogFinished(String dialogID)
This method is called by the UI bus to inform the dialog manager that a dialog was successfully finished. The dialog manager can then show dialogs that were previously suspended.

Specified by:
dialogFinished in interface IDialogManager
Parameters:
dialogID - ID of the dialog that is now finished.
See Also:
IDialogManager.dialogFinished(String)

showSomething

public void showSomething()
Find something to show. First check there aren't any pending messages, Then check dialogs, as a last resort show main menu.


resumeUIRequest

public final void resumeUIRequest(UIRequest req)
Resume an existing dialog.

Parameters:
req - the Request to be resumed.

userLogIn

public final void userLogIn(Resource user,
                            AbsLocation location)
A User has logged in at a location resend the appropriate dialog.

Specified by:
userLogIn in interface IDialogManager
Parameters:
user - User of a system. It is declared as Resource because the type User is defined in the Profiling Ontology. The type is not needed for for matchmaking Either.
location - Location from which User has logged in to the system

getSuspendedDialog

public final UIRequest getSuspendedDialog(String dialogID)
Get a suspended dialog. Removes the dialog from suspendedDialogs and adds it to runningDialogs.

Specified by:
getSuspendedDialog in interface IDialogManager
Parameters:
dialogID - ID of the dialog.
Returns:
the suspended UIRequest, null if not found.

suspendDialog

public final void suspendDialog(String dialogID)
Suspend a dialog. This method is called by the UI bus and removes the given dialog from 'runningDialogs' and stores it in 'suspendedDialogs'.

Specified by:
suspendDialog in interface IDialogManager
Parameters:
dialogID - ID of the dialog.

handleUIResponse

public void handleUIResponse(UIResponse response)
Handle the response. If the UIResponse corresponds to one of the registered ISubmitGroupListeners then delegate method, and remove all its IDs from map.

Parameters:
response - the response to be handled.

add

public final void add(ISubmitGroupListener sgl)
Add a ISubmitGroupListener to listen to UIResponses.

Parameters:
sgl - the ISubmitGroupListener to be added to the list of listeners.

getCurrentUserLocation

public final AbsLocation getCurrentUserLocation()
Last estimated location of the user.

Returns:
the location of the user

setCurrentUserLocation

public final void setCurrentUserLocation(AbsLocation currentUserLocation)
This method is for the context susbscriber to update the user's location. when called the DM will re-send the current dialog (to implement the follow me scenario).

Parameters:
currentUserLocation - the new location of the user.

pushUIRequest

public void pushUIRequest(UIRequest req)
Order a UIRequest to be sent. pushing a UIRequest through this method will skip the priority check and the UIRequest will be sent Immediately to any UIHandler.

Parameters:
req - the UIRequest to be sent by the DM.

pushDialog

public final void pushDialog(Form form)
Present a dialog to the user. This method is only intended for DMs forms to be presented to the user.

Parameters:
form - the form to be presented to the user.

showMainMenu

public final void showMainMenu()
Trigger a main menu.


refreshMainMenu

public final void refreshMainMenu()
Re send the main menu, if the current dialog is the main menu.


openPendingDialogsDialog

public final void openPendingDialogsDialog()

openPendingMessagedDialog

public final void openPendingMessagedDialog()

getUiPreferencesSubProfile

public UIPreferencesSubProfile getUiPreferencesSubProfile()
Returns:
the uiPreferencesSubProfile

getLocaleHelper

public MessageLocaleHelper getLocaleHelper()
Get the MessageLocaleHelper, to access internationalized strings and user locale.

Returns:
the helper.

adaptationParametersChanged

public void adaptationParametersChanged(String parameter)
change the AdaptationParameters of the current dialog.

Parameters:
parameter - the parameter that has changed.


Copyright © 2014 universAAL Consortium. All Rights Reserved.