com.japisoft.xmlpad
Class XMLDocumentInfo

java.lang.Object
  extended bycom.japisoft.xmlpad.XMLDocumentInfo

public class XMLDocumentInfo
extends java.lang.Object

This class contains information about the current document.

Version:
1.3
Author:
(c) 2003 JAPISOFT

Field Summary
 java.util.Hashtable htBackgroundColorForPrefix
           
 java.util.Hashtable htColorForPrefix
           
 java.lang.String originalDTDLocation
           
 
Constructor Summary
XMLDocumentInfo()
           
 
Method Summary
 void addFileExt(java.lang.String ext)
          Add a file extension for loading/saving this document type
 void addHelperHandler(AbstractHelperHandler handler)
          Add a new handler
 XMLDocumentInfo cloneDocument()
           
 java.awt.Color getBackgroundColorForPrefix(java.lang.String prefixName)
           
 java.awt.Color getColorForAttribute(java.lang.String attributeName)
           
 java.awt.Color getColorForPrefix(java.lang.String prefixName)
           
 java.awt.Color getColorForTag(java.lang.String tagName)
           
 java.lang.String getCurrentDocumentLocation()
           
 java.lang.Object getCurrentDocumentLocationArg()
           
 java.lang.String getDefaultDocument()
           
 java.lang.String getDefaultDTDLocation()
           
 java.lang.String getDefaultDTDRoot()
           
 java.net.URL getDefaultDTDURL()
           
 java.lang.String getDefaultFileExt()
           
 java.lang.String getDefaultNamespace()
           
 java.lang.String getDefaultNamespacePrefix()
           
 java.lang.String getDefaultSchemaLocation()
           
 java.lang.String getDefaultSchemaRoot()
           
 java.lang.String getDocumentDescription()
           
 javax.swing.Icon getDocumentIcon()
           
 java.lang.String getDocumentIconPath()
           
 java.lang.String getDocumentName()
           
 java.lang.String getDTDExternalCommentFile()
          Special file for using external comment to a dtd.
 javax.swing.filechooser.FileFilter getFileFilter()
           
 java.util.ArrayList getHelperHandlers()
           
 java.lang.String getId()
           
 java.lang.String[] getListOfAttributesWithAutoAssistant()
           
 java.lang.String getOriginalDTDLocation()
          Particular case when a mapping is done with the DTD location
 java.lang.String getParamValue(java.lang.String paramName)
           
 java.lang.String getParentType()
           
 java.lang.String getSchemaValid()
           
 java.lang.String[] getSupportedFileExt()
           
 SystemHelper getSystemHelper()
           
 java.lang.String getSystemHelperClass()
           
 java.lang.String getTemplate()
           
 java.lang.String getType()
           
 java.lang.String getWorkingDirectory()
           
 boolean hasAutoClosing()
           
 boolean hasBackgroundColorForPrefix(java.lang.String prefixName)
           
 boolean hasColorForAttribute(java.lang.String attributeName)
           
 boolean hasColorForPrefix(java.lang.String prefixName)
           
 boolean hasColorForTag(java.lang.String tagName)
           
 boolean hasSyntaxColor()
           
 boolean hasSyntaxHelper()
           
 boolean isAssistantAppendMode()
          Only when providing a set of handlers with the setHelperHandlers method
 boolean isDtdMode()
          For DTD coloration
 boolean isRealTimeTree()
           
 boolean isSelectFirstTagAfterReading()
          When opening a new document the first element is chosen automatically
 boolean isSystemDocument()
           
 boolean isTreeAvailable()
           
 boolean matchFileExt(java.lang.String ext)
           
 void removeFileExt(java.lang.String ext)
          Remove this file extension for loading/saving this document type
 void setAutoClosing(boolean autoClosing)
          Set the auto tag closing feature.
 void setBackgroundColorForPrefix(java.lang.String prefixName, java.awt.Color c)
          Choose a particular background color for a tag prefix.
 void setColorForAttribute(java.lang.String attributeName, java.awt.Color c)
          Choose a particular color for an attribute.
 void setColorForPrefix(java.lang.String prefixName, java.awt.Color c)
          Choose a particular color for a tag prefix.
 void setColorForTag(java.lang.String tagName, java.awt.Color c)
          Define a color for this tagName.
 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 setDefaultDocument(java.lang.String doc)
          Reset the default document.
 void setDefaultDTD(java.lang.String root, java.lang.String location)
          Reset the defaultDTD location for syntax completion
 void setDefaultDTD(java.lang.String root, java.net.URL location)
           
 void setDefaultFileExt(java.lang.String ext)
          Reset the default file ext.
 void setDefaultNamespace(java.lang.String namespace)
           
 void setDefaultSchema(java.lang.String root, java.lang.String location)
          Reset the default schema root and location for syntax completion
 void setDocumentDescription(java.lang.String description)
          Reset the document description.
 void setDocumentIcon(javax.swing.Icon icon)
          Reset the document icon
 void setDocumentIconPath(java.lang.String iconPath)
          Information relative to the current document icon path
 void setDTDExternalCommentFile(java.lang.String url)
          Special file for using external comment to a dtd.
 void setDtdMode(boolean dtdMode)
          For DTD coloration
 void setHelperHandlers(java.util.ArrayList handlers, boolean appendMode)
          Set specific handlers for the content assistant
 void setId(java.lang.String id)
          Give an identifier
 void setListOfAttributesWithAutoAssistant(java.lang.String[] atts)
          Particular usage for asking an assistant automatically when adding an attribute
 void setOriginalDTDLocation(java.lang.String dtd)
          Particular case when a mapping is done with the DTD location
 void setParam(java.lang.String param, java.lang.String value)
          For template usage
 void setParamValues(java.util.HashMap params)
          Reset parameters for template.
 void setParentType(java.lang.String parentType)
          Reset a parent type for this document
 void setRealTimeTree(boolean realTimeTree)
          The real time tree will be available : By default true
 void setSchemaValid(java.lang.String schema)
          Force a W3C schema validation with this document url
 void setSelectFirstTagAfterReading(boolean select)
          When opening a new document the first element is chosen automatically
 void setSupportedFileExt(java.lang.String[] content)
          Reset a set of file extension for this document type
 void setSyntaxColor(boolean syntaxColor)
           
 void setSyntaxHelper(boolean sh)
          Reset the syntax helper.
 void setSystemDocument(boolean system)
          Special flag for multiple document usage
 void setSystemHelperClass(java.lang.String helper)
          Reset a class name for the system helper
 void setTemplate(java.lang.String documentTemplate)
          Set a template for this document type
 void setTreeAvailable(boolean tree)
          The tree will be available for this document
 void setType(java.lang.String type)
          Reset a known type for this document
 void setWorkingDirectory(java.lang.String workingDirectory)
          Reset the default working directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

