Package org.opentrafficsim.editor
Class XsdTreeNodeRoot
java.lang.Object
org.djutils.event.LocalEventProducer
org.opentrafficsim.editor.XsdTreeNode
org.opentrafficsim.editor.XsdTreeNodeRoot
- All Implemented Interfaces:
Serializable
,Remote
,org.djutils.event.EventProducer
Extends
This class also sets up a listener for all xsd:key, xsd:keyref and xsd:unique from the schema.
XsdTreeNode
with event producer capabilities. In this way there is a clear central point for subscription to
events on node creation and removal. Because this node itself is created, and the tree table model will expand two layers,
for none of those nodes creation events can be thrown regularly after listeners have had a change to register with this root
node. Therefore, this class overrides addListener(...)
to throw a creation event for all existing nodes in the tree.
This class also sets up a listener for all xsd:key, xsd:keyref and xsd:unique from the schema.
Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Wouter Schakel
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.djutils.event.EventType
Event when a node is created.static final org.djutils.event.EventType
Event when a node is removed.Fields inherited from class org.opentrafficsim.editor.XsdTreeNode
ACTIVATION_CHANGED, active, ATTRIBUTE_CHANGED, children, choice, MOVED, OPTION_CHANGED, options, parent, referringXsdNode, selected, VALUE_CHANGED, xsdNode
Fields inherited from interface org.djutils.event.EventProducer
FIRST_POSITION, LAST_POSITION
-
Constructor Summary
ConstructorDescriptionXsdTreeNodeRoot
(Schema schema) Constructor for root node, based on a schema. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addListener
(org.djutils.event.EventListener listener, org.djutils.event.EventType eventType, int position, org.djutils.event.reference.ReferenceType referenceType) Overridden to throw events on existing nodes to the listener.Returns the directory.getRoot()
Returns the root node.Returns the schema location.void
setDirectory
(String directory) Set the directory.void
setSchemaLocation
(String schemaLocation) Sets the scehame location.Methods inherited from class org.opentrafficsim.editor.XsdTreeNode
add, addAttributeValidator, addAttributeValidator, addConsumer, addListener, addNodeValidator, addValueValidator, assureChildren, attributeCount, attributeIsExpression, canContain, canMoveDown, canMoveUp, consume, copyInto, createOptions, duplicate, duplicate, emptyCopy, getAttributeBaseType, getAttributeIndexByName, getAttributeNameByIndex, getAttributeNode, getAttributeRestrictions, getAttributeValue, getAttributeValue, getChild, getChildCount, getChildren, getConsumerMenuItems, getCoupledKeyrefNodeAttribute, getCoupledKeyrefNodeAttribute, getCoupledKeyrefNodeValue, getDefaultAttributeValue, getDescription, getFirstChild, getId, getIdRestrictions, getNodeName, getOption, getOptions, getParent, getPath, getPathString, getShortString, getValue, getValueRestrictions, hasAttribute, hasConsumer, hasExpression, idIsExpression, invalidate, invalidateAll, isActive, isAddable, isChoice, isEditable, isIdentifiable, isInclude, isRemovable, isSelfValid, isType, isValid, loadChildren, loadXmlNodes, maxOccurs, minOccurs, move, remove, reportInvalidAttributeValue, reportInvalidId, reportInvalidNode, reportInvalidValue, saveXmlNodes, setActive, setAttributeValue, setAttributeValue, setChild, setId, setInactive, setOption, setStringFunction, setValue, toString, valueIsExpression
Methods inherited from class org.djutils.event.LocalEventProducer
addListener, addListener, fireEvent, fireEvent, fireEvent, fireTimedEvent, fireTimedEvent, fireTimedEvent, fireUnverifiedEvent, fireUnverifiedEvent, fireUnverifiedTimedEvent, fireUnverifiedTimedEvent, getEventListenerMap, getEventTypesWithListeners, getListenerReferences, hasListeners, numberOfListeners, removeAllListeners, removeAllListeners, removeListener
-
Field Details
-
NODE_CREATED
public static final org.djutils.event.EventType NODE_CREATEDEvent when a node is created. This event is always thrown by the root of the data structure. Listeners should register with the root. -
NODE_REMOVED
public static final org.djutils.event.EventType NODE_REMOVEDEvent when a node is removed. Invoked for each individual node, including all child nodes of a node that a user removes. This event is always thrown by the root of the data structure. Listeners should register with the root.
-
-
Constructor Details
-
XsdTreeNodeRoot
Constructor for root node, based on a schema.- Parameters:
schema
- XsdSchema; XSD Schema.- Throws:
RemoteException
- when unable to listen for created nodes.
-
-
Method Details
-
getDirectory
Returns the directory.- Returns:
- String; directory.
-
setDirectory
Set the directory.- Parameters:
directory
- String; directory.
-
getRoot
Returns the root node.- Overrides:
getRoot
in classXsdTreeNode
- Returns:
- XsdTreeNodeRoot; root node.
-
addListener
public boolean addListener(org.djutils.event.EventListener listener, org.djutils.event.EventType eventType, int position, org.djutils.event.reference.ReferenceType referenceType) Overridden to throw events on existing nodes to the listener.- Specified by:
addListener
in interfaceorg.djutils.event.EventProducer
- Overrides:
addListener
in classorg.djutils.event.LocalEventProducer
-
setSchemaLocation
Sets the scehame location. This can't happen through the editor, but it may be set when loading a file.- Parameters:
schemaLocation
- String; schema location.
-
getSchemaLocation
Returns the schema location. If it is notnull
it was set during file loading, and will be saved too.- Returns:
- String; schema location.
-