|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.AbstractListModel biz.chitec.quarterback.swing.NumberedStringListModel
List model for Lists of NumberedStrings. Has nice special methods for handling the lists (e.g. intelligent insertion) and several methods to transform between GUI indices and NumberedString indices
Field Summary | |
protected boolean |
addnrfirst
|
protected boolean |
dosort
|
protected java.util.List |
mydata
|
protected javax.swing.JList |
mylist
|
protected boolean |
showaddnr
|
protected boolean |
sortbyname
|
Fields inherited from class javax.swing.AbstractListModel |
listenerList |
Constructor Summary | |
NumberedStringListModel()
initializes with neither data list nor show-additional-number-flag |
|
NumberedStringListModel(boolean sad)
initializes with show-additional-number-flag only |
|
NumberedStringListModel(ChatSymbolHolder csh)
Initialize with symbols from given ChatSymbolHolder, take all symbols. |
|
NumberedStringListModel(ChatSymbolHolder csh,
int[] idxx)
Initialize with symbols from given ChatSymbolHolder. |
|
NumberedStringListModel(java.util.List v)
initializes with data list only |
|
NumberedStringListModel(java.util.List v,
boolean sad)
initializes with data list and show-additional-number-flag given |
Method Summary | |
void |
add(java.lang.Object element)
Adds a single element to the model. |
void |
addAll(java.util.List v)
|
void |
addContent(java.util.List newdata)
adds some content at the end of already existing one. |
void |
addFromChatSymbolHolder(ChatSymbolHolder csh)
Adds all symbols from the given ChatSymbolHolder to the model. |
void |
addFromChatSymbolHolder(ChatSymbolHolder csh,
int[] idxx)
Add content to the chat data model from a chat symbol holder. |
int |
Addnr2GUIIdx(int addnr)
Translates NumberedString's addnr into the GUI index of the NumberedString. |
boolean |
changeContent(java.util.List v)
replace content with new content. |
private static void |
changeInIntArray(int[] a,
int swap1,
int swap2)
|
void |
clear()
Removes all elements. |
boolean |
containsNSIdx(int nsidx)
Checks if there is a NumberedString with the given internal index. |
private static int[] |
deleteFromIntArray(int[] a,
int delval)
|
boolean |
getAddNrFirst()
|
java.util.List |
getContent()
returns the content list |
java.lang.Object |
getElementAt(int idx)
returns an element with GUI index This is a list model interface method. |
javax.swing.JList |
getList()
|
NumberedString |
getNSbyNSIdx(int nsidx)
Returns one NumberedString by its own index field. |
boolean |
getShowAddNr()
|
int |
getSize()
returns size of data list. |
int |
GUI2NSAddNr(int guiidx)
Translates GUI index into additional number of NumberedString at that position. |
int |
GUI2NSIdx(int guiidx)
Translates GUI index into index of NumberedString at that position. |
int[] |
GUI2NSIdx(int[] guiidx)
Translates several GUI indices into their internal NumberedString counterparts. |
boolean |
isSortByName()
|
boolean |
isSorting()
|
int[] |
lazyNS2GUIIdx(int[] nsidx)
Converts elements of given int array to GUI index. |
int[] |
lazyNS2GUIIdx(java.util.List nsidx)
Converts elements of given List to GUI index. |
int |
NS2GUIIdx(int nsidx)
Translates internal NumberedString index into the GUI index of the NumberedString. |
int[] |
NS2GUIIdx(int[] guiidx)
Translates several internal NumberedString indices into their GUI counterparts. |
java.lang.Object |
remove(int index)
Removes a certain element from the model. |
void |
removeContent()
removes all content. |
void |
setAddNrFirst(boolean addnrfirstx)
|
void |
setContent(java.util.List newdata)
sets new content. |
void |
setList(javax.swing.JList lx)
|
void |
setShowAddNr(boolean sad)
|
void |
setSortByName(boolean s)
|
void |
setSorting(boolean s)
|
private void |
sortMe()
|
void |
trimToExternalList(java.util.List v)
Trims contents of this model to external List. |
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 |
Methods inherited from interface javax.swing.ListModel |
addListDataListener, removeListDataListener |
Field Detail |
protected java.util.List mydata
protected boolean showaddnr
protected boolean addnrfirst
protected javax.swing.JList mylist
protected boolean dosort
protected boolean sortbyname
Constructor Detail |
public NumberedStringListModel(java.util.List v, boolean sad)
public NumberedStringListModel(boolean sad)
public NumberedStringListModel(java.util.List v)
public NumberedStringListModel()
public NumberedStringListModel(ChatSymbolHolder csh, int[] idxx)
public NumberedStringListModel(ChatSymbolHolder csh)
Method Detail |
public void setList(javax.swing.JList lx)
setList
in interface ChangeableListModel
public javax.swing.JList getList()
getList
in interface ChangeableListModel
public void setShowAddNr(boolean sad)
public boolean getShowAddNr()
public void setAddNrFirst(boolean addnrfirstx)
public boolean getAddNrFirst()
public void setSorting(boolean s)
public boolean isSorting()
public void setSortByName(boolean s)
public boolean isSortByName()
private static void changeInIntArray(int[] a, int swap1, int swap2)
private static int[] deleteFromIntArray(int[] a, int delval)
private void sortMe()
public void trimToExternalList(java.util.List v)
This method is needed to trim the model's content against any changes in the data underlying the model's filling. The method is given the new basic data, it decides for each currently included value whether it continues to be valid or not (e.g. whether it is in the new data or not). If it is not valid any more, it is removed (that's logical). If it continues to be valid, it is removed from the (new) data, so that that list contains only those elements which are really new and not yet in the model. Having it changed that way allows us just to append that list to the currently available data at the end (e.g. using addContent()) to ensure that all new data is in the model.
trimToExternalList
in interface ChangeableListModel
public java.lang.Object getElementAt(int idx)
getElementAt
in interface javax.swing.ListModel
public int getSize()
getSize
in interface javax.swing.ListModel
public void setContent(java.util.List newdata)
public void addContent(java.util.List newdata)
public void addAll(java.util.List v)
addAll
in interface ChangeableListModel
public void removeContent()
public java.util.List getContent()
public boolean changeContent(java.util.List v)
public void add(java.lang.Object element)
add
in interface ChangeableListModel
public java.lang.Object remove(int index)
remove
in interface ChangeableListModel
public void clear()
clear
in interface ChangeableListModel
public NumberedString getNSbyNSIdx(int nsidx)
public int GUI2NSIdx(int guiidx)
public int GUI2NSAddNr(int guiidx)
public int[] GUI2NSIdx(int[] guiidx)
public int NS2GUIIdx(int nsidx)
public int Addnr2GUIIdx(int addnr)
public int[] NS2GUIIdx(int[] guiidx)
public boolean containsNSIdx(int nsidx)
public int[] lazyNS2GUIIdx(java.util.List nsidx)
public int[] lazyNS2GUIIdx(int[] nsidx)
public void addFromChatSymbolHolder(ChatSymbolHolder csh, int[] idxx)
csh
- ChatSymbolHolder to get the symbols fromidxx
- Numeric constants to actually add to the listpublic void addFromChatSymbolHolder(ChatSymbolHolder csh)
ChatSymbolHolder.getAllSymbols()
method which must therefore be implemented.
csh
- ChatSymbolHolder to get the symbols from
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |