sam.ui
Class UserInterface

java.lang.Object
  |
  +--sam.ui.UserInterface
Direct Known Subclasses:
UserInterface, UserInterface, UserInterface

public abstract class UserInterface
extends java.lang.Object

Pluggable user interface abstraction A user interface defines all the interactions between the user and the program; they are grouped by categories as follows:

By now three different user interfaces are proposed:

See Also:
RulingInterface, RunningInterface, ErrorInterface, LogInterface

Nested Class Summary
static class UserInterface.Abort
          Exception thrown whenever the whole program should abort.
 
Field Summary
static sam.toolkit.ClassRegistry REGISTRY
          Class registry in charge of registring and lazily instantiating UserInterfaces
 
Constructor Summary
protected UserInterface()
           
 
Method Summary
static void disposeFrames()
          Abruptly disposes all frames of the application.
abstract  sam.ui.ErrorInterface error()
           
static sam.ui.UserInterface get()
          Gets the current user interface.
static java.lang.String[] getKnwonInterfaces()
          Gets the list of all known user interfaces
static boolean isSet()
          Wether a user interface has ever been set.
abstract  sam.ui.LogInterface log()
           
static void main(java.lang.String[] arguments)
          Simple test code Loads a user interface and performs basic tests on it Syntax is java sam.ui.UserInterface [user-interface]
protected static boolean register(java.lang.Class UI, java.lang.String name)
          Registers a new UserInterface as name
abstract  sam.ui.RulingInterface ruling()
           
abstract  sam.ui.RunningInterface running()
           
static boolean set(java.lang.String name)
          Sets name as the current user interface.
protected static void setBest()
          Sets the best user interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGISTRY

public static final sam.toolkit.ClassRegistry REGISTRY
Class registry in charge of registring and lazily instantiating UserInterfaces

Constructor Detail

UserInterface

protected UserInterface()
Method Detail

set

public static boolean set(java.lang.String name)
Sets name as the current user interface.

Throws:
NoSuchElementException - if name is not a registered UserInterface

isSet

public static boolean isSet()
Wether a user interface has ever been set.

See Also:
set(java.lang.String)

setBest

protected static void setBest()
Sets the best user interface.

See Also:
Settings.Constants.UI.PREFERENCES, Settings.Constants.UI.FAILSAFE

getKnwonInterfaces

public static java.lang.String[] getKnwonInterfaces()
Gets the list of all known user interfaces


register

protected static boolean register(java.lang.Class UI,
                                  java.lang.String name)
Registers a new UserInterface as name

This is also set as the current one if none currently is.


get

public static sam.ui.UserInterface get()
Gets the current user interface.

Instanciation is lazy and occurs only once.

Returns:
the current user interface

disposeFrames

public static void disposeFrames()
Abruptly disposes all frames of the application.


ruling

public abstract sam.ui.RulingInterface ruling()
Returns:
the RulingInterface associated with this UserInterface

running

public abstract sam.ui.RunningInterface running()
Returns:
the RunningInterface associated with this UserInterface

error

public abstract sam.ui.ErrorInterface error()
Returns:
the ErrorInterface associated with this UserInterface

log

public abstract sam.ui.LogInterface log()
Returns:
the LogInterface associated with this UserInterface

main

public static void main(java.lang.String[] arguments)
Simple test code Loads a user interface and performs basic tests on it Syntax is java sam.ui.UserInterface [user-interface]