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
-
_ordered
-
-
OrderedListModel()
- Constructor.
-
OrderedListModel(DefaultListModel)
- Constructor.
-
addElement(Object)
- In the case where the model is not ordered, the element will be
added to the end of the list.
-
compare(Object, Object)
- To implement a different ordering policy, e.g.
-
find(Object)
-
-
insertElementAt(Object, int)
- This method is overriden to disallow element insertion when the
model is in ordered state.
-
isOrdered()
- Returns true if the state of the model is ordered, false
otherwise.
-
merge(OrderedListModel)
- Merge the given model with this.
-
order()
- The default implementation calls a quicksort implementation.
-
qsort(int, int)
-
-
removeElementAt(int)
- Remove the element at the given index.
-
setElementAt(Object, int)
- This method is overriden to disallow element setting when the
model is in ordered state.
-
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.
_ordered
private boolean _ordered
OrderedListModel
public OrderedListModel()
- Constructor.
OrderedListModel
public OrderedListModel(DefaultListModel src)
- Constructor.
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.
isOrdered
public boolean isOrdered()
- Returns true if the state of the model is ordered, false
otherwise.
order
protected void order()
- The default implementation calls a quicksort implementation.
qsort
private void qsort(int start,
int end)
compare
protected int compare(Object o1,
Object o2)
- To implement a different ordering policy, e.g. descending,
override this method in a subclass.
find
public Object[] find(Object target)
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
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
removeElementAt
public void removeElementAt(int index)
- Remove the element at the given index.
- Overrides:
- removeElementAt in class DefaultListModel
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
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