Package totalcross.ui
Class GridContainer
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.GridContainer
-
public class GridContainer extends Container
Class that implements a Grid that each cell is a container. See the ImageBook sample, which also shows how to dynamically load and unload images. Here's a piece of it:add(gc = new GridContainer(GridContainer.HORIZONTAL_ORIENTATION),LEFT,TOP,FILL,FILL); gc.setBackColor(Color.WHITE); Flick f = gc.getFlick(); f.shortestFlick = 1000; f.longestFlick = 6000; gc.setPageSize(linhas,colunas); gc.setRowsPerPage(linhasPorPagina); Celula []cels = new Celula[TOTAL_ITEMS]; for (int i = 0; i < cels.length; i++) cels[i] = new Celula(i); gc.setCells(cels);- Since:
- TotalCross 1.53
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridContainer.CellA Grid's cell.-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description intbuttonsHeightA percentage that defines the heihgt of the arrow buttons.static intHORIZONTAL_ORIENTATIONDefines a horizontal orientation scroll.NumericPagePositionpageposThe container that has the page number and first/last arrows.ScrollContainerscThe ScrollContainer used in this control.static intVERTICAL_ORIENTATIONDefines a vertical orientation scroll.-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, lastX, lastY, npback, numChildren, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
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, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description GridContainer(int orientation)Constructs a GridContainer with the given orientation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlickgetFlick()Returns the flick attached to the ScrollContainer.voidinitUI()Called to initialize the User Interface of this container.voidonColorsChanged(boolean colorsChanged)Called after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container.voidonEvent(Event e)Called to process key, pen, control and other posted events.voidonFontChanged()Called after a setFontvoidsetCells(GridContainer.Cell[] cells)Sets the cells of this GridContainer.voidsetPageSize(int cols, int rows)Sets the page size in columns and rows.voidsetRowsPerPage(int rpp)Sets the rows per page.-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, applyTransitionEffect, broadcastEvent, clear, fillBackground, findChild, findNearestChild, findNextFocusControl, getBorderStyle, getChildren, getChildrenCount, getClientRect, getClientRect, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onPaint, onRemove, onSwapFinished, paintChildren, remove, removeAll, resize, resizeHeight, resizeWidth, setBorderStyle, setEnabled, setFocusTraversable, setHighlighting, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPreferredHeight, getPreferredWidth, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isTopMost, isVisible, isVisibleAndInside, onBoundsChanged, onWindowPaintFinished, post, postEvent, postPressedEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimer, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
-
-
-
Field Detail
-
HORIZONTAL_ORIENTATION
public static final int HORIZONTAL_ORIENTATION
Defines a horizontal orientation scroll.- See Also:
- Constant Field Values
-
VERTICAL_ORIENTATION
public static final int VERTICAL_ORIENTATION
Defines a vertical orientation scroll.- See Also:
- Constant Field Values
-
sc
public ScrollContainer sc
The ScrollContainer used in this control.
-
pagepos
public NumericPagePosition pagepos
The container that has the page number and first/last arrows. Only works when orientation is horizontal, and is null otherwise.
-
buttonsHeight
public int buttonsHeight
A percentage that defines the heihgt of the arrow buttons. Defaults to 200 in penless devices, 100 otherwise.
-
-
Constructor Detail
-
GridContainer
public GridContainer(int orientation)
Constructs a GridContainer with the given orientation- See Also:
HORIZONTAL_ORIENTATION,VERTICAL_ORIENTATION
-
-
Method Detail
-
getFlick
public Flick getFlick()
Returns the flick attached to the ScrollContainer.
-
onFontChanged
public void onFontChanged()
Description copied from class:ControlCalled after a setFont- Overrides:
onFontChangedin classControl
-
initUI
public void initUI()
Description copied from class:ContainerCalled to initialize the User Interface of this container. This differs from the onAddAgain method by that this method is called only once, at the first time the control is added to the parent. When the container is being setup, the initUI method is called; then, the onAddAgain is called every time the container is added again.
-
setRowsPerPage
public void setRowsPerPage(int rpp)
Sets the rows per page. Changing this value changes the font size dynamically.
-
setPageSize
public void setPageSize(int cols, int rows)Sets the page size in columns and rows.
-
setCells
public void setCells(GridContainer.Cell[] cells)
Sets the cells of this GridContainer. Note that you cannot delete or add cells, only change the whole set of cells. You must call setRowsPerPage and/or setPageSize before calling this method.
-
onEvent
public void onEvent(Event e)
Description copied from class:ControlCalled to process key, pen, control and other posted events.
-
onColorsChanged
public void onColorsChanged(boolean colorsChanged)
Description copied from class:ControlCalled after a setEnabled, setForeColor and setBackColor and when a control has been added to a Container. If colorsChanged is true, it was called from setForeColor/setBackColor/Container.add; otherwise, it was called from setEnabled- Overrides:
onColorsChangedin classContainer
-
-