Package totalcross.ui
Class DynamicScrollContainer.DataSource
- java.lang.Object
-
- totalcross.ui.DynamicScrollContainer.DataSource
-
- Enclosing class:
- DynamicScrollContainer
public static class DynamicScrollContainer.DataSource extends java.lang.ObjectThis class is responsible for serving up theDynamicScrollContainer.AbstractViews to display on aDynamicScrollContainer. You must populate theDynamicScrollContainer.DataSourcewith all the views you want to display before passing it to theDynamicScrollContainer
-
-
Constructor Summary
Constructors Constructor Description DataSource()DataSource(int viewCount)Create aDynamicScrollContainer.DataSourceand allocate memory forviewCountviews to be stored
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddView(DynamicScrollContainer.AbstractView view)Adds aDynamicScrollContainer.AbstractViewto the datasource if it does not already exist.intgetTotalScrollHeight(int scrollContainerWidth)Returns the total scrollable height that allDynamicScrollContainer.AbstractViews together will take up. This is calculated based on eachDynamicScrollContainer.AbstractViewheight and is called when aDynamicScrollContainer.DataSourceis set on aDynamicScrollContainer.DataSourceor theDynamicScrollContainerdetects screen rotation.DynamicScrollContainer.AbstractViewgetView(int no)Returns view numbernocontained within thisDynamicScrollContainer.DataSourceVectorgetVisibleViewsVec(int yStart, int yEnd, int scrollDirection)Returns a Vector containing theDynamicScrollContainer.AbstractViews that are visible in the Y viewing area ofDynamicScrollContainerbetween y positionyStartandyEndvoidremoveView(DynamicScrollContainer.AbstractView view)Removes theDynamicScrollContainer.AbstractViewfrom the datasource.
-
-
-
Field Detail
-
views
protected Vector views
-
-
Constructor Detail
-
DataSource
public DataSource()
-
DataSource
public DataSource(int viewCount)
Create aDynamicScrollContainer.DataSourceand allocate memory forviewCountviews to be stored- Parameters:
viewCount-
-
-
Method Detail
-
getTotalScrollHeight
public int getTotalScrollHeight(int scrollContainerWidth)
Returns the total scrollable height that allDynamicScrollContainer.AbstractViews together will take up. This is calculated based on eachDynamicScrollContainer.AbstractViewheight and is called when aDynamicScrollContainer.DataSourceis set on aDynamicScrollContainer.DataSourceor theDynamicScrollContainerdetects screen rotation.
-
addView
public void addView(DynamicScrollContainer.AbstractView view)
Adds aDynamicScrollContainer.AbstractViewto the datasource if it does not already exist. This does not automatically recalculate the view height- Parameters:
view-
-
removeView
public void removeView(DynamicScrollContainer.AbstractView view)
Removes theDynamicScrollContainer.AbstractViewfrom the datasource. This does not automatically recalculate the view height- Parameters:
view-
-
getVisibleViewsVec
public Vector getVisibleViewsVec(int yStart, int yEnd, int scrollDirection)
Returns a Vector containing theDynamicScrollContainer.AbstractViews that are visible in the Y viewing area ofDynamicScrollContainerbetween y positionyStartandyEnd- Parameters:
yStart-yEnd-
-
getView
public DynamicScrollContainer.AbstractView getView(int no)
Returns view numbernocontained within thisDynamicScrollContainer.DataSource- Parameters:
no-
-
-