Class ReadableXML

  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by issrg.utils.gui.xml.ReadableXML
All Implemented Interfaces:
XMLChangeListener, java.awt.image.ImageObserver, java.awt.MenuContainer,, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:

public abstract class ReadableXML
extends javax.swing.JPanel
implements XMLChangeListener

This abstract class defines the component that will contain an XML Transformation with an XSL file. It is implemented as an abstract file so as not to limit its functionality just to one XSL transformation.

The component presents the transformation, on a JEditorPane situated on the extended JPanel. The transformation would result in an HTML document, that could be easily displayed by these components.

This component is made to be a registered XMLChangeListener, so as to update itself in real time on any modifications that have occurred to the section of XML that it is representing.

Christian Azzopardi
See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
Nested classes/interfaces inherited from class java.awt.Container
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Field Summary
 javax.swing.JEditorPane editorPane
          The component that can render html.
 java.lang.String mimeType
 javax.swing.JScrollPane scrollPane
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
ReadableXML(XMLEditor xmlED, java.lang.String nodeName, java.lang.String mimeType)
          Creates a new instance of ReadableXML and initialises the JPanel super class.
Method Summary
abstract  java.lang.String getStyle()
          An abstract method, that when overridden will return the path to the style that the XML will be transformed with.
 boolean getXML()
          Method that actually loads the XML document to transform.
 XMLEditor getXMLEditor()
 boolean isEmpty()
          This method returns true if the result of the last transformation resulted in an empty XML.
 void setEmpty(boolean em)
 void setXMLEditor(XMLEditor xmlED)
          Sets the XML Editor by removing the previously one that was set, and setting the one that was just passed.
 void XMLChanged(XMLChangeEvent ev)
          When an XMLChangeEvent is received, instruction is given to refresh the contents of this component.
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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


public javax.swing.JEditorPane editorPane
The component that can render html. Therefore will be the output of this component.


public javax.swing.JScrollPane scrollPane


public java.lang.String mimeType
Constructor Detail


public ReadableXML(XMLEditor xmlED,
                   java.lang.String nodeName,
                   java.lang.String mimeType)
Creates a new instance of ReadableXML and initialises the JPanel super class. The JEditor Instance is placed on the JPanel, and the transformation is output as 'text/html'

The nodename can be specified depending on the style sheets, recognised Node Names. If the nodename is passed as an empty string, the transformation will occur to the whole XML Document. Otherwise if a particular node is passed, the style transformation will only happen to that particular node.

This is useful as it can transform the sub-policy that is being modified at the moment, and can be displayed to the user so he would be informed of his modifications to the XML policy.

xmlED - the XML Editor Reference
nodeName - the name of the XML Node to convert to readable policy
Method Detail


public abstract java.lang.String getStyle()
An abstract method, that when overridden will return the path to the style that the XML will be transformed with.

the style transformation that the XML will be transformed with.


public void setXMLEditor(XMLEditor xmlED)
Sets the XML Editor by removing the previously one that was set, and setting the one that was just passed. This method then requests that the transformed output is refreshed.

xmlED -


public XMLEditor getXMLEditor()


public void XMLChanged(XMLChangeEvent ev)
When an XMLChangeEvent is received, instruction is given to refresh the contents of this component.

Specified by:
XMLChanged in interface XMLChangeListener


public boolean isEmpty()
This method returns true if the result of the last transformation resulted in an empty XML.


public void setEmpty(boolean em)


public boolean getXML()
Method that actually loads the XML document to transform.

It checks if the nodeName is empty. If it is, it will search for the root element of the XML document. If it is not the root element will be set to nodeName.

The Transformation takes place under the transformer that was declared in this class's Constructor. Position of Cursor is always set at the beggining of the transformed Document.

This method performs a transformation of the XML into a readable form. It returns the result of isEmpty(), i.e. it returns true, if the transformation resulted in an empty XML.

boolean specifying if XML is empty or not.