|
VdexReload 1.1.3 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.reload.moonunit.dom.ReloadDocument
uk.ac.reload.moonunit.dom.ReloadSchemaDocument
This encapsulates the JDOM XML Document file and the ReloadSchema associated with it plus helper methods.
Nested Class Summary | |
protected class |
ReloadSchemaDocument.UndoableAddAction
Handles Undo/Redo for Adding Elements |
protected class |
ReloadSchemaDocument.UndoableCopyAction
Handles Undo/Redo for Copying Elements |
protected class |
ReloadSchemaDocument.UndoableCutAction
Handles Undo/Redo for Cutting Elements |
protected class |
ReloadSchemaDocument.UndoableDeleteAction
Handles Undo/Redo for Deleting Elements |
protected class |
ReloadSchemaDocument.UndoableMoveAction
Handles Undo/Redo for Moving Elements |
protected class |
ReloadSchemaDocument.UndoablePasteAction
Handles Undo/Redo for Pasting Elements |
Field Summary | |
protected ReloadSchemaController |
_controller
The Schema that will be our template |
protected UndoHandler |
_undoHandler
The Undo Handler |
Fields inherited from class uk.ac.reload.moonunit.dom.ReloadDocument |
_dirty, _doc, _file |
Constructor Summary | |
ReloadSchemaDocument()
Default Constructor |
|
ReloadSchemaDocument(java.io.File file,
org.jdom.Document doc,
ReloadSchemaController schemaController)
Constructor that takes in a an XML filename, JDOM document and a ReloadSchemaController |
Method Summary | |
org.jdom.Attribute |
addAttribute(java.lang.Object source,
org.jdom.Element parentElement,
ReloadSchemaAttribute newSchemaAttribute)
Create and Add a new Attribute to a given Element as per the Schema |
protected void |
addComments(org.jdom.Document doc)
Add our signature comments to the XML Document |
org.jdom.Element |
addElement(java.lang.Object source,
org.jdom.Element parentElement,
org.jdom.Element childElement,
boolean doSelect)
Just add a new Element. |
org.jdom.Element |
addElementAtIndex(java.lang.Object source,
org.jdom.Element parentElement,
org.jdom.Element newElement,
int index,
boolean doSelect)
Add an Element at an index Position and Notify listeners |
org.jdom.Element |
addElementBySchema(java.lang.Object source,
org.jdom.Element parentElement,
ReloadSchemaElement newSchemaElement,
boolean doSelect)
Add a new Element to the parent Element based on ReloadSchemaElement Create new JDOM Element based on childSchemaElement Insert into the correct position! Set any defaults of the Element Add any default child Elements if needed |
org.jdom.Element |
addElementBySchemaUndoable(java.lang.Object source,
org.jdom.Element parentElement,
ReloadSchemaElement newSchemaElement,
boolean doSelect)
Add a new Element to the parent Element based on RELOADSchemaElement and register an Undo event. |
org.jdom.Element |
addElementUndoable(java.lang.Object source,
org.jdom.Element parentElement,
org.jdom.Element childElement,
boolean doSelect)
Just add a new Element. |
org.jdom.Element |
addElementUnique(java.lang.Object source,
ReloadSchemaElement newSchemaElement,
boolean doSelect)
Add a new Element given the Path in the ReloadSchemaElement. |
void |
addReloadDocumentListener(ReloadDocumentListener listener)
Add a ReloadDocumentListener |
boolean |
canAddElement(org.jdom.Element parentElement,
ReloadSchemaElement childSchemaElement)
Decide whether a child Element can be added to a parent Element by max amount |
boolean |
canCopyElement(org.jdom.Element element)
Decides whether an element can be copied or not - will need to override this |
boolean |
canCutElement(org.jdom.Element element,
ReloadSchemaElement schemaElement)
Decides whether we can cut an element - will need to override this |
boolean |
canDeleteElement(org.jdom.Element element,
ReloadSchemaElement schemaElement)
Decide whether a Element can be deleted |
boolean |
canMoveElementDown(org.jdom.Element element)
Decides whether we can move the element down by one place |
boolean |
canMoveElementUp(org.jdom.Element element)
Decides whether we can move the element up by one place |
boolean |
canPasteFromClipboard(org.jdom.Element element)
Decides whether we can paste an element - will need to override this |
void |
changedElement(java.lang.Object source,
org.jdom.Element element)
Somebody has notified us that they have changed an Element in some way. |
org.jdom.Element |
copyElementUndoable(java.lang.Object source,
org.jdom.Element element,
org.jdom.Element newParent,
boolean doSelect)
Copy an Element to a new Parent |
org.jdom.Element |
cutElementUndoable(java.lang.Object source,
org.jdom.Element element)
Cut a child Element from its parent and notify any listeners and Undo |
org.jdom.Element |
deleteElementUndoable(java.lang.Object source,
org.jdom.Element element)
Delete a child Element from its parent and notify any listeners and Undo |
void |
destroy()
Cleanup |
void |
fireDocumentSaved()
Tell our listeners that we have saved |
void |
fireElementAdded(ReloadDocumentListenerEvent event)
Tell our listeners that we have added a new Element |
void |
fireElementChanged(ReloadDocumentListenerEvent event)
Tell our listeners that we have changed an Element |
void |
fireElementRemoved(ReloadDocumentListenerEvent event)
Tell our listeners that we have deleted an Element |
abstract java.lang.String[] |
getComments()
Get the comments to add to the XML document |
org.jdom.Element |
getElement(DomPath domPath)
Return the 'first' found Element for the given DOM Path or null if not found return the first found element for the given DOM Path or null if not found |
org.jdom.Element |
getElement(ReloadSchemaElement schemaElement)
Return the 'first' found Element for the given DOM Path or null if not found |
org.jdom.Element[] |
getElements(DomPath domPath)
Return all Elements for the given DOM Path or null |
org.jdom.Element[] |
getElements(ReloadSchemaElement schemaElement)
Return all Elements for the given ReloadSchemaElement Path or an empty array |
static int |
getIndexOfElement(org.jdom.Element element)
Get the index position of an element in relation to its parent |
static int |
getInsertPositionOfAttribute(org.jdom.Element parentElement,
ReloadSchemaAttribute reloadSchemaAttribute)
Get the correct position to insert an Attribute in an Element according to the Schema |
static int |
getInsertPositionOfElement(org.jdom.Element parentElement,
ReloadSchemaElement newSchemaElement)
Get the correct position to insert an element according to the Schema |
ReloadSchemaController |
getReloadSchemaController()
Get the ReloadSchemaController for this Document |
org.jdom.Namespace |
getSchemaNamespace()
Get the schema namespace of the document, or the target namespace of there isn't one |
org.jdom.Namespace |
getTargetNamespace()
Get the target schema namespace of the document |
abstract java.lang.String |
getTargetRootElementName()
Get the Target Root element name |
UndoHandler |
getUndoHandler()
Get the undo handler for this document |
boolean |
isAllowedChild(org.jdom.Element parentElement,
org.jdom.Element childElement)
Decide whether a child is allowed or not depending on the schema rules |
org.jdom.Element |
moveElementDown(java.lang.Object source,
org.jdom.Element element,
boolean doSelect)
Move an Element down one place |
org.jdom.Element |
moveElementUndoable(java.lang.Object source,
org.jdom.Element element,
org.jdom.Element newParent,
boolean doSelect)
Move an Element to a new Parent |
org.jdom.Element |
moveElementUp(java.lang.Object source,
org.jdom.Element element,
boolean doSelect)
Move an Element up one place |
org.jdom.Element |
pasteElementUndoable(java.lang.Object source,
org.jdom.Element element,
org.jdom.Element newParent,
boolean doSelect)
Paste an Element to a new Parent |
org.jdom.Element |
removeElement(java.lang.Object source,
org.jdom.Element element)
Remove a child Element from its parent and notify any listeners |
void |
removeReloadDocumentListener(ReloadDocumentListener listener)
Remove a ReloadDocumentListener |
void |
saveDocument()
This will save the XML IMS file with the existing File ref and notify any listeners |
void |
setReloadSchemaController(ReloadSchemaController controller)
Set the ReloadSchemaController |
void |
setUndoHandler(UndoHandler undoHandler)
Set the undo handler for this document |
Methods inherited from class uk.ac.reload.moonunit.dom.ReloadDocument |
getDocument, getFile, getRootElement, isDirty, isDocumentNamespace, isMemberOfSameDocument, loadDocument, saveAsDocument, setDirty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ReloadSchemaController _controller
protected UndoHandler _undoHandler
Constructor Detail |
public ReloadSchemaDocument()
public ReloadSchemaDocument(java.io.File file, org.jdom.Document doc, ReloadSchemaController schemaController)
file
- the XML file, for example an IMS metadata or an IMS VDEX vocabulary file
doc the JDOM document of the XML file
schemaController the ReloadSchemaController corresponding to the schema of the XML fileMethod Detail |
public void setReloadSchemaController(ReloadSchemaController controller)
controller
- the ReloadSchemaControllerpublic ReloadSchemaController getReloadSchemaController()
public void saveDocument() throws ReloadDomException
saveDocument
in class ReloadDocument
ReloadDomException
- if an error occurspublic abstract java.lang.String getTargetRootElementName()
public abstract java.lang.String[] getComments()
public org.jdom.Namespace getSchemaNamespace()
getSchemaNamespace
in class ReloadDocument
public org.jdom.Namespace getTargetNamespace()
public org.jdom.Element getElement(ReloadSchemaElement schemaElement)
public org.jdom.Element getElement(DomPath domPath)
public org.jdom.Element[] getElements(ReloadSchemaElement schemaElement)
public org.jdom.Element[] getElements(DomPath domPath)
protected void addComments(org.jdom.Document doc)
doc
- the document to which the signature comments has to be addedpublic void destroy()
public org.jdom.Element addElementUnique(java.lang.Object source, ReloadSchemaElement newSchemaElement, boolean doSelect)
source
- Who is adding it
newSchemaElement the new schema element type we want to add
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public org.jdom.Element addElementBySchemaUndoable(java.lang.Object source, org.jdom.Element parentElement, ReloadSchemaElement newSchemaElement, boolean doSelect)
source
- who is telling us thisparentElement
- the parent Element to add tonewSchemaElement
- the Type of Element we want to adddoSelect
- true or false depending on whether the new added element should be selected or not on the user interfacepublic org.jdom.Element addElementBySchema(java.lang.Object source, org.jdom.Element parentElement, ReloadSchemaElement newSchemaElement, boolean doSelect)
source
- who is telling us thisparentElement
- the parent Element to add tonewSchemaElement
- the Type of Element we want to adddoSelect
- true or false depending on whether the new added element should be selected or not on the user interfacepublic org.jdom.Element addElementUndoable(java.lang.Object source, org.jdom.Element parentElement, org.jdom.Element childElement, boolean doSelect)
source
- tho is telling us this
parentElement the parent Element to add to
childElement the child element to be added to the parent element
doSelect true or false depending on whether the new added element should be selected or not on the user interfacepublic org.jdom.Element addElement(java.lang.Object source, org.jdom.Element parentElement, org.jdom.Element childElement, boolean doSelect)
source
- who is telling us this
parentElement the parent Element to add to
childElement the child element to be added to the parent element
doSelect true or false depending on whether the new added element should be selected or not on the user interfacepublic org.jdom.Element addElementAtIndex(java.lang.Object source, org.jdom.Element parentElement, org.jdom.Element newElement, int index, boolean doSelect)
source
- who is telling us this
parentElement the parent Element to add to
newElement the new element to be added to the parent element
index the index position at which the new element has to be added
doSelect true or false depending on whether the new added element should be selected or not on the user interfacepublic org.jdom.Element deleteElementUndoable(java.lang.Object source, org.jdom.Element element)
source
- who is telling us thiselement
- the Element to removepublic org.jdom.Element cutElementUndoable(java.lang.Object source, org.jdom.Element element)
source
- who is telling us thiselement
- the Element to removepublic org.jdom.Element removeElement(java.lang.Object source, org.jdom.Element element)
source
- who is telling us thiselement
- the Element to removepublic org.jdom.Element moveElementUndoable(java.lang.Object source, org.jdom.Element element, org.jdom.Element newParent, boolean doSelect)
source
- who is telling us this
element the element to be moved
newParent the new parent element
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public org.jdom.Element copyElementUndoable(java.lang.Object source, org.jdom.Element element, org.jdom.Element newParent, boolean doSelect)
source
- who is telling us this
element the element to be copied
newParent the new parent element
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public org.jdom.Element pasteElementUndoable(java.lang.Object source, org.jdom.Element element, org.jdom.Element newParent, boolean doSelect)
source
- who is telling us this
element the element to be pasted
newParent the new parent element
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public org.jdom.Element moveElementUp(java.lang.Object source, org.jdom.Element element, boolean doSelect)
source
- who is telling us this
element the element to be moved up
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public org.jdom.Element moveElementDown(java.lang.Object source, org.jdom.Element element, boolean doSelect)
source
- who is telling us this
element the element to be moved down
doSelect true or false depending on whether the new added element should be selected or not on the user interface
public void changedElement(java.lang.Object source, org.jdom.Element element)
source
- who is telling us thiselement
- the Element that changedpublic boolean canAddElement(org.jdom.Element parentElement, ReloadSchemaElement childSchemaElement)
parentElement
- the parent Element to which we wish to addchildSchemaElement
- the SchemaElement of the child to add
public boolean isAllowedChild(org.jdom.Element parentElement, org.jdom.Element childElement)
parentElement
- the parent element to which we wish to add
childElement the child element to add
public boolean canDeleteElement(org.jdom.Element element, ReloadSchemaElement schemaElement)
element
- the Element which we wish to deleteschemaElement
- the SchemaElement of the Element
public boolean canCopyElement(org.jdom.Element element)
element
- the element which we are testing
public boolean canCutElement(org.jdom.Element element, ReloadSchemaElement schemaElement)
element
- the element which we are testing
schemaElement the schemaElement against which we are testing
public boolean canPasteFromClipboard(org.jdom.Element element)
element
- the element which we are testing
public boolean canMoveElementUp(org.jdom.Element element)
element
- the element which we are testing
public boolean canMoveElementDown(org.jdom.Element element)
element
- the element which we are testing
public org.jdom.Attribute addAttribute(java.lang.Object source, org.jdom.Element parentElement, ReloadSchemaAttribute newSchemaAttribute)
source
- who is telling us this
parentElement the parent element to which we wish to add
newSchemaAttribute the new schema attribute we wish to add to the parent element
public static int getIndexOfElement(org.jdom.Element element)
element
- the element for which we require the index position
public static int getInsertPositionOfElement(org.jdom.Element parentElement, ReloadSchemaElement newSchemaElement)
parentElement
- the parent element to which the new element is to be added
newSchemaElement the type of Element we want to add
public static int getInsertPositionOfAttribute(org.jdom.Element parentElement, ReloadSchemaAttribute reloadSchemaAttribute)
parentElement
- the parent element to which the new attribute is to be added
reloadSchemaAttribute the type of attribute we want to add
public void addReloadDocumentListener(ReloadDocumentListener listener)
listener
- The ReloadDocumentListenerpublic void removeReloadDocumentListener(ReloadDocumentListener listener)
listener
- The ReloadDocumentListenerpublic void fireElementAdded(ReloadDocumentListenerEvent event)
event
- the ReloadDocumentListenerEventpublic void fireElementRemoved(ReloadDocumentListenerEvent event)
event
- the ReloadDocumentListenerEventpublic void fireElementChanged(ReloadDocumentListenerEvent event)
event
- the ReloadDocumentListenerEventpublic void fireDocumentSaved()
public void setUndoHandler(UndoHandler undoHandler)
public UndoHandler getUndoHandler()
|
VdexReload 1.1.3 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |