Package totalcross.ui
Class DynamicScrollContainer.AbstractView
- java.lang.Object
-
- totalcross.ui.DynamicScrollContainer.AbstractView
-
- Enclosing class:
- DynamicScrollContainer
public abstract static class DynamicScrollContainer.AbstractView extends java.lang.ObjectRepresents a view to be displayed on aDynamicScrollContainer. You must subclassDynamicScrollContainer.AbstractViewand overwritegetHeight()andinitUI()CRITICAL: in
initUI()YOU MUST SETyon the defined rectangle of your container to beyStartotherwise the view will not be visible inDynamicScrollContainer
-
-
Field Summary
Fields Modifier and Type Field Description protected ContainercintheightReturns the height of this view.intparentWidththe width of the parent container in which this view will be visible, this is the width ofDynamicScrollContainerDO NOT MODIFY This is set when adding this view to theDynamicScrollContainer.DataSourceintviewNoThe position of the view in the datasourceintyEndSpecifies the range between which the view is visible on the scroll container Do NOT modify directly.intyStartSpecifies the range between which the view is visible on the scroll container Do NOT modify directly.
-
Constructor Summary
Constructors Constructor Description AbstractView()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()Called when this view is scrolled out of the visible view area. The view is destroyed You can overwrite to include any further garbage collection and resource releaseContainergetComponent()Returns the container to display on theDynamicScrollContainer.abstract intgetHeight()Returns the height this view will occupy in theDynamicScrollContainer.voidinitUI()Initializes the container that represents this view. You must create your UI in this method.
-
-
-
Field Detail
-
c
protected Container c
-
parentWidth
public int parentWidth
the width of the parent container in which this view will be visible, this is the width ofDynamicScrollContainerDO NOT MODIFY This is set when adding this view to theDynamicScrollContainer.DataSource
-
yStart
public int yStart
Specifies the range between which the view is visible on the scroll container Do NOT modify directly. These are set when adding this view to theDynamicScrollContainer.DataSource
-
yEnd
public int yEnd
Specifies the range between which the view is visible on the scroll container Do NOT modify directly. These are set when adding this view to theDynamicScrollContainer.DataSource
-
height
public int height
Returns the height of this view. This needs to be calculated by the view itself usinggetHeight()and is exposed for faster referencing byDynamicScrollContainer.DataSource. If you know the height of your component then set this directly and havegetHeight()return this value.
-
viewNo
public int viewNo
The position of the view in the datasource
-
-
Method Detail
-
getHeight
public abstract int getHeight()
Returns the height this view will occupy in theDynamicScrollContainer. This method should not initialize the component just return the height the view will take up on the scroll container.If you know the height of your component then set
heightdirectly and return that value. If your component's height can only be determined when the component is painted, say for example because of text that may be wrapped, dynamically added controls,etc, then you need to calculate the height in this method, setheightto the value and then return it.
-
getComponent
public Container getComponent()
Returns the container to display on theDynamicScrollContainer. Do not create your ui here but ininitUI()
-
initUI
public void initUI()
Initializes the container that represents this view. You must create your UI in this method. The UI must fit into the height specified bygetHeight()You could lazy load data onto your ui at this point in time from a datasource, however if the loading takes a long time it will delay the painting of the ui in theDynamicScrollContainerCRITICAL: YOU MUST SET
yon the defined rectangle of your container to beyStartotherwise the view will not be visible inDynamicScrollContainer
-
clear
public void clear()
Called when this view is scrolled out of the visible view area. The view is destroyed You can overwrite to include any further garbage collection and resource release
-
-