org.universAAL.ui.handler.gui.swing
Class Renderer

Package class diagram package Renderer
java.lang.Object
  extended by java.lang.Thread
      extended by org.universAAL.ui.handler.gui.swing.Renderer
All Implemented Interfaces:
Runnable

public class Renderer
extends Thread

Coordinator Class for Swing GUI Handler. It will provide all of the needed properties and constants for all other classes, as well as acting as placeholder for all the needed classes to work. This placeholding and mutual reference (between contained and container classes) enables the renderer to be loaded more than once per instance.

Author:
amedrano

Nested Class Summary
static class Renderer.RenderStarter
          A bootstrap class to start Renderer(s).
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String CONFIGURED_USER
           
protected static String DEMO_MODE
          The Key value for the demo mode configuration property.
protected static String FORM_MANAGEMENT
          The Key value for the Form manager selection configuration property.
protected static String GUI_LOCATION
          The Key value for the location configuration property.
protected  InitInterface initLAF
          Maintenance of the instance created when initialising the LAF, so it can be accessed by LAF components through the renderer.
protected  ModelMapper modelMapper
          The ModelMapper in order to find the correct Model for each rdf class.
protected  ModuleContext moduleContext
          uAAL ModuleContext to make uAAL operations.
protected static String NO_SAVE
          Error message to display when unable to save property file.
protected  Properties properties
          The configuration properties read from the file.
protected static String RENDERER_CONF
          FileName for the main configuration File.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected Renderer()
          Only to be used by TestCases.
  Renderer(ModuleContext mc)
          Constructor.
  Renderer(ModuleContext mc, File propFile)
          Constructor for one Renderer on a certain file.
  Renderer(ModuleContext mc, File propFile, IContainerManager cmanager)
          Constructor for one Renderer on a certain file with a container manager.
  Renderer(ModuleContext mc, IContainerManager con)
          Constructor.
 
Method Summary
 boolean authenticate(String user, String password)
          Check if a user-password pair is registered.
protected  void checkPropertiesVersion()
          Checks for updates the properties file, and updates the properties.
 void finish()
          Terminate current dialog and all pending dialogs.
static ModuleContext getContext()
          Get the ModuleContext for the Renderer.
 Form getCurrentForm()
          Gets the form being displayed right now.
 User getCurrentUser()
          Get the logged in user, the one that is in theory receiving and manipulating the dialogs.
 FormManager getFormManagement()
          Get the FormManager being used, useful to access the current UIResquest and current form.
 Handler getHandler()
          get the Handler of this Renderer.
static String getHomeDir()
          Get the configuration directory.
 InitInterface getInitLAF()
          get the Initial instance when the LAF was loaded.
 String getLanguage()
          Get the Language that should be used.
 ModelMapper getModelMapper()
          Returns the ModelMapper that automatically assigns this Renderer to the Models.
 ModuleContext getModuleContext()
          get the ModuleContext.
 String getProperty(String string)
          Access to the property file.
 String getProperty(String key, String defaultVal)
          Access to the property file.
 AbsLocation getRendererLocation()
           
 boolean hasImpairment(AccessImpairment impariment)
          Check if impairment is listed as present impairments for the current user and form.
protected  void loadFormManager(String FormManagerClassName)
          Load the FormManager from name (to be configured in properties file).
protected  void loadProperties()
          load configuration properties from a file, setting the default for those which are not defined.
 void logOffCurrentUser()
          The user is requesting a logOff.
 void run()
          Main, Top Level Renderer Logic.
static void setHome(String absolutePath)
          Only to be called by container activator.
 void setProperty(String key, String newValue)
          Update the property file.
 void shutdownContainer()
          Callback the container to shutdown.
protected  void storeProperties()
          Save the current properties in the file.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEMO_MODE

protected static final String DEMO_MODE
The Key value for the demo mode configuration property. demo mode will disable Impairment parameter registration. user. Default: demo.mode=true.

See Also:
properties, Constant Field Values

NO_SAVE

protected static final String NO_SAVE
Error message to display when unable to save property file.

See Also:
Constant Field Values

GUI_LOCATION

protected static final String GUI_LOCATION
The Key value for the location configuration property. this location is used when publishing UIResponses. Default: gui.location = Unknown

See Also:
properties, Constant Field Values

FORM_MANAGEMENT

protected static final String FORM_MANAGEMENT
The Key value for the Form manager selection configuration property. this will select between the available FormManagers Default: queued.forms=org.universAAL.ui.handler.gui.swing.formManagement.SimpleFormManager

See Also:
fm, QueuedFormManager, SimpleFormManager, HierarchicalFormManager, OverlayFormManager, Constant Field Values

RENDERER_CONF

protected static final String RENDERER_CONF
FileName for the main configuration File.

See Also:
Constant Field Values

CONFIGURED_USER

public static final String CONFIGURED_USER
See Also:
Constant Field Values

moduleContext

protected ModuleContext moduleContext
uAAL ModuleContext to make uAAL operations.


properties

protected Properties properties
The configuration properties read from the file.


modelMapper

protected ModelMapper modelMapper
The ModelMapper in order to find the correct Model for each rdf class.


initLAF

protected InitInterface initLAF
Maintenance of the instance created when initialising the LAF, so it can be accessed by LAF components through the renderer.

Constructor Detail

Renderer

protected Renderer()
Only to be used by TestCases.


Renderer

public Renderer(ModuleContext mc)
Constructor.

Parameters:
mc - the ModuleContext to create UIHandler and send logs

Renderer

public Renderer(ModuleContext mc,
                IContainerManager con)
Constructor.

Parameters:
mc - the ModuleContext to create UIHandler and send logs
con - the container manager.

Renderer

public Renderer(ModuleContext mc,
                File propFile)
Constructor for one Renderer on a certain file.

Parameters:
mc - the ModuleContext to create UIHandler and send logs
propFile - File to use as property file for this Renderer.

Renderer

public Renderer(ModuleContext mc,
                File propFile,
                IContainerManager cmanager)
Constructor for one Renderer on a certain file with a container manager.

Parameters:
mc - the ModuleContext to create UIHandler and send logs
propFile - File to use as property file for this Renderer.
cmanager - the container manager that manages the container operations.
Method Detail

loadFormManager

protected final void loadFormManager(String FormManagerClassName)
Load the FormManager from name (to be configured in properties file).

Parameters:
FormManagerClassName - the name of the FormManager to be loaded, if not found SimpleFormManager will be loaded.

loadProperties

protected void loadProperties()
load configuration properties from a file, setting the default for those which are not defined.

See Also:
properties

checkPropertiesVersion

protected void checkPropertiesVersion()
Checks for updates the properties file, and updates the properties.


storeProperties

protected void storeProperties()
Save the current properties in the file.


getModuleContext

public final ModuleContext getModuleContext()
get the ModuleContext.

Returns:
the module context.
See Also:
moduleContext

run

public void run()
Main, Top Level Renderer Logic.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

finish

public void finish()
Terminate current dialog and all pending dialogs.


getProperty

public final String getProperty(String string)
Access to the property file.

Parameters:
string - Key of property to access
Returns:
String Value of the property
See Also:
properties

getProperty

public final String getProperty(String key,
                                String defaultVal)
Access to the property file.

Parameters:
key - Key of property to access
defaultVal - default value for the propertie if isn't int he property file.
Returns:
String Value of the property.
See Also:
properties

setProperty

public final void setProperty(String key,
                              String newValue)
Update the property file.

Parameters:
key - Key of property to access
newValue - New value for the property.
See Also:
properties

getCurrentForm

public final Form getCurrentForm()
Gets the form being displayed right now.

Returns:
the current Form being processed.

getCurrentUser

public final User getCurrentUser()
Get the logged in user, the one that is in theory receiving and manipulating the dialogs.

Returns:
ontlogical representation of the user.

logOffCurrentUser

public final void logOffCurrentUser()
The user is requesting a logOff.


hasImpairment

public final boolean hasImpairment(AccessImpairment impariment)
Check if impairment is listed as present impairments for the current user and form.

Parameters:
impariment - the AccessImpairment to be checked
Returns:
true is impairment is present in the current Dialog Request.
See Also:
AccessImpairment, UIRequest

getLanguage

public final String getLanguage()
Get the Language that should be used.

Returns:
the two-letter representation of the language-

getFormManagement

public FormManager getFormManagement()
Get the FormManager being used, useful to access the current UIResquest and current form.

Returns:
fm

getModelMapper

public final ModelMapper getModelMapper()
Returns the ModelMapper that automatically assigns this Renderer to the Models.

Returns:

getHandler

public final Handler getHandler()
get the Handler of this Renderer.

Returns:
the Handler

getInitLAF

public final InitInterface getInitLAF()
get the Initial instance when the LAF was loaded.

Returns:
the initLAF

authenticate

public final boolean authenticate(String user,
                                  String password)
Check if a user-password pair is registered. If it is this method will set the current user, and initiate the handler business.

Parameters:
user - userID trying to authenticate
password - password of the user.
Returns:
true only if the user is properly authenticated, false otherwise.

getRendererLocation

public final AbsLocation getRendererLocation()

setHome

public static void setHome(String absolutePath)
Only to be called by container activator. Initialize the configuration home path.

Parameters:
absolutePath - Absolute path to configuration directory

getHomeDir

public static String getHomeDir()
Get the configuration directory.

Returns:
the home directory (ends with "/")

getContext

public static ModuleContext getContext()
Get the ModuleContext for the Renderer.

Returns:
the ModuleContext.

shutdownContainer

public void shutdownContainer()
Callback the container to shutdown.



Copyright © 2014 universAAL Consortium. All Rights Reserved.