com.fg.fxapplet
Class FXApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byjavax.swing.JApplet
                      extended bycom.fg.fxapplet.FXApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class FXApplet
extends javax.swing.JApplet

FXApplet Swing applet is a front-end component of distributed XML editor. The applet reads XML Schemas and XML documents from server and sends edited xml content back to the server. The url of schemas and documents along with some additional information can be specified with applet parameters (the applet web-page can be dynamically generated by a servlet) and/or assigned with web-page javascript code. The applet is based upon FXDoubleView component.

Version:
2.0
Author:
Felix Golubov
See Also:
Serialized Form

Field Summary
static java.lang.String BASE_URL
          BASE_URL = "BASE_URL"
Specifies name of applet parameter, which defines relative (to the applet code base) base url of the XML document.
static java.lang.String CONTENT
          XML_DEST = "XML_DEST"
Specifies a name of servlet parameter (see XML_DEST), which holds posted XML content.
static java.lang.String DOC_NAME
          DOC_NAME = "DOC_NAME"
Specifies name of the XML document.
static java.lang.String ELEMENT
          ELEMENT = "ELEMENT"
Specifies name of applet parameter, which defines a root element name for new XML document.
static java.lang.String NAMESPACE
          NAMESPACE = "NAMESPACE"
Specifies name of applet parameter, which defines a root namespace of new XML document.
static java.lang.String ON_LOAD
          ON_LOAD = "ON_LOAD"
Specifies name of a javascript event handler method, which is called when user clicks "Load" button.
static java.lang.String ON_SAVE
          ON_SAVE = "ON_SAVE"
Specifies name of a javascript event handler method, which is called when user clicks "Save" button.
static java.lang.String ON_START
          ON_START = "ON_START"
Specifies name of a javascript event handler method, which is called from the applet start() method.
static java.lang.String XML_DEST
          XML_DEST = "XML_DEST"
Specifies name of applet parameter, which defines a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent.
static java.lang.String XML_SCHEMA
          XML_SCHEMA = "XML_SCHEMA"
Specifies name of applet parameter, which defines relative (to the applet code base) url of the XML Schema document.
static java.lang.String XML_SOURCE
          XML_SOURCE = "XML_SOURCE"
Specifies name of applet parameter, which defines relative (to the applet code base) url of the XML document.
 
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
FXApplet()
           
 
Method Summary
 void destroy()
           
 java.lang.String getAppletInfo()
           
 java.lang.String getBaseURL()
          Method returns relative (to the applet code base) base url of the XML document.
 java.lang.String getDocName()
          Method returns name of the XML document, which will be shown in the left text area at the bottom of the applet when XML document is loaded.
 java.lang.String getElement()
          Method returns root element name for new XML document.
 java.lang.String getNamespace()
          Method returns root namespace of new XML document.
 java.lang.String[][] getParameterInfo()
           
 java.lang.String getXMLDest()
          Method returns a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent.
 java.lang.String getXMLDocumentAsText()
          Method returns edited XML document as text.
 java.lang.String getXMLSchema()
          Method returns relative (to the applet code base) url of the XML Schema document.
 java.lang.String getXMLSource()
          Method returns relative (to the applet code base) url of the XML document.
 void init()
           
 void loadXMLDocument(java.lang.String xmlContent)
          Method loads a text, which contains XML document, to XML editor.
 void setBaseURL(java.lang.String baseURL)
          Method sets relative (to the applet code base) base url of the XML document.
 void setDocName(java.lang.String docName)
          Method sets name of the XML document, which will be shown in the left text area at the bottom of the applet when XML document is loaded.
 void setElement(java.lang.String rootElementName)
          Method sets root element name for new XML document.
 void setNamespace(java.lang.String namespace)
          Method sets root namespace of new XML document.
 void setXMLDest(java.lang.String xmlDest)
          Method sets a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent.
 void setXMLSchema(java.lang.String xmlSchema)
          Method sets relative (to the applet code base) url of the XML Schema document.
 void setXMLSource(java.lang.String xmlSource)
          Method sets relative (to the applet code base) url of the XML document.
 void start()
           
 
Methods inherited from class javax.swing.JApplet
getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, 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, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, 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, 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, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DOC_NAME

public static final java.lang.String DOC_NAME
DOC_NAME = "DOC_NAME"
Specifies name of the XML document. The document name will be shown in the left text area at the bottom of the applet when document is loaded.

See Also:
setDocName(String), getDocName(), Constant Field Values

XML_SCHEMA

public static final java.lang.String XML_SCHEMA
XML_SCHEMA = "XML_SCHEMA"
Specifies name of applet parameter, which defines relative (to the applet code base) url of the XML Schema document. The parameter value will be posted to a servlet (see XML_DEST, setXMLDest(String)) under the same name.

See Also:
setXMLSchema(String), getXMLSchema(), Constant Field Values

XML_SOURCE

public static final java.lang.String XML_SOURCE
XML_SOURCE = "XML_SOURCE"
Specifies name of applet parameter, which defines relative (to the applet code base) url of the XML document. The parameter value will be posted to a servlet (see XML_DEST, setXMLDest(String)) under the same name. The XML_SOURCE parameter is mutually exclusive with NAMESPACE and ELEMENT parameters.

See Also:
setXMLSource(String), getXMLSource(), Constant Field Values

BASE_URL

public static final java.lang.String BASE_URL
BASE_URL = "BASE_URL"
Specifies name of applet parameter, which defines relative (to the applet code base) base url of the XML document. The parameter has to be specified when value of XML_DEST parameter represents sevlet url (and thus can't be used as base url). The parameter value will be posted to a servlet (see XML_DEST, setXMLDest(String)) under the same name.

See Also:
setBaseURL(String), getBaseURL(), Constant Field Values

NAMESPACE

public static final java.lang.String NAMESPACE
NAMESPACE = "NAMESPACE"
Specifies name of applet parameter, which defines a root namespace of new XML document. The parameter requires ELEMENT parameter to be specified and it is mutually exclusive with XML_SOURCE parameter. The parameter value will be posted to a servlet (see XML_DEST, setXMLDest(String)) under the same name.

See Also:
setNamespace(String), getNamespace(), Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
ELEMENT = "ELEMENT"
Specifies name of applet parameter, which defines a root element name for new XML document. The parameter requires NAMESPACE parameter to be specified and it is mutually exclusive with XML_SOURCE parameter. The parameter value will be posted to a servlet (see XML_DEST, setXMLDest(String)) under the same name.

See Also:
setElement(String), getElement(), Constant Field Values

XML_DEST

public static final java.lang.String XML_DEST
XML_DEST = "XML_DEST"
Specifies name of applet parameter, which defines a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent.

See Also:
setXMLDest(String), getXMLDest(), Constant Field Values

CONTENT

public static final java.lang.String CONTENT
XML_DEST = "XML_DEST"
Specifies a name of servlet parameter (see XML_DEST), which holds posted XML content.

See Also:
Constant Field Values

ON_START

public static final java.lang.String ON_START
ON_START = "ON_START"
Specifies name of a javascript event handler method, which is called from the applet start() method. If parameter is not specified, the applet loads xml document from the XML_SOURCE url (if specified), otherwise the javascript code may load the xml document by calling loadXMLDocument(String). The javascript method has to have a single parameter, which is the FXApplet reference.

See Also:
Constant Field Values

ON_LOAD

public static final java.lang.String ON_LOAD
ON_LOAD = "ON_LOAD"
Specifies name of a javascript event handler method, which is called when user clicks "Load" button. If parameter is not specified, the applet loads xml document from the XML_SOURCE url (if specified), otherwise the javascript code may load the xml document by calling loadXMLDocument(String). The javascript method has to have a single parameter, which is the FXApplet reference.

See Also:
Constant Field Values

ON_SAVE

public static final java.lang.String ON_SAVE
ON_SAVE = "ON_SAVE"
Specifies name of a javascript event handler method, which is called when user clicks "Save" button. If parameter is not specified, the applet saves xml document using servlet url, specified with XML_DEST parameter, otherwise the javascript code may retrieve xml document as text (see getXMLDocumentAsText()) and submit it with an HTML form. The javascript method has to have a single parameter, which is the FXApplet reference.

See Also:
Constant Field Values
Constructor Detail

FXApplet

public FXApplet()
Method Detail

setDocName

public void setDocName(java.lang.String docName)
Method sets name of the XML document, which will be shown in the left text area at the bottom of the applet when XML document is loaded. (Initial value of the document name can be set with DOC_NAME applet parameter.) Method is intended to be called from a javascript code.

Parameters:
docName - a String name of the XML document
See Also:
DOC_NAME, getDocName()

getDocName

public java.lang.String getDocName()
Method returns name of the XML document, which will be shown in the left text area at the bottom of the applet when XML document is loaded. Method is intended to be called from a javascript code.

Returns:
an XML document name
See Also:
XML_SCHEMA, setXMLSchema(String)

setXMLSchema

public void setXMLSchema(java.lang.String xmlSchema)
Method sets relative (to the applet code base) url of the XML Schema document. (Initial value of the XML Schema url can be set with XML_SCHEMA applet parameter.) Method is intended to be called from a javascript code.

Parameters:
xmlSchema - a String represents relative url of the XML Schema document
See Also:
XML_SCHEMA, getXMLSchema()

getXMLSchema

public java.lang.String getXMLSchema()
Method returns relative (to the applet code base) url of the XML Schema document. Method is intended to be called from a javascript code.

Returns:
relative url of the XML Schema document
See Also:
XML_SCHEMA, setXMLSchema(String)

setXMLSource

public void setXMLSource(java.lang.String xmlSource)
Method sets relative (to the applet code base) url of the XML document. (Initial value of the XML document URL can be set with XML_SOURCE applet parameter.) The url may be either file url or servlet url with query string. Method is intended to be called from a javascript code.

Parameters:
xmlSource - a String represents relative url of the XML document
See Also:
XML_SOURCE, getXMLSource()

getXMLSource

public java.lang.String getXMLSource()
Method returns relative (to the applet code base) url of the XML document. Method is intended to be called from a javascript code.

Returns:
relative url of the XML document
See Also:
XML_SOURCE, setXMLSource(String)

setBaseURL

public void setBaseURL(java.lang.String baseURL)
Method sets relative (to the applet code base) base url of the XML document. (Initial value of the XML document URL can be set with BASE_URL applet parameter.) The value has to be set when "XMLSource" url represents sevlet url (and thus can't be used as base url). Method is intended to be called from a javascript code.

Parameters:
baseURL - a String represents relative base url of the XML document
See Also:
BASE_URL, getBaseURL(), XML_SOURCE, setXMLSource(String), getXMLSource()

getBaseURL

public java.lang.String getBaseURL()
Method returns relative (to the applet code base) base url of the XML document. Method is intended to be called from a javascript code.

Returns:
relative base url of the XML document
See Also:
BASE_URL, setBaseURL(String)

setNamespace

public void setNamespace(java.lang.String namespace)
Method sets root namespace of new XML document. (Initial value of the root namespace can be set with NAMESPACE applet parameter.) To open a new document, a user code has to set both root namespace and root element name (see ELEMENT, setElement(String)) and make sure that XML source is set to null (see XML_SOURCE, setXMLSource(String), getXMLSource()). Method is intended to be called from a javascript code.

Parameters:
namespace - a root namespace of new XML document
See Also:
NAMESPACE, getNamespace()

getNamespace

public java.lang.String getNamespace()
Method returns root namespace of new XML document. Method is intended to be called from a javascript code.

Returns:
root namespace of new XML document
See Also:
NAMESPACE, setNamespace(String)

setElement

public void setElement(java.lang.String rootElementName)
Method sets root element name for new XML document. (Initial value of the root element name can be set with ELEMENT applet parameter.) To open a new document, a user code has to set both root namespace and root element name (see NAMESPACE, setNamespace(String)) and make sure that XML source is set to null (see XML_SOURCE, setXMLSource(String), getXMLSource()). Method is intended to be called from a javascript code.

Parameters:
rootElementName - a root element name for new XML document
See Also:
ELEMENT, getElement()

getElement

public java.lang.String getElement()
Method returns root element name for new XML document. Method is intended to be called from a javascript code.

Returns:
root element name for new XML document
See Also:
ELEMENT, setElement(String)

setXMLDest

public void setXMLDest(java.lang.String xmlDest)
Method sets a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent. (Initial value of can be set with XML_DEST applet parameter.) Method is intended to be called from a javascript code.

Parameters:
xmlDest - a relative url of servlet, to which edited XML document will be sent
See Also:
XML_DEST, getXMLDest()

getXMLDest

public java.lang.String getXMLDest()
Method returns a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent. Method is intended to be called from a javascript code.

Returns:
a relative (to the applet code base) url of servlet (with query string), to which edited XML document will be sent
See Also:
XML_DEST, setXMLDest(String)

init

public void init()

start

public void start()

loadXMLDocument

public void loadXMLDocument(java.lang.String xmlContent)
Method loads a text, which contains XML document, to XML editor. Method should be called after XML Schema URL and Base URL are set. If xmlContent value equals null or empty string, then the method call loads XML document from remote source with url set by XML_SOURCE parameter or setXMLSource(String) method.

Parameters:
xmlContent - a text, which contains XML document
See Also:
XML_SCHEMA, setXMLSchema(String), BASE_URL, setBaseURL(String), getXMLDocumentAsText()

getXMLDocumentAsText

public java.lang.String getXMLDocumentAsText()
Method returns edited XML document as text. Method is intended to be called from a javascript code.

Returns:
edited XML document as text
See Also:
loadXMLDocument(String)

getAppletInfo

public java.lang.String getAppletInfo()

getParameterInfo

public java.lang.String[][] getParameterInfo()

destroy

public void destroy()