org.formaria.swt.app
Class AriaProxy

java.lang.Object
  extended by Composite
      extended by org.formaria.swt.app.AriaProxy
All Implemented Interfaces:
PersistentState, StartupObject

public class AriaProxy
extends Composite
implements StartupObject

The AriaProxy acts as a context for a Aria application embedded within another application, such as a Swing application. The proxy does not setup a frame or window as with other startup objects and instead it expects to be embedded within a container such as a JPanel. It is the launch application's reposnsibility to size and position the proxy as needed.

Copyright (c) Formaria Ltd., 2008. See license.txt for more details


Field Summary
protected  ApplicationContext applicationContext
           
protected  Shell appWindow
          The application window
protected  boolean bUseWindow
          true if a popup window is in use
protected  Display display
          The Application frame
protected  java.awt.Container pageHolder
          The panel holding the page content
 
Constructor Summary
AriaProxy(java.lang.String[] args, Shell f, Display d)
          Create a new aplication.
 
Method Summary
 java.lang.Object displayDecoration(PageSupport page, java.lang.String constraint)
          Display a window decoration, for example a toolbar
 java.lang.Object getApplicationMenuBar()
          Get the menubar.
 java.lang.Object getContentPaneEx()
          Get the content pane used by Aria - the container in which pages are displayed
 java.net.URL getDocumentBase()
          Gets the URL of the document in which this applet is embedded.
 Display getFrame()
          Gets the Frame containing the applet.
 java.lang.String getParameter(java.lang.String param)
          Get a startup parameter
 java.lang.Object getParentObject()
          Get the parent object
 java.lang.String getWidgetClassPackage()
          Get the package name for the default widget set
 void init()
          Invoked when used as an applet.
 void refresh()
          Validate and repaint the display
 void restoreState(XmlElement stateElement)
          Restore the application state
 void restoreViews()
          Restore the normal page views, as in the case of the docking layout where panels may be zoomed or minimized.
 void saveState(XmlElement stateElement)
          Save the application state
 void setApplicationMenuBar(java.lang.Object mb)
          Set the menubar
 void setAppTitle(java.lang.String title)
          Set the application title.
 void setIcon(java.awt.Image icon)
          Set the application icon
 void setMenuBar(MenuBar mb)
          Set the menubar.
 void setSize(java.awt.Dimension size)
          Set the size of this application/applet
 void setupFrameset(java.util.Hashtable params)
          Setup frameset.
 void setupWindow(ApplicationContext context, Project currentProject, int clientWidth, int clientHeight)
          Setup the main application window
 void validate()
          Validates this container and all of its subcomponents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appWindow

protected Shell appWindow
The application window


display

protected Display display
The Application frame


bUseWindow

protected boolean bUseWindow
true if a popup window is in use


applicationContext

protected ApplicationContext applicationContext

pageHolder

protected java.awt.Container pageHolder
The panel holding the page content

Constructor Detail

AriaProxy

public AriaProxy(java.lang.String[] args,
                 Shell f,
                 Display d)
Create a new aplication. Most of the setup work is actually done by the initialize method and is called by the main method or the init method depending on whether or not an application of applet is being launched.

Method Detail

getParentObject

public java.lang.Object getParentObject()
Get the parent object

Specified by:
getParentObject in interface StartupObject
Returns:
the parent

getWidgetClassPackage

public java.lang.String getWidgetClassPackage()
Get the package name for the default widget set

Specified by:
getWidgetClassPackage in interface StartupObject
Returns:
the class name of the widget set

setupFrameset

public void setupFrameset(java.util.Hashtable params)
Setup frameset. This method is called prior to the addition of any target areas in the framset and prior to the display of any pages. Since this applet does not support configurable framesets, this method ignores the parameter values passed.

Specified by:
setupFrameset in interface StartupObject
Parameters:
params - the framset parameters if any

displayDecoration

public java.lang.Object displayDecoration(PageSupport page,
                                          java.lang.String constraint)
Display a window decoration, for example a toolbar

Specified by:
displayDecoration in interface StartupObject
Parameters:
page - the new page
constraint - a value controlling how and where the decoration is displayed, this value is application type specific
Returns:
the page being displayed

refresh

public void refresh()
Validate and repaint the display

Specified by:
refresh in interface StartupObject

restoreViews

public void restoreViews()

Restore the normal page views, as in the case of the docking layout where panels may be zoomed or minimized. The method is called prior to the display of a new page.

In this context the method has no effect.

Specified by:
restoreViews in interface StartupObject

getContentPaneEx

public java.lang.Object getContentPaneEx()
Get the content pane used by Aria - the container in which pages are displayed

Specified by:
getContentPaneEx in interface StartupObject
Returns:
the page container

setAppTitle

public void setAppTitle(java.lang.String title)
Description copied from interface: StartupObject
Set the application title. This method is called just before the first page is displayed, when all the other resources should have been loaded.

Specified by:
setAppTitle in interface StartupObject

setIcon

public void setIcon(java.awt.Image icon)
Set the application icon

Specified by:
setIcon in interface StartupObject
Parameters:
img - the image name

setupWindow

public void setupWindow(ApplicationContext context,
                        Project currentProject,
                        int clientWidth,
                        int clientHeight)
Setup the main application window

Specified by:
setupWindow in interface StartupObject
Parameters:
context - the application context for the new application
currentProject - the current project
clientWidth - the desired width for the new window
clientHeight - the desired height for the new window

init

public void init()
Invoked when used as an applet. Sets up the startup file and initialises the application. Reads the applet parameters and calls initialize.


getFrame

public Display getFrame()
Gets the Frame containing the applet.

Returns:
Frame which is the applet or application's parent

setMenuBar

public void setMenuBar(MenuBar mb)
Set the menubar.

Parameters:
mb - the new menu bar

getApplicationMenuBar

public java.lang.Object getApplicationMenuBar()
Get the menubar.

Specified by:
getApplicationMenuBar in interface StartupObject
Returns:
the menu bar

setApplicationMenuBar

public void setApplicationMenuBar(java.lang.Object mb)
Set the menubar

Specified by:
setApplicationMenuBar in interface StartupObject
Parameters:
mb - the menubar

getDocumentBase

public java.net.URL getDocumentBase()

Gets the URL of the document in which this applet is embedded.

Returns null in this instance

Specified by:
getDocumentBase in interface StartupObject
Returns:
the URL of the document that contains this applet.
See Also:
Applet.getCodeBase()

getParameter

public java.lang.String getParameter(java.lang.String param)
Get a startup parameter

Returns null in this instance

Specified by:
getParameter in interface StartupObject
Parameters:
param - the name of the parameter

restoreState

public void restoreState(XmlElement stateElement)
Restore the application state

Specified by:
restoreState in interface PersistentState

saveState

public void saveState(XmlElement stateElement)
Save the application state

Specified by:
saveState in interface PersistentState
Parameters:
the - elements to hold the page state

setSize

public void setSize(java.awt.Dimension size)
Description copied from interface: StartupObject
Set the size of this application/applet

Specified by:
setSize in interface StartupObject
Parameters:
size - the requested size

validate

public void validate()
Description copied from interface: StartupObject
Validates this container and all of its subcomponents

Specified by:
validate in interface StartupObject