Package totalcross.ui
Class PagePosition
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.PagePosition
-
- Direct Known Subclasses:
NumericPagePosition
public class PagePosition extends Control
PagePosition implements the empty and filled balls that indicates the current page in a set of pages, very common on Android and iPhone. It has three properties:- visible count: the number of visible balls
- count: the number of balls that will be displayed. Can be less, equal or greater than visible count
- position: the current position of the filled ball
- Since:
- TotalCross 1.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description protected intcountprotected intpositionprotected intvisibleCount-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, nextTabControl, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description PagePosition(int visibleCount)Constructs a new PagePosition with the given number of visible balls.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddec(boolean wrap)Decrements the current position.intgetCount()Returns the ball count.intgetPosition()Returns the current positionintgetPreferredHeight()Returns the preferred height of this control.intgetPreferredWidth()Returns the preferred width of this control.intgetVisibleCount()Returns the visibleCount passed in the constructor.voidinc(boolean wrap)Increments the current position.voidonPaint(Graphics g)Called to draw the control.voidsetCount(int c)Sets the balls count.voidsetPosition(int p)Sets the current position (starting at 1).-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addGridListener, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addTimer, addTimer, addTimerListener, addWindowListener, bringToFront, changeHighlighted, clear, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onBoundsChanged, onColorsChanged, onEvent, onFontChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setEnabled, setFocusLess, setFont, setForeColor, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Method Detail
-
setCount
public void setCount(int c)
Sets the balls count. Invalid values are forced to a valid range.
-
setPosition
public void setPosition(int p)
Sets the current position (starting at 1). Invalid values are forced to a valid range.
-
getVisibleCount
public int getVisibleCount()
Returns the visibleCount passed in the constructor.
-
getCount
public int getCount()
Returns the ball count.
-
getPosition
public int getPosition()
Returns the current position
-
inc
public void inc(boolean wrap)
Increments the current position. If wrap is true, when position gets above count, it wraps to 1.
-
dec
public void dec(boolean wrap)
Decrements the current position. If wrap is true, when position gets below 1, it wraps to count.
-
onPaint
public void onPaint(Graphics g)
Description copied from class:ControlCalled to draw the control. When this method is called, the graphics object passed has been translated into the coordinate system of the control and the area behind the control has already been painted.
-
getPreferredWidth
public int getPreferredWidth()
Description copied from class:ControlReturns the preferred width of this control.- Overrides:
getPreferredWidthin classControl
-
getPreferredHeight
public int getPreferredHeight()
Description copied from class:ControlReturns the preferred height of this control.- Overrides:
getPreferredHeightin classControl
-
-