| javax.swing.JApplet net.xoetrope.swing.XApplet
XApplet | public class XApplet extends JApplet implements WindowListener,XPageDisplay(Code) | | This class is constructed with a window or frame
and can be part of an applet or an application. The class acts as the main
entry point to an XUI application and provides some of the infrastructure
needed to support the application.
The applet can provide support for a frameset or a single page. Page display
functions are also supported to allow the application to display more than a
single page or change the page that is displayed.
By choosing either the AWT or Swing version of the XApplet you choose to
have either an AWT or a Swing application/applet. In general once this choice
has been made you should not mix toolkits.
Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt
version: $Revision: 1.24 $ |
Constructor Summary | |
public | XApplet() A default constructor. |
bUseWindow | protected boolean bUseWindow(Code) | | |
clientHeight | protected int clientHeight(Code) | | |
clientWidth | protected int clientWidth(Code) | | |
defaultSourceClass | protected static Class defaultSourceClass(Code) | | |
XApplet | public XApplet()(Code) | | A default constructor. 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.
|
addTarget | public void addTarget(String name, Object constraint, int preferredWidth, int preferredHeight)(Code) | | Add a new frame or target area to a frameset
Parameters: name - the frame name Parameters: constraint - the BorderlayoutConstraint Parameters: preferredWidth - the preferred width Parameters: preferredHeight - the preferred height |
addTarget | public void addTarget(XTarget frame, Object constraint)(Code) | | Adds a target frame to the frameset
Parameters: frame - the new traget frame |
displayPage | public XPage displayPage(XPage page)(Code) | | Called when a page has been added or shown via the XPageManager. The page manager
then requests that the applet/application then displays the page in the
appropriate location.
Parameters: page - The XPage which has been loaded. the page being displayed |
displayPage | public XPage displayPage(XPage page, String target)(Code) | | Called when a page has been added or shown via the XPageManager. The page manager
then requests that the applet/application then displays the page in the
appropriate location.
The sequence with which the page transition occurs is as follows:
Find the appropriate target area
Ask the page to make its components non visible (to avoid flicker during the page update)
Set the page size
Save the current page's data by calling 'saveBoundComponentValues
Mark the current page as deactivated, and call the page's deactivated() method
Remove the old page from the container
Add the new page
Update the new page's bindings by calling updateBindings()
Update the new page's data by calling updateBoundComponentValues()
Layout the container and request it to repaint
Show the new page
Mark the new page as activated, and call its pageActivated method
Parameters: page - The XPage which has been loaded. Parameters: target - the area to update the page being displayed |
findTarget | public Container findTarget(String target)(Code) | | Finds the target area for a page display request, this only applies to a
frameset. If there is no frameset the main area or default area is named
'content' and this area is used if null is used as the target name.
Parameters: target - the target area name the container to be updated |
getClientHeight | public int getClientHeight()(Code) | | Get the height of the main window. Retrieved from the startup file or
defaulted
|
getClientWidth | public int getClientWidth()(Code) | | Get the width of the main window. Retrieved from the startup file or
defaulted
|
getFrame | public JFrame getFrame()(Code) | | Gets the Frame containing the applet.
Frame which is the applet or application's parent |
getMenuBar | public static JMenuBar getMenuBar()(Code) | | Get the menubar.
Parameters: mb - |
getNumTargets | public int getNumTargets()(Code) | | Get the number of targets in the container
|
getSecondaryClassLoader | protected XPageLoader getSecondaryClassLoader(String packageName)(Code) | | Construct a new builder and set the default package. XUI sometimes uses
additional class loaders to find the resources needed in a project. By default
XUI uses the XuiBuilder class loader to convert XML files to Java classes.
A custom class loader can be referenced in the startup properties file
using the 'BuilderClass' property. Once this property has been determined
this method will instantiate an instance of that class if necessary.
Parameters: packageName - the name of the default widget package e.g. net.xoetrope.awt,this is normally defined as a result of choosing the appropriate version ofthe XApplet class |
getTarget | public Container getTarget(int idx)(Code) | | Get the target for a page display request. The target areas are stored in
the order in which they were declared or added.
Parameters: idx - the target area the container to be updated |
hidePage | public void hidePage(XPage page)(Code) | | Remove the page from container. The page is simply removed and the container validated.
Parameters: page - |
init | public void init()(Code) | | Invoked when used as an applet. Sets up the startup file and initialises
the application. Reads the applet parameters and calls initialize.
|
initialise | protected void initialise(JFrame f)(Code) | | Generic function which is called from the constructor if it's an application
or from start if its an applet.
The initialization process proceeds in the following order
- Register the component factories
- Setup the project class
- Setup the page manager
- Setup the resource manager
- Setup the style manager
- Size the main window
- Set the layout
- Add a shutdown hook
- Display the main window
Parameters: f - The Frame which acts as the parent.the style manager |
main | public static void main(String args)(Code) | | main method to be invoked as an application. This method is invoked as the
entry point to the 'Application', it is not used if an Applet is being
launched. This method establishes the frame within which the application
runs. If overloading this method remeber to call the setup method.
|
register | protected void register()(Code) | | Load the componentFactories by reading the factory names from the startup
file. The value of the 'NumComponentFactories' is first read and then
the value of ComponentFactory (i.e. ComponentFactory0, ComponentFactory1)
where is the number, starting at zero, of the factory. Each factory is
then instantiated and will be called upon to construct components in the
order in which the factories were registered.
|
setContent | protected void setContent(JFrame f)(Code) | | Load the content into the model. In the process an instance of the default
model data source class is instantiated and reads data from a file pointed
to by the 'ModelData' startup parameter.
Parameters: f - the frame |
setDefaultDataSource | public static void setDefaultDataSource(String className)(Code) | | Sets the default datasource class. The default data source will be used to
provide any initial data for the XModel. Normally this data is static data
that will be used to populate things like lists and provide default values.
Parameters: className - the name of the datasource classe.g. net.xoetrope.data.XDataSource.class, this class reads data from an XML file |
setHome | public void setHome()(Code) | | Set the home page using the startup properties. The home page is established
by combining the two startup properties 'StartPackage' and 'StartClass'. By
default 'StartClass' is set to a value of 'home. Both startup parameters
are optional. Load the first page for the application.
|
setMenuBar | public static void setMenuBar(JMenuBar mb)(Code) | | Set the menubar.
Parameters: mb - |
setResourceFile | protected void setResourceFile(String startFile)(Code) | | Setup the default resource file for the application and load some of the
information in it. The resource file is the startup properties file
Parameters: startFile - The name of the file to be loaded, by default startup.properties |
setup | protected void setup(JFrame frame, String[] args)(Code) | | Setup the applet by setting paths and then initializing the applet. This
method is a stand-in for the main method, processing the commandline
parameters, so that its work is reusable and
does not needed to be redone by derived classes. This method should not be
called directly by user code.
Parameters: frame - the owner frame Parameters: args - the command line arguments |
windowActivated | public void windowActivated(WindowEvent e)(Code) | | Template method, unused at present
|
windowClosed | public void windowClosed(WindowEvent e)(Code) | | Template method, unused at present
|
windowDeactivated | public void windowDeactivated(WindowEvent e)(Code) | | Template method, unused at present
|
windowDeiconified | public void windowDeiconified(WindowEvent e)(Code) | | Template method, unused at present
|
windowIconified | public void windowIconified(WindowEvent e)(Code) | | Template method, unused at present
|
windowOpened | public void windowOpened(WindowEvent e)(Code) | | Template method, unused at present
|
|
|