originalDTDLocation

public java.lang.String originalDTDLocation

htColorForPrefix

public java.util.Hashtable htColorForPrefix

htBackgroundColorForPrefix

public java.util.Hashtable htBackgroundColorForPrefix
Constructor Detail

XMLDocumentInfo

public XMLDocumentInfo()
Method Detail

setDefaultDocument

public void setDefaultDocument(java.lang.String doc)
Reset the default document. This document is used bu default for initializing the editor for the new action If no default document is specified a inner default one is used using the com.japisoft.xmlpad.bean.XMLTemplate value

Parameters:
doc -

getDefaultDocument

public java.lang.String getDefaultDocument()
Returns:
the default document

setSystemDocument

public void setSystemDocument(boolean system)
Special flag for multiple document usage


isSystemDocument

public boolean isSystemDocument()

setParamValues

public void setParamValues(java.util.HashMap params)
Reset parameters for template. A parameter is a "${param}" value. The value from the "param" key will be replaced in the current template usage

Parameters:
params - Set of parameters : name & value

setParam

public void setParam(java.lang.String param,
                     java.lang.String value)
For template usage


getParamValue

public java.lang.String getParamValue(java.lang.String paramName)
Returns:
a parameter value. If the parameter is unknwon an empty string is returned

matchFileExt

public boolean matchFileExt(java.lang.String ext)
Returns:
true if this document matched this file extention

addFileExt

public void addFileExt(java.lang.String ext)
Add a file extension for loading/saving this document type


removeFileExt

public void removeFileExt(java.lang.String ext)
Remove this file extension for loading/saving this document type


setDefaultFileExt

public void setDefaultFileExt(java.lang.String ext)
Reset the default file ext. If will be used to complete any file name without extention while loading/saving a file

Parameters:
ext - Default file extension

getDefaultFileExt

public java.lang.String getDefaultFileExt()
Returns:
the default file extention. If no default file ext has been specified, then 'xml' is returned

getSupportedFileExt

public java.lang.String[] getSupportedFileExt()
Returns:
set of file extension for loading/saving this document type

setSupportedFileExt

public void setSupportedFileExt(java.lang.String[] content)
Reset a set of file extension for this document type


getFileFilter

public javax.swing.filechooser.FileFilter getFileFilter()
Returns:
a file chooser filter for this document. It will use the file ext data

setDocumentDescription

public void setDocumentDescription(java.lang.String description)
Reset the document description. This description will be used inside file dialog box for filtering document


getDocumentDescription

public java.lang.String getDocumentDescription()
Returns:
the document description

setDefaultSchema

public void setDefaultSchema(java.lang.String root,
                             java.lang.String location)
Reset the default schema root and location for syntax completion


getDefaultSchemaLocation

public java.lang.String getDefaultSchemaLocation()
Returns:
the default schema URL location

getDefaultSchemaRoot

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

setDefaultDTD

public void setDefaultDTD(java.lang.String root,
                          java.net.URL location)

setDefaultDTD

public void setDefaultDTD(java.lang.String root,
                          java.lang.String location)
Reset the defaultDTD location for syntax completion


setOriginalDTDLocation

public void setOriginalDTDLocation(java.lang.String dtd)
Particular case when a mapping is done with the DTD location


getOriginalDTDLocation

public java.lang.String getOriginalDTDLocation()
Particular case when a mapping is done with the DTD location


getDefaultDTDLocation

public java.lang.String getDefaultDTDLocation()
Returns:
the default DTD location for syntax completion

getDefaultDTDURL

public java.net.URL getDefaultDTDURL()
Returns:
a stream with the default DTD content

getDefaultDTDRoot

public java.lang.String getDefaultDTDRoot()
Returns:
the default DTD root for syntax completion

setWorkingDirectory

public void setWorkingDirectory(java.lang.String workingDirectory)
Reset the default working directory. It will be used by file dialog for initializing

Parameters:
workingDirectory -

getWorkingDirectory

public java.lang.String getWorkingDirectory()
Returns:
the default working directory

setCurrentDocumentLocation

public void setCurrentDocumentLocation(java.lang.String location)
Reset the current document location


getCurrentDocumentLocation

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

setCurrentDocumentLocationArg

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


getCurrentDocumentLocationArg

public java.lang.Object getCurrentDocumentLocationArg()
Returns:
the current document location optional argument

getDocumentName

public java.lang.String getDocumentName()
Returns:
a document shortcut name

getDocumentIcon

public javax.swing.Icon getDocumentIcon()
Returns:
the current document icon

setDocumentIcon

public void setDocumentIcon(javax.swing.Icon icon)
Reset the document icon


setDocumentIconPath

public void setDocumentIconPath(java.lang.String iconPath)
Information relative to the current document icon path


getDocumentIconPath

public java.lang.String getDocumentIconPath()
Returns:
information relative to the current document icon path

setTemplate

public void setTemplate(java.lang.String documentTemplate)
Set a template for this document type


getTemplate

public java.lang.String getTemplate()
Returns:
a template for this document

setId

public void setId(java.lang.String id)
Give an identifier


getId

public java.lang.String getId()
Returns:
the document identifier

getSystemHelper

public SystemHelper getSystemHelper()
Returns:
a system helper for this document. This helper is provided thanks to the sysHelper property

getSystemHelperClass

public java.lang.String getSystemHelperClass()
Returns:
a class name for the system helper

setSystemHelperClass

public void setSystemHelperClass(java.lang.String helper)
Reset a class name for the system helper


setTreeAvailable

public void setTreeAvailable(boolean tree)
The tree will be available for this document


isTreeAvailable

public boolean isTreeAvailable()
Returns:
true if the tree is available. By default to true

setRealTimeTree

public void setRealTimeTree(boolean realTimeTree)
The real time tree will be available : By default true


isRealTimeTree

public boolean isRealTimeTree()
Returns:
true if the real time tree is available for this document

hasSyntaxColor

public boolean hasSyntaxColor()
Returns:
true if an XML syntax color is available

setSyntaxColor

public void setSyntaxColor(boolean syntaxColor)
Parameters:
syntaxColor - define if a XML syntax color is available. By default true

hasAutoClosing

public boolean hasAutoClosing()
Returns:
true if the auto tag closing is available

hasSyntaxHelper

public boolean hasSyntaxHelper()
Returns:
true if the syntax helper is available

setSyntaxHelper

