Modifier and Type | Field and Description |
---|---|
private int |
page
the size of visible region in object-specific units, page <= width
|
private int |
position
Current scroll position 0 <= position <= (width - page)
|
private int |
width
the size of the scrolled object in some object-specific units, >= 0
|
Constructor and Description |
---|
ScrollModel()
Create a scrolling model in the "no scrolling required" state.
|
ScrollModel(int width,
int page,
int position)
Create a scrolling model.
|
Modifier and Type | Method and Description |
---|---|
int |
getLastVisible()
Get the sum of the position and the page.
|
int |
getPage()
Get the scroll model page value.
|
int |
getPosition()
Get the scroll model position value.
|
int |
getWidth()
Get the scroll model width.
|
boolean |
increment(int value)
Convenience function to shift the position by the given number.
|
boolean |
isScrollAvailable()
Test is any scrolling is possible.
|
boolean |
makeVisible(int visiblePosition,
boolean forceTop)
Assure the given position is "visible".
|
void |
print(PrintHelper printer)
Add class-specific fields to the helper.
|
void |
reset()
Reset all fields to initial state without sending notifications.
|
boolean |
set(int width,
int page,
int position)
Set all model data fields.
|
boolean |
setPosition(int position)
Change the model position.
|
addListener, changed, removeListener, toString
private int page
private int position
private int width
public ScrollModel()
public ScrollModel(int width, int page, int position)
width
- the width valuepage
- the page valueposition
- the position.public int getLastVisible()
public int getPage()
public int getPosition()
public int getWidth()
public boolean increment(int value)
value
- any increment value, may be negative.public boolean isScrollAvailable()
public boolean makeVisible(int visiblePosition, boolean forceTop)
visiblePosition
- the position which should be "visible".forceTop
- if true
then try to make the argument node the tree top nodetrue
if the model was changed as the result of this callpublic void reset()
public boolean set(int width, int page, int position)
width
- the new width valuepage
- the new page valueposition
- the new position valuetrue
if model was changed as the result of this call.public boolean setPosition(int position)
position
- the new position value.true
if position was changed as the result of this call.public void print(PrintHelper printer)
printer
- the string helper to update