Extension SDK

oracle.jdeveloper.library
Class DefaultLibraryList

java.lang.Object
  extended byoracle.ide.IdeSubject
      extended byoracle.jdeveloper.library.DefaultLibraryList
All Implemented Interfaces:
Copyable, Data, Dirtyable, Displayable, Element, Folder, LibraryList, SubDirtyable, Subject
Direct Known Subclasses:
AddinLibraryList, JProjectLibraryList

public abstract class DefaultLibraryList
extends IdeSubject
implements LibraryList, SubDirtyable

The DefaultLibraryList class provides a basic implementation of the LibraryList interface. DefaultLibraryList does not provide a mechanism for persisting itself; however, it can be included within the datamodel of another object and be persisted within that object's model. DefaultLibraryList instances are marked as being transient; subclasses must override this if the list is to be displayed to the user when creating new libraries

Since:
9.0.3

Field Summary
 
Fields inherited from interface oracle.ide.addin.Subject
OBJECT_MODIFIED
 
Constructor Summary
DefaultLibraryList()
           
DefaultLibraryList(DefaultLibraryList orig)
           
 
Method Summary
 boolean add(Element child)
          Appends a child Element to the end of the Folder.
 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.
abstract  java.lang.Object copyTo(java.lang.Object target)
          Copies the internal state of this object to the specified copy.
protected  void copyToImpl(DefaultLibraryList copy)
           
 boolean equals(java.lang.Object obj)
           
protected  boolean equalsImpl(DefaultLibraryList otherList)
           
 JDK findJDK(java.lang.String jdkName)
          Finds the J2SE definition that matches the specified name.
 JDK findJDK(VersionNumber verNum)
          Finds the J2SE definition that matches the specified version number.
 JLibrary findLibrary(java.lang.String libName)
          Finds the library that matches the specified name.
 java.lang.String findUniqueJDKName()
          Determines a unique name that can be used for a new J2SE definition.
 java.lang.String findUniqueLibraryName()
          Determines a unique name that can be used for a new library.
 Attributes getAttributes()
          This method returns an Attributes object that encodes the attributes of the Element.
 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 Elements without having to test the object's type with the instanceof operator or having to downcast to a more specific type.
 java.lang.Object getData()
          Returns the data element associated with this Data.
 javax.swing.Icon getIcon()
          Returns an Icon that can be shown in association with this Displayable.
 java.util.List getJdkList()
          Retrieves the list of J2SE definitions contained in this LibraryList.
 java.util.List getLibraryList()
          Retrieves the list of Libraries contained in this LibraryList.
abstract  java.lang.String getListName()
          Retrieves the name of this LibraryList.
 java.lang.String getLongLabel()
          Returns a long label that can be displayed to the user.
 java.lang.String getShortLabel()
          Returns a short label that can be displayed to the user.
 java.lang.String getToolTipText()
          Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Displayable.
 boolean isChildJDK(JDK jdk)
          Determines whether the specified J2SE definition is a child of this LibraryList.
 boolean isChildLibrary(JLibrary lib)
          Determines whether the specified Library is a child of this LibraryList.
 boolean isDirty()
          True if the data in the object has been modified.
 boolean isTransient()
          Whether this list is transient (not-persistent).
 void markDirty(boolean dirty)
          Marks the data with the specified dirty state.
 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 child)
          Removes the specified child Element.
 void removeAll()
          Removes all children from the folder.
 void setJdkList(java.util.List jdkList)
           
 void setLibraryList(java.util.List libList)
           
 void setOwner(Dirtyable owner)
          This method should be called to set the document in which a SubDirtyable implementation will be persisted.
 int size()
          Returns the current number of children in the folder.
 
Methods inherited from class oracle.ide.IdeSubject
attach, copy, detach, getObservers, notifyObservers, setObservers
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.ide.model.Displayable
toString
 
