Extension SDK 10.1.2

oracle.ide.model
Class HierarchicalFolder

java.lang.Object
  extended byoracle.ide.model.DefaultDisplayable
      extended byoracle.ide.model.DefaultElement
          extended byoracle.ide.model.DefaultFolder
              extended byoracle.ide.model.HierarchicalFolder
All Implemented Interfaces:
Category, Data, Displayable, Element, Folder, Locatable
Direct Known Subclasses:
DirectoryFolder, PackageFolder

public abstract class HierarchicalFolder
extends DefaultFolder
implements Locatable, Category

The HierarchicalFolder defines common behavior for folder elements managed by a HierarchicalFilter. The HierarchicalFolder also defines an abstract interface which all concrete subclasses must implement.

See Also:
HierarchicalFilter, DirectoryFolder, PackageFolder

Field Summary
protected  HierarchicalFilter filter
          The ChildFilter that manages this folder.
protected  boolean isOpen
          Flag denoting whether the contents of this folder have been read.
protected  java.lang.String longName
          Cached version of the long name for this Displayable.
protected  java.lang.String shortName
          Cached version of the short name for this Displayable.
protected  java.net.URL url
          The URL that describes this folder.
 
Fields inherited from class oracle.ide.model.DefaultFolder
_children
 
Fields inherited from interface oracle.ide.model.Category
UNDEFINED
 
Constructor Summary
HierarchicalFolder()
           
HierarchicalFolder(java.net.URL url, HierarchicalFilter filter)
          Constructs a HierarchicalFolder given an URL and a HierarchicalFilter that will manage this folder.
 
Method Summary
 boolean add(Element element)
          Allows the Element to be added if the element short label is unique in this folder and the superclass add(Element) method allows the element to be added.
 boolean canAdd(Element element)
          Returns true if the Element short label is unique in this folder.
 boolean canRemove(Element element)
          Returns true if the Element short label occurs in this folder.
 boolean containsChild(Element child)
          Returns true if the folder contains the specified child Element; returns false otherwise.
 int getCategory()
          Returns the category of the CategoryFolder that owns this folder's parent filter; if the filter is not owned by a CategoryFolder, then returns Category.UNDEFINED.
 java.util.Iterator getChildren()
          Returns an Iterator over the child Element objects belonging to this folder.
 HierarchicalFilter getFilter()
          Get the HierarchicalFilter.
 java.lang.String getLongLabel()
          Returns the long label for this Displayable.
 java.lang.String getShortLabel()
          Returns the short label for this Displayable.
 java.lang.String getToolTipText()
          Returns the tool tip for this Displayable.
 java.net.URL getURL()
          Gets the URL for this Locatable.
protected  boolean getViewAllFiles()
          Convenience method that calls HierarchicalFilter.getViewAllFiles().
protected  boolean getViewHierarchically()
          Convenience method that calls HierarchicalFilter.getViewHierarchically().
protected abstract  boolean isInProject()
          Tests whether any Element belonging to the project is contained by this folder.
 boolean isStrict()
          When true indicates that this folder is strict with name and children.
protected abstract  java.net.URL[] list()
          Lists the files and directories contained by this folder.
 boolean remove(Element element)
          Allows the Element to be removed if the element short label occurs in this folder and the superclass remove(Element) method allows the element to be removed.
 void removeAll()
          Overridden in order to also clear the Set of unique names belonging to this folder.
 void setFilter(HierarchicalFilter filter)
          Set the HierarchicalFilter associated with this folder.
 void setURL(java.net.URL url)
          Sets the URL for this Locatable.
 
Methods inherited from class oracle.ide.model.DefaultFolder
copyToImpl, equalsImpl, getIcon, mayHaveChildren, size
 
Methods inherited from class oracle.ide.model.DefaultElement
getAttributes, getData
 
Methods inherited from class oracle.ide.model.DefaultDisplayable
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
toString
 

Field Detail

isOpen

protected boolean isOpen
Flag denoting whether the contents of this folder have been read.


url

protected java.net.URL url
The URL that describes this folder.


filter

protected HierarchicalFilter filter
The ChildFilter that manages this folder.


longName

protected java.lang.String longName
Cached version of the long name for this Displayable.


shortName

protected java.lang.String shortName
Cached version of the short name for this Displayable.

Constructor Detail

HierarchicalFolder

public HierarchicalFolder()

HierarchicalFolder

public HierarchicalFolder(java.net.URL url,
                          HierarchicalFilter filter)
Constructs a HierarchicalFolder given an URL and a HierarchicalFilter that will manage this folder.

Parameters:
url - the URL for this folder.
filter - the HierarchicalFilter that manages this folder.
Method Detail

list

protected abstract java.net.URL[] list()
Lists the files and directories contained by this folder. Subclasses should provide an appropriate implementation.

This method is only called when all files in the folder need to be shown; if only project files are to be shown, then the owning filter is called to provide the list of children.

Returns:
an array of URL objects naming the files and directories contained by this folder; if the contents of this folder cannot be listed, then null is returned.

isInProject

protected abstract boolean isInProject()
Tests whether any Element belonging to the project is contained by this folder. Subclasses should provide an appropriate implementation.

This method is called by the owning filter to determine whether or not to gray the icon for this folder.

Returns:
true if any Element belonging to the project is contained by this folder; otherwise, false.

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
Overrides:
containsChild in class DefaultFolder

canAdd

public boolean canAdd(Element element)
Returns true if the Element short label is unique in this folder.

Specified by:
canAdd in interface Folder
Overrides:
canAdd in class DefaultFolder
Returns:
true if and only if the specified Element is not null.
See Also:
Folder.canAdd(Element)

canRemove

public boolean canRemove(Element element)
Returns true if the Element short label occurs in this folder.

Specified by:
canRemove in interface Folder
Overrides:
canRemove in class DefaultFolder
Returns:
true if and only if the specified Element is not null.
See Also:
Folder.canRemove(Element)

add

public boolean add(Element element)
Allows the Element to be added if the element short label is unique in this folder and the superclass add(Element) method allows the element to be added.

Specified by:
add in interface Folder
Overrides:
add in class DefaultFolder
See Also:
Folder.add(oracle.ide.model.Element)

remove

public boolean remove(Element element)
Allows the Element to be removed if the element short label occurs in this folder and the superclass remove(Element) method allows the element to be removed.

Specified by:
remove in interface Folder
Overrides:
remove in class DefaultFolder
See Also:
Folder.remove(Element)

removeAll

public void removeAll()
Overridden in order to also clear the Set of unique names belonging to this folder.

Specified by:
removeAll in interface Folder
Overrides:
removeAll in class DefaultFolder

getChildren

public java.util.Iterator getChildren()
Returns an Iterator over the child Element objects belonging to this folder.

Specified by:
getChildren in interface Element
Overrides:
getChildren in class DefaultFolder
See Also:
Element.getChildren()

getShortLabel

public java.lang.String getShortLabel()
Returns the short label for this Displayable. The default implementation returns the full platform path name of this folder when in flat view, and it returns just the file name when in nested view.

Specified by:
getShortLabel in interface Displayable
Overrides:
getShortLabel in class DefaultDisplayable
See Also:
Displayable.getShortLabel()

getLongLabel

public java.lang.String getLongLabel()
Returns the long label for this Displayable. The default implementation returns the full platform path name of this folder.

Specified by:
getLongLabel in interface Displayable
Overrides:
getLongLabel in class DefaultDisplayable
See Also:
Displayable.getLongLabel()

getToolTipText

public java.lang.String getToolTipText()
Returns the tool tip for this Displayable. The default implementation returns the String version of the URL for this folder.

Specified by:
getToolTipText in interface Displayable
Overrides:
getToolTipText in class DefaultDisplayable
See Also:
Displayable.getToolTipText()

setURL

public void setURL(java.net.URL url)
Sets the URL for this Locatable.

Specified by:
setURL in interface Locatable
Parameters:
url - The URL to set.

getURL

public java.net.URL getURL()
Gets the URL for this Locatable.

Specified by:
getURL in interface Locatable
Returns:
The URL identifying this Locatable.

getCategory

public int getCategory()
Returns the category of the CategoryFolder that owns this folder's parent filter; if the filter is not owned by a CategoryFolder, then returns Category.UNDEFINED.

Specified by:
getCategory in interface Category
Returns:
the category types.

getFilter

public HierarchicalFilter getFilter()
Get the HierarchicalFilter.


setFilter

public void setFilter(HierarchicalFilter filter)
Set the HierarchicalFilter associated with this folder. The specified filter will only be set if it has never been set.


isStrict

public boolean isStrict()
When true indicates that this folder is strict with name and children. This implementation always returns true;


getViewAllFiles

protected boolean getViewAllFiles()
Convenience method that calls HierarchicalFilter.getViewAllFiles().


getViewHierarchically

protected boolean getViewHierarchically()
Convenience method that calls HierarchicalFilter.getViewHierarchically().


Extension SDK

 

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