Extension SDK 10.1.2

oracle.ide.gallery
Class GalleryFolder

java.lang.Object
  extended byoracle.ide.gallery.GalleryFolder
All Implemented Interfaces:
java.lang.Comparable, Data, Displayable, Element, Folder
Direct Known Subclasses:
RootGalleryFolder

public class GalleryFolder
extends java.lang.Object
implements Folder, java.lang.Comparable

Container used in the gallery category tree, which may contain both sub-folders and gallery items.


Field Summary
protected static java.text.Collator COLLATOR
           
 
Constructor Summary
GalleryFolder()
          Default constructor, used for beans instantiation.
GalleryFolder(java.lang.String name)
          Constructor.
 
Method Summary
 boolean add(Element element)
          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.
 int compareTo(java.lang.Object o)
           
 boolean containsChild(Element element)
          Returns true if the folder contains the specified child Element; returns false otherwise.
 GalleryFolder createFolder(java.lang.String folderName)
          Returns the child GalleryFolder with the specified name if one exists, or creates a new child GalleryFolder if one does not exist.
protected  GalleryFolder findFolder(java.lang.String folderName)
          Returns the first descendant GalleryFolder with the specified name, using a depth-first search of all descendants; returns null if no descendant folder was found.
 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.
protected  java.util.List getChildrenDirectly()
          Subclasses can override this method to change the way that the list of children is determined and stored.
 java.lang.Object getData()
          Returns the data element associated with this Data.
 java.lang.Object getElementAt(int index)
          Deprecated. Replace with getList().get(int).
protected  GalleryElement[] getElementChildren()
           
 GalleryFolder getFolder(java.lang.String folderName)
          Returns the child GalleryFolder with the specified name, or returns null if no such child folder exists.
protected  GalleryFolder[] getFolderChildren()
           
 GalleryElement getGalleryElement(java.lang.String elementName)
           
 GalleryFolder getGalleryFolder(java.lang.String folderName)
          Deprecated. recursive folder lookup is ill-advised -- replace with non-recursive getFolder(String) or createFolder(String).
 javax.swing.Icon getIcon()
          Returns an Icon that can be shown in association with this Displayable.
 java.util.List getList()
           
 java.lang.String getLongLabel()
          Returns a long label that can be displayed to the user.
 java.lang.String getName()
           
 java.lang.String getShortLabel()
          Returns a short label that can be displayed to the user.
 int getSize()
          Deprecated. Replace with size().
 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 getUnsorted()
           
protected  boolean isExpanded()
           
 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.
 void removeAll()
          Removes all children from the folder.
protected  void setChildrenDirectly(java.util.List children)
          Subclasses can override this method to change the way that the list of children is determined and stored.
protected  void setExpanded(boolean expanded)
           
 void setList(java.util.List list)
           
 void setName(java.lang.String name)
           
 void setUnsorted(boolean unsorted)
           
 int size()
          Returns the current number of children in the folder.
 java.lang.String toString()
          Returns the Short Label displayed to a user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLLATOR

protected static final java.text.Collator COLLATOR
Constructor Detail

GalleryFolder

public GalleryFolder()
Default constructor, used for beans instantiation.


GalleryFolder

public GalleryFolder(java.lang.String name)
Constructor.

Parameters:
name - - name of this folder
Method Detail

getList

public java.util.List getList()

setList

public void setList(java.util.List list)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getUnsorted

public boolean getUnsorted()

setUnsorted

public void setUnsorted(boolean unsorted)

getFolder

public GalleryFolder getFolder(java.lang.String folderName)
Returns the child GalleryFolder with the specified name, or returns null if no such child folder exists.


createFolder

public GalleryFolder createFolder(java.lang.String folderName)
Returns the child GalleryFolder with the specified name if one exists, or creates a new child GalleryFolder if one does not exist.


getGalleryFolder

public GalleryFolder getGalleryFolder(java.lang.String folderName)
Deprecated. recursive folder lookup is ill-advised -- replace with non-recursive getFolder(String) or createFolder(String).

Searches recursively in depth-first order for a descendant GalleryFolder with the specified name.

Returns:
the GalleryFolder with the specified name, or null if no such named folder exists

getGalleryElement

public GalleryElement getGalleryElement(java.lang.String elementName)

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

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 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
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
Parameters:
element - The child object to remove.

removeAll

public void removeAll()
Description copied from interface: Folder
Removes all children from the folder.

Specified by:
removeAll in interface Folder

containsChild

public boolean containsChild(Element element)
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

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.

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.

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.

toString

public java.lang.String toString()
Description copied from interface: Displayable
Returns the Short Label displayed to a user. This overrides the toString method in java.lang.Object.

Implementors of the Displayable interface should override this as appropriate. The default implementation is the same as getShortLabel

Specified by:
toString in interface Displayable

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.

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

getSize

public int getSize()
Deprecated. Replace with size().

Returns the length of the list.


getElementAt

public java.lang.Object getElementAt(int index)
Deprecated. Replace with getList().get(int).

Returns the value at the specified index.


isExpanded

protected boolean isExpanded()

setExpanded

protected void setExpanded(boolean expanded)

getChildrenDirectly

protected java.util.List getChildrenDirectly()
Subclasses can override this method to change the way that the list of children is determined and stored.


setChildrenDirectly

protected void setChildrenDirectly(java.util.List children)
Subclasses can override this method to change the way that the list of children is determined and stored.


getElementChildren

protected GalleryElement[] getElementChildren()

getFolderChildren

protected GalleryFolder[] getFolderChildren()

findFolder

protected GalleryFolder findFolder(java.lang.String folderName)
Returns the first descendant GalleryFolder with the specified name, using a depth-first search of all descendants; returns null if no descendant folder was found.


Extension SDK

 

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