public void setSyntaxHelper(boolean sh)
Reset the syntax helper. By default to true


setAutoClosing

public void setAutoClosing(boolean autoClosing)
Set the auto tag closing feature. By default to true


setType

public void setType(java.lang.String type)
Reset a known type for this document


getType

public java.lang.String getType()
Returns:
the current document type, like XML, DTD...

setParentType

public void setParentType(java.lang.String parentType)
Reset a parent type for this document


getParentType

public java.lang.String getParentType()

setHelperHandlers

public void setHelperHandlers(java.util.ArrayList handlers,
                              boolean appendMode)
Set specific handlers for the content assistant

Parameters:
handlers - List of handlers
appendMode - maintain or replace the current assistants

isAssistantAppendMode

public boolean isAssistantAppendMode()
Only when providing a set of handlers with the setHelperHandlers method


getHelperHandlers

public java.util.ArrayList getHelperHandlers()
Returns:
specific handlers for the content assistant

addHelperHandler

public void addHelperHandler(AbstractHelperHandler handler)
Add a new handler


cloneDocument

public XMLDocumentInfo cloneDocument()
Returns:
another XMLDocumentInfo instance from this one

getDefaultNamespacePrefix

public java.lang.String getDefaultNamespacePrefix()

setDefaultNamespace

public void setDefaultNamespace(java.lang.String namespace)

getDefaultNamespace

public java.lang.String getDefaultNamespace()

isDtdMode

public boolean isDtdMode()
For DTD coloration


setDtdMode

public void setDtdMode(boolean dtdMode)
For DTD coloration


setSchemaValid

public void setSchemaValid(java.lang.String schema)
Force a W3C schema validation with this document url


getSchemaValid

public java.lang.String getSchemaValid()

setSelectFirstTagAfterReading

public void setSelectFirstTagAfterReading(boolean select)
When opening a new document the first element is chosen automatically


isSelectFirstTagAfterReading

public boolean isSelectFirstTagAfterReading()
When opening a new document the first element is chosen automatically


setListOfAttributesWithAutoAssistant

public void setListOfAttributesWithAutoAssistant(java.lang.String[] atts)
Particular usage for asking an assistant automatically when adding an attribute


getListOfAttributesWithAutoAssistant

public java.lang.String[] getListOfAttributesWithAutoAssistant()

setDTDExternalCommentFile

public void setDTDExternalCommentFile(java.lang.String url)
Special file for using external comment to a dtd. Should not be used


getDTDExternalCommentFile

public java.lang.String getDTDExternalCommentFile()
Special file for using external comment to a dtd. Should not be used


setColorForPrefix

public void setColorForPrefix(java.lang.String prefixName,
                              java.awt.Color c)
Choose a particular color for a tag prefix. Use the color null for removing it


getColorForPrefix

public java.awt.Color getColorForPrefix(java.lang.String prefixName)
Returns:
a custom color for this prefix name

hasColorForPrefix

public boolean hasColorForPrefix(java.lang.String prefixName)
Returns:
true if a color exist for this prefixName

setBackgroundColorForPrefix

public void setBackgroundColorForPrefix(java.lang.String prefixName,
                                        java.awt.Color c)
Choose a particular background color for a tag prefix. Use the color null for removing it


getBackgroundColorForPrefix

public java.awt.Color getBackgroundColorForPrefix(java.lang.String prefixName)
Returns:
a custom background color for this prefix name

hasBackgroundColorForPrefix

public boolean hasBackgroundColorForPrefix(java.lang.String prefixName)
Returns:
true if a background color exist for this prefixName

setColorForTag

public void setColorForTag(java.lang.String tagName,
                           java.awt.Color c)
Define a color for this tagName. Use a null color for removing it


getColorForTag

public java.awt.Color getColorForTag(java.lang.String tagName)
Returns:
a custom color for this tagName

hasColorForTag

public boolean hasColorForTag(java.lang.String tagName)
Returns:
true if a custom color exists for this tagName

setColorForAttribute

public void setColorForAttribute(java.lang.String attributeName,
                                 java.awt.Color c)
Choose a particular color for an attribute. Use the color null for removing it


getColorForAttribute

public java.awt.Color getColorForAttribute(java.lang.String attributeName)
Returns:
the user custom color for this attribute

hasColorForAttribute

public boolean hasColorForAttribute(java.lang.String attributeName)
Returns:
true if this attribute has a custom color


Copyright © 2006 JAPISoft. All Rights Reserved.