oracle.ide.model
Class XMLDataContainer
java.lang.Object
|
+--oracle.ide.model.DefaultDisplayable
|
+--oracle.ide.model.DefaultElement
|
+--oracle.ide.model.DefaultDocument
|
+--oracle.ide.model.DefaultNode
|
+--oracle.ide.model.XMLDataNode
|
+--oracle.ide.model.XMLDataContainer
- All Implemented Interfaces:
- Category, Container, Data, Dirtyable, Displayable, Document, Element, Folder, LazyLoadable, Locatable, Node, Subject
- public class XMLDataContainer
- extends XMLDataNode
- implements Container
The XMLDataContainer
is the Container
wrapper
for a Folder
-implementing JavaBean that can be
persisted to XML using the XML marshalling framework in
oracle.ide.marshal.xml
.
XMLDataContainer
wraps objects that can contain
children. In order to interact with XMLDataContainer
,
wrapped objects must implement Folder
.
All methods to the XMLDataContainer
's Element
,
Folder
, and Container
methods are forwarded to the
wrapped Folder
object.
If the wrapped object is not an instance of Folder
,
then an IllegalStateException
will be thrown every time
an operation that requires the children list is called.
- See Also:
Object2Dom
Method Summary |
boolean |
add(Element element)
Appends a child Element to the end of the
Folder . |
boolean |
add(Element element,
boolean notify)
This is a variant of the Folder.add(Element) method
that accepts an additional flag that indicates whether or not
notifications of the change should be sent to registered observers. |
boolean |
canAdd(Element element)
Other classes can call this method to determine whether the given
Element can be added to the Folder . |
boolean |
canRemove(Element element)
Other classes can call this method to determine whether the
specified Element can be removed from this
Folder . |
boolean |
containsChild(Element child)
Returns true if the folder contains the
specified child Element ; returns false
otherwise. |
protected Folder |
getDataFolder()
Retrieves the Folder object associated with this
XMLDataContainer instance. |
boolean |
mayHaveChildren()
This method is part of the Element interface to
provide a convenient way of determining whether an object may
have children without having to test the object's type with the
instanceof operator or having to downcast to a
more specific type. |
boolean |
remove(Element element)
Removes the specified child Element . |
boolean |
remove(Element element,
boolean notify)
This is a variant of the Folder.remove(Element) method
that accepts an additional flag that indiciates whether or not
notifications of the change should be sent to registered observers. |
void |
removeAll()
Removes all children from the folder. |
void |
removeAll(boolean notify)
Removes all elements in the Container . |
int |
size()
Returns the current number of children in the folder. |
Methods inherited from class oracle.ide.model.XMLDataNode |
close, getAttributes, getCategory, getChildren, getData, getDataCastPacketDirectly, getDefaultClass, getIcon, getToolTipText, getXMLRootElementName, markDirty, newObject2Dom, open, reopen, save, setData, setDataCastPacketDirectly, setNodeInfo, setURL |
Methods inherited from class oracle.ide.model.DefaultDocument |
attach, copyToImpl, createSubject, detach, ensureOpen, equalsImpl, getInputStream, getLongLabel, getShortLabel, getSubject, getTimestamp, getTimestampDirectly, getURL, isDirty, isNew, isOpen, isReadOnly, notifyObservers, refreshTimestamp, setOpen, setTimestampDirectly |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.ide.model.Data |
getData |
XMLDataContainer
public XMLDataContainer()
mayHaveChildren
public boolean mayHaveChildren()
- Description copied from interface:
Element
- This method is part of the
Element
interface to
provide a convenient way of determining whether an object may
have children without having to test the object's type with the
instanceof
operator or having to downcast to a
more specific type.
An implementation of Element
that represents a leaf
in a tree structure should return false
from this
method. An implementation of Element
that could
represent a non-leaf in a tree structure should return
true
from this method, even if it does not currently
contain any children.
- Specified by:
mayHaveChildren
in interface Element
- Overrides:
mayHaveChildren
in class XMLDataNode
- Following copied from interface:
oracle.ide.model.Element
- Returns:
true
if this Element
may contain
child Element
s.
canAdd
public boolean canAdd(Element element)
- Description copied from interface:
Folder
- Other classes can call this method to determine whether the given
Element
can be added to the Folder
.
- Specified by:
canAdd
in interface Folder
- Following copied from interface:
oracle.ide.model.Folder
- Parameters:
element
- the Element
that is about to be added
to this Folder
.- Returns:
true
if the specified Element
can be
added to this Folder
; false
if the
Element
cannot be added.
add
public boolean add(Element element)
- Description copied from interface:
Folder
- Appends a child
Element
to the end of the
Folder
.
- Specified by:
add
in interface Folder
canRemove
public boolean canRemove(Element element)
- Description copied from interface:
Folder
- Other classes can call this method to determine whether the
specified
Element
can be removed from this
Folder
.
- Specified by:
canRemove
in interface Folder
- Following copied from interface:
oracle.ide.model.Folder
- Parameters:
element
- the Element
that is about to be removed
from this Folder
.- Returns:
true
if the specified Element
can be
removed from this Folder
; false
if the
Element
cannot be removed.
remove
public boolean remove(Element element)
- Description copied from interface:
Folder
- Removes the specified child
Element
. If the child object
appears more than once, only the first instance is removed.
- Specified by:
remove
in interface Folder
- Following copied from interface:
oracle.ide.model.Folder
- Parameters:
child
- The child object to remove.
containsChild
public boolean containsChild(Element child)
- Description copied from interface:
Folder
- Returns
true
if the folder contains the
specified child Element
; returns false
otherwise.
- Specified by:
containsChild
in interface Folder
size
public int size()
- Description copied from interface:
Folder
- Returns the current number of children in the folder.
- Specified by:
size
in interface Folder
removeAll
public void removeAll()
- Description copied from interface:
Folder
- Removes all children from the folder.
- Specified by:
removeAll
in interface Folder
add
public boolean add(Element element,
boolean notify)
- Description copied from interface:
Container
- This is a variant of the
Folder.add(Element)
method
that accepts an additional flag that indicates whether or not
notifications of the change should be sent to registered observers.
- Specified by:
add
in interface Container
- Following copied from interface:
oracle.ide.model.Container
- Parameters:
element
- The Element
to be added to this
Container
.notify
- If true
, any observers are notified
of the change. If false
, no notification is sent.
remove
public boolean remove(Element element,
boolean notify)
- Description copied from interface:
Container
- This is a variant of the
Folder.remove(Element)
method
that accepts an additional flag that indiciates whether or not
notifications of the change should be sent to registered observers.
- Specified by:
remove
in interface Container
- Following copied from interface:
oracle.ide.model.Container
- Parameters:
element
- The Element
to be removed from this
Container
.notify
- If true
, any observers are notified
of the change. If false
, no notification is sent.
removeAll
public void removeAll(boolean notify)
- Description copied from interface:
Container
- Removes all elements in the
Container
. The
notify
flag indicates whether observers should be
notified of the change.
- Specified by:
removeAll
in interface Container
- Following copied from interface:
oracle.ide.model.Container
- Parameters:
notify
- If true
, any observers are notified
of the change. If false
, no notification is sent.
getDataFolder
protected final Folder getDataFolder()
throws java.lang.IllegalStateException
- Retrieves the
Folder
object associated with this
XMLDataContainer
instance. If there is no Folder
currently associated with the XMLDataContainer
, however,
then an IllegalStateException
is thrown.
- Throws:
java.lang.IllegalStateException
- if the XMLDataContainer
is not capable of holding a Folder
.