Methods inherited from interface oracle.ide.addin.Subject
attach, detach, notifyObservers
 

Constructor Detail

DefaultLibraryList

public DefaultLibraryList()

DefaultLibraryList

public DefaultLibraryList(DefaultLibraryList orig)
Method Detail

copyTo

public abstract java.lang.Object copyTo(java.lang.Object target)
Description copied from interface: Copyable
Copies the internal state of this object to the specified copy. If copy is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object. Generally, only the persistent state of the object should be copied, but whether or not it is appropriate to copy transient properties is at the discretion of the individual implementor.

Regardless of whether the copy occurs to an existing object or to a newly created object, the return value is object to which this object's state was copied.

There is a standard implementation pattern for the copyTo method that helps avoid problems that arise when a Copyable object is subclassed. The pattern is:

public Object copyTo( Object target )
{
final <this_class> copy =
target != null ? (<this_class>) target : new <this_class>();
copyToImpl( copy );
return copy;
} protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
The parameter passed into the copyToImpl method is the same type of this class. The responsibility of copyToImpl is to copy the state of this class through direct access of the fields. The copyToImpl method should not use getters and setters since these may be overridden, causing the state of this class to be incompletely copied.

Specified by:
copyTo in interface Copyable
Parameters:
target - The target object to which the state of this object should be copied. If target is null, then the copyTo method will return a new instance of this class.
Returns:
The object to which the state of this object was copied. If the target was non-null, then the return value is the same as the target object that was passed in; otherwise, the return value is a new instance of this class.

copyToImpl

protected void copyToImpl(DefaultLibraryList copy)

equals

public boolean equals(java.lang.Object obj)

equalsImpl

protected boolean equalsImpl(DefaultLibraryList otherList)

findJDK

public JDK findJDK(java.lang.String jdkName)
Description copied from interface: LibraryList
Finds the J2SE definition that matches the specified name.

Specified by:
findJDK in interface LibraryList
Parameters:
jdkName - the name of the J2SE definition
Returns:
the JDK representing the J2SE definition.

findJDK

public JDK findJDK(VersionNumber verNum)
Description copied from interface: LibraryList
Finds the J2SE definition that matches the specified version number.

Specified by:
findJDK in interface LibraryList
Parameters:
verNum - the VersionNumber of the desired J2SE defintion.
Returns:
the JDK representing the J2SE definition.

findLibrary

public JLibrary findLibrary(java.lang.String libName)
Description copied from interface: LibraryList
Finds the library that matches the specified name.

Specified by:
findLibrary in interface LibraryList

findUniqueJDKName

public java.lang.String findUniqueJDKName()
Description copied from interface: LibraryList
Determines a unique name that can be used for a new J2SE definition.

Specified by:
findUniqueJDKName in interface LibraryList

findUniqueLibraryName

public java.lang.String findUniqueLibraryName()
Description copied from interface: LibraryList
Determines a unique name that can be used for a new library.

Specified by:
findUniqueLibraryName in interface LibraryList

getJdkList

public java.util.List getJdkList()
Description copied from interface: LibraryList
Retrieves the list of J2SE definitions contained in this LibraryList.

Specified by:
getJdkList in interface LibraryList

setJdkList

public void setJdkList(java.util.List jdkList)

getLibraryList

public java.util.List getLibraryList()
Description copied from interface: LibraryList
Retrieves the list of Libraries contained in this LibraryList.

Specified by:
getLibraryList in interface LibraryList

setLibraryList

public void setLibraryList(java.util.List libList)

getListName

public abstract java.lang.String getListName()
Description copied from interface: LibraryList
Retrieves the name of this LibraryList.

Specified by:
getListName in interface LibraryList

isChildJDK

public boolean isChildJDK(JDK jdk)
Description copied from interface: LibraryList
Determines whether the specified J2SE definition is a child of this LibraryList.

Specified by:
isChildJDK in interface LibraryList

