com.japisoft.xmlpad
Class XMLContainer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.japisoft.xmlpad.XMLContainer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, IXMLPanel, java.awt.MenuContainer, java.io.Serializable

public class XMLContainer
extends javax.swing.JPanel
implements IXMLPanel

This is the main component for the XMLEditor. This container manages a toolbar thanks to the ToolBarModel, a tree for real time tree location and a minimal status bar. It contains also the main editor. As a split function is supported, 2 editors are managed. The current one is always available by the getEditor method.

User can know the current documeent location and state with the LocationListener and DocumentStateListener. It is possible to disable the default status bar to use your own by calling setStatusBarAvailable( false ). The same thing for the error panel by calling setErrorPanelAvailable( false ).

If you have an external toolBar, you must disable the default one by calling setToolBarAvailable(false)

If you wish the custom the default popups content or the default toolBar content, use the PopupModel or the ToolBarModel It is advised to use such model only if you want to use several editors with non common action. On the contrary managed it inside the ActionModel.
myContainer.getToolBarModel().addAction( myAction ) or myContainer.getPopupModel().addAction( myAction ) or myContainer.getTreePopupModel().addAction( myTreeAction )

You can act on the default indentation for tab/untab and the FormatAction by calling

// Reset the indentation size ActionModel.setProperty( ActionModel.FORMAT_ACTION, Properties.INDENT_SIZE_PROPERTY, new Integer( 1 ) ); // Reset the indentation character ActionModel.setProperty( ActionModel.FORMAT_ACTION, Properties.INDENT_CHAR_PROPERTY, new Character( '\t' ) );

