fi.paatti.mobile.paattiapplication
Class MobileViewHandler

java.lang.Object
  extended by fi.paatti.mobile.paattiapplication.MobileViewHandler
All Implemented Interfaces:
MobileViewHeaderAndFooterActions

public class MobileViewHandler
extends Object
implements MobileViewHeaderAndFooterActions

Handles the opening and closing of views and setting the height of the current view.

MobileView is the base view and when a new view is opened it will be set as the content in the MobileView.

TODO: Changing header icon and/or text doesn´t allways work as expected.

Since:
0.0.1
Author:
Lauri Satokangas, lauri.n.satokangas@student.jyu.fi, Toni Salminen, toni.a.j.salminen@student.jyu.fi
 

Field Summary
 fi.paatti.paattiloginutils.LoginHelper loginHelper
          The login helper that is used for the user login.
 
Method Summary
 void createAndStartEvent(com.vaadin.data.util.sqlcontainer.SQLContainer taskContainer, com.vaadin.data.util.sqlcontainer.SQLContainer choiceContainer, String eventName)
          Set the EventView as the content and inform it to start a new event.
 fi.paatti.paattidatabaseutils.dbservice.PaattiMobileDBService getDbService()
          Get the database service.
 HashMap<Object,com.vaadin.ui.Component> getFooterComponents()
          Get the footer buttons.
 fi.paatti.paattiloginutils.LoginHelper getLoginHelper()
          Get the LoginHelper.
 fi.paatti.paattidatabaseutils.dbobjects.User getUser()
          Get the User-object.
 int getUserID()
          Get the ID of the User.
 void resetFooterButtons()
          Removes all text and icons from all the footer buttons.
 void setContentView(Object viewToBeOpened)
          Set the content view.
 void setContentViewWithConfirmation(Object viewToBeOpened, String confirmationMessage)
          Shows a confirmation view with the possibility to open the given view or to return to the view that was open before the confirmation.
 void setFooterButtonEnabled(Object footerButtonId, boolean enabled)
          Enable or disable the button.
 void setFooterButtonIcon(Object footerButtonId, com.vaadin.terminal.ThemeResource themeResource)
          Set the icon of the footer button.
 void setFooterButtonPressed(Object footerButton, boolean pressed)
          Sets the button state as pressed.
 void setFooterButtonsEnabled(boolean enabled)
          Enable all footerbuttons.
 void setFooterButtonsVisible(boolean visible)
          Hide all the footer buttons or make them visible.
 void setFooterButtonText(Object footerButtonId, String text)
          Set the text of the footer button.
 void setHeaderIcon(com.vaadin.terminal.ThemeResource iconResource)
          Set icon for the header.
 void setHeaderText(String headerText)
          Set the text of the header label.
 void setMobileViewLogic(MobileViewLogic logic)
          Set logic for the mobile view.
 void setUser(fi.paatti.paattidatabaseutils.dbobjects.User user)
          Set the User-object

 void setWindowHeight(int height)
          Set the height of the layout (which should be the height of the mobile browser).
 void showNotification(String notificationText, int timeInMsec, boolean clickToCloseNotification)
          Show a notification on the screen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loginHelper

public final fi.paatti.paattiloginutils.LoginHelper loginHelper
The login helper that is used for the user login.

Method Detail

setContentView

public void setContentView(Object viewToBeOpened)
Set the content view.

Sets the view as the content of the mobile view. The logic of the content view is also set as the logic of the mobileview.

Parameters:
viewToBeOpened - ID of the view to be opened

setContentViewWithConfirmation

public void setContentViewWithConfirmation(Object viewToBeOpened,
                                           String confirmationMessage)
Shows a confirmation view with the possibility to open the given view or to return to the view that was open before the confirmation.

Parameters:
viewToBeOpened - ID of the view to be opened
confirmationMessage - The confirmation message

showNotification

public void showNotification(String notificationText,
                             int timeInMsec,
                             boolean clickToCloseNotification)
Show a notification on the screen.

Stylename: mobilenotification

Parameters:
notificationText - Text for the notification
timeInMsec - Notification timeout in milliseconds
clickToCloseNotification - Should the user click the notification to close it or will it close after 10 sec.

createAndStartEvent

public void createAndStartEvent(com.vaadin.data.util.sqlcontainer.SQLContainer taskContainer,
                                com.vaadin.data.util.sqlcontainer.SQLContainer choiceContainer,
                                String eventName)
Set the EventView as the content and inform it to start a new event.

Parameters:
taskContainer - All the tasks that are in the event.
choiceContainer - All the choices that are in tasks (that are in the event)
eventName - The name of the event.

