|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.model.DefaultDisplayable oracle.ide.model.DefaultElement oracle.ide.model.DefaultFolder
DefaultFolder
is a complete, default implementation of
the Folder
interface. This is a convenient starting point
for the implementation of data classes which can be integrated with
the IDE framework.
If a subclass of DefaultFolder
adheres to the JavaBeans API,
it can also interoperate with the IDE's marshalling framework, which
is used for persistence. Such a subclass can be persisted
automatically (i.e. no custom persistence code needs to be written),
so long as the subclass implementation follows the guidelines of the
marshalling framework. For details, see the documentation for the
oracle.ide.marshal
package and its subpackages.
A JavaBean also has the advantage of interoperating with the
property inspector. Newer APIs are also being considered which
leverage the JavaBeans API, so implementing a DefaultFolder
subclass to follow the JavaBeans API will also result in
compatibility with future features.
DefaultElement
,
Folder
,
oracle.ide.marshal
,
oracle.ide.marshal.xml
,
Object2Dom
Field Summary | |
protected java.util.ArrayList |
_children
The " final " modifier makes it possible to synchronize
on the _children object, since its value can never
change. |
Constructor Summary | |
DefaultFolder()
Creates a new DefaultFolder instance. |
Method Summary | |
boolean |
add(Element element)
Part of the Folder interface. |
boolean |
canAdd(Element element)
Part of the Folder interface. |
boolean |
canRemove(Element element)
Part of the Folder interface. |
boolean |
containsChild(Element child)
Returns true if the folder contains the
specified child Element ; returns false
otherwise. |
protected void |
copyToImpl(DefaultFolder copy)
Design pattern for supporting strongly typed copying. |
protected boolean |
equalsImpl(DefaultFolder defaultFolder)
This is a helper method for Object.equals(Object) that can
also be used by subclasses that implement Object.equals(Object) . |
java.util.Iterator |
getChildren()
Part of the Element interface. |
javax.swing.Icon |
getIcon()
Part of Element interface. |
boolean |
mayHaveChildren()
Part of the Element interface. |
boolean |
remove(Element element)
Part of the Folder interface. |
void |
removeAll()
Removes all children from the folder. |
int |
size()
Returns the current number of children in the folder. |
Methods inherited from class oracle.ide.model.DefaultElement |
getAttributes, getData |
Methods inherited from class oracle.ide.model.DefaultDisplayable |
getLongLabel, getShortLabel, getToolTipText, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.ide.model.Element |
getAttributes |
Methods inherited from interface oracle.ide.model.Data |
getData |
Methods inherited from interface oracle.ide.model.Displayable |
getLongLabel, getShortLabel, getToolTipText, toString |
Field Detail |
protected final java.util.ArrayList _children
final
" modifier makes it possible to synchronize
on the _children
object, since its value can never
change. All subclasses that directly access the
_children
field are responsible for first synchronizing
on the _children
object before accessing its contents and
and for managing the state of the dirty flag when changes are
made.
Constructor Detail |
public DefaultFolder()
DefaultFolder
instance.Subclasses that are designed to operate as a JavaBean must implement a public default constructor.
Method Detail |
public boolean mayHaveChildren()
Element
interface. This implementation always
returns true
.
mayHaveChildren
in interface Element
mayHaveChildren
in class DefaultElement
Element.mayHaveChildren()
public java.util.Iterator getChildren()
Element
interface. This implementation returns
an Iterator
over the current list of children.
getChildren
in interface Element
getChildren
in class DefaultElement
Element.getChildren()
public javax.swing.Icon getIcon()
Element
interface. The default implementation
returns null
, which causes a default folder icon to be
used.
getIcon
in interface Displayable
getIcon
in class DefaultDisplayable
Displayable.getIcon()
public boolean canAdd(Element element)
Folder
interface. The default implementation
returns true
if and only if the specified
Element
is not null
.
canAdd
in interface Folder
element
- the Element
that is about to be added
to this Folder
.
true
if and only if the specified
Element
is not null
.Folder.canAdd(Element)
public boolean add(Element element)
Folder
interface. The specified Element
is added to the end of the child list. However, if the
Element
is null
, this method does nothing.
In order for the UI to get updated correctly, an appropriate
UpdateMessage
will need to
be sent to Observer
s of the
DefaultFolder
. The policy in the IDE is that the class
that changes the state of an object is responsible for firing the
UpdateMessage
s for those
changes. UpdageMessage
s
are not fired by the changed object itself.
For a single UpdateMessage
corresponding to add(Element)
, you can fire the
UpdateMessage
using code
like:
UpdateMessage.fireChildAdded(folder, newlyAddedChild);
add
in interface Folder
Folder.add(oracle.ide.model.Element)
public boolean canRemove(Element element)
Folder
interface. The default implementation
returns true
if and only if the specified
Element
is not null
.
canRemove
in interface Folder
element
- the Element
that is about to be removed
from this Folder
.
true
if and only if the specified
Element
is not null
.Folder.canRemove(Element)
public boolean remove(Element element)
Folder
interface. The specified Element
is removed from the child list. However, if the Element
is
null
, this method does nothing. If the Element
occurs more than once in the child list, then only the first
instance is removed.
In order for the UI to get updated correctly, an appropriate
UpdateMessage
will need to
be sent to Observer
s of the
DefaultFolder
. The policy in the IDE is that the class
that changes the state of an object is responsible for firing the
UpdateMessage
s for those
changes. UpdateMessage
s
are not fired by the changed object itself.
For a single UpdateMessage
corresponding to remove(Element)
, you can fire the
UpdateMessage
using code
like:
UpdateMessage.fireChildRemoved(folder, removedChild);
remove
in interface Folder
element
- The child object to remove.Folder.remove(Element)
public boolean containsChild(Element child)
Folder
true
if the folder contains the
specified child Element
; returns false
otherwise.
containsChild
in interface Folder
public int size()
Folder
size
in interface Folder
public void removeAll()
Folder
removeAll
in interface Folder
protected final boolean equalsImpl(DefaultFolder defaultFolder)
Object.equals(Object)
that can
also be used by subclasses that implement Object.equals(Object)
.
It assumes that the argument is not null
.
protected final void copyToImpl(DefaultFolder copy)
This method is intended to be helper method that subclasses can use,
if they implement the Copyable
interface.
The copy of the children list is a shallow copy. That is, the
children themselves are not copied, but the list is copied.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.