org.caleigo.core
Class OrderedProxySelection

java.lang.Object
  extended byorg.caleigo.core.ProxySelection
      extended byorg.caleigo.core.OrderedProxySelection
All Implemented Interfaces:
IEntityPool, IProxySelection, ISelection, java.io.Serializable

public class OrderedProxySelection
extends ProxySelection

Version:
1.00
Author:
Dennis Zikovic
See Also:
Serialized Form

Nested Class Summary
protected  class OrderedProxySelection.OrderedRelayListener
           
 
Nested classes inherited from class org.caleigo.core.ProxySelection
ProxySelection.RelayListener
 
Constructor Summary
OrderedProxySelection(IEntityDescriptor entityDescriptor)
          Creates new OrderedProxySelection
OrderedProxySelection(IEntityDescriptor entityDescriptor, java.util.Comparator comparator)
          Creates new OrderedProxySelection
OrderedProxySelection(ISelection selection)
          Creates new OrderedProxySelection
OrderedProxySelection(ISelection selection, java.util.Comparator comparator)
          Creates new OrderedProxySelection
 
Method Summary
 void addCollationField(IFieldDescriptor fieldDescriptor)
           
 void addCollationField(IFieldDescriptor fieldDescriptor, boolean ascending)
           
 boolean addEntity(int index, IEntity entity)
          Adds the provided IEntity object to at the specified index in the selection object.
 void clearCollationFields()
           
protected  ProxySelection.RelayListener createRelayListener()
          Access method that returns the selections relay listener.
 ISelection createSubSelection(int[] indexArray)
          Creates a sub selection with the indexed entities in the called selection.
protected  void doAfterRemoteChange()
          Overriden to sort the index map for the new remote selection.
 java.util.Comparator getComparator()
           
 java.lang.Object getData(int row, int column)
          Access method that views the selection objct as a grid where row is the entity index and column is the field index for the stored entities.
 IEntity getEntity(int index)
          Access method that returns the contained IEntity object with the specified index.
 int getOrderedIndex(int remoteIndex)
          Converts a remote unordered entity index to an ordered index.
 int getRemoteIndex(int orderedIndex)
          Converts an ordered entity index to a remote unordered index.
 int indexOf(IEntity entity)
          Help method that returns the index of the provided IEntity object in the selection if it exists othewise a negative value is returned.
 IEntity removeEntity(int index)
          Mutation method that removes the indexed entity from the selection.
 void setCollationField(IFieldDescriptor fieldDescriptor)
           
 void setCollationField(IFieldDescriptor fieldDescriptor, boolean ascending)
           
 void setComparator(java.util.Comparator comp)
           
 void setData(int row, int column, java.lang.Object dataValue)
          Mutation method that views the selection objct as a grid where row is the entity index and column is the field index for the stored entities.
 void sort()
          Sorts the selection using the current entity collator.
 
Methods inherited from class org.caleigo.core.ProxySelection
addEntity, addEntityChangeListener, addEntityListener, addProxyListener, addSelectionListener, asList, asSet, clear, contains, createSubSelection, deleteAll, doesAccept, fireContentsChanged, fireEntityAdded, fireEntityRemoved, fireProxyEvent, fireStatusChangedEvent, getEntityDescriptor, getRelayListener, getRemoteSelection, getSourceSelection, hasRemoteSelection, hasSourceSelection, indexOf, isDirty, isEmpty, iterator, refreshAll, removeEntity, removeEntityChangeListener, removeEntityListener, removeProxyListener, removeSelectionListener, setRemoteSelection, size, sort, storeAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderedProxySelection

public OrderedProxySelection(IEntityDescriptor entityDescriptor)
Creates new OrderedProxySelection


OrderedProxySelection

public OrderedProxySelection(IEntityDescriptor entityDescriptor,
                             java.util.Comparator comparator)
Creates new OrderedProxySelection


OrderedProxySelection

public OrderedProxySelection(ISelection selection)
Creates new OrderedProxySelection


OrderedProxySelection

public OrderedProxySelection(ISelection selection,
                             java.util.Comparator comparator)
Creates new OrderedProxySelection

Method Detail

addEntity

public boolean addEntity(int index,
                         IEntity entity)
Adds the provided IEntity object to at the specified index in the selection object. If an entity with the same identity already exists in the selection the requeat is ignored and false is returned.

Specified by:
addEntity in interface ISelection
Overrides:
addEntity in class ProxySelection

getEntity

public IEntity getEntity(int index)
Access method that returns the contained IEntity object with the specified index.

Specified by:
getEntity in interface ISelection
Overrides:
getEntity in class ProxySelection

removeEntity

public IEntity removeEntity(int index)
Mutation method that removes the indexed entity from the selection. Returns the indexed entity if it was found and removed otherwise null is returned. The entities are not effecte in any other way.

Specified by:
removeEntity in interface ISelection
Overrides:
removeEntity in class ProxySelection

getData

public java.lang.Object getData(int row,
                                int column)
Access method that views the selection objct as a grid where row is the entity index and column is the field index for the stored entities.

Specified by:
getData in interface ISelection
Overrides:
getData in class ProxySelection

setData

public void setData(int row,
                    int column,
                    java.lang.Object dataValue)
Mutation method that views the selection objct as a grid where row is the entity index and column is the field index for the stored entities.

Specified by:
setData in interface ISelection
Overrides:
setData in class ProxySelection

createSubSelection

public ISelection createSubSelection(int[] indexArray)
Creates a sub selection with the indexed entities in the called selection. The created selection that should be independant of changes in the source/called selection after the time of creation.

Specified by:
createSubSelection in interface IProxySelection
Overrides:
createSubSelection in class ProxySelection

indexOf

public int indexOf(IEntity entity)
Help method that returns the index of the provided IEntity object in the selection if it exists othewise a negative value is returned.

Specified by:
indexOf in interface ISelection
Overrides:
indexOf in class ProxySelection

createRelayListener

protected ProxySelection.RelayListener createRelayListener()
Access method that returns the selections relay listener.

Overrides:
createRelayListener in class ProxySelection

doAfterRemoteChange

protected void doAfterRemoteChange()
Overriden to sort the index map for the new remote selection.

Overrides:
doAfterRemoteChange in class ProxySelection

getComparator

public java.util.Comparator getComparator()

setComparator

public void setComparator(java.util.Comparator comp)

setCollationField

public void setCollationField(IFieldDescriptor fieldDescriptor)

setCollationField

public void setCollationField(IFieldDescriptor fieldDescriptor,
                              boolean ascending)

addCollationField

public void addCollationField(IFieldDescriptor fieldDescriptor)

addCollationField

public void addCollationField(IFieldDescriptor fieldDescriptor,
                              boolean ascending)

clearCollationFields

public void clearCollationFields()

getRemoteIndex

public int getRemoteIndex(int orderedIndex)
Converts an ordered entity index to a remote unordered index.


getOrderedIndex

public int getOrderedIndex(int remoteIndex)
Converts a remote unordered entity index to an ordered index.


sort

public void sort()
Sorts the selection using the current entity collator. Note that the sort is automatically called when a new collator is set using any of the order changing methods in the object. The method should however be used if the registered Comperator is changed externally.



Copyright © 2005 Caleigo. All Rights Reserved.