|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.fg.ftree.DefaultFTreeModel
com.fg.xmleditor.FXDocumentModelImpl
XML editor data-model implementation class.
| Constructor Summary | |
FXDocumentModelImpl()
|
|
| Method Summary | |
void |
addModelStatusListener(FXModelStatusListener listener)
Registers FXModelStatusListener listener. |
void |
clear()
Removes current XML document from data-model. |
void |
fireTreeModelDataChanged(boolean restructured)
Method call causes a data-model object to notify all the registered FTreeModelListener listemers about
document changes. |
java.lang.String[] |
getAvailableRootElementNames(java.lang.String ns)
Returns an array of names of global non-abstract elements names for the given namespace. |
java.lang.String[] |
getAvailableRootNamespaces()
Returns an array of namespaces which have global definitions of non-absract elements. |
org.w3c.dom.Document |
getDocument()
Returns current XML document as a DOM Tree or null when
data-model contains no document. |
java.lang.String |
getNodeMessage(FToggleNode node)
Method returns a message for a node (XML element or attribute), which is specified in the respective "appinfo" element of the XML Shema document. |
java.util.Map |
getNSQualifiers()
Returns a Map object, which contains namespaces (as keys) and namespace qualifiers (as values). |
java.lang.String |
getRootElementName()
Returns a local name of the root XML element. |
java.lang.String |
getRootNamespace()
Returns a namespace of the root XML element. |
java.net.URL |
getSchemaURL()
Returns a URL of the current XML Schema document. |
java.lang.String |
getValidityMessage(FToggleNode node,
java.lang.Object value)
Method validates value with validation rules for the specified node and returns null when value is valid and
an error message otherwise. |
FToggleNode |
insertInstance(FToggleNode arrayNode,
int index)
Insert a new FToggleNode instance of Element,
Substitution Group or Model Group into an Array folder at the
specified position. |
boolean |
isDocumentChanged()
Method returns "changed" status for the current XML document. |
boolean |
isDocumentValid()
Method returns validity status for the current XML document. |
void |
newDocument(java.net.URL schemaURL)
Creates a new empty XML document for the specified XML Schema for the first available root namespace and element name found. |
void |
newDocument(java.net.URL schemaURL,
java.lang.String elementName)
Creates a new empty XML document for specified XML Schema and name of the root element. |
void |
newDocument(java.net.URL schemaURL,
java.lang.String ns,
java.lang.String elementName)
Creates a new empty XML document for specified XML Schema and namespace and name of the root element. |
java.util.List |
openDocument(java.net.URL schemaURL,
org.w3c.dom.Document doc)
Opens an existing XML document with specified XML Schema. |
java.util.List |
openDocument(java.net.URL schemaURL,
org.xml.sax.InputSource src)
Opens an existing XML document with specified XML Schema. |
java.util.List |
openDocument(java.net.URL schemaURL,
java.net.URL docURL)
Opens an existing XML document with specified XML Schema. |
boolean |
populateNode(FToggleNode parentNode)
Populates an empty Element node with all child nodes. |
int |
removeInstance(FToggleNode node)
Removes specified FToggleNode instance of Element,
Substitution Group or Model Group from an Array folder. |
void |
removeModelStatusListener(FXModelStatusListener listener)
Unregisters FXModelStatusListener listener. |
void |
setDocumentChanged(boolean changed)
Allows to set "changed" status for the current XML document programaticaly. |
void |
setFolderBackground(int type,
java.awt.Color color)
Sets background color for specified type of tree folders. |
void |
setNodeImage(int type,
java.awt.Image image)
Sets an image for the specified type of tree nodes. |
void |
setNodeValue(FToggleNode node,
java.lang.Object newValue)
Assignes a new value to specified FToggleNode node. |
void |
setNSQualifier(java.lang.String namespace,
java.lang.String qualifier)
Sets a namespace qualifier. |
void |
toggleSelectionChanged(FToggleNode node)
Revalidates a tree after a toggle control (check-box or radio-button) of the specified node was selected or unselected. |
| Methods inherited from class com.fg.ftree.DefaultFTreeModel |
addTreeModelListener, getAllowsChildren, getChild, getChildCount, getRoot, removeTreeModelListener |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.fg.ftree.FTreeModel |
addTreeModelListener, getAllowsChildren, getChild, getChildCount, getRoot, removeTreeModelListener |
| Constructor Detail |
public FXDocumentModelImpl()
| Method Detail |
public void setFolderBackground(int type,
java.awt.Color color)
XSRef class (or any number of these
constants combined with | - bitwise OR operators).
type - a folder type - an integer constant declared in the
XSRef class (or any number of these constants combined
with | - bitwise OR operators).color - a folder background.
public void setNodeImage(int type,
java.awt.Image image)
XSRef class (or any number of these
constants combined with | - bitwise OR operators).
type - a node type - an integer constant declared in the
XSRef class (or any number of these constants combined
with | - bitwise OR operators).public void addModelStatusListener(FXModelStatusListener listener)
FXModelStatusListener listener.
addModelStatusListener in interface FXModellistener - FXModelStatusListener object.public void removeModelStatusListener(FXModelStatusListener listener)
FXModelStatusListener listener.
removeModelStatusListener in interface FXModellistener - FXModelStatusListener object.public boolean isDocumentChanged()
isDocumentChanged in interface FXModelpublic void setDocumentChanged(boolean changed)
false after the
current document is saved.
setDocumentChanged in interface FXDocumentModelchanged - a "changed" boolean valuepublic boolean isDocumentValid()
isDocumentValid in interface FXModelpublic void fireTreeModelDataChanged(boolean restructured)
FTreeModelListener listemers about
document changes.
fireTreeModelDataChanged in interface FXModelfireTreeModelDataChanged in class DefaultFTreeModelrestructured - equals true if document was
restructured (some nodes were deleted or added).public java.net.URL getSchemaURL()
getSchemaURL in interface FXDocumentModelpublic java.lang.String[] getAvailableRootNamespaces()
getAvailableRootNamespaces in interface FXDocumentModelpublic java.lang.String[] getAvailableRootElementNames(java.lang.String ns)
getAvailableRootElementNames in interface FXDocumentModelns - a namespace URI
public java.lang.String getRootNamespace()
getRootNamespace in interface FXModelpublic java.lang.String getRootElementName()
getRootElementName in interface FXModel
public void newDocument(java.net.URL schemaURL)
throws FXModelException
newDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema document
FXModelException - when specified XML document can't be created
public void newDocument(java.net.URL schemaURL,
java.lang.String elementName)
throws FXModelException
FXModelException when no
such namespace found.
newDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema documentelementName - a local name of the root XML element
FXModelException - when specified XML document can't be created
public void newDocument(java.net.URL schemaURL,
java.lang.String ns,
java.lang.String elementName)
throws FXModelException
newDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema documentns - a namespace of the root XML elementelementName - a local name of the root XML element
FXModelException - when specified XML document can't be created
public java.util.List openDocument(java.net.URL schemaURL,
org.w3c.dom.Document doc)
throws FXModelException
openDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema documentdoc - a Document object, which holds existing XML document
org.w3c.dom.Element elements, which
have not been loaded because of the document structural invalidity or
null if the whole document has been loaded successfully.
FXModelException - when specified XML document can't be opened
with the specified XML Schema.
public java.util.List openDocument(java.net.URL schemaURL,
java.net.URL docURL)
throws FXModelException
openDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema documentdocURL - a URL of the XML document
org.w3c.dom.Element elements, which
have not been loaded because of the document structural invalidity or
null if the whole document has been loaded successfully.
FXModelException - when specified XML document can't be opened
with the specified XML Schema.
public java.util.List openDocument(java.net.URL schemaURL,
org.xml.sax.InputSource src)
throws FXModelException
openDocument in interface FXDocumentModelschemaURL - a URL of the XML Schema documentsrc - an InputSource for the XML document
org.w3c.dom.Element elements, which
have not been loaded because of the document structural invalidity or
null if the whole document has been loaded successfully.
FXModelException - when specified XML document can't be opened
with the specified XML Schema.public void clear()
clear in interface FXDocumentModelpublic boolean populateNode(FToggleNode parentNode)
true when operation is
allowed and does nothing and returns false otherwise.
populateNode in interface FXModelparentNode - FToggleNode object, which represents
XML Element node.
true when operation is allowed and
false otherwise.
public FToggleNode insertInstance(FToggleNode arrayNode,
int index)
FToggleNode instance of Element,
Substitution Group or Model Group into an Array folder at the
specified position. If an instance can be inserted, the method
returns reference to the new instance, otherwise it returns
null.
- Specified by:
insertInstance in interface FXModel
- Parameters:
arrayNode - FToggleNode object, which represents
Array folder node.
- Returns:
- a reference to the inserted instance or
null
when operation is not allowed.
public int removeInstance(FToggleNode node)
FToggleNode instance of Element,
Substitution Group or Model Group from an Array folder. If an
instance can be removed, the method returns a former index of the
removed instance within Array folder, otherwise it returns -1.
removeInstance in interface FXModelnode - FToggleNode object, which represents
instance to be removed.
public void toggleSelectionChanged(FToggleNode node)
toggleSelectionChanged in interface FXModelnode - FToggleNode object, whose toggle control
(check-box or radio-button) node was selected or unselected.
public void setNodeValue(FToggleNode node,
java.lang.Object newValue)
FToggleNode node.
setNodeValue in interface FXModelnode - FToggleNode object, to which new value
will be assigned.newValue - a value to be assigned to the specified node.
public java.lang.String getValidityMessage(FToggleNode node,
java.lang.Object value)
null when value is valid and
an error message otherwise.
getValidityMessage in interface FXModelnode - FToggleNode object.value - an Object value to be validated.
null if value is valid and error
message otherwisepublic java.lang.String getNodeMessage(FToggleNode node)
getNodeMessage in interface FXModelnode - FToggleNode object.public java.util.Map getNSQualifiers()
setNSQualifier(String, String) methods.
getNSQualifiers in interface FXModel
public void setNSQualifier(java.lang.String namespace,
java.lang.String qualifier)
setNSQualifier in interface FXModelnamespace - a namespace URIqualifier - a namespace qualifierpublic org.w3c.dom.Document getDocument()
null when
data-model contains no document.
getDocument in interface FXDocumentModelDocument object.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||