class org.aswing.ext.GridList extends JViewport
Interfaces | |||
ListDataListener |
|
Dispatched when the list selection changed. @eventType org.aswing.event.SelectionEvent.LISTSELECTIONCHANGED
Class Fields
Instance Fields
function new(?model:ListModel = null, ?cellFactory:GridListCellFactory = null, ?columns:Int = 0, ?rows:Int = 2): Void
Creates a GridList
model | the data provider model |
cellFactory | the cell factory, null to be a default factory to generate text cell |
columns | if == 0 it will auto (only one of col or row can be == 0) |
rows | if == 0 it will auto (only one of col or row can be == 0) |
function addSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void
@see ListSelectionModel#addSelectionInterval() @see #removeSelectionInterval()
index0 | index0. |
index1 | index1. |
programmatic | indicate if this is a programmatic change. |
function addSelectionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void
function clearSelection(?programmatic:Bool = true): Void
Clears the selection - after calling this method isSelectionEmpty will return true. This is a convenience method that just delegates to the selectionModel. * @param programmatic indicate if this is a programmatic change.
function getAnchorSelectionIndex(): Int
Returns the first index argument from the most recent
addSelectionModel
or setSelectionInterval
call.
This is a convenience method that just delegates to the
selectionModel
.
@see ListSelectionModel#getAnchorSelectionIndex @see #addSelectionInterval() @see #setSelectionInterval() @see #addSelectionListener()
returns | the index that most recently anchored an interval selection |
function getLeadSelectionIndex(): Int
Returns the second index argument from the most recent
addSelectionInterval
or setSelectionInterval
call.
This is a convenience method that just delegates to the
selectionModel
.
@see ListSelectionModel#getLeadSelectionIndex @see #addSelectionInterval() @see #setSelectionInterval() @see #addSelectionListener()
returns | the index that most recently ended a interval selection |
function getSelectedIndex(): Int
Return the selected index, if selection multiple, return the first. if not selected any, return -1.
returns | the selected index |
function getSelectedIndices(): Array<Dynamic>
Returns an array of all of the selected indices in increasing order.
returns | a array contains all selected indices |
function getSelectedValue(): Dynamic
Returns the first selected value, or null if the selection is empty.
returns | the first selected value |
function getSelectedValues(): Array<Dynamic>
Returns an array of the values for the selected cells. The returned values are sorted in increasing index order.
returns | the selected values or an empty list if nothing is selected |
function getSelectionMode(): Int
Return whether single-item or multiple-item selections are allowed. @see #SINGLESELECTION @see #MULTIPLESELECTION
function isSelectionEmpty(): Bool
Returns true if nothing is selected.
returns | true if nothing is selected, false otherwise. |
function removeSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void
@see ListSelectionModel#removeSelectionInterval()
index0 | index0. |
index1 | index1. |
programmatic | indicate if this is a programmatic change. |
function selectAll(?programmatic:Bool = true): Void
Selects all elements in the list.
* @param programmatic indicate if this is a programmatic change. @see #setSelectionInterval
function setListData(ld:Array<Dynamic>): Void
Set a array to be the list data, a new model will be created and the values is copied to the model. This is not a good way, its slow. So suggest you to create a ListMode for example VectorListMode to JList, When you modify ListMode, it will automatic update GridList if necessary. @see #setModel() @see org.aswing.ListModel
function setModel(m:ListModel): Void
Set the list mode to provide the data to GridList. @see org.aswing.ListModel
function setSelectedIndex(index:Int, ?programmatic:Bool = true): Void
Selects a single cell. @see ListSelectionModel#setSelectionInterval @see #isSelectedIndex()
index | the index to be seleted. |
programmatic | indicate if this is a programmatic change. |
function setSelectedIndices(indices:Array<Dynamic>, ?programmatic:Bool = true): Void
Selects a set of cells.
This will not cause a scroll, if you want to scroll to visible the selected value, call ensureIndexIsVisible(). @param programmatic indicate if this is a programmatic change. * @see #isSelectedIndex() * @see #addSelectionListener() @see #ensureIndexIsVisible()
indices | an array of the indices of the cells to select. * |
function setSelectedValue(value:Dynamic, ?programmatic:Bool = true): Void
Selects the specified object from the list. This will not cause a scroll, if you want to scroll to visible the selected value, call ensureIndexIsVisible(). @param programmatic indicate if this is a programmatic change. @see #setSelectedIndex()
value | the value to be selected. * |
function setSelectedValues(values:Array<Dynamic>, ?programmatic:Bool = true): Void
Selects a set of cells.
This will not cause a scroll, if you want to scroll to visible the selected value, call ensureIndexIsVisible(). @param programmatic indicate if this is a programmatic change. * @see #isSelectedIndex() * @see #addSelectionListener() @see #ensureIndexIsVisible()
values | an array of the values to select. * |
function setSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void
@see ListSelectionModel#setSelectionInterval @see #removeSelectionInterval()
index0 | index0. |
index1 | index1. |
programmatic | indicate if this is a programmatic change. |
function setSelectionMode(sm:Int): Void
Determines whether single-item or multiple-item selections are allowed. If selection mode changed, will cause clear selection; @see #SINGLESELECTION @see #MULTIPLESELECTION