` An ElementView is a way to show any tree element node. This ElementView can be customized by implanting the ElementView interface and calling the setElementView from the XMLContainer before showing it. You can remove the default ElementView calling setElementView( null ) on your XMLContainer instance. This ElementView can be editable or non editable, by default the element view is editable, however you can disable it calling from your XMLContainer instance getElementView().setEditable( false ).

usage samples :

// Simple usage
 JJFrame frame = new JFrame();
  XMLContainer container = new XMLContainer();
  container.getAccessibility().setText( "<?version='1.0'?> <test> </test>" );
  frame.getContentPane().add( container )
  
  // Load a known XMLfile
  XMLContainer container = new XMLContainer();
  container.getAccessibility().read( new FileReader( "myFile.xml" ) );
  frame.getContentPane().add( container )
  
// JInternal frame usage
 JInternalFrame editorFrameOne = new JInternalFrame();
  // This constructor avoids XMLContainer for freeing automatically its inner reference
  editor1 = new XMLContainer( false );
  editorFrameOne.getContentPane().add( editor1 );
 
 // Using a theme
 com.japisoft.xmlpad.look.themes.BlueTheme.install();
 JFrame fr = new JFrame();
 fr.getContentPane().add( new XMLContainer() );
 

Please consult JAPISoft site and forum for API news and forum : http://www.japisoft.com

Version:
2.2 RC2
Author:
(c) 2002-2003 JAPISoft
See Also:
JPanel, LocationListener, DocumentStateLeistener, ToolBarModel, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
XMLContainer()
          Create a new XMLContainer, all components are created by the default ComponentFactory
XMLContainer(boolean autoDisposeMode)
          Create a new XMLContainer. if autoDisposeMode is false, XMLContainer will free no resource automatically.
 
Method Summary
 void addDocumentStateListener(DocumentStateListener listener)
          Add listener for document parsing state : error or not
 void addLocationListener(LocationListener listener)
          Deprecated. Use setLocationListener
 void addNavigationHistoryPath(java.lang.String path)
          Store a new navigation XPath value.
 void addNotify()
          This method call the init method for connection listeners to components
 void cleanNavigationHistoryPath()
          Reset the navigation path
 void dispose()
          Remove all listeners/component connection.
 boolean editNode()
          Edit the current node with the EditorModel API.
 boolean editNode(com.japisoft.fastparser.node.SimpleNode currentNode)
          Edit the provided node with the EditorModel API.
 Accessibility getAccessibility()
           
 java.lang.String getCurrentDocumentLocation()
           
 java.lang.String getCurrentDTD()
           
 java.lang.String getCurrentDTDRoot()
           
 javax.swing.JPopupMenu getCurrentPopup()
           
 java.lang.String getCurrentSchema()
           
 java.lang.String getCurrentSchemaRoot()
           
 javax.swing.JPopupMenu getCurrentTreePopup()
           
 java.lang.String getDefaultDTDLocation()
           
 java.lang.String getDefaultDTDRoot()
           
 java.lang.String getDefaultSchemaLocation()
           
 java.lang.String getDefaultSchemaRoot()
           
 XMLDocument getDocument()
           
 XMLDocumentInfo getDocumentInfo()
           
 XMLIntegrity getDocumentIntegrity()
           
 java.lang.String getDTDLocation(boolean resolve)
           
 DTDMapper getDTDMapper()
           
 XMLEditor getEditor()
           
 EditorContext getEditorContext()
          For inner usage only
 ElementView getElementView()
           
 com.japisoft.fastparser.node.SimpleNode getLastDocumentLocation()
           
 com.japisoft.fastparser.node.SimpleNode getLastNodeParsed()
           
 XMLContainer getMainContainer()
           
 int getNavigationHistoryLimit()
           
 javax.swing.undo.UndoManager getNewUndoRedoManager()
           
 PopupModel getPopupModel()
          User can add/remove dynamically action by acting on this model.
 java.util.Iterator getProperties()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.Object getProperty(java.lang.String name, java.lang.Object def)
           
 RealTimeTreeManager getRealTimeTreeManager()
           
 java.lang.String getRelaxNGValidationLocation()
           
 java.lang.String getSchemaLocation(boolean resolve)
           
 XMLContainer getSubContainer(java.lang.String type)
           
 SyntaxHelper getSyntaxHelper()
           
 XMLTemplate getTemplate()
           
 java.lang.String getText()
          Deprecated. use getAccessibility().getText()
 javax.swing.JToolBar getToolBar()
           
 ToolBarModel getToolBarModel()
          User can add/remove dynamically action by acting on this model.
 javax.swing.JTree getTree()
           
 PopupModel getTreePopupModel()
           
 javax.swing.JComponent getView()
           
 boolean hasErrorMessage()
           
 boolean hasSyntaxCompletion()
           
 boolean hasTextSelection()
           
 boolean isAutoDisposeMode()
           
 boolean isAutoFocus()
           
 boolean isEditable()
          By default return true
 boolean isEnabledTreeLocation()
          Is Enabled the view of the tree location in the status bar ?
 boolean isErrorPanelAvailable()
           
 boolean isPopupAvailable()
           
 boolean isRealTimeTreeOnTextChange()
           
 boolean isSplit()
           
 boolean isStatusBarAvailable()
           
 boolean isToolBarAvailable()
           
 boolean isToolBarVisible()
           
 boolean isTreePopupAvailable()
           
 boolean isTreeVisible()
           
static void main(java.lang.String[] args)
           
 java.lang.String nextNavigationHistoryPath()
          Change the navigation history cursor and return the next navigation path.
 void notifyCaretListener(int col, int line)
          Notify to all CaretListener that the current caret location has changed.
 void notifyDocumentStateError(java.lang.String message, int line, boolean temporary)
          Notify all DocumentStateListener about the parsing state: A null value means no error.
 void notifyDocumentVersion(boolean newOne)
          Notify that a new document has been inserted or the current one has been altered once.
 void notifyLocationListener(LocationEvent event)
          Notify to all LocationListener that the current document location has changed.
 void paintComponent(java.awt.Graphics gc)
           
 java.lang.String previousNavigationHistoryPath()
          Change the navigation history cursor and return the previous navigation path.
 void refreshUndoRedoState()
          Update undo/redo button state
 void removeDocumentStateListener(DocumentStateListener listener)
          Remove a listener
 void removeLocationListener(LocationListener listener)
          Remove a listener
 void removeNavigationHistoryPath(java.lang.String path)
          Remove this XPath navigation value.
 void removeNotify()
          This method calls the dispose method for freeing ressource
 void requestFocus()
           
 void resetDefaultToolBarActions()
          Update the toolbarModel adding separator.
 void resetEditor(XMLEditor editor)
          Particular case for using the good editor with focus.
 void resetProperties(java.util.HashMap map)
          Reset the inner properties
 boolean searchAndParseDTD()
          Search inside the current document a DTD and parses it for syntax helper.
 boolean searchAndParseSchema()
          Search and parse a schema from the current document
 void setAutoDisposeMode(boolean disposeMode)
          Set JXMLPad in a special mode for freeing internal resource.
 void setAutoFocus(boolean autoFocus)
          If true when the setText method is called the current editor gets the focus.
 void setAutoNewDocument(boolean autoNew)
          Decide to initialize the XMLContainer calling the new action.
 void setAutoResetAction(boolean autoResetAction)
          Here a way to reset all XMLAction from the current XMLEditor focus.
 void setCaretListener(CaretListener listener)
          Add a listener for giving information about the current caret location
 void setColorForAttribute(java.lang.String attribute, java.awt.Color c)
          Choose a particular color for this attribute
 void setColorForPrefix(java.lang.String prefix, java.awt.Color c)
          Choose a particular color for this namespace prefix
 void setColorForTag(java.lang.String tag, java.awt.Color c)
          Choose a particular color for this tag
 void setCurrentDocumentLocation(java.lang.String location)
          Reset the current document location.
 void setDefaultDTD(java.lang.String dtdRoot, java.lang.String dtd)
          Reset the default document DTD location
 void setDefaultSchema(java.lang.String root, java.lang.String location)
          Reset the default schema root tag and document location (url or file path)
 void setDocumentInfo(XMLDocumentInfo info)
          Reset the current documentation info.
 void setDocumentIntegrity(XMLIntegrity integrity)
          This objet contains data for avoiding to corrupt the current document.
 void setDTD(java.lang.String dtdRoot, java.lang.String dtdLocation)
          Reset the current dtd root and dtd location by this one.
 void setDTDMapper(DTDMapper mapper)
          Reset a map between URL and local path.
 void setEditable(boolean editable)
          The document is only readable for true
 void setElementView(ElementView view)
          Set a view fo visualizing an XML element under the tree. if view is null no view will be available
 void setEnabledRealTimeStructureChanged(boolean support)
          Synchronize the tree each time the text has significatif change.
 void setEnabledTreeLocation(boolean location)
          Enable the view of the tree location in the status bar
 void setEnabledTreeLocationForCaret(boolean rt)
          Enable the tree selection for each text caret change.
 void setErrorPanelAvailable(boolean errorPanel)
          Choose to show a minimal panel for each parsing error with a comment line.
 void setFocusView(boolean focusView)
           
 void setLastNodeParsed(com.japisoft.fastparser.node.SimpleNode node)
          Provides the last parsed node.
 void setLocationListener(LocationListener listener)
          Set a listener for giving information about the current document location
 void setModifiedState(boolean state)
          Update this container state if the document has been changed
 void setNavigationHistoryLimit(int limit)
          Set the navigation limit.
 void setPopableErrorMode(boolean popableErrorMode)
          By default to false, this mode will open a dialog box for each parsing error with the parsing error message
 void setPopupAvailable(boolean popupAvailable)
          Create a default popup.
 void setProperty(java.lang.String name, java.lang.Object content)
          Store a property inside this container.
 void setRealTimeTreeOnTextChange(boolean realTimeTreeOnTextChange)
          If you use the false value the tree will only be updated for each return key.
 void setRelaxNGValidationLocation(java.lang.String location)
          Reset the current RelaxNG document path for validating the current document.
 void setSchema(java.lang.String schemaRoot, java.lang.String schemaLocation)
          Reset the current schema location
 void setSplit(boolean split)
          if true, it will split the current editors in two one else it will unsplit the two current editors in only one
 void setStatusBarAvailable(boolean statusBar)
          Choose to show a minimal statusbar with the current location.
 void setSyntaxCompletion(boolean syntaxCompletion)
          Enabled/Disabled syntax completion.
 void setTemplate(XMLTemplate template)
          Template for the 'new' operation
 void setText(java.lang.String text)
          Deprecated. use getAccessibility().setText()
 void setToolBarAvailable(boolean toolBarAvailable)
          Create a default toolbar.
 void setToolBarVisible(boolean toolbarVisible)
          Show or hide the default toolbar.
 void setTreePopupAvailable(boolean treePopupAvailable)
          Reset the tree popup.
 void setTreeVisible(boolean treeVisible)
          Show or hide the location tree.
 void showPopup(java.awt.Component c, int x, int y)
          Show a popup.
 void split()
          Split the current editor in two ones or unsplit it
 void unsetCaretListener()
          Remove a listener
 void unsetLocationListener()
          Remove a listener
 void unSplit()
          Show only one editor
 void updateNavigationHistoryState()
          Update the previous, next action status from the current context
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMLContainer

public XMLContainer()
Create a new XMLContainer, all components are created by the default ComponentFactory


XMLContainer

public XMLContainer(boolean autoDisposeMode)
Create a new XMLContainer. if autoDisposeMode is false, XMLContainer will free no resource automatically. But you will have to call dispose to conclude the usage for freeing all inner reference and help the garbage collector to do the best job

Method Detail

getView

public javax.swing.JComponent getView()
Specified by:
getView in interface IXMLPanel
Returns:
itselft

getMainContainer

public XMLContainer getMainContainer()
Specified by:
getMainContainer in interface IXMLPanel
Returns:
the main container. This is itself

getSubContainer

public XMLContainer getSubContainer(java.lang.String type)
Specified by:
getSubContainer in interface IXMLPanel
Returns:
a sub container for this document type. This is itself

hasSyntaxCompletion

public boolean hasSyntaxCompletion()
Returns:
true if this container will manage syntax completion

setSyntaxCompletion

public void setSyntaxCompletion(boolean syntaxCompletion)
Enabled/Disabled syntax completion. By default true


setElementView

public void setElementView(ElementView view)
Set a view fo visualizing an XML element under the tree. if view is null no view will be available


getElementView

public ElementView getElementView()
Returns:
the current view for visualizing an element

setTemplate

public void setTemplate(XMLTemplate template)
Template for the 'new' operation


getTemplate

public XMLTemplate getTemplate()
Returns:
the default template for the 'new' operation. If user has no specify a template, a new one is created

setDocumentInfo

public void setDocumentInfo(XMLDocumentInfo info)
Reset the current documentation info. This objet contains a set of information like the file filter about editable document. If a template is found inside this info, it will replace the current XMLTemplate

Parameters:
info -

getDocumentInfo

public XMLDocumentInfo getDocumentInfo()
Returns:
the current document info

setLastNodeParsed

public void setLastNodeParsed(com.japisoft.fastparser.node.SimpleNode node)
Provides the last parsed node. This is for internal usage only, so don't override it or call it.


getLastNodeParsed

public com.japisoft.fastparser.node.SimpleNode getLastNodeParsed()
Returns:
the last parsed document. This is for internal usage only

getToolBarModel

public ToolBarModel getToolBarModel()
User can add/remove dynamically action by acting on this model.

Returns:
the model for the default toolBar

getPopupModel

public PopupModel getPopupModel()
User can add/remove dynamically action by acting on this model.

Returns:
the model for the default popup

getTreePopupModel

public PopupModel getTreePopupModel()

getSyntaxHelper

public SyntaxHelper getSyntaxHelper()
Returns:
the current SyntaxHelper. This helper is used for showing a popup for available tags or entities choice

getTree

public javax.swing.JTree getTree()
Returns:
the current XML tree view

getEditorContext

public EditorContext getEditorContext()
For inner usage only


setNavigationHistoryLimit

public void setNavigationHistoryLimit(int limit)
Set the navigation limit. By default to 10


getNavigationHistoryLimit

public int getNavigationHistoryLimit()
Returns:
the navigation history limit

addNavigationHistoryPath

public void addNavigationHistoryPath(java.lang.String path)
Store a new navigation XPath value. This action will updat the navigation cursor to the new one


removeNavigationHistoryPath

public void removeNavigationHistoryPath(java.lang.String path)
Remove this XPath navigation value. This action will update the navigation cursor to the last one


updateNavigationHistoryState

public void updateNavigationHistoryState()
Update the previous, next action status from the current context


cleanNavigationHistoryPath

public void cleanNavigationHistoryPath()
Reset the navigation path


previousNavigationHistoryPath

public java.lang.String previousNavigationHistoryPath()
Change the navigation history cursor and return the previous navigation path. It will return null if the previous path is not available


nextNavigationHistoryPath

public java.lang.String nextNavigationHistoryPath()
Change the navigation history cursor and return the next navigation path. If will return null if the next path is not available


searchAndParseDTD

public boolean searchAndParseDTD()
Search inside the current document a DTD and parses it for syntax helper. It will return true if the DTD is found


searchAndParseSchema

public boolean searchAndParseSchema()
Search and parse a schema from the current document


setFocusView

public void setFocusView(boolean focusView)

paintComponent

public void paintComponent(java.awt.Graphics gc)

requestFocus

public void requestFocus()

getCurrentDTD

public java.lang.String getCurrentDTD()
Returns:
the current DTD location

getCurrentDTDRoot

public java.lang.String getCurrentDTDRoot()
Returns:
the current DTD root

setDefaultDTD

public void setDefaultDTD(java.lang.String dtdRoot,
                          java.lang.String dtd)
Reset the default document DTD location

Parameters:
dtdRoot - The DTD Root element
dtd - The DTD path or URL

getCurrentSchema

public java.lang.String getCurrentSchema()
Returns:
the current schema location

getCurrentSchemaRoot

public java.lang.String getCurrentSchemaRoot()
Returns:
the current schema root

setSchema

public void setSchema(java.lang.String schemaRoot,
                      java.lang.String schemaLocation)
Reset the current schema location

Parameters:
schemaLocation - Schema URL or current document relative location

setDTD

public void setDTD(java.lang.String dtdRoot,
                   java.lang.String dtdLocation)
Reset the current dtd root and dtd location by this one. This is done automatically for a new document and for parsing action. If you want default dtd, call rather the setDefaultDTD method


setDTDMapper

public void setDTDMapper(DTDMapper mapper)
Reset a map between URL and local path. This is only useful for avoiding external access to DTD

Parameters:
mapper - By default null

getDTDMapper

public DTDMapper getDTDMapper()
Returns:
a mapper for DTD. By default null

getDefaultDTDRoot

public java.lang.String getDefaultDTDRoot()
Returns:
the current DTD root element

getDefaultDTDLocation

public java.lang.String getDefaultDTDLocation()
Returns:
the current DTDLocation built with the current document location

getDTDLocation

public java.lang.String getDTDLocation(boolean resolve)
Parameters:
resolve - if true the location is built using the current document location
Returns:
the current DTD location. This DTD location can take into account relative document location

getDefaultSchemaLocation

public java.lang.String getDefaultSchemaLocation()
Returns:
the default schema file/url location

getDefaultSchemaRoot

public java.lang.String getDefaultSchemaRoot()
Returns:
the default schema root tag

setDefaultSchema

public void setDefaultSchema(java.lang.String root,
                             java.lang.String location)
Reset the default schema root tag and document location (url or file path)


setRelaxNGValidationLocation

public void setRelaxNGValidationLocation(java.lang.String location)
Reset the current RelaxNG document path for validating the current document. At this moment, there's no way to embedded th RelaxNG usage inside the XML document like for the DTD or the schema, so you Must specify the relaxNG location each time you need it for parsing. Note that to remove this option, you have to call it with a null value


getRelaxNGValidationLocation

public java.lang.String getRelaxNGValidationLocation()
Returns:
the current RelaxNG documant location

getSchemaLocation

public java.lang.String getSchemaLocation(boolean resolve)
Parameters:
resolve - if true the location is built using the current document location
Returns:
the current Schema location. This schema location can take into account relative document location

setCurrentDocumentLocation

public void setCurrentDocumentLocation(java.lang.String location)
Reset the current document location. This is useful for reading/writing a document


getCurrentDocumentLocation

public java.lang.String getCurrentDocumentLocation()
Returns:
the current document location

setModifiedState

public void setModifiedState(boolean state)
Update this container state if the document has been changed


setColorForAttribute

public void setColorForAttribute(java.lang.String attribute,
                                 java.awt.Color c)
Choose a particular color for this attribute


setColorForTag

public void setColorForTag(java.lang.String tag,
                           java.awt.Color c)
Choose a particular color for this tag


setColorForPrefix

public void setColorForPrefix(java.lang.String prefix,
                              java.awt.Color c)
Choose a particular color for this namespace prefix


getCurrentPopup

public javax.swing.JPopupMenu getCurrentPopup()
Returns:
the current menu popup

getCurrentTreePopup

public javax.swing.JPopupMenu getCurrentTreePopup()
Returns:
the current tree menu popup

getToolBar

public javax.swing.JToolBar getToolBar()
Returns:
the current toolbar

getEditor

public XMLEditor getEditor()
Returns:
the current editor component. Editor can changed due to splitting state

setAutoFocus

public void setAutoFocus(boolean autoFocus)
If true when the setText method is called the current editor gets the focus. By default to true

Parameters:
autoFocus - Get the focus for the setText

isAutoFocus

public boolean isAutoFocus()
Returns:
true if the current editor gets the focus while calling setText

setText

public void setText(java.lang.String text)
Deprecated. use getAccessibility().setText()

Reset the XML content. It is adviced not to call this same method on the XMLEditor.


getText

public java.lang.String getText()
Deprecated. use getAccessibility().getText()

Returns:
the XM content

getDocument

public XMLDocument getDocument()
Returns:
the current XML document

hasTextSelection

public boolean hasTextSelection()
Returns:
true if the current editor has a text selection

setEditable

public void setEditable(boolean editable)
The document is only readable for true


isEditable

public boolean isEditable()
By default return true


setTreeVisible

public void setTreeVisible(boolean treeVisible)
Show or hide the location tree. This method has no effect if no tree is available => XMLPadProperties.setProperty("tree", "false" )

Parameters:
treeVisible - Show or hide the current location tree

isTreeVisible

public boolean isTreeVisible()
Returns:
true if there's a current location tree and the splitpane bar is not closed

setToolBarVisible

public void setToolBarVisible(boolean toolbarVisible)
Show or hide the default toolbar. This method has no effect if the default toolbar is not available. Note that this method is only for dynamic usage, it has no effect before the visibility of the XMLContainer. If you wish no toolbar, you must call setToolBarAvailable( false )


isToolBarVisible

public boolean isToolBarVisible()
Returns:
the toolbar state

setToolBarAvailable

public void setToolBarAvailable(boolean toolBarAvailable)
Create a default toolbar. By default true. If user has an external toolbar, this property must be set to false. It is possible to control the visibility by calling setToolBarVisible( ... )


isToolBarAvailable

public boolean isToolBarAvailable()
Returns:
true if a default toolbar is available

setPopupAvailable

public void setPopupAvailable(boolean popupAvailable)
Create a default popup. By default true


isPopupAvailable

public boolean isPopupAvailable()
Returns:
true if a default popup is available

setTreePopupAvailable

public void setTreePopupAvailable(boolean treePopupAvailable)
Reset the tree popup. By default to true. This code has no effect if no tree is used.


isTreePopupAvailable

public boolean isTreePopupAvailable()
Returns:
true if a tree exists and if the tree popup is available

resetDefaultToolBarActions

public void resetDefaultToolBarActions()
Update the toolbarModel adding separator. This method is called by the XMLContainer constructor. It uses the ActionModel for adding action. For note : It will invoke the current NEW_ACTION for initializing the document content. Note that if no default toolBar is available, this method will have a limited scope


setEnabledTreeLocationForCaret

public void setEnabledTreeLocationForCaret(boolean rt)
Enable the tree selection for each text caret change. By default to true


setEnabledRealTimeStructureChanged

public void setEnabledRealTimeStructureChanged(boolean support)
Synchronize the tree each time the text has significatif change. By default to true


addNotify

public void addNotify()
This method call the init method for connection listeners to components


setAutoNewDocument

public void setAutoNewDocument(boolean autoNew)
Decide to initialize the XMLContainer calling the new action. By default true


dispose

public void dispose()
Remove all listeners/component connection. This is called by the removeNotify method if XMLContainer works with the disposeMode


removeNotify

public void removeNotify()
This method calls the dispose method for freeing ressource


setAutoDisposeMode

public void setAutoDisposeMode(boolean disposeMode)
Set JXMLPad in a special mode for freeing internal resource. By default to true


isAutoDisposeMode

public boolean isAutoDisposeMode()
Returns:
true if JXMLPad frees itself its inner resource for the garbage collector. By default to true

setPopableErrorMode

public void setPopableErrorMode(boolean popableErrorMode)
By default to false, this mode will open a dialog box for each parsing error with the parsing error message

Parameters:
popableErrorMode -

editNode

public boolean editNode()
Edit the current node with the EditorModel API. This API part is for custom node editor usage

Returns:
false if the editing is not allowed here

editNode

public boolean editNode(com.japisoft.fastparser.node.SimpleNode currentNode)
Edit the provided node with the EditorModel API. This API part is for custom node editor usage.

Returns:
false if the editing is not allowed here

setStatusBarAvailable

public void setStatusBarAvailable(boolean statusBar)
Choose to show a minimal statusbar with the current location. By default to true. If you use external status bar and a LocationListener, you should disable it.


isStatusBarAvailable

public boolean isStatusBarAvailable()
Returns:
true if a status bar is shown with the current document location

setErrorPanelAvailable

public void setErrorPanelAvailable(boolean errorPanel)
Choose to show a minimal panel for each parsing error with a comment line. By default to true. If you have external panel for that using a DocumentStateListener, you should disable it


isErrorPanelAvailable

public boolean isErrorPanelAvailable()
Returns:
true if an error panel is shown for parsing error

getLastDocumentLocation

public com.japisoft.fastparser.node.SimpleNode getLastDocumentLocation()
Returns:
the last document location for the caret

getRealTimeTreeManager

public RealTimeTreeManager getRealTimeTreeManager()
Returns:
the manager for real time tree location

setEnabledTreeLocation

public void setEnabledTreeLocation(boolean location)
Enable the view of the tree location in the status bar


isEnabledTreeLocation

public boolean isEnabledTreeLocation()
Is Enabled the view of the tree location in the status bar ?


resetEditor

public void resetEditor(XMLEditor editor)
Particular case for using the good editor with focus. User shouldn't use it


setSplit

public void setSplit(boolean split)
if true, it will split the current editors in two one else it will unsplit the two current editors in only one


isSplit

public boolean isSplit()
Returns:
true if the current editor is splitted with two ones

split

public void split()
Split the current editor in two ones or unsplit it


setAutoResetAction

public void setAutoResetAction(boolean autoResetAction)
Here a way to reset all XMLAction from the current XMLEditor focus. By default to true


unSplit

public void unSplit()
Show only one editor


resetProperties

public void resetProperties(java.util.HashMap map)
Reset the inner properties


setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object content)
Store a property inside this container. It can be useful for action that must store their state between several editors

Specified by:
setProperty in interface IXMLPanel

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface IXMLPanel
Returns:
a property values

getProperties

public java.util.Iterator getProperties()
Specified by:
getProperties in interface IXMLPanel
Returns:
a list of properties

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object def)
Specified by:
getProperty in interface IXMLPanel
Returns:
a property value or the default one

addLocationListener

public void addLocationListener(LocationListener listener)
Deprecated. Use setLocationListener

Add a listener for giving information about the current document location


removeLocationListener

public void removeLocationListener(LocationListener listener)
Remove a listener


getAccessibility

public Accessibility getAccessibility()
Returns:
an implantation for interacting easily with XMLContainer

getNewUndoRedoManager

public javax.swing.undo.UndoManager getNewUndoRedoManager()
Returns:
a new UndoRedoManager

refreshUndoRedoState

public void refreshUndoRedoState()
Update undo/redo button state


showPopup

public void showPopup(java.awt.Component c,
                      int x,
                      int y)
Show a popup. This is invoked by XMLEditor so theorically you needn't to call it directly


getDocumentIntegrity

public XMLIntegrity getDocumentIntegrity()
Returns:
the current XML integrity manager

setDocumentIntegrity

public void setDocumentIntegrity(XMLIntegrity integrity)
This objet contains data for avoiding to corrupt the current document.

Parameters:
integrity - XML integrity manager

isRealTimeTreeOnTextChange

public boolean isRealTimeTreeOnTextChange()
Returns:
true if the tree is updated for each text change rather than on return key

setRealTimeTreeOnTextChange

public void setRealTimeTreeOnTextChange(boolean realTimeTreeOnTextChange)
If you use the false value the tree will only be updated for each return key. This is better for medium or heavy XML document. By default to false

Parameters:
realTimeTreeOnTextChange - Tree is updated for any text change if true

setCaretListener

public void setCaretListener(CaretListener listener)
Add a listener for giving information about the current caret location


unsetCaretListener

public void unsetCaretListener()
Remove a listener


setLocationListener

public void setLocationListener(LocationListener listener)
Set a listener for giving information about the current document location


unsetLocationListener

public void unsetLocationListener()
Remove a listener


notifyLocationListener

public void notifyLocationListener(LocationEvent event)
Notify to all LocationListener that the current document location has changed. Note that you shouldn't override this method because this is used internally.


notifyCaretListener

public void notifyCaretListener(int col,
                                int line)
Notify to all CaretListener that the current caret location has changed. Note that you shouldn't override this method because this is used internally.


addDocumentStateListener

public void addDocumentStateListener(DocumentStateListener listener)
Add listener for document parsing state : error or not


removeDocumentStateListener

public void removeDocumentStateListener(DocumentStateListener listener)
Remove a listener


hasErrorMessage

public boolean hasErrorMessage()
Returns:
true if the last parsing step has error

notifyDocumentStateError

public void notifyDocumentStateError(java.lang.String message,
                                     int line,
                                     boolean temporary)
Notify all DocumentStateListener about the parsing state: A null value means no error.

Parameters:
message - Error message or null

notifyDocumentVersion

public void notifyDocumentVersion(boolean newOne)
Notify that a new document has been inserted or the current one has been altered once. This method will notify all DocumentStateListener element.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable
Throws:
java.lang.Throwable