|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.plumtree.uiinfrastructure.arraywrapper.PTSortedArrayWrapper
public class PTSortedArrayWrapper
MES- The PTSortedArrayWrapper
class wraps a 2D Object array. It
allows a client to re-sort the rows in the array by multiple columns in a
performant way. Additionally, it allows addressing of columns by ID,
rather than index (for example, if col 0 is NAME and col 1 is DESC, a
client can ask for the NAME for row 2, rather than asking for col 0.)
Field Summary | |
---|---|
protected java.lang.Object[][] |
m_arrData
MES- m_arrData stores the actual data |
protected int[][] |
m_arrSort
MES- m_arrSort stores the current sort we're displaying |
protected boolean |
m_bSortOptimized
MES- When the data is correctly sorted according to m_arrSort, we can skip the step of dereferencing rows through m_lstRowMapping. |
protected XPHashtable |
m_hashPropIDtoColumn
MES- m_hashPropIDtoColumn stores a map of Property ID to the column that contains data for that property. |
protected XPArrayList |
m_lstRowMapping
MES- m_lstRowMapping holds the row numbers. |
static int |
PTSAW_NEWITEMSINFO_INDEX
JF- This is used by the SetItems method. |
static int |
PTSAW_NEWITEMSINFO_NEWVALUE
JF- This is used by the SetItems method. |
static int |
PTSAW_NEWITEMSINFO_PROPERTYID
JF- This is used by the SetItems method. |
static int |
PTSAW_SORT_ASCENDING
MES- PTSAW_SORT_ASCENDING indicates that a column is sorted ascending |
static int |
PTSAW_SORT_DESCENDING
MES- PTSAW_SORT_DESCENDING indicates that a column is sorted descending |
static int |
PTSAW_SORT_ROW_DIRECTION
MES- Sort direction is indicated via a 2D array. |
static int |
PTSAW_SORT_ROW_PROPID
MES- Sort direction is indicated via a 2D array. |
Constructor Summary | |
---|---|
PTSortedArrayWrapper()
|
Method Summary | |
---|---|
boolean |
ContainsPropID(int iPropID)
MES- ContainsPropID is used by clients to see if a given Property is represented by a column in the data. |
int |
GetCount()
MES- GetCount returns the number of rows in our data set |
java.lang.Object |
GetItem(int iRow,
int iPropID)
MES- GetItem is used by clients to retrieve data from the array |
int[][] |
GetSort()
MES- GetSort returns the current sort array |
void |
Initialize(int[] arrColumnIDs,
java.lang.Object[][] arrData,
int[][] arrSort,
boolean bRequiresSort)
MES- Initialize sets up this object with the data it needs to return items, as well as to perform sorts, etc. |
protected void |
MapColumnIDs(int[] arrColumnIDs)
MES- MapColumnIDs is an internal function that sets up the m_hashPropIDtoColumn mapping based on an array of ColumnIDs |
void |
SetItem(int iRow,
int iPropID,
java.lang.Object oItem)
JF- SetItem is used by clients modify one cell in the array. |
void |
SetItems(java.lang.Object[][] arrNewItemsInfo)
JF- SetItems is used by clients modify a number of cells in the array. |
void |
Sort(int[][] arrSort)
MES- Sort is used by clients to resort the internal data according to new criteria. |
protected void |
SortInternal()
MES- SortInternal is an internal helper function that actually performs the sort based on m_arrSort. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PTSAW_SORT_ASCENDING
public static final int PTSAW_SORT_DESCENDING
public static final int PTSAW_SORT_ROW_PROPID
public static final int PTSAW_SORT_ROW_DIRECTION
public static final int PTSAW_NEWITEMSINFO_INDEX
public static final int PTSAW_NEWITEMSINFO_PROPERTYID
public static final int PTSAW_NEWITEMSINFO_NEWVALUE
protected XPArrayList m_lstRowMapping
protected XPHashtable m_hashPropIDtoColumn
protected java.lang.Object[][] m_arrData
protected int[][] m_arrSort
protected boolean m_bSortOptimized
Constructor Detail |
---|
public PTSortedArrayWrapper()
Method Detail |
---|
public boolean ContainsPropID(int iPropID)
iPropID
- is the ID of the Property
public int GetCount()
public java.lang.Object GetItem(int iRow, int iPropID)
iRow
- indicates the row that's desired. That's the SORTED row,
rather than the RAW row. GetItem will dereference the row
number to figure out the real, raw row.iPropID
- indicates the Property that the client wants
public int[][] GetSort()
public void Initialize(int[] arrColumnIDs, java.lang.Object[][] arrData, int[][] arrSort, boolean bRequiresSort)
arrColumnIDs
- contains the Property IDs for each column in
arrData. The size of arrColumnIDs should be equal to the number
of columns in arrData.arrData
- contains the actual data to be stored and manipulated.
The index convention matches the Plumtree server- the first
index is column, and the second is the row, like
arrData[iColIndex][iRowIndex]arrSort
- is a 2D int array of PropertyIDs to sort by. It should
contain a column for each sort. The first row holds the
PropertyID, and the second row holds the sort direction,
PTSAW_SORT_ASCENDING or PTSAW_SORT_DESCENDINGbRequiresSort
- indicates if arrData is already sorted as indicated
by arrSort. If the client knows that the data is already
sorted, we can skip the sort, and we can also optimize access.
XPException
- when arguments are not valid.public void SetItem(int iRow, int iPropID, java.lang.Object oItem)
iRow
- indicates the row of the cell to modify. That's
the SORTED row, rather than the RAW row. SetItem will
dereference the row number to figure out the real, raw row.iPropID
- indicates the Property that the client wants to modifyoItem
- is the new Object to set in the cell defined with
iRow and iPropIDpublic void SetItems(java.lang.Object[][] arrNewItemsInfo)
arrNewItemsInfo
- This is a 2D array containing
the row index, prop ID and new cell value of each cell to modify.
Use the PTSAW_NEWITEMSINFO_ constant to build the array.public void Sort(int[][] arrSort)
arrSort
- is a 2D int array of PropertyIDs to sort by. It should
contain a column for each sort. The first row holds the
PropertyID, and the second row holds the sort direction,
PTSAW_SORT_ASCENDING or PTSAW_SORT_DESCENDING.
XPException
- when arguments are not valid.protected void MapColumnIDs(int[] arrColumnIDs)
arrColumnIDs
- is an array of column IDs. It should contain
one int for each column in m_arrData, and may identify the
column in any way the client desires.protected void SortInternal()
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |