public abstract static class DynamicScrollContainer.AbstractView
extends java.lang.Object
DynamicScrollContainer
.
You must subclass DynamicScrollContainer.AbstractView
and overwrite getHeight()
and initUI()
CRITICAL: in initUI()
YOU MUST SET y
on the defined rectangle of your container to be yStart
otherwise the view will not be visible in DynamicScrollContainer
Modifier and Type | Field and Description |
---|---|
protected Container |
c |
int |
height
Returns the height of this view.
|
int |
parentWidth
the width of the parent container in which this view will be visible, this is the width of
DynamicScrollContainer DO NOT MODIFY This is set when adding this view to the DynamicScrollContainer.DataSource |
int |
viewNo
The position of the view in the datasource
|
int |
yEnd
Specifies the range between which the view is visible on the scroll container
Do NOT modify directly.
|
int |
yStart
Specifies the range between which the view is visible on the scroll container
Do NOT modify directly.
|
Constructor and Description |
---|
AbstractView() |
Modifier and Type | Method and Description |
---|---|
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
|
Container |
getComponent()
Returns the container to display on the
DynamicScrollContainer . |
abstract int |
getHeight()
Returns the height this view will occupy in the
DynamicScrollContainer . |
void |
initUI()
Initializes the container that represents this view.
You must create your UI in this method.
|
protected Container c
public int parentWidth
DynamicScrollContainer
DO NOT MODIFY This is set when adding this view to the DynamicScrollContainer.DataSource
public int yStart
DynamicScrollContainer.DataSource
public int yEnd
DynamicScrollContainer.DataSource
public int height
getHeight()
and is exposed
for faster referencing by DynamicScrollContainer.DataSource
.
If you know the height of your component then set this directly and have getHeight()
return this value.public int viewNo
public abstract int getHeight()
DynamicScrollContainer
. 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 height
directly 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, set height
to the value and then return it.
public Container getComponent()
DynamicScrollContainer
.
Do not create your ui here but in initUI()
public void initUI()
getHeight()
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 the DynamicScrollContainer
CRITICAL: YOU MUST SET y
on the defined rectangle of your container to be yStart
otherwise the view will not be visible in DynamicScrollContainer
public void clear()