voji.ui
Class JOrderList.OrderListModel

java.lang.Object
  |
  +--javax.swing.AbstractListModel
        |
        +--voji.ui.JOrderList.OrderListModel
All Implemented Interfaces:
javax.swing.ListModel, java.io.Serializable
Enclosing class:
JOrderList

protected class JOrderList.OrderListModel
extends javax.swing.AbstractListModel

This is the list model for OrderLists

See Also:
Serialized Form

Field Summary
protected  int[] ids
          The IDs
protected  java.lang.Object[] values
          The shown items
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
JOrderList.OrderListModel()
          Constructs an OrderListModel with empty data
 
Method Summary
 java.lang.Object getElementAt(int index)
           
 int[] getOrder()
          Returns the IDs in their current order
 int getSize()
           
 void moveItem(int from, int to)
          Moves an item
 void setItems(java.util.Vector items)
          Sets the items of this model.
protected  void switchItems(int index1, int index2)
          Switches the positions of two items
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ids

protected int[] ids
The IDs


values

protected java.lang.Object[] values
The shown items

Constructor Detail

JOrderList.OrderListModel

public JOrderList.OrderListModel()
Constructs an OrderListModel with empty data

Method Detail

getSize

public int getSize()
Returns:
the length of the list

getElementAt

public java.lang.Object getElementAt(int index)
Parameters:
index - the index whose value has to be retrieved
Returns:
the value at the specified index

setItems

public void setItems(java.util.Vector items)
Sets the items of this model. The argument has to be a Vector of Vectors with 2 elements:

Parameters:
items - the Vector of Vector of [Integer,Object] where to take the items from.

getOrder

public int[] getOrder()
Returns the IDs in their current order

Returns:
an Array of the IDs in the same order as their Strings in the list.

switchItems

protected void switchItems(int index1,
                           int index2)
Switches the positions of two items

Parameters:
index1 -
index2 - the two indices of these items

moveItem

public void moveItem(int from,
                     int to)
Moves an item

Parameters:
from - the index of the item to move
to - the index where to move the item