|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--dyntable.OrderTranslatorEntityList
$Id: OrderTranslatorEntityList.java,v 1.0 2005/09/25 jDynTable@gmx.de $
This OrderTranslatorEntityList provides a temporary ordering of the EntityList
for display purposes. This allows the user to modify the view order in the table,
without modifying the actual data order in the EntityList.
OrderTranslatorEntityList contains a mapping between the order
in this OrderTranslatorEntityList and the order in the EntityList
used by the table. If the order of the entities in the table is not locked
to the order of the entities in the EntityList, then the user can manipulate
the order in this OrderTranslatorEntityList only. If the order is locked, then
the order in both the EntityList and this OrderTranslatorEntityList is
modified. This class can be used to allow the user to have a custom entity
order that is different from the EntityList order.
Constructor Summary | |
---|---|
OrderTranslatorEntityList()
Constructs a new OrderTranslatorEntityList. |
|
OrderTranslatorEntityList(EntityList e,
EntityTableColumnModel c)
Constructs a new OrderTranslatorEntityList with the given EntityList and EntityTableColumnModel. |
Method Summary | |
---|---|
boolean |
addEntity(java.lang.Object entityInstance)
Adds a new entity to the EntityList and updates this OrderTranslatorEntityList. |
void |
addEntityListListener(EntityListListener e)
Adds a listener for EntityList events. |
EntityTableColumnModel |
getColumnModel()
Returns the column model being used. |
int |
getCount()
Returns the number of entities in the EntityList. |
java.lang.Object |
getDefaultEntity()
Returns the default entity which contains desirable column values. |
java.lang.Object |
getEntity(int index)
Returns the entity at the specified index. |
int |
getEntityIndex(int index)
Returns the index of the entity in the EntityList corresponding to the given index in this OrderTranslatorEntityList |
EntityList |
getEntityList()
Returns the current EntityList. |
void |
getEntityListOrder()
Makes the table order the same as the EntityList order. |
java.lang.Object |
getNewDefaultEntity()
Returns a new entity containing desirable column values. |
java.lang.Object |
getNewEntity()
Returns a new entity. |
int |
getViewIndex(int entityIndex)
Returns the index of an entity in the table, given the index of the same entity in the EntityList. |
boolean |
insertEntity(int index,
java.lang.Object entityInstance)
Inserts the given entity at the index specified and moves all other entities to make room for the new entity if needed. |
boolean |
isOrderLockedToList()
Returns true if the table data order in this OrderTranslatorEntityList is the same as the underlying EntityList, false otherwise. |
boolean |
isRowSortingAllowed()
Returns true if row sorting is enabled, false otherwise. |
void |
listChanged(EntityListEvent evt)
The list changed event handler. |
boolean |
moveEntity(int startIndex,
int endIndex,
int newIndex)
Moves the entities between the startIndex and endIndex inclusive to the new location specified by the newIndex. |
boolean |
removeEntity(int index)
Removes the entity at the specified index. |
void |
removeEntityListListener(EntityListListener e)
Removes an existing listener that listened for changes in the EntityList. |
void |
replaceAll(EntityList e)
Replaces all the entities in the EntityList with those specified by the new EntityList. |
void |
setColumnModel(EntityTableColumnModel c)
Changes the column model to the one specified. |
void |
setDefaultEntity(java.lang.Object o)
Replaces the current entity that is used to hold desirable column values. |
boolean |
setEntity(int index,
java.lang.Object entityInstance)
Replaces the entity at the specified index. |
void |
setEntityList(EntityList e)
Sets the EntityList and thus replaces all the entities in the table by the entities in the EntityList provided. |
void |
setEntityListOrder()
Sets the order of the entities in the EntityList to match the order of the entities in the table. |
void |
setOrderLockedToList(boolean b)
Sets the order of the table entities in this OrderTranslatorEntityList to match that of the underlying EntityList. |
void |
setRowSortingAllowed(boolean b)
Enables or disables row sorting. |
void |
sortByColumn(int column)
Sorts the table rows according to the column index given. |
void |
sortByColumn(int column,
boolean ascending)
Sorts the table rows in ascending or descending order according to the column index given. |
void |
sortByColumns(java.util.Vector columns)
Sorts the row in the table by the given columns. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OrderTranslatorEntityList()
public OrderTranslatorEntityList(EntityList e, EntityTableColumnModel c)
e
- the EntityListc
- the TableColumnModelMethod Detail |
public EntityList getEntityList()
public void setEntityList(EntityList e)
e
- the EntityListpublic EntityTableColumnModel getColumnModel()
public void setColumnModel(EntityTableColumnModel c)
c
- the EntityTableColumnModel, the new column modelpublic int getCount()
getCount
in interface EntityList
public int getEntityIndex(int index)
index
- in this OrderTranslatorEntityList
public java.lang.Object getEntity(int index)
getEntity
in interface EntityList
index
- the entity index
public boolean setEntity(int index, java.lang.Object entityInstance) throws EntityListException
setEntity
in interface EntityList
index
- the index of the entity to replaceentityInstance
- the Object representing the new entity
EntityListException
- on any EntityList eventspublic java.lang.Object getNewEntity()
getNewEntity
in interface EntityList
public java.lang.Object getNewDefaultEntity()
getNewDefaultEntity
in interface EntityList
public java.lang.Object getDefaultEntity()
getDefaultEntity
in interface EntityList
public void setDefaultEntity(java.lang.Object o)
setDefaultEntity
in interface EntityList
o
- the Object entity containing desirable valuespublic boolean addEntity(java.lang.Object entityInstance) throws EntityListException
addEntity
in interface EntityList
entityInstance
- the new entity to add
EntityListException
- on any EntityList errorspublic boolean insertEntity(int index, java.lang.Object entityInstance) throws EntityListException
insertEntity
in interface EntityList
index
- the location where the new entity should be placedentityInstance
- the new entity to add
EntityListException
- on any EntityList
errorspublic boolean moveEntity(int startIndex, int endIndex, int newIndex) throws EntityListException
moveEntity
in interface EntityList
startIndex
- the index of the first entity to moveendIndex
- the index of the last entity to movenewIndex
- the new location of the entities
EntityListException
- on any EntityList errorspublic boolean removeEntity(int index) throws EntityListException
removeEntity
in interface EntityList
index
- the index of the entity to remove
EntityListException
- on any EntityList errorspublic void replaceAll(EntityList e)
replaceAll
in interface EntityList
e
- the EntityList which, holds the new entitiespublic boolean isOrderLockedToList()
public void setOrderLockedToList(boolean b)
b
- enabled if true, disabled otherwisepublic boolean isRowSortingAllowed()
public void setRowSortingAllowed(boolean b)
b
- enabled if true, disabled otherwisepublic void sortByColumns(java.util.Vector columns)
columns
- the columns to sort bypublic void sortByColumn(int column)
column
- the column indexpublic void sortByColumn(int column, boolean ascending)
column
- the column indexascending
- sorts ascending if true, else descendingpublic void getEntityListOrder()
public void setEntityListOrder()
public int getViewIndex(int entityIndex)
entityIndex
- the entity index
public void listChanged(EntityListEvent evt)
listChanged
in interface EntityListListener
evt
- the EntityListEvent representing
the event tha occurredpublic void addEntityListListener(EntityListListener e)
addEntityListListener
in interface EntityList
e
- the new listenerpublic void removeEntityListListener(EntityListListener e)
removeEntityListListener
in interface EntityList
e
- the listener to remove
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |