home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 1.8 KB | 75 lines |
- package symantec.itools.awt.multiList;
-
- import java.util.BitSet;
- import symantec.itools.awt.CompareCells;
- import java.util.ResourceBundle;
-
- // 07/14/97 LAB Separeated from Multilist.java. Made public to accommodate future
- // extendibility of the MultiList class.
-
- /**
- * This is a helper class to the MultiList class.
- * It is used to compare Cells of the MultiList.
- * @version 1.1, July 14, 1997
- * @author Symantec
- */
- public class CompareTextAndImageCells
- extends CompareCells
- {
- /**
- * Constructs a CompareTextAndImageCells object.
- */
- public CompareTextAndImageCells()
- {
- errors = ResourceBundle.getBundle("symantec.itools.resources.ErrorsBundle");
- }
-
- /**
- * Compares the value of two objects.
- * @param o1 the first object
- * @param o2 the second object
- * @return 0 if the object's values are equal, less than 0 if the first
- * object's value is less than the second object's value, and greater
- * than 0 if the first object's value is greater than the second
- * object's value
- * @param o1 the first object
- * @param o2 the second object
- */
- public int compareObjects(Object o1, Object o2)
- {
- TextAndImageCell c1;
- TextAndImageCell c2;
-
- c1 = null;
- c2 = null;
-
- if(o1 instanceof TextAndImageCell)
- {
- c1 = (TextAndImageCell)o1;
- }
- else
- {
- throw new IllegalArgumentException(errors.getString("NotCellObject"));
- }
-
- if(o2 instanceof TextAndImageCell)
- {
- c2 = (TextAndImageCell)o2;
- }
- else
- {
- throw new IllegalArgumentException(errors.getString("NotCellObject"));
- }
-
- String o1Text = (c1 != null) ? c1.getText() : "";
- String o2Text = (c2 != null) ? c2.getText() : "";
-
- return o1Text.compareTo(o2Text);
- }
-
- /**
- * Error strings.
- */
- transient protected ResourceBundle errors;
- }
-