isChildLibrary

public boolean isChildLibrary(JLibrary lib)
Description copied from interface: LibraryList
Determines whether the specified Library is a child of this LibraryList.

Specified by:
isChildLibrary in interface LibraryList

isTransient

public boolean isTransient()
Description copied from interface: LibraryList
Whether this list is transient (not-persistent). Transient lists cannot have new children created by the user

Specified by:
isTransient in interface LibraryList

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
Returns:
true if this Element may contain child Elements.

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 Elements 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 Elements or null if there are no children.

Specified by:
getChildren in interface Element
Returns:
an Iterator over any child Elements contained by this Element. If there are no children, null is returned.

getAttributes

public Attributes getAttributes()
Description copied from interface: Element
This method returns an Attributes object that encodes the attributes of the Element. Changing the attribute settings on the return object changes the element attributes. Subclasses should use their super class attributes object to define their own attributes. This allows subclasses to inherit their super class attributes. If a subclass does not wish to inherit attributes, they should first call getAttributes().clear() and define new attributes.

Specified by:
getAttributes in interface Element

getData

public java.lang.Object getData()
Description copied from interface: Data
Returns the data element associated with this Data. The getData() method provides a standard means for getting the data element whether or not it is same object as its Element object.

Specified by:
getData in interface Data
Returns:
the data object associated with this Data instance.

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
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 child)
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
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 child)
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
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

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
Returns:
a short descriptive label of the Displayable that can be shown to the user.

getLongLabel

public java.lang.String getLongLabel()
Description copied from interface: Displayable
Returns a long 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. The long label differs from the short label essentially on length. Usually the long label will only be shown on-demand and in places where horizontal space is more available. Examples are the status bar and tooltips.

Specified by:
getLongLabel in interface Displayable
Returns:
a long descriptive label of the Displayable that can be shown to the user.

getIcon

public javax.swing.Icon getIcon()
Description copied from interface: Displayable
Returns an Icon that can be shown in association with this Displayable. Typically the icon will be used in a tree control or list control. Therefore the icon must fit naturally within the space normally given to items within those controls. Such icons are usually 16x16 in size or, if there is a one-pixel transparent padding around the edge, 18x18 in size. It is strongly recommended that icons returned by this method be either 16x16 or 18x18 in size. If null is returned, the control may show a default icon, or it may show no icon, whichever is appropriate.

Specified by:
getIcon in interface Displayable
Returns:
the Icon to be displayed for the Displayable.

getToolTipText

public java.lang.String getToolTipText()
Description copied from interface: Displayable
Returns the tool tip text to show when the mouse pointer pauses over a UI component that represents this Displayable. In many cases it may be appropriate for this method to return the same value as Displayable.getLongLabel().

Specified by:
getToolTipText in interface Displayable
Returns:
the tooltip to show when the mouse pointer pauses over a UI component that represents this Displayable.

setOwner

public void setOwner(Dirtyable owner)
Description copied from interface: SubDirtyable
This method should be called to set the document in which a SubDirtyable implementation will be persisted.

Specified by:
setOwner in interface SubDirtyable
Parameters:
owner - The Dirtyable object in which this SubDirtyable will be saved.

isDirty

public boolean isDirty()
Description copied from interface: Dirtyable
True if the data in the object has been modified.

Specified by:
isDirty in interface Dirtyable
Returns:
true if the data in the object has been modified.

markDirty

public void markDirty(boolean dirty)
Description copied from interface: Dirtyable
Marks the data with the specified dirty state. This method is called markDirty(...) instead of setDirty(...) so that the JavaBeans Introspector will not mistakenly identify "dirty" as a JavaBean property.

Specified by:
markDirty in interface Dirtyable
Parameters:
dirty - If true, sets the object as being dirty; if false, sets the object as being up-to-date.

Extension SDK

 

Copyright ©1997, 2003, Oracle. All rights reserved.