setMobileViewLogic

public void setMobileViewLogic(MobileViewLogic logic)
Set logic for the mobile view. This usually means what the footer buttons will do when pressed.

Parameters:
logic - The logic to be set.

setWindowHeight

public void setWindowHeight(int height)
Set the height of the layout (which should be the height of the mobile browser).

Parameters:
height - Height of the browser window in pixels.

getFooterComponents

public HashMap<Object,com.vaadin.ui.Component> getFooterComponents()
Get the footer buttons.

Returns:

getUserID

public int getUserID()
Get the ID of the User.

Returns:
User ID

getUser

public fi.paatti.paattidatabaseutils.dbobjects.User getUser()
Get the User-object.

Returns:
User

getDbService

public fi.paatti.paattidatabaseutils.dbservice.PaattiMobileDBService getDbService()
Get the database service.

Returns:
the dbService

getLoginHelper

public fi.paatti.paattiloginutils.LoginHelper getLoginHelper()
Get the LoginHelper.

Returns:
LoginHelper.

setUser

public void setUser(fi.paatti.paattidatabaseutils.dbobjects.User user)
Set the User-object

Parameters:
user -

setHeaderText

public void setHeaderText(String headerText)
Description copied from interface: MobileViewHeaderAndFooterActions
Set the text of the header label.

The text can be styled with the style name .v-label-headertext

Specified by:
setHeaderText in interface MobileViewHeaderAndFooterActions
Parameters:
headerText - The text for the header.

setFooterButtonEnabled

public void setFooterButtonEnabled(Object footerButtonId,
                                   boolean enabled)
Description copied from interface: MobileViewHeaderAndFooterActions
Enable or disable the button.

Specified by:
setFooterButtonEnabled in interface MobileViewHeaderAndFooterActions
Parameters:
footerButtonId - Wich button will be enabled/disabled
enabled - Will the button be enabled or disabled

setFooterButtonIcon

public void setFooterButtonIcon(Object footerButtonId,
                                com.vaadin.terminal.ThemeResource themeResource)
Description copied from interface: MobileViewHeaderAndFooterActions
Set the icon of the footer button.

Specified by:
setFooterButtonIcon in interface MobileViewHeaderAndFooterActions
Parameters:
footerButtonId - On which button the icon will be set.
themeResource - ThemeResource containing the icon

setFooterButtonText

public void setFooterButtonText(Object footerButtonId,
                                String text)
Description copied from interface: MobileViewHeaderAndFooterActions
Set the text of the footer button.

Specified by:
setFooterButtonText in interface MobileViewHeaderAndFooterActions
Parameters:
footerButtonId - On which button the text will be set
text - The new text of the button

setFooterButtonPressed

public void setFooterButtonPressed(Object footerButton,
                                   boolean pressed)
Description copied from interface: MobileViewHeaderAndFooterActions
Sets the button state as pressed.

This means adding the button a style 'pressed' or removing the style.

Specified by:
setFooterButtonPressed in interface MobileViewHeaderAndFooterActions
Parameters:
footerButton - Wich button will be pressed/unpressed
pressed - Will the button be pressed or not.

setHeaderIcon

public void setHeaderIcon(com.vaadin.terminal.ThemeResource iconResource)
Description copied from interface: MobileViewHeaderAndFooterActions
Set icon for the header.

Specified by:
setHeaderIcon in interface MobileViewHeaderAndFooterActions
Parameters:
iconResource - ThemeResource containing the icon

resetFooterButtons

public void resetFooterButtons()
Description copied from interface: MobileViewHeaderAndFooterActions
Removes all text and icons from all the footer buttons. Also sets the state as enabled and makes all the buttons visible.

Specified by:
resetFooterButtons in interface MobileViewHeaderAndFooterActions

setFooterButtonsEnabled

public void setFooterButtonsEnabled(boolean enabled)
Description copied from interface: MobileViewHeaderAndFooterActions
Enable all footerbuttons.

Specified by:
setFooterButtonsEnabled in interface MobileViewHeaderAndFooterActions
Parameters:
enabled - Will the buttons be set to enabled or disabled.

setFooterButtonsVisible

public void setFooterButtonsVisible(boolean visible)
Description copied from interface: MobileViewHeaderAndFooterActions
Hide all the footer buttons or make them visible.

Specified by:
setFooterButtonsVisible in interface MobileViewHeaderAndFooterActions
Parameters:
visible - Will the buttons be visible or hidden.


Copyright © 2012. All Rights Reserved.