Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.javatools.editor.insight
Class ListDataItem

java.lang.Object
  extended by oracle.javatools.editor.insight.ListDataItem
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
ClassPackageListItem, oracle.ide.ceditor.insight.ListDataItem

public abstract class ListDataItem
extends java.lang.Object
implements java.lang.Comparable

The ListDataItem can be used as an abstract starting point for data item objects stored in a ListInsightData. Note that its use is optional - as it provides methods for handling case-insensitivity, it is more for convenience and code reuse.

It is still the responsibility of the given ListInsightData implementation to sort its underlying data items before passing it to the ListInsightView via getListModel().

Note that data items that do extend this class can also make use of the ListDataItemCellRenderer as a basic default cell renderer.

See Also:
ListInsightData, ListInsightView, ListDataItemCellRenderer

Constructor Summary
ListDataItem()
           
 
Method Summary
static int compareInsensitive(java.lang.String name1, java.lang.String name2)
          Compares its two Strings for case insensitive order.
static int compareSensitive(java.lang.String name1, java.lang.String name2)
          Compares its two Strings for case sensitive order.
 int compareTo(java.lang.Object object)
          Compares this object with the specified object for order.
 java.lang.String getAccessibleText()
          Gets the tet to use for accessibility purposes
abstract  java.lang.String getDisplayText()
          Fetches a displayable text for this item that can be used as the visible text within a list cell.
abstract  javax.swing.Icon getIcon()
          Fetches an icon associated with this type of data item that can pictorially provide some information for this data item.
abstract  java.lang.String getName()
          Fetches the display name of this data item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListDataItem

public ListDataItem()
Method Detail

getIcon

public abstract javax.swing.Icon getIcon()
Fetches an icon associated with this type of data item that can pictorially provide some information for this data item. For example, the icon may represent the type of the data item (i.e., package or class), or some other characteristic of the data item (i.e., public or private.)

Returns:
an icon representing this data item

getDisplayText

public abstract java.lang.String getDisplayText()
Fetches a displayable text for this item that can be used as the visible text within a list cell. When using the ListDataItemCellRenderer, this display text is what is rendered visibly.

Returns:
a String with the displayable text

getName

public abstract java.lang.String getName()
Fetches the display name of this data item. This is typically what is entered by a completion insight implementation into the buffer.

For example, let's suppose a data item represents a Java method. Its internal name might be "String.substring()", while its display name as returned by this method getName() might be "substring", while its displayable text might be "substring() returns String".

When sorting ListDataItems using its Comparable implementation, it is the display name as returned by getName() that is used for sorting purposes, not the displayable text.

Returns:
the name for this data item

compareTo

public int compareTo(java.lang.Object object)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Although this method is not declared final, it is recommended that subclasses do not override it unless they define another abstract class which overrides this routine for ALL subsequent data items. It could be pretty confusing (and unpredictable) otherwise if there are different data item classes with different compareTo() implementations.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

compareInsensitive

public static int compareInsensitive(java.lang.String name1,
                                     java.lang.String name2)
Compares its two Strings for case insensitive order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Note that this method should only be used for sorting purposes, not for equivalency purposes. This method will return "ACTION" < "action". For true case-insensitive comparison where "ACTION" == "action", use String.compareToIgnoreCase().

Parameters:
name1 - the first String to be compared
name2 - the second String to be compared
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

compareSensitive

public static int compareSensitive(java.lang.String name1,
                                   java.lang.String name2)
Compares its two Strings for case sensitive order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Parameters:
name1 - the first String to be compared
name2 - the second String to be compared
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

getAccessibleText

public java.lang.String getAccessibleText()
Gets the tet to use for accessibility purposes

Returns:
the text to use for accessiblity

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

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