|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet javax.swing.JApplet net.xoetrope.swing.XApplet
public class XApplet
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
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JApplet |
---|
javax.swing.JApplet.AccessibleJApplet |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected java.awt.Window |
appWindow The application window |
protected boolean |
bUseWindow true if a popup window is in use |
protected javax.swing.JFrame |
clientFrame the application frame |
protected int |
clientHeight The height of the client area |
protected int |
clientWidth The width of the client area |
protected java.lang.Class |
defaultSourceClass The default model data source class |
protected XDataSource |
modelDataSource The model data source |
protected XPageManager |
pageMgr The page manager |
Fields inherited from class javax.swing.JApplet |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
XApplet() A default constructor. |
Method Summary | |
---|---|
XContentHolder |
addTarget(java.lang.String name, java.lang.Object constraint, int preferredWidth, int preferredHeight, java.util.Hashtable params) Add a new frame or target area to a frameset |
java.lang.Object |
displayPage(PageSupport page) Called when a page has been added or shown via the XPageManager. |
java.lang.Object |
displayPage(PageSupport pageObj, java.lang.String target) Called when a page has been added or shown via the XPageManager. |
java.lang.Object |
findTarget(java.lang.String target) Finds the target area for a page display request, this only applies to a frameset. |
int |
getClientHeight() Get the height of the main window. |
int |
getClientWidth() Get the width of the main window. |
javax.swing.JFrame |
getFrame() Gets the Frame containing the applet. |
javax.swing.JMenuBar |
getMenuBar() Get the menubar. |
int |
getNumTargets() Get the number of targets in the container |
protected XPageLoader |
getSecondaryClassLoader(java.lang.String packageName) Construct a new builder and set the default package. |
java.lang.Object |
getTarget(int idx) Get the target for a page display request. |
void |
hidePage(XPage page) Remove the page from container. |
void |
init() Invoked when used as an applet. |
protected void |
initialise(javax.swing.JFrame f) Generic function which is called from the constructor if it's an application or from start if its an applet. |
protected static void |
loadUI(java.lang.String[] args) Do the actual work of loading the UI |
static void |
main(java.lang.String[] args) main method to be invoked as an application. |
protected void |
register() Load the componentFactories by reading the factory names from the startup file. |
void |
removeAllTargets() Remove all frames/targets from the current frameset |
protected void |
setContent(javax.swing.JFrame f) Load the content into the model. |
void |
setDefaultDataSource(java.lang.String className) Sets the default datasource class. |
void |
setHome() Set the home page using the startup properties. |
void |
setMenuBar(javax.swing.JMenuBar mb) Set the menubar. |
protected void |
setResourceFile(java.lang.String startFile) Setup the default resource file for the application and load some of the information in it. |
protected void |
setup(javax.swing.JFrame frame, java.lang.String[] args) Setup the applet by setting paths and then initializing the applet. |
void |
windowActivated(java.awt.event.WindowEvent e) Template method, unused at present |
void |
windowClosed(java.awt.event.WindowEvent e) Template method, unused at present |
void |
windowClosing(java.awt.event.WindowEvent e) Exit the application |
void |
windowDeactivated(java.awt.event.WindowEvent e) Template method, unused at present |
void |
windowDeiconified(java.awt.event.WindowEvent e) Template method, unused at present |
void |
windowIconified(java.awt.event.WindowEvent e) Template method, unused at present |
void |
windowOpened(java.awt.event.WindowEvent e) Template method, unused at present |
Methods inherited from class javax.swing.JApplet |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.applet.Applet |
---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.awt.Window appWindow
protected javax.swing.JFrame clientFrame
protected XPageManager pageMgr
protected boolean bUseWindow
protected XDataSource modelDataSource
protected java.lang.Class defaultSourceClass
protected int clientWidth
protected int clientHeight
Constructor Detail |
---|
public XApplet()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- the command line argumentsprotected static void loadUI(java.lang.String[] args)
args
-protected void setup(javax.swing.JFrame frame, java.lang.String[] args)
frame
- the owner frameargs
- the command line argumentsprotected XPageLoader getSecondaryClassLoader(java.lang.String packageName)
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.
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 of the XApplet classpublic void setDefaultDataSource(java.lang.String className)
className
- the name of the datasource class e.g. net.xoetrope.data.XDataSource.class, this class reads data from an XML fileprotected void setResourceFile(java.lang.String startFile)
startFile
- The name of the file to be loaded, by default startup.propertiespublic void init()
init
in class java.applet.Applet
public javax.swing.JFrame getFrame()
protected void initialise(javax.swing.JFrame f)
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 orderf
- The Frame which acts as the parent. the style managerprotected void register()
protected void setContent(javax.swing.JFrame f)
f
- the framepublic void setHome()
public java.lang.Object displayPage(PageSupport page)
displayPage
in interface XPageDisplay
page
- The XPage which has been loaded.public java.lang.Object displayPage(PageSupport pageObj, java.lang.String target)
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:
displayPage
in interface XPageDisplay
pageObj
- the page to displaytarget
- the area to updatepublic void hidePage(XPage page)
page
- the page to hidepublic java.lang.Object findTarget(java.lang.String target)
findTarget
in interface XPageDisplay
target
- the target area namepublic java.lang.Object getTarget(int idx)
getTarget
in interface XPageDisplay
idx
- the target areapublic int getNumTargets()
getNumTargets
in interface XPageDisplay
public XContentHolder addTarget(java.lang.String name, java.lang.Object constraint, int preferredWidth, int preferredHeight, java.util.Hashtable params)
addTarget
in interface XPageDisplay
name
- the frame nameconstraint
- the BorderlayoutConstraintpreferredWidth
- the preferred widthpreferredHeight
- the preferred heightparams
- extra parameters for the targetpublic void removeAllTargets()
removeAllTargets
in interface XPageDisplay
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing
in interface java.awt.event.WindowListener
e
- the window eventpublic int getClientWidth()
public int getClientHeight()
public void setMenuBar(javax.swing.JMenuBar mb)
mb
- the new menu barpublic javax.swing.JMenuBar getMenuBar()
public void windowActivated(java.awt.event.WindowEvent e)
windowActivated
in interface java.awt.event.WindowListener
e
- the window eventpublic void windowClosed(java.awt.event.WindowEvent e)
windowClosed
in interface java.awt.event.WindowListener
e
- the window eventpublic void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified
in interface java.awt.event.WindowListener
e
- the window eventpublic void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated
in interface java.awt.event.WindowListener
e
- the window eventpublic void windowIconified(java.awt.event.WindowEvent e)
windowIconified
in interface java.awt.event.WindowListener
e
- the window eventpublic void windowOpened(java.awt.event.WindowEvent e)
windowOpened
in interface java.awt.event.WindowListener
e
- the window event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |