|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.ScrollBar
public class ScrollBar
Realizes a scrollbar for any J2ME Polish screens.
The scrollbar needs to be activated using the "polish.useScrollBar" variable:
<variable name="polish.useScrollBar" value="true" />
If you don't want the scrollbar to handle pointer/drag events itself, you can specify "polish.ScrollBar.handlePointerEvents":
<variable name="polish.ScrollBar.handlePointerEvents" value="false" />
Design the scrollbar using the predefined "scrollbar" style. You
can also specify a screen specific style by defining the "scrollbar-style" CSS attribute.
Scrollbars support following additional attributes (apart from the background etc):
You can exchange the default implementation with the "polish.classes.ScrollBar" variable.
Copyright Enough Software 2006 - 2009
history
22-Feb-2006 - rob creation
| Field Summary | |
|---|---|
protected boolean |
hideSlider
|
protected boolean |
isPointerPressedHandled
|
protected boolean |
isVisible
|
protected boolean |
overlap
|
protected boolean |
repeatSliderImage
|
protected int |
repeatSliderNumber
|
protected int |
scrollBarHeight
|
protected Background |
sliderBackground
|
protected int |
sliderColor
|
protected int |
sliderHeight
|
protected Image |
sliderImage
|
protected int |
sliderMinHeight
|
protected int |
sliderMode
|
protected Dimension |
sliderWidth
|
protected int |
sliderY
|
| Constructor Summary | |
|---|---|
ScrollBar()
Creates a new default scrollbar |
|
ScrollBar(Style style)
Creates a new styled scrollbar |
|
| Method Summary | |
|---|---|
boolean |
animate()
Animates this item. |
protected String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected boolean |
handlePointerDragged(int x,
int y)
Allows to drag the scroll handle. |
protected boolean |
handlePointerPressed(int relX,
int relY)
Handles the event when a pointer has been pressed at the specified position. |
protected boolean |
handlePointerReleased(int relX,
int relY)
Handles the event when a pointer has been released at the specified position. |
protected void |
initContent(int firstLineWidth,
int availWidth,
int availHeight)
Initialises this item. |
int |
initScrollBar(int screenWidth,
int screenAvailableHeight,
int screenContentHeight,
int contentYOffset,
int selectionStart,
int selectionHeight,
int focusedIndex,
int numberOfItems)
Initializes this scrollbar. |
void |
paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints this item on the screen. |
protected void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints the content of this item. |
void |
resetAnimation()
Resets the animation status - when the opcaity is defined, it will be set to the start opacity again |
void |
setStyle(Style style)
Sets the style of this item. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int sliderColor
protected Dimension sliderWidth
protected Image sliderImage
protected boolean repeatSliderImage
protected int repeatSliderNumber
protected int sliderMode
protected Background sliderBackground
protected boolean hideSlider
protected int sliderY
protected int sliderHeight
protected int sliderMinHeight
protected int scrollBarHeight
protected boolean isVisible
protected boolean overlap
protected boolean isPointerPressedHandled
| Constructor Detail |
|---|
public ScrollBar()
public ScrollBar(Style style)
style - the style| Method Detail |
|---|
public int initScrollBar(int screenWidth,
int screenAvailableHeight,
int screenContentHeight,
int contentYOffset,
int selectionStart,
int selectionHeight,
int focusedIndex,
int numberOfItems)
screenWidth - the width of the screenscreenAvailableHeight - the height available for the content within the screenscreenContentHeight - the height of the content area of the screencontentYOffset - the y offset for the content in the range of [-(screenContentHeight-screenAvailableHeight)...0]selectionStart - the start of the selection relative to the screenContentHeightselectionHeight - the height of the current selectionfocusedIndex - the index of currently focused itemnumberOfItems - the number of available items
public void resetAnimation()
public boolean animate()
Item
animate in class ItemItem.animate(long, ClippingRegion)
protected void initContent(int firstLineWidth,
int availWidth,
int availHeight)
Item
initContent in class ItemfirstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelsItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeight
public void paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Item
paint in class Itemx - the left start position of this item.y - the top start position of this item.leftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this position,
rightBorder > x >= leftBorderg - the Graphics on which this item should be painted.
protected void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Item
paintContent in class Itemx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.protected String createCssSelector()
Item
createCssSelector in class Itempublic void setStyle(Style style)
Item
setStyle in interface UiElementsetStyle in class Itemstyle - the new style for this item.
protected boolean handlePointerPressed(int relX,
int relY)
handlePointerPressed in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int)
protected boolean handlePointerReleased(int relX,
int relY)
handlePointerReleased in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
Item.handleKeyPressed(int, int)
protected boolean handlePointerDragged(int x,
int y)
handlePointerDragged in class Itemx - relative x offsety - relative y offset
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||