Packageorg.aswing
Interfacepublic interface ListCellFactory
ImplementorsDefaultListTextCellFactory, GeneralListCellFactory

List cell renderer factory, a ListCellFactory should not change it return value of these method isAllCellHasSameHeight, getCellHeight after created. Mean, if one of its instance method isAllCellHasSameHeight returned false, it should always return false.



Public Methods
 MethodDefined by
  
Creates a new list cell.
ListCellFactory
  
If isAllCellHasSameHeight or isShareCells returns true, this method will be used, it returned value means each cell's same height.
ListCellFactory
  
Returns is all cells has same height.
ListCellFactory
  
isShareCells():Boolean
Returns is list data should share cell instances for items.
ListCellFactory
Method detail
createNewCell()method
public function createNewCell():ListCell

Creates a new list cell.

Returns
ListCell
getCellHeight()method 
public function getCellHeight():int

If isAllCellHasSameHeight or isShareCells returns true, this method will be used, it returned value means each cell's same height.

Returns
int — the height for every cells
isAllCellHasSameHeight()method 
public function isAllCellHasSameHeight():Boolean

Returns is all cells has same height.

If all cells has same height, the List component will has more efficient on speed.

If this method return true, the List component will set all list cells height what getCellHeight returned, otherwise, the getPreferredSize() of list cell's component will be used.

If shareCells, this method must return true.

Returns
Boolean — is all cells has same height.

See also

isShareCells()method 
public function isShareCells():Boolean

Returns is list data should share cell instances for items.

If this return true, the List component will just create enough cell instance to display viewable items. This may cause the List component have shorter time to create, but may get slow when scrolling.

If this return false, the List component will create cells instances for every value of the list. This may cause the List component have hard time to create with huge list, but may get fast when scrolling.

Ordinary, if your List component will hold a very huge list(more than 100), you many need a allCellHasSameHeight and shareCells factory. If your list will just hold a small list(less than 50), and you want a smooth scrolling, you may need a not shareCells factory, and in this case, allCellHasSameHeight is not matter with speed, just matter whether you need different height items.

Note that if shareCells, allCellHasSameHeight must be true

Returns
Boolean — is share cell instances.

See also