All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.netobjects.nfx.ui.OrderedListModel

java.lang.Object
   |
   +----com.sun.java.swing.AbstractListModel
           |
           +----com.netobjects.nfx.ui.DefaultListModel
                   |
                   +----com.netobjects.nfx.ui.OrderedListModel

public class OrderedListModel
extends DefaultListModel
implements Serializable

Variable Index

 o _ordered

Constructor Index

 o OrderedListModel()
Constructor.
 o OrderedListModel(DefaultListModel)
Constructor.

Method Index

 o addElement(Object)
In the case where the model is not ordered, the element will be added to the end of the list.
 o compare(Object, Object)
To implement a different ordering policy, e.g.
 o find(Object)
 o insertElementAt(Object, int)
This method is overriden to disallow element insertion when the model is in ordered state.
 o isOrdered()
Returns true if the state of the model is ordered, false otherwise.
 o merge(OrderedListModel)
Merge the given model with this.
 o order()
The default implementation calls a quicksort implementation.
 o qsort(int, int)
 o removeElementAt(int)
Remove the element at the given index.
 o setElementAt(Object, int)
This method is overriden to disallow element setting when the model is in ordered state.
 o setOrdered(boolean)
If the state of the object is not ordered and ordered is set to true, the elements will be ordered using quicksort based on the comparison criteria specified by the compare() method.

Variables

 o _ordered
 private boolean _ordered

Constructors

 o OrderedListModel
 public OrderedListModel()
Constructor.

 o OrderedListModel
 public OrderedListModel(DefaultListModel src)
Constructor.

Methods

 o setOrdered
 public void setOrdered(boolean ordered)
If the state of the object is not ordered and ordered is set to true, the elements will be ordered using quicksort based on the comparison criteria specified by the compare() method.

 o isOrdered
 public boolean isOrdered()
Returns true if the state of the model is ordered, false otherwise.

 o order
 protected void order()
The default implementation calls a quicksort implementation.

 o qsort
 private void qsort(int start,
                    int end)
 o compare
 protected int compare(Object o1,
                       Object o2)
To implement a different ordering policy, e.g. descending, override this method in a subclass.

 o find
 public Object[] find(Object target)
 o insertElementAt
 public void insertElementAt(Object obj,
                             int index)
This method is overriden to disallow element insertion when the model is in ordered state. If isOrdered() == false, then this method calls the implementation in DefaultListModel.

Overrides:
insertElementAt in class DefaultListModel
 o setElementAt
 public void setElementAt(Object obj,
                          int index)
This method is overriden to disallow element setting when the model is in ordered state. If isOrdered() == false, then this method calls the implementation in DefaultListModel.

Overrides:
setElementAt in class DefaultListModel
 o removeElementAt
 public void removeElementAt(int index)
Remove the element at the given index.

Overrides:
removeElementAt in class DefaultListModel
 o addElement
 public void addElement(Object obj)
In the case where the model is not ordered, the element will be added to the end of the list. Otherwise, the element is inserted according to its rank (using binary search tree).

Overrides:
addElement in class DefaultListModel
 o merge
 public OrderedListModel merge(OrderedListModel m)
Merge the given model with this.

Parameters:
m - the model to merge.
Returns:
the model.

All Packages  Class Hierarchy  This Package  Previous  Next  Index