Extension SDK 9.0.5

oracle.ide.model
Class DefaultFilter.SortedFolderFirstComparator

java.lang.Object
  extended byoracle.ide.model.DefaultFilter.SortedComparator
      extended byoracle.ide.model.DefaultFilter.SortedFolderFirstComparator
All Implemented Interfaces:
java.util.Comparator
Direct Known Subclasses:
HierarchicalFilter.HierarchicalComparator
Enclosing class:
DefaultFilter

public static class DefaultFilter.SortedFolderFirstComparator
extends DefaultFilter.SortedComparator

Builtin Comparator class for ordering the children of a container node, with container children ordered before non-container children. Each subgroup of children (container children or non-container children) is ordered in locale-sensitive collation order.

This class is an extension of the builtin TNode.SortedComparator class that provides one additional template method for determining where container children are ordered relative to non-container children.


Field Summary
 
Fields inherited from class oracle.ide.model.DefaultFilter.SortedComparator
collator, SORT_ALPHA, SORT_BY_TYPE
 
Constructor Summary
  DefaultFilter.SortedFolderFirstComparator()
          Default constructor.
protected DefaultFilter.SortedFolderFirstComparator(boolean checkAttributes)
          Constructor.
 
Method Summary
protected  int compareElements(Element e1, Element e2)
          Override of TNode.SortedComparator#compareElements(Element, Element) to call a different comparison routine when the Element objects are not either both Folders or both not Folders.
protected  int compareFolderToElement(Folder f, Element e)
          Deprecated. no longer used; equivalent to compareUnlikeElementToElement(Element,Element).
protected  int compareUnlikeElementToElement(Element f, Element e)
          Template method for comparing two unlike Element objects to each other.
 boolean equals(java.lang.Object obj)
          Implementation of the Comparator.equals(Object) method.
protected  boolean isFolder(Element e)
          Check if the element is a folder.
 
Methods inherited from class oracle.ide.model.DefaultFilter.SortedComparator
compare, compareElementToElement, compareStrings, compareTNodes, getOptions, setOptions
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFilter.SortedFolderFirstComparator

public DefaultFilter.SortedFolderFirstComparator()
Default constructor.


DefaultFilter.SortedFolderFirstComparator

protected DefaultFilter.SortedFolderFirstComparator(boolean checkAttributes)
Constructor.

Parameters:
checkAttributes - flag indicating that when sorting folders we need to check the folder attributes in order to determine if the folder is not hiding its children. This can happen when that folder is displayed in the application navigator.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Implementation of the Comparator.equals(Object) method. Subclasses may need to override this method.

This implementation returns true if this Comparator has the same class and property as the other Object.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class DefaultFilter.SortedComparator

compareElements

protected int compareElements(Element e1,
                              Element e2)
Override of TNode.SortedComparator#compareElements(Element, Element) to call a different comparison routine when the Element objects are not either both Folders or both not Folders.

Most subclasses should not need to override this method.

Overrides:
compareElements in class DefaultFilter.SortedComparator

compareUnlikeElementToElement

protected int compareUnlikeElementToElement(Element f,
                                            Element e)
Template method for comparing two unlike Element objects to each other. One Element object is not like another if only one of them is a container.

Subclasses may wish to override this method. The default implementation always returns -1, which causes container elements to be ordered before non-container elements.

Parameters:
f - an Element that may contain children
e - an Element that may not contain children

compareFolderToElement

protected int compareFolderToElement(Folder f,
                                     Element e)
Deprecated. no longer used; equivalent to compareUnlikeElementToElement(Element,Element).


isFolder

protected boolean isFolder(Element e)
Check if the element is a folder. It's not enough for the element to return true from the method mayHaveChildren. We also need to check the element's attributes if this comparator has been told to do so. In particular, we need to check if the element attribute HIDE_CHILDREN has been set. Setting this attribute tells a folder element to behave as a leaf.


Extension SDK

 

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