com.japisoft.xmlpad
Class XMLContainer

java.lang.Object
  |
  +--com.japisoft.xmlpad.XMLContainer
All Implemented Interfaces:
IXMLPanel

public class XMLContainer
extends java.lang.Object
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 document 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 implementing 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
     JFrame frame = new JFrame();
      XMLContainer container = new XMLContainer();
      container.getAccessibility().setText( "<?version='1.0'?> <test> </test>" );
      frame.getContentPane().add( container.getView() );
      ...
     container.dispose(); // Called when terminating using JXMLPad
  
 
 
 // Load a known XMLfile
 XMLContainer container = new XMLContainer();
 container.getAccessibility().read(new FileReader("myFile.xml"));
 frame.getContentPane().add(container.getView());
 
 
 // JInternal frame usage
 JInternalFrame editorFrameOne = new JInternalFrame();
 // This constructor avoids XMLContainer for freeing automatically its inner reference
 editor1 = new XMLContainer();
 editorFrameOne.getContentPane().add(editor1.getView());
 
 
 // Using a theme
 com.japisoft.xmlpad.look.themes.BlueTheme.install();
 JFrame fr = new JFrame();
 fr.getContentPane().add(new XMLContainer().getView());
 
 // Using it in a tabbedpane
 XMLContainer container = new XMLContainer(true);
 // We want the container to dispose its ressource automatically, so we needn't to call 
 
 
 
 dispose
 
 
     when the
     // editor is removed from the tabbedpane
     container.setToolBarAvailable( false ); // We have an external toolbar 
     JTabbedPane pane = new JTappedPane();
     pane.add( container.getView() ); 
  
 

More information at : http://www.japisoft.com

Version:
3.5
Author:
(c) 2002-2004 JAPISoft
See Also:
JPanel, LocationListener, DocumentStateLeistener, ToolBarModel

Field Summary
 java.util.Hashtable htBackgroundColorForPrefix
           
 java.util.Hashtable htColorForPrefix
           
 
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(com.japisoft.xmlpad.DocumentStateListener listener)
          Add listener for document parsing state : error or not
 void addLocationListener(com.japisoft.xmlpad.LocationListener listener)
          Deprecated. Use setLocationListener
 void addNavigationHistoryPath(java.lang.String path)
          Store a new navigation XPath value.
 void cleanNavigationHistoryPath()
          Reset the navigation path
 javax.swing.undo.UndoManager createUndoManager()
          For inner usage only
 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.
 void focus()
          This is a method called by the inner editor for saving the current tree state.
 com.japisoft.xmlpad.Accessibility getAccessibility()
           
 BookmarkContext getBookmarkContext()
           
 int getCaretPosition()
           
 java.lang.String getCurrentDocumentLocation()
           
 java.lang.Object getCurrentDocumentLocationArg()
          More information about the current document location
 com.japisoft.fastparser.node.SimpleNode getCurrentNode()
           
 javax.swing.JPopupMenu getCurrentPopup()
           
 javax.swing.JPopupMenu getCurrentTreePopup()
          Deprecated. use getUIAccessibility().getCurrentTreePopup()
 XMLDocument getDocument()
           
 com.japisoft.xmlpad.DocumentColorAccessibility getDocumentColorAccessibility()
           
 com.japisoft.xmlpad.XMLDocumentInfo getDocumentInfo()
           
 com.japisoft.xmlpad.XMLIntegrity getDocumentIntegrity()
           
 XMLEditor getEditor()
          Deprecated. use getUIAccessibility().getEditor()
 EditorContext getEditorContext()
          For inner usage only
 ElementView getElementView()
           
 com.japisoft.xmlpad.IView getInnerView()
          For inner usage only
static java.lang.String getLocalizedMessage(java.lang.String key, java.lang.String defaultValue)
          For inner usage, it returns a localized message for this key
 com.japisoft.xmlpad.XMLContainer getMainContainer()
           
 int getNavigationHistoryLimit()
           
 com.japisoft.xmlpad.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)
           
 com.japisoft.xmlpad.tree.RealTimeTreeManager getRealTimeTreeManager()
           
 com.japisoft.fastparser.node.SimpleNode getRootNode()
           
 com.japisoft.xmlpad.SchemaAccessibility getSchemaAccessibility()
           
 com.japisoft.xmlpad.XMLContainer getSubContainer(java.lang.String type)
           
 SyntaxHelper getSyntaxHelper()
           
 XMLTemplate getTemplate()
           
 java.lang.String getText()
          Deprecated. use getAccessibility().getText()
 javax.swing.JToolBar getToolBar()
          Deprecated. use getUIAccessibility().getToolBar()
 com.japisoft.xmlpad.ToolBarModel getToolBarModel()
          User can add/remove dynamically action by acting on this model.
 javax.swing.JTree getTree()
          Deprecated. use getUIAccessibility().getTree()
 com.japisoft.xmlpad.PopupModel getTreePopupModel()
           
 com.japisoft.xmlpad.ToolBarModel getTreeToolBarModel()
           
 com.japisoft.xmlpad.UIAccessibility getUIAccessibility()
           
 javax.swing.JComponent getView()
           
 boolean hasErrorMessage()
           
 boolean hasFocus()
          Notify that the current container has the focus when managing one tree for several XML Container
 boolean hasSchema()
           
 boolean hasSyntaxCompletion()
           
 boolean hasTextSelection()
           
 boolean isAutoDisposeMode()
           
 boolean isAutoFocus()
           
 boolean isEditable()
          By default return true
 boolean isEditableDocumentMode()
           
 boolean isEnabledTreeLocation()
          Is Enabled the view of the tree location in the status bar ?
 boolean isErrorPanelAvailable()
           
 boolean isPopupAvailable()
          Deprecated. use getUIAccessibility().isPopupAvailable
 boolean isRealTimeTreeOnTextChange()
           
 boolean isSplit()
           
 boolean isStatusBarAvailable()
           
 boolean isToolBarAvailable()
          Deprecated. getUIAccessibility().setToolBarAvailable
 boolean isToolBarVisible()
          Deprecated. getUIAccessibility().isToolBarVisible
 boolean isTreeAvailable()
          Deprecated. getUIAccessibility().isTreeAvailable()
 boolean isTreePopupAvailable()
          Deprecated. use getUIAccessibility().isTreePopupAvailable
 boolean isTreeVisible()
          Deprecated. use getUIAccessibility().isTreeVisible()
 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(com.japisoft.xmlpad.LocationEvent event)
          Notify to all LocationListener that the current document location has changed.
 java.lang.String previousNavigationHistoryPath()
          Change the navigation history cursor and return the previous navigation path.
 void refreshUndoRedoState()
          Update undo/redo button state
 void removeDocumentStateListener(com.japisoft.xmlpad.DocumentStateListener listener)
          Remove a listener
 void removeLocationListener(com.japisoft.xmlpad.LocationListener listener)
          Remove a listener
 void removeNavigationHistoryPath(java.lang.String path)
          Remove this XPath navigation value.
 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 setBookmarkContext(BookmarkContext context)
          Set a bookmarkContext.
 void setCaretListener(com.japisoft.xmlpad.CaretListener listener)
          Add a listener for giving information about the current caret location
 void setCurrentDocumentLocation(java.lang.String location)
          Reset the current document location.
 void setCurrentDocumentLocationArg(java.lang.Object arg)
          Reset an optional argument for the document location
 void setDisposeAction(boolean disposeAction)
          Decide to dispose the ActionModel when disposing the XMLContainer.
 void setDocumentInfo(com.japisoft.xmlpad.XMLDocumentInfo info)
          Reset the current documentation info.
 void setDocumentIntegrity(com.japisoft.xmlpad.XMLIntegrity integrity)
          This objet contains data for avoiding to corrupt the current document.
 void setEditable(boolean editable)
          The document is only readable for true
 void setEditableDocumentMode(boolean editable)
          This mode will let the cursor, but user will not be abable to update the document if the parameter is false
 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 root node.
 void setLocationListener(com.japisoft.xmlpad.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)
          Deprecated. use getUIAccessibility().setPopupAvailable
 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 setSplit(boolean split)
          Deprecated. Use the same method name with two arguments
 void setSplit(boolean split, boolean vertical)
          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)
          Deprecated. getUIAccessibility().setToolBarAvailable
 void setToolBarVisible(boolean toolbarVisible)
          Deprecated. getUIAccessibility().setToolBarVisible
 void setTreeAvailable(boolean treeAvailable)
          Deprecated. use getUIAccessibility().setTreeAvailable()
 void setTreeDelegate(javax.swing.JTree treeDelegate)
          Deprecated. use getUIAccessibility().setTreeDelegate
 void setTreePopupAvailable(boolean treePopupAvailable)
          Deprecated. use getUIAccessibility().setTreePopupAvailable
 void setTreeVisible(boolean treeVisible)
          Deprecated. use getUIAccessibility().setTreeVisible
 void setUIReady(boolean uiReady)
          This is called by the view while the addNotify or the removeNotify.
 void setUIStateListener(com.japisoft.xmlpad.UIStateListener listener)
          Here a listener for knowing the user interface state : ready or not
 void showPopup(java.awt.Component c, int x, int y)
          Show a popup.
 void split()
          Deprecated. use split with one argument
 void split(boolean vertical)
           
 void unfocus()
          This is a method called by the inner editor for restoring the current tree state.
 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
 void updateNodeLocation(com.japisoft.fastparser.node.SimpleNode content)
          Update the UI elements like the location statusbar for this node
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

htColorForPrefix

public java.util.Hashtable htColorForPrefix

htBackgroundColorForPrefix

public java.util.Hashtable htBackgroundColorForPrefix
Constructor Detail

XMLContainer

public XMLContainer()
Create a new XMLContainer, all components are created by the default ComponentFactory. You will have to call dispose after usage of this XMLContainer for freeing inner resources. You can avoid to call dispose using the second constructor


XMLContainer

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

Note that if you add/remove/add/... this container you MUSTN'T use the true value

Method Detail

setUIReady

public void setUIReady(boolean uiReady)
This is called by the view while the addNotify or the removeNotify.

Parameters:
uiReady - true when the final view for the container is ready

getView

public javax.swing.JComponent getView()
Specified by:
getView in interface IXMLPanel
Returns:
The view containing the final panel

getInnerView

public com.japisoft.xmlpad.IView getInnerView()
For inner usage only


getMainContainer

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

getSubContainer

public com.japisoft.xmlpad.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(com.japisoft.xmlpad.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 com.japisoft.xmlpad.XMLDocumentInfo getDocumentInfo()
Returns:
the current document info

getToolBarModel

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

Returns:
the model for the default toolBar

getPopupModel

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

Returns:
the model for the default popup

getTreePopupModel

public com.japisoft.xmlpad.PopupModel getTreePopupModel()
Returns:
the model of available actions on the tree's popup

getTreeToolBarModel

public com.japisoft.xmlpad.ToolBarModel getTreeToolBarModel()
Returns:
the model of available actions on the tree

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()
Deprecated. use getUIAccessibility().getTree()

Returns:
the current XML tree view

setTreeDelegate

public void setTreeDelegate(javax.swing.JTree treeDelegate)
Deprecated. use getUIAccessibility().setTreeDelegate

This is a way to share a tree which is outside the XMLContainer. This is only useful if the setTreeAvailable( false ) method is called


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)

requestFocus

public void requestFocus()

setBookmarkContext

public void setBookmarkContext(BookmarkContext context)
Set a bookmarkContext. This is required to mark a set of line


getBookmarkContext

public BookmarkContext getBookmarkContext()
Returns:
the current bookmarkContext. By default null

hasSchema

public boolean hasSchema()

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

getCurrentDocumentLocationArg

public java.lang.Object getCurrentDocumentLocationArg()
More information about the current document location


setCurrentDocumentLocationArg

public void setCurrentDocumentLocationArg(java.lang.Object arg)
Reset an optional argument for the document location


setModifiedState

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


getCurrentPopup

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

getCurrentTreePopup

public javax.swing.JPopupMenu getCurrentTreePopup()
Deprecated. use getUIAccessibility().getCurrentTreePopup()

Returns:
the current tree menu popup

getToolBar

public javax.swing.JToolBar getToolBar()
Deprecated. use getUIAccessibility().getToolBar()

Returns:
the current toolbar

getEditor

public XMLEditor getEditor()
Deprecated. use getUIAccessibility().getEditor()

Returns:
the current editor component. Editor can changed due to splitting state.

getCaretPosition

public int getCaretPosition()
Returns:
the current caret position. -1 is returned if there's no editor

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


setEditableDocumentMode

public void setEditableDocumentMode(boolean editable)
This mode will let the cursor, but user will not be abable to update the document if the parameter is false


isEditableDocumentMode

public boolean isEditableDocumentMode()
Returns:
true by default

isEditable

public boolean isEditable()
By default return true


setTreeVisible

public void setTreeVisible(boolean treeVisible)
Deprecated. use getUIAccessibility().setTreeVisible

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()
Deprecated. use getUIAccessibility().isTreeVisible()

Returns:
true if there's a current location tree and the splitpane bar is not closed

setTreeAvailable

public void setTreeAvailable(boolean treeAvailable)
Deprecated. use getUIAccessibility().setTreeAvailable()

Decide to have a left tree with the XML document content or not. By default true


isTreeAvailable

public boolean isTreeAvailable()
Deprecated. getUIAccessibility().isTreeAvailable()

Returns:
true if the tree is available

setToolBarVisible

public void setToolBarVisible(boolean toolbarVisible)
Deprecated. getUIAccessibility().setToolBarVisible

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()
Deprecated. getUIAccessibility().isToolBarVisible

Returns:
the toolbar state

setToolBarAvailable

public void setToolBarAvailable(boolean toolBarAvailable)
Deprecated. getUIAccessibility().setToolBarAvailable

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()
Deprecated. getUIAccessibility().setToolBarAvailable

Returns:
true if a default toolbar is available.

setPopupAvailable

public void setPopupAvailable(boolean popupAvailable)
Deprecated. use getUIAccessibility().setPopupAvailable

Create a default popup. By default true


isPopupAvailable

public boolean isPopupAvailable()
Deprecated. use getUIAccessibility().isPopupAvailable

Returns:
true if a default popup is available

setTreePopupAvailable

public void setTreePopupAvailable(boolean treePopupAvailable)
Deprecated. use getUIAccessibility().setTreePopupAvailable

Reset the tree popup. By default to true. This code has no effect if no tree is used.


isTreePopupAvailable

public boolean isTreePopupAvailable()
Deprecated. use getUIAccessibility().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


setUIStateListener

public void setUIStateListener(com.japisoft.xmlpad.UIStateListener listener)
Here a listener for knowing the user interface state : ready or not


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

Specified by:
dispose in interface IXMLPanel

setAutoDisposeMode

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


setDisposeAction

public void setDisposeAction(boolean disposeAction)
Decide to dispose the ActionModel when disposing the XMLContainer. By default 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

setLastNodeParsed

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


getCurrentNode

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

getRootNode

public com.japisoft.fastparser.node.SimpleNode getRootNode()
Returns:
the current document root node

updateNodeLocation

public void updateNodeLocation(com.japisoft.fastparser.node.SimpleNode content)
Update the UI elements like the location statusbar for this node


getRealTimeTreeManager

public com.japisoft.xmlpad.tree.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


focus

public void focus()
This is a method called by the inner editor for saving the current tree state. This is useful when sharing a tree between several XML containers, it gives information to the shared tree that this is the current XML container.


unfocus

public void unfocus()
This is a method called by the inner editor for restoring the current tree state. This is only useful when sharing a tree between several XML containers. The user shouldn't override this method.


hasFocus

public boolean hasFocus()
Notify that the current container has the focus when managing one tree for several XML Container


setSplit

public void setSplit(boolean split)
Deprecated. Use the same method name with two arguments


setSplit

public void setSplit(boolean split,
                     boolean vertical)
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()
Deprecated. use split with one argument

Split vertically.


split

public void split(boolean vertical)

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(com.japisoft.xmlpad.LocationListener listener)
Deprecated. Use setLocationListener

Add a listener for giving information about the current document location


removeLocationListener

public void removeLocationListener(com.japisoft.xmlpad.LocationListener listener)
Remove a listener


getAccessibility

public com.japisoft.xmlpad.Accessibility getAccessibility()
Returns:
an implementation for interacting easily with XMLContainer

getSchemaAccessibility

public com.japisoft.xmlpad.SchemaAccessibility getSchemaAccessibility()
Returns:
an implementation for interacting easily for schemas

getUIAccessibility

public com.japisoft.xmlpad.UIAccessibility getUIAccessibility()
Returns:
an implementation for interacting easily with inner components

getDocumentColorAccessibility

public com.japisoft.xmlpad.DocumentColorAccessibility getDocumentColorAccessibility()
Returns:
an implementation for updating the color for one document like a particular tag color...

refreshUndoRedoState

public void refreshUndoRedoState()
Update undo/redo button state


createUndoManager

public javax.swing.undo.UndoManager createUndoManager()
For inner usage only


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 com.japisoft.xmlpad.XMLIntegrity getDocumentIntegrity()
Returns:
the current XML integrity manager

setDocumentIntegrity

public void setDocumentIntegrity(com.japisoft.xmlpad.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

getLocalizedMessage

public static java.lang.String getLocalizedMessage(java.lang.String key,
                                                   java.lang.String defaultValue)
For inner usage, it returns a localized message for this key


setCaretListener

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


unsetCaretListener

public void unsetCaretListener()
Remove a listener


setLocationListener

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


unsetLocationListener

public void unsetLocationListener()
Remove a listener


notifyLocationListener

public void notifyLocationListener(com.japisoft.xmlpad.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(com.japisoft.xmlpad.DocumentStateListener listener)
Add listener for document parsing state : error or not


removeDocumentStateListener

public void removeDocumentStateListener(com.japisoft.xmlpad.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.