FXModel
Keywords: com.fg.xmleditor.FXModel interface

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.fg.xmleditor
Interface FXModel

All Superinterfaces:
  FTreeModel

All Known Subinterfaces:
  FXDocumentModel

All Known Implementing Classes:
  FXDocumentModelImpl

public interface FXModel
extends FTreeModel

Represents an XML editor data-model interface.

Version:
  1.0
Author:
  Felix Golubov

Method Summary
`void` | `addModelStatusListener(FXModelStatusListener listener)` Registers `FXModelStatusListener` listener.
`void` | `fireTreeModelDataChanged(boolean restructured)` Method call causes FXModel object to notify all the registered `FTreeModelListener` listemers about document changes.
`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()` Method returns a local name of the root XML element.
`java.lang.String` | `getRootNamespace()` Method returns a namespace of the root XML element.
`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.
`boolean` | `populateNode(FToggleNode parentNode)` Populates a 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` | `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 interface com.fg.ftree.FTreeModel
`addTreeModelListener, getAllowsChildren, getChild, getChildCount, getRoot, removeTreeModelListener`

Method Detail

### addModelStatusListener

    public void addModelStatusListener(FXModelStatusListener listener)

  Registers `FXModelStatusListener` listener.

  Parameters:
    `listener` - `FXModelStatusListener` object.

### removeModelStatusListener

    public void removeModelStatusListener(FXModelStatusListener listener)

  Unregisters `FXModelStatusListener` listener.

  Parameters:
    `listener` - `FXModelStatusListener` object.

### populateNode

    public boolean populateNode(FToggleNode parentNode)

  Populates a empty Element node with all child nodes. Performs operation and returns `true` when operation is allowed and does nothing and returns `false` otherwise.

  Parameters:
    `parentNode` - `FToggleNode` object, which represents XML Element node.
  Returns:
    `true` when operation is allowed and `false` otherwise.

### insertInstance

    public 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. If an instance can be inserted, the method returns reference to the new instance, otherwise it returns `null`.

  ``
  Parameters:
    `arrayNode` - `FToggleNode` object, which represents Array folder node.
  Returns:
    a reference to the inserted instance or `null` when operation is not allowed.

### removeInstance

    public int removeInstance(FToggleNode node)

  Removes specified `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.

  Parameters:
    `node` - `FToggleNode` object, which represents instance to be removed.
  Returns:
    a former index of the removed instance within Array folder or -1 when operation is not allowed.

### setNodeValue

    public void setNodeValue(FToggleNode node,
                             java.lang.Object newValue)

  Assignes a new value to specified `FToggleNode` node.

  Parameters:
    `node` - `FToggleNode` object, to which new value will be assigned.
    `newValue` - a value to be assigned to the specified node.

### toggleSelectionChanged

    public void toggleSelectionChanged(FToggleNode node)

  Revalidates a tree after a toggle control (check-box or radio-button) of the specified node was selected or unselected.

  Parameters:
    `node` - `FToggleNode` object, whose toggle control (check-box or radio-button) node was selected or unselected.

### getNodeMessage

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

  Parameters:
    `node` - `FToggleNode` object.

### getValidityMessage

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

  Parameters:
    `node` - `FToggleNode` object.
    `value` - an Object value to be validated.
  Returns:
    `null` if value is valid and error message otherwise

### isDocumentChanged

    public boolean isDocumentChanged()

  Method returns "changed" status for the current XML document.

  Returns:
    "changed" status for the current XML document.

### isDocumentValid

    public boolean isDocumentValid()

  Method returns validity status for the current XML document.

  Returns:
    validity status for the current XML document.

### fireTreeModelDataChanged

    public void fireTreeModelDataChanged(boolean restructured)

  Method call causes FXModel object to notify all the registered `FTreeModelListener` listemers about document changes.

  Parameters:
    `restructured` - equals `true` if document was restructured (some nodes were deleted or added).

### getNSQualifiers

    public java.util.Map getNSQualifiers()

  Returns a Map object, which contains namespaces (as keys) and namespace qualifiers (as values). The returned Map is a clone of an internal Map, so its changes don't affect the actual data. To assign custom qualifiers use `setNSQualifier(String, String)` methods.

  Returns:
    a Map object, which contains namespaces (as keys) and namespace qualifiers (as values).

### setNSQualifier

    public void setNSQualifier(java.lang.String namespace,
                               java.lang.String qualifier)

  Sets a namespace qualifier.

  Parameters:
    `namespace` - a namespace URI
    `qualifier` - a namespace qualifier

### getRootNamespace

    public java.lang.String getRootNamespace()

  Method returns a namespace of the root XML element.

  Returns:
    a namespace of the root XML element.

### getRootElementName

    public java.lang.String getRootElementName()

  Method returns a local name of the root XML element.

  Returns:
    a local name of the root XML element.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD