|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Displayable
javax.microedition.lcdui.Canvas
de.enough.polish.ui.Canvas
de.enough.polish.ui.Screen
de.enough.polish.ui.Form
de.enough.polish.ui.FramedForm
public class FramedForm
Allows to split up a form into several frames.
The main frame is used for the normal content. Additional frames can be used for keeping GUI elements always in the same position, regardless whether the form is scrolled.
Copyright (c) Enough Software 2005 - 2011
| Field Summary | |
|---|---|
protected boolean |
allowCycling
|
protected Container |
bottomFrame
|
protected Container |
currentlyActiveContainer
|
static int |
FRAME_BOTTOM
the frame positioned at the bottom |
static int |
FRAME_CENTER
the frame positioned at the center (the scrollable view) |
static int |
FRAME_LEFT
the frame positioned at the left |
static int |
FRAME_RIGHT
the frame positioned at the right |
static int |
FRAME_TOP
the frame positioned at the top |
protected Container |
leftFrame
|
protected Container |
rightFrame
|
protected Container |
topFrame
|
| Fields inherited from class de.enough.polish.ui.Canvas |
|---|
_commands, DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP |
| Fields inherited from interface de.enough.polish.ui.CycleListener |
|---|
DIRECTION_BOTTOM_TO_TOP, DIRECTION_LEFT_TO_RIGHT, DIRECTION_RIGHT_TO_LEFT, DIRECTION_TOP_TO_BOTTOM |
| Constructor Summary | |
|---|---|
FramedForm(String title)
Creates a new FramedForm |
|
FramedForm(String title,
Style style)
Creates a new FramedForm |
|
| Method Summary | |
|---|---|
protected void |
adjustContentArea(int x,
int y,
int width,
int height,
Container cont)
Subclasses may override this to adjust the content area of a screen. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this screen. |
void |
append(int frameOrientation,
Item item)
Adds the given item to the specified frame. |
void |
append(int frameOrientation,
Item item)
Adds the given item to the specified frame. |
void |
append(int frameOrientation,
Item item,
Style itemStyle)
Adds the given item to the specified frame. |
int |
append(Item item)
Adds an Item into the Form. |
protected boolean |
checkForRequestInit(Item source)
Checks if this screen's content area should be refreshed when the specified item has changed it's size. |
void |
delete(int frameOrientation,
int itemNum)
Removes the given item from the specified frame. |
void |
deleteAll()
Deletes all the items from all frames of this FramedForm, leaving it with zero items. |
void |
deleteAll(int frameOrientation)
Removes all items from the specified frame. |
boolean |
deleteFrame(int frameOrientation)
Deletes a complete frame. |
void |
destroy()
Destroys the screen |
void |
focus(Item item,
boolean force)
Focuses the specified item. |
void |
focus(Item item,
boolean force,
boolean keepCurrentFrame)
Focuses the specified item and optionally keeps the current frame focused |
void |
focusByAction(int gameAction,
Container cont)
Focuses the first resp. |
Item |
getCurrentItem()
Retrieves the currently focused item. |
Container |
getFrame(int x,
int y)
Looks up the frame around the given position |
Item |
getItemAt(int x,
int y)
Locates and returns the item at the given coordinate. |
protected Item[] |
getRootItems()
Retrieves all root-items of this screen. |
protected boolean |
handleCommand(Command cmd)
Tries to handle the specified command. |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
protected boolean |
handleKeyReleased(int keyCode,
int gameAction)
Handles the key-released event. |
protected boolean |
handleKeyRepeated(int keyCode,
int gameAction)
Handles the key-repeated event. |
protected boolean |
handlePointerDragged(int x,
int y,
ClippingRegion repaintRegion)
Handles the dragging/movement of a pointer. |
protected boolean |
handlePointerPressed(int x,
int y)
Handles the pressing of a pointer. |
protected boolean |
handlePointerReleased(int x,
int y)
Handles the release of a pointer. |
boolean |
handlePointerTouchDown(int x,
int y)
Handles a touch down/press event. |
boolean |
handlePointerTouchUp(int x,
int y)
Handles a touch up/release event. |
boolean |
onCycle(Item item,
int direction)
Notifies the listener about a cycle action. |
protected void |
paintScreen(Graphics g)
Paints the screen. |
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this item. |
void |
set(int frameOrientation,
int itemNumber,
Item item)
Updates an existing item in the specified frame |
void |
set(int frameOrientation,
int itemNum,
Item item)
Updates an existing item in the specified frame |
void |
set(int itemNumber,
Item item)
Updates an existing item in the content frame |
protected void |
setActiveFrame(Container newFrame,
boolean keepMainFocus)
Activates another frame. |
protected void |
setActiveFrame(Container newFrame,
boolean keepMainFocus,
int direction)
Activates another frame. |
void |
setActiveFrame(int frameOrientation)
Focuses the specified frame. |
void |
setActiveFrame(int frameOrientation,
boolean keepMainFocus)
Focuses the specified frame while optionally keeping the focus on the main content frame. |
void |
setFrameStyle(int frameOrientation)
Sets a style for the specified frame programmatically. |
void |
setFrameStyle(int frameOrientation,
Style style)
Sets the style for the specified frame programmatically |
protected void |
setItemCommands(ArrayList commandsList,
Item item)
Sets the commands of the given item |
void |
setItemStateListener(ItemStateListener iListener)
Sets the ItemStateListener for the Screen,
replacing any previous ItemStateListener. |
void |
setStyle(Style style)
Sets the style of this screen. |
void |
setStyle(Style style,
boolean resetStyle)
Sets the style with animatable CSS attributes of this user interface element. |
int |
size(int frameOrientation)
Retrieves the size of the specified frame. |
void |
sizeChanged(int width,
int height)
Adjusts the size of this screen. |
| Methods inherited from class de.enough.polish.ui.Form |
|---|
append, append, append, append, append, append, createCssSelector, delete, get, insert, insert, insert, set, set, size |
| Methods inherited from class de.enough.polish.ui.Canvas |
|---|
_hideNotify, _hideNotifyExternal, _showNotify, getGameAction, getHeight, getKeyCode, getKeyName, getWidth, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotifyExternal, isDoubleBuffered, isShown, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, setTicker |
| Methods inherited from class javax.microedition.lcdui.Canvas |
|---|
repaint, repaint, serviceRepaints |
| Methods inherited from class javax.microedition.lcdui.Displayable |
|---|
getTicker, removeCommand, setTicker |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FRAME_TOP
public static final int FRAME_BOTTOM
public static final int FRAME_LEFT
public static final int FRAME_RIGHT
public static final int FRAME_CENTER
protected Container leftFrame
protected Container rightFrame
protected Container topFrame
protected Container bottomFrame
protected boolean allowCycling
protected Container currentlyActiveContainer
| Constructor Detail |
|---|
public FramedForm(String title)
title - the title of this form
public FramedForm(String title,
Style style)
title - the title of this formstyle - the style of this form, usually set with a #style directive| Method Detail |
|---|
public Container getFrame(int x,
int y)
x - the absolute x positiony - the absolute y position
public Item getItemAt(int x,
int y)
Screen
getItemAt in class Screenx - horizontal position in pixelsy - vertical position in pixels
public void focus(Item item,
boolean force)
Screen
focus in class Screenitem - the item which is already shown on this screen.force - true when the item should be focused even when it is inactive (like a label for example)
public void focus(Item item,
boolean force,
boolean keepCurrentFrame)
item - the itemforce - when the item should be focused even when it is not interactivekeepCurrentFrame - true when the currently active container should keep its focuspublic void deleteAll()
FramedForm, leaving it with zero items.
This method does nothing if the FramedForm is already empty.
deleteAll in class Formpublic void deleteAll(int frameOrientation)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.FRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTERpublic int append(Item item)
FormItem into the Form.
The newly
added Item becomes the last Item in the
Form, and the size of the Form grows
by one.
This method is only provided for being able to add native items as well as custom items to a J2ME Polish form
within an IDE.
append in class Formitem - the Item to be added.
public void set(int frameOrientation,
int itemNumber,
Item item)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.itemNumber - the index of the previous itemitem - the new itemFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTER
public void set(int itemNumber,
Item item)
set in class FormitemNumber - the index of the previous itemitem - the new item
public void append(int frameOrientation,
Item item)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.item - the itemFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTERpublic void setItemStateListener(ItemStateListener iListener)
ItemStateListener for the Screen,
replacing any previous ItemStateListener.
If
iListener is null, simply
removes the previous ItemStateListener.
setItemStateListener in class ScreeniListener - the new listener, or null to remove it
public void append(int frameOrientation,
Item item)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.item - the itemFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTER
public void set(int frameOrientation,
int itemNum,
Item item)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.itemNum - the index of the previous itemitem - the new itemFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTER
public void delete(int frameOrientation,
int itemNum)
itemNum parameter must be
within the range [0..size()-1], inclusive.
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.itemNum - the index of the itemFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTERpublic int size(int frameOrientation)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.
FRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTERpublic boolean deleteFrame(int frameOrientation)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.
FRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTER
public void append(int frameOrientation,
Item item,
Style itemStyle)
frameOrientation - either FRAME_TOP, FRAME_BOTTOM, FRAME_LEFT, FRAME_RIGHT or FRAME_CENTER for the content frame.item - the itemitemStyle - the style for that item, is ignored when nullFRAME_TOP,
FRAME_BOTTOM,
FRAME_LEFT,
FRAME_RIGHT,
FRAME_CENTER
protected void adjustContentArea(int x,
int y,
int width,
int height,
Container cont)
Screen
adjustContentArea in class Screenx - the contentX fieldy - the contentY fieldwidth - the contentWidth fieldheight - the contentHeight fieldcont - the container, may be nullScreen.setScreenInitializerListener(ScreenInitializerListener)protected boolean checkForRequestInit(Item source)
Screen
checkForRequestInit in class Screensource - the source of the event
protected void paintScreen(Graphics g)
Screen
paintScreen in class Screeng - the graphics on which the screen should be paintedScreen.contentX,
Screen.contentY,
Screen.contentWidth,
Screen.contentHeight,
Screen.paintScrollIndicator,
Screen.paintScrollIndicatorUp,
Screen.paintScrollIndicatorDown
protected boolean handleKeyPressed(int keyCode,
int gameAction)
Screen
handleKeyPressed in class ScreenkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
public void focusByAction(int gameAction,
Container cont)
gameAction - the game actioncont - the container
protected boolean handleKeyReleased(int keyCode,
int gameAction)
Screen
handleKeyReleased in class ScreenkeyCode - the code of the released key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleKeyRepeated(int keyCode,
int gameAction)
Screen
handleKeyRepeated in class ScreenkeyCode - the code of the repeated key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleCommand(Command cmd)
Screen
handleCommand in class Screencmd - the command
public Item getCurrentItem()
getCurrentItem in class Screenpublic void setActiveFrame(int frameOrientation)
frameOrientation - either Graphics.TOP, Graphics.BOTTOM, Graphics.LEFT, Graphics.RIGHT or -1 for the main/scrollable frame
public void setActiveFrame(int frameOrientation,
boolean keepMainFocus)
frameOrientation - either Graphics.TOP, Graphics.BOTTOM, Graphics.LEFT, Graphics.RIGHT or -1 for the main/scrollable framekeepMainFocus - true when the focus should be kept on the main container at the same time.
protected void setActiveFrame(Container newFrame,
boolean keepMainFocus)
newFrame - the next framekeepMainFocus - true when the focus should be kept on the main container at the same time.
protected void setActiveFrame(Container newFrame,
boolean keepMainFocus,
int direction)
newFrame - the next framekeepMainFocus - true when the focus should be kept on the main container at the same time.direction - the direction that should be used. e.g. Canvas.UP, DOWN
protected boolean handlePointerPressed(int x,
int y)
Screen
handlePointerPressed in class Screenx - the absolute x position of the pointer pressingy - the absolute y position of the pointer pressing
protected boolean handlePointerDragged(int x,
int y,
ClippingRegion repaintRegion)
Screen
handlePointerDragged in class Screenx - the absolute x position of the pointer movementy - the absolute y position of the pointer movement
protected boolean handlePointerReleased(int x,
int y)
Screen
handlePointerReleased in class Screenx - the absolute x position of the pointer releasey - the absolute y position of the pointer release
public boolean handlePointerTouchDown(int x,
int y)
Screen
handlePointerTouchDown in class Screenx - the absolute horizontal pixel position of the touch eventy - the absolute vertical pixel position of the touch event
public boolean handlePointerTouchUp(int x,
int y)
Screen
handlePointerTouchUp in class Screenx - the absolute horizontal pixel position of the touch eventy - the absolute vertical pixel position of the touch event
public void animate(long currentTime,
ClippingRegion repaintRegion)
Screen
animate in interface Animatableanimate in class ScreencurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)protected Item[] getRootItems()
Screen
getRootItems in class Screenpublic void setStyle(Style style)
Screen
setStyle in interface UiElementsetStyle in class Screenstyle - the styleScreen.setStyle(Style, boolean)
public void setStyle(Style style,
boolean resetStyle)
UiElement
setStyle in interface UiElementsetStyle in class Screenstyle - the new style for this element.resetStyle - true when style settings should be resetted. This is not the case
when styles are animated, for example.public void setFrameStyle(int frameOrientation)
//#style dynamicTopFrame framedForm.setFrameOrientation( Graphics.TOP );
frameOrientation - the frame, e.g. Graphics.TOP
public void setFrameStyle(int frameOrientation,
Style style)
frameOrientation - the frame, e.g. Graphics.TOPstyle - the style for the frame
protected void setItemCommands(ArrayList commandsList,
Item item)
Screen
setItemCommands in class ScreencommandsList - the commands that are addeditem - the item which contains the specified commandsScreen.removeItemCommands(Item)
public void sizeChanged(int width,
int height)
Screen
sizeChanged in interface DisplayablesizeChanged in class Screenwidth - the new width of the screenheight - the new height of the screenin class Displayablepublic void releaseResources()
Screen
releaseResources in class Screenpublic void destroy()
Screen
destroy in class Screen
public boolean onCycle(Item item,
int direction)
CycleListener
onCycle in interface CycleListeneritem - the item that cyclesdirection - the direction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||