|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.millstone.base.Application
Abstract base class required for all MillStone applications. This
class provides all the basic services required by the MillStone
framework. These services allow external discovery and manipulation of
the user, windows
and
themes, and starting and stopping the application.
As mentioned, all MillStone applications must inherit this class.
However, this is almost all of what one needs to do to create a fully
functional MillStone application. The only thing a class inheriting the
Application
needs to do is implement the init()
where it creates the windows it needs to perform its function. Note that
all MillStone applications must have at least one window: the main
window. The first unnamed window constructed by an application
automatically becomes the main window which behaves just like other
windows with one exception: when accessing windows using URLs the main
window corresponds to the application URL whereas other windows
correspond to a URL gotten by catenating the window's name to the
application URL.
See the class org.millstone.examples.HelloWorld
for
a simple example of a fully working MillStone Application.
Window access. Application
provides
methods to list, add and remove the windows it contains.
Execution control. This class includes method to start and finish the execution of the application. Being finished means basically that no windows will be available from the application anymore.
Theme selection. The MillStone theme selection
process allows a theme to be specified at three different levels. When
a window's theme needs to be found out, the window itself is queried
for a preferred theme. If the window does not prefer a specific theme,
the application containing the window is queried. If neither the
application prefers a theme, the default theme for the
terminal
is used. The
terminal always defines a default theme.
Nested Class Summary | |
class |
Application.UserChangeEvent
Application user change event sent when the setUser is called to change the current user of the application. |
static interface |
Application.UserChangeListener
Public interface for listening application user changes |
class |
Application.WindowAttachEvent
Window attach event |
static interface |
Application.WindowAttachListener
Window attach listener interface |
class |
Application.WindowDetachEvent
Window detach event |
static interface |
Application.WindowDetachListener
Window detach listener interface |
Constructor Summary | |
Application()
|
Method Summary | |
void |
addListener(Application.UserChangeListener listener)
Add user change listener |
void |
addListener(Application.WindowAttachListener listener)
Add window attach listener |
void |
addListener(Application.WindowDetachListener listener)
Add window detach listener |
void |
addResource(ApplicationResource resource)
Add new resource to the application. |
void |
addWindow(Window window)
Adds a new window to the application. |
void |
close()
Ends the Application. |
java.util.Locale |
getLocale()
Get thed default locale for this application |
java.lang.String |
getLogoutURL()
Returns the URL user is redirected to on application close. |
Window |
getMainWindow()
Returns the mainWindow of the application. |
java.lang.String |
getProperty(java.lang.String name)
Searches for the property with the specified name in this application. |
java.util.Enumeration |
getPropertyNames()
Returns an enumeration of all the names in this application. |
java.lang.String |
getRelativeLocation(ApplicationResource resource)
Get relative uri of the resource |
java.lang.String |
getTheme()
Gets the application's theme. |
java.net.URL |
getURL()
Gets the URL of the application. |
java.lang.Object |
getUser()
Gets the user of the application. |
Window |
getWindow(java.lang.String name)
Gets a window by name. |
java.util.Collection |
getWindows()
Gets the set of windows contained by the application. |
DownloadStream |
handleURI(java.net.URL context,
java.lang.String relativeUri)
Handle uri. |
abstract void |
init()
Main initializer of the application. |
boolean |
isRunning()
Tests if the application is running or if it has it been finished. |
void |
removeListener(Application.UserChangeListener listener)
Remove user change listener |
void |
removeListener(Application.WindowAttachListener listener)
Remove window attach listener |
void |
removeListener(Application.WindowDetachListener listener)
Remove window detach listener |
void |
removeResource(ApplicationResource resource)
Remove resource from the application. |
void |
removeWindow(Window window)
Removes the specified window from the application. |
void |
setLocale(java.util.Locale locale)
Set the default locale for this application |
void |
setLogoutURL(java.lang.String logoutURL)
Sets the URL user is redirected to on application close. |
void |
setMainWindow(Window mainWindow)
Sets the mainWindow. |
void |
setTheme(java.lang.String theme)
Sets the application's theme. |
void |
setUser(java.lang.Object user)
Sets the user of the application instance. |
void |
start(java.net.URL applicationUrl,
java.util.Properties applicationProperties)
Starts the application on the given URL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Application()
Method Detail |
public Window getWindow(java.lang.String name)
null
if the application is not running or it does not contain a window
corresponding to name
.
name
- The name of the window.
null
public void addWindow(Window window) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
This implicitly invokes the
Window.setApplication(Application)
method.
window
- the new Window
to add
java.lang.IllegalArgumentException
- if a window with the same name
as the new window already exists in the application
java.lang.NullPointerException
- if the given Window
or
its name is null
public void removeWindow(Window window)
window
- The window to be removedpublic java.lang.Object getUser()
public void setUser(java.lang.Object user)
user
- the new user.public java.net.URL getURL()
public void close()
public void start(java.net.URL applicationUrl, java.util.Properties applicationProperties)
applicationUrl
- The URL the application should respond toapplicationProperties
- Application properties as specified by the adapter.public boolean isRunning()
true
if the application is running,
false
if notpublic java.util.Collection getWindows()
public abstract void init()
public java.lang.String getTheme()
null
is returned.
public void setTheme(java.lang.String theme)
null
implies the default terminal theme.
theme
- The new theme for this applicationpublic Window getMainWindow()
public void setMainWindow(Window mainWindow)
mainWindow
- The mainWindow to setpublic java.util.Enumeration getPropertyNames()
public java.lang.String getProperty(java.lang.String name)
name
- The name of the property.
public void addResource(ApplicationResource resource)
public void removeResource(ApplicationResource resource)
public java.lang.String getRelativeLocation(ApplicationResource resource)
public DownloadStream handleURI(java.net.URL context, java.lang.String relativeUri)
URIHandler
handleURI
in interface URIHandler
public java.util.Locale getLocale()
public void setLocale(java.util.Locale locale)
public void addListener(Application.UserChangeListener listener)
public void removeListener(Application.UserChangeListener listener)
public void addListener(Application.WindowAttachListener listener)
public void addListener(Application.WindowDetachListener listener)
public void removeListener(Application.WindowAttachListener listener)
public void removeListener(Application.WindowDetachListener listener)
public java.lang.String getLogoutURL()
public void setLogoutURL(java.lang.String logoutURL)
logoutURL
- The logoutURL to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |