com.japisoft.xmlpad
Class XMLContainer

java.lang.Object
  extended bycom.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:
4.0
Author:
(c) 2002-2004 JAPISoft
See Also:
JPanel, LocationListener, DocumentStateLeistener, ToolBarModel

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.
protected XMLContainer(ComponentFactory cf)
          You will have to call dispose after usage
 
Method Summary
 void addDocumentStateListener(DocumentStateListener listener)
          Add listener for document parsing state : error or not
 void addNavigationHistoryPath(java.lang.String path)
          Store a new navigation XPath value.
 void cleanNavigationHistoryPath()
          Reset the navigation path
protected  javax.swing.JPopupMenu createPopupMenu()
           
protected  javax.swing.JToolBar createToolBar()
           
 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(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.
 Accessibility getAccessibility()
           
 BookmarkContext getBookmarkContext()
           
 int getCaretPosition()
           
 java.lang.String getCurrentDocumentLocation()
           
 java.lang.Object getCurrentDocumentLocationArg()
          More information about the current document location
 java.net.URL getCurrentDocumentLocationURL()
           
 SimpleNode getCurrentElementNode()
           
 SimpleNode getCurrentNode()
           
 javax.swing.JPopupMenu getCurrentPopup()
           
 javax.swing.JPopupMenu getCurrentTreePopup()
          Deprecated. use getUIAccessibility().getCurrentTreePopup()
 XMLDocument getDocument()
           
 DocumentColorAccessibility getDocumentColorAccessibility()
           
 XMLDocumentInfo getDocumentInfo()
           
 XMLIntegrity getDocumentIntegrity()
           
 XMLEditor getEditor()
          Deprecated. use getUIAccessibility().getEditor()
 EditorContext getEditorContext()
          For inner usage only
protected  double getElementViewInitialDividerLocation()
           
 ErrorManager getErrorManager()
           
 HelperManager getHelperManager()
           
protected  double getInitialDividerLocation()
           
 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
 XMLContainer getMainContainer()
           
 int getNavigationHistoryLimit()
           
 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)
           
 SimpleNode getRootNode()
           
 SchemaAccessibility getSchemaAccessibility()
           
 XMLContainer getSubContainer(java.lang.String type)
           
 SchemaHelperManager getSyntaxHelper()
           
 XMLTemplate getTemplate()
           
 java.lang.String getText()
          Deprecated. use getAccessibility().getText()
 javax.swing.JToolBar getToolBar()
          Deprecated. use getUIAccessibility().getToolBar()
 ToolBarModel getToolBarModel()
          User can add/remove dynamically action by acting on this model.
 javax.swing.JTree getTree()
          Deprecated. use getUIAccessibility().getTree()
 TreeListeners getTreeListeners()
           
 PopupModel getTreePopupModel()
           
 ToolBarModel getTreeToolBarModel()
           
 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()
           
protected  void initModels()
          Prepare various models for toolbars or popups
protected  void initOnce(javax.swing.JComponent view)
          Prepare the UI elements of the container.
protected  void initOnceErrorBinding()
          Called once for connecting all the UI parts that must manage the parsing errors
protected  void initUI(javax.swing.JComponent view)
          Prepare the layout of the components
protected  void installDefaultHelperHandlers(HelperManager manager)
          Install the default assistants for the helper
 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 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.
 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
protected  void removeErrorPanel(boolean onTheFly)
          Remove the error panel.
 void removeNavigationHistoryPath(java.lang.String path)
          Remove this XPath navigation value.
 void requestFocus()
           
 void resetDefaultToolBarActions()
          Update the toolbarModel adding separator.
protected  void resetDefaultTreeToolBarModel(ToolBarModel model)
           
 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(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(XMLDocumentInfo info)
          Reset the current documentation info.
 void setDocumentIntegrity(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 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(SimpleNode node)
          Provides the last parsed root 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 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, 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(UIStateListener listener)
          Here a listener for knowing the user interface state : ready or not
protected  void showErrorPanel()
          Show an error panel for each parsing error with the following message.
protected  void showLocation(SimpleNode content)
          Show the tree location in the tree and in a minimal status bar
 void showPopup(java.awt.Component c, int x, int y)
          Show a popup.
 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(SimpleNode content)
          Update the UI elements like the location statusbar for this node
protected  boolean useCustomPopupMenu()
           
protected  void visibleAction()
          Action when the component is shown at screen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLContainer

protected XMLContainer(ComponentFactory cf)
You will have to call dispose after usage


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 IView getInnerView()
For inner usage only


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


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

getHelperManager

public HelperManager getHelperManager()
Returns:
the current helper manager. This is the container for all the content assistant definition

installDefaultHelperHandlers

protected void installDefaultHelperHandlers(HelperManager manager)
Install the default assistants for the helper


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()
Returns:
the model of available actions on the tree's popup

getTreeToolBarModel

public ToolBarModel getTreeToolBarModel()
Returns:
the model of available actions on the tree

resetDefaultTreeToolBarModel

protected void resetDefaultTreeToolBarModel(ToolBarModel model)

getSyntaxHelper

public SchemaHelperManager 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, this is a physical path

getCurrentDocumentLocationURL

public java.net.URL getCurrentDocumentLocationURL()
Returns:
the current document location as an URL

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

createToolBar

protected javax.swing.JToolBar createToolBar()
Returns:
the default toolBar using the ComponentFactory

createPopupMenu

protected javax.swing.JPopupMenu createPopupMenu()
Returns:
the default popup using the ComponentFactory

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


getInitialDividerLocation

protected double getInitialDividerLocation()
Returns:
the location for the tree divider in percent

getElementViewInitialDividerLocation

protected double getElementViewInitialDividerLocation()
Returns:
the location for the element view / tree divider in percent

setUIStateListener

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


initOnce

protected void initOnce(javax.swing.JComponent view)
Prepare the UI elements of the container. This method is used once from the addNotify method of the main panel ( can be the CustomView class )


initOnceErrorBinding

protected void initOnceErrorBinding()
Called once for connecting all the UI parts that must manage the parsing errors


initUI

protected void initUI(javax.swing.JComponent view)
Prepare the layout of the components


initModels

protected void initModels()
Prepare various models for toolbars or popups


setAutoNewDocument

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


useCustomPopupMenu

protected boolean useCustomPopupMenu()
Returns:
true if you don't want to use the XMLPAd popup menu but your own. By default false. Note that you must override too the getCurrentPopupMenu and disable the default popup

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

Specified by:
setAutoDisposeMode in interface IXMLPanel

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

getErrorManager

public ErrorManager getErrorManager()
Returns:
the objet managing all the parsing errors

showErrorPanel

protected void showErrorPanel()
Show an error panel for each parsing error with the following message. If user needs to have a custom behavior, it is suggested to use a DocumentStateListener and disable the error panel by calling setErrorPanelAvailable( false )


removeErrorPanel

protected void removeErrorPanel(boolean onTheFly)
Remove the error panel. If the ErrorPanelAvailable property has been set to false. This code has no effect


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(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(SimpleNode node)
Provides the last parsed root node. This is for internal usage only, so don't override it or call it.


getCurrentNode

public SimpleNode getCurrentNode()
Returns:
the last document location for the caret. It can be a text node or an element

getCurrentElementNode

public SimpleNode getCurrentElementNode()
Returns:
this is similar to the getCurrentNode, except it cannot return a text node

getRootNode

public SimpleNode getRootNode()
Returns:
the current document root node

updateNodeLocation

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


showLocation

protected void showLocation(SimpleNode content)
Show the tree location in the tree and in a minimal status bar


getTreeListeners

public TreeListeners getTreeListeners()
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,
                     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(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

visibleAction

protected void visibleAction()
Action when the component is shown at screen


getAccessibility

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

getSchemaAccessibility

public SchemaAccessibility getSchemaAccessibility()
Returns:
an implementation for interacting easily for schemas

getUIAccessibility

public UIAccessibility getUIAccessibility()
Returns:
an implementation for interacting easily with inner components

getDocumentColorAccessibility

public 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 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

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(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

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.



Copyright © 2006 JAPISoft. All Rights Reserved.