oracle.ide.model
Class PropertiesContainer
java.lang.Object
|
+--oracle.ide.model.DefaultDisplayable
|
+--oracle.ide.model.DefaultElement
|
+--oracle.ide.model.DefaultDocument
|
+--oracle.ide.model.DefaultNode
|
+--oracle.ide.model.PropertiesNode
|
+--oracle.ide.model.PropertiesContainer
- All Implemented Interfaces:
- Category, Container, Data, Dirtyable, Displayable, Document, Element, Folder, LazyLoadable, Locatable, Node, PropertyAccess, Subject
- public class PropertiesContainer
- extends PropertiesNode
- implements Container
This is a complete implementation of the Container
interface
that uses a single HashMap
to hold all of its data and an
ArrayList
to hold its children. PropertiesContainer
takes care of marshalling the data and the children to XML and
unmarshalling them from XML back into their respective HashMap
and ArrayList
. Unmarshalling (loading) and marshalling
(saving) are done only on-demand. Access to the properties occurs
through the PropertyAccess
interface. Access
to the children occurs through the Container
interface.
This class serves primarily as an example of how a Container
implementation can interact with Object2Dom
to produce
marshalling behavior that differs from the approach taken by
XMLDataContainer
. The XMLDataContainer
class is the
main Container
class that is responsible for XML marshalling
in the Oracle IDE framework and in JDeveloper.
Method Summary |
boolean |
add(Element element)
Appends a child Element to the end of the
Folder . |
boolean |
add(Element element,
boolean notifyObservers)
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 . |
void |
close()
Closes the Document and unloads any associated data. |
boolean |
containsChild(Element child)
Returns true if the folder contains the
specified child Element ; returns false
otherwise. |
java.util.Iterator |
getChildren()
This method is part of the Element interface to
provide a convenient way of getting an Iterator over any
contained child Element s without having to test the
object's type with the instanceof operator or having
to downcast to a more specific type. |
java.lang.String |
getShortLabel()
Returns a short label that can be displayed to the user. |
protected java.lang.String |
getXMLRootElementName()
|
boolean |
hasChild(Element element)
|
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 notifyObservers)
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 notifyObservers)
Removes all elements in the Container . |
void |
reopen()
Overrides PropertiesNode.reopen() . |
void |
save(boolean shallow)
Saves the contents of the document. |
int |
size()
Returns the current number of children in the folder. |
Methods inherited from class oracle.ide.model.DefaultDocument |
attach, copyToImpl, createSubject, detach, ensureOpen, equalsImpl, getInputStream, getLongLabel, getSubject, getTimestamp, getTimestampDirectly, getToolTipText, getURL, isDirty, isNew, isOpen, isReadOnly, markDirty, 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 |
PropertiesContainer
protected PropertiesContainer(java.net.URL url)
PropertiesContainer
protected PropertiesContainer()
getShortLabel
public java.lang.String getShortLabel()
- Description copied from interface:
Displayable
- Returns a short label that can be displayed to the user.
Generally, the value of the returned
String
is considered
translatable and should therefore be placed in an appropriate
resource file. When possible, the returned label should be
reasonably short enough to show in the navigator or explorer
windows but long enough to clearly identify and distinguish the
Displayable
.
- Specified by:
getShortLabel
in interface Displayable
- Overrides:
getShortLabel
in class DefaultDocument
- Following copied from interface:
oracle.ide.model.Displayable
- Returns:
- a short descriptive label of the
Displayable
that can be shown to the user.
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 DefaultElement
- Following copied from interface:
oracle.ide.model.Element
- Returns:
true
if this Element
may contain
child Element
s.
getChildren
public java.util.Iterator getChildren()
- Description copied from interface:
Element
- This method is part of the
Element
interface to
provide a convenient way of getting an Iterator
over any
contained child Element
s 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 null
from this
method. An implementation of Element
that could
represent a non-leaf in a tree structure should return either an
Iterator
over the child Element
s or
null
if there are no children.
- Specified by:
getChildren
in interface Element
- Overrides:
getChildren
in class DefaultElement
- Following copied from interface:
oracle.ide.model.Element
- Returns:
- an
Iterator
over any child Element
s
contained by this Element
. If there are no children,
null
is returned.
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.
size
public int size()
- Description copied from interface:
Folder
- Returns the current number of children in the folder.
- Specified by:
size
in interface Folder
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
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 notifyObservers)
- 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 notifyObservers)
- 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 notifyObservers)
- 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.
save
public void save(boolean shallow)
- Description copied from interface:
Document
- Saves the contents of the document.
- Specified by:
save
in interface Document
- Overrides:
save
in class PropertiesNode
- Following copied from interface:
oracle.ide.model.Document
- Parameters:
shallow
- The value of this parameter only matters if the
Document
is also a Container
. If
shallow
is true
, children should not
be saved; if shallow
is false
, children
should also be saved.
close
public void close()
- Description copied from interface:
Document
- Closes the
Document
and unloads any associated data.
When this method returns, the state of the Document
object should be equivalent to when the Document
object has just been instantiated but not yet opened.
- Specified by:
close
in interface Document
- Overrides:
close
in class PropertiesNode
- Following copied from class:
oracle.ide.model.DefaultDocument
- See Also:
Document.close()
reopen
public void reopen()
- Overrides
PropertiesNode.reopen()
. This therefore also
affects the behavior of PropertiesNode.open()
.
- Overrides:
reopen
in class PropertiesNode
getXMLRootElementName
protected java.lang.String getXMLRootElementName()
- Overrides:
getXMLRootElementName
in class PropertiesNode
hasChild
public boolean hasChild(Element element)