|
||||||||||
| 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.Screen
public abstract class Screen
The common superclass of all high-level user interface classes. The contents displayed and their interaction with the user are defined by subclasses.
Using subclass-defined methods, the application may change the contents
of a Screen object while it is shown to the user. If
this occurs, and the
Screen object is visible, the display will be updated
automatically. That
is, the implementation will refresh the display in a timely fashion without
waiting for any further action by the application. For example, suppose a
List object is currently displayed, and every element
of the List is
visible. If the application inserts a new element at the beginning of the
List, it is displayed immediately, and the other
elements will be
rearranged appropriately. There is no need for the application to call
another method to refresh the display.
It is recommended that applications change the contents of a
Screen only
while it is not visible (that is, while another
Displayable is current).
Changing the contents of a Screen while it is visible
may result in
performance problems on some devices, and it may also be confusing if the
Screen's contents changes while the user is
interacting with it.
In MIDP 2.0 the four Screen methods that defined
read/write ticker and title properties were moved to Displayable,
Screen's superclass. The semantics of these methods have not changed.
| Field Summary | |
|---|---|
protected Background |
background
|
protected Border |
border
|
protected Container |
container
|
protected int |
contentHeight
|
protected int |
contentWidth
|
protected int |
contentX
|
protected int |
contentY
|
protected java.lang.String |
cssSelector
|
protected int |
fullScreenHeight
the real, complete height of the screen - this includes title, subtitle, content and menubar |
protected boolean |
ignoreRepaintRequests
|
protected int |
infoHeight
|
protected boolean |
isInitRequested
requests a call to calcuateContentArea() the next time this screen is being painted |
protected boolean |
isRepaintRequested
|
protected boolean |
isScrollBackground
|
protected boolean |
isSetFullScreenCalled
|
protected ItemStateListener |
itemStateListener
|
boolean |
keyPressedProcessed
flag for key pressed events - only for internal usage on BlackBerry platforms! |
boolean |
keyReleasedProcessed
flag for key released events - only for internal usage on BlackBerry platforms! |
protected long |
lastInteractionTime
The last time in ms when the user interacted with this screen. |
protected javax.microedition.lcdui.Command |
lastTriggeredCommand
|
protected int |
menuBarHeight
|
protected int |
originalScreenHeight
the screen height minus the height of the menu bar |
protected boolean |
paintScrollBarOnRightSide
|
protected int |
screenHeight
the screen height minus the ticker height and the height of the menu bar |
protected int |
screenOrientationDegrees
|
protected ScreenStateListener |
screenStateListener
|
protected int |
screenWidth
|
protected ScrollBar |
scrollBar
|
protected boolean |
scrollBarVisible
|
protected Style |
style
|
protected int |
subTitleHeight
|
protected Item |
title
|
protected int |
titleHeight
|
protected int |
triggerReleasedKeyCode
|
protected long |
triggerReleasedTime
|
| Fields inherited from class javax.microedition.lcdui.Canvas |
|---|
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 |
| Constructor Summary | |
|---|---|
Screen(java.lang.String title,
boolean createDefaultContainer)
Creates a new screen, this constructor can be used together with the //#style directive. |
|
Screen(java.lang.String title,
boolean createDefaultContainer,
Style style)
Creates a new screen, this constructor can be used together with the //#style directive. |
|
Screen(java.lang.String title,
Style style,
boolean createDefaultContainer)
Creates a new screen |
|
| Method Summary | |
|---|---|
void |
addCommand(javax.microedition.lcdui.Command cmd)
|
void |
addCommand(javax.microedition.lcdui.Command cmd,
Style commandStyle)
Adds a command to this screen with the specified style. |
void |
addSubCommand(javax.microedition.lcdui.Command child,
javax.microedition.lcdui.Command parent)
Adds the given command as a subcommand to the specified parent command. |
void |
addSubCommand(javax.microedition.lcdui.Command child,
javax.microedition.lcdui.Command parent,
Style commandStyle)
Adds the given command as a subcommand to the specified parent command. |
boolean |
animate()
Animates this Screen. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this screen. |
protected void |
calculateContentArea(int x,
int y,
int width,
int height)
Calculates and sets the content area for this screen. |
protected void |
callCommandListener(javax.microedition.lcdui.Command cmd)
Calls the command listener with the specified command. |
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 |
closeMenu()
Closes the commands menu of this screen. |
void |
commandAction(javax.microedition.lcdui.Command command,
javax.microedition.lcdui.Displayable screen)
|
protected abstract java.lang.String |
createCssSelector()
Retrieves the CSS selector for this screen. |
void |
focus(int index)
Focuses the specified item. |
void |
focus(int index,
boolean force)
Focuses the specified item. |
void |
focus(int index,
Item item,
boolean force)
Focuses the specified item. |
void |
focus(Item item)
Focuses the specified item. |
void |
focus(Item item,
boolean force)
Focuses the specified item. |
int |
getAvailableHeight()
Retrieves the available height for this screen. |
CommandItem |
getCommandItem(javax.microedition.lcdui.Command command)
Retrieves the CommandItem used for rendering the specified command. |
javax.microedition.lcdui.CommandListener |
getCommandListener()
Retrieves the asscociated command listener of this screen (if any). |
int |
getCurrentIndex()
Retrieves the index of the currently focused item. |
Item |
getCurrentItem()
Retrieves the currently focused item. |
int |
getGameAction(int keyCode)
|
Item |
getItemAt(int x,
int y)
Locates and returns the item at the given coordinate. |
MenuBar |
getMenuBar()
Allows to access the menu bar. |
Ticker |
getPolishTicker()
Gets the ticker used by this Screen. |
protected Item[] |
getRootItems()
Retrieves all root-items of this screen. |
int |
getScreenContentHeight()
Retrieves the height of the content area. |
int |
getScreenContentWidth()
Retrieves the width of the content area. |
java.lang.Object |
getScreenData()
Retrieves screen specific data. |
int |
getScreenFullHeight()
Retrieves the height that the complete screen uses, including title, menubar, ticker, etc. |
int |
getScreenFullWidth()
Retrieves the width that the complete screen uses, including scrollbar, etc. |
int |
getScreenHeight()
|
Style |
getScreenStyle()
Retrieves the style currently used by this screen. |
protected int |
getScrollBarWidth()
Retrieves the width of the scrollbar Note that you need to activate the usage of the scrollbar by setting polish.useScrollbar=true |
int |
getScrollYOffset()
Retrieves the vertical scroll offset. |
java.lang.String |
getTitle()
Gets the title of the Screen. |
protected boolean |
handleCommand(javax.microedition.lcdui.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 |
handlePointerPressed(int x,
int y)
Handles the pressing of a pointer. |
protected boolean |
handlePointerReleased(int x,
int y)
Handles the release of a pointer. |
void |
hideNotify()
Unregisters this screen and notifies all items that they will not be shown anymore. |
boolean |
isGameActionFire(int keyCode,
int gameAction)
Determines whether the given key is really a Canvas.FIRE game action |
protected boolean |
isKeyboardAccessible()
Checks if the keyboard (if any) is currently accessible by the application. |
boolean |
isMenuOpened()
Checks whether the commands menu of the screen is currently opened. |
boolean |
isShown()
Determines whether the screen is currently shown. |
boolean |
isSoftKey(int keyCode)
Determines if the given keycode belongs to a softkey |
boolean |
isSoftKey(int keyCode,
int gameAction)
Determines if the given keycode belongs to a soft key |
boolean |
isSoftKeyLeft(int keyCode,
int gameAction)
Checks if the given keycode is the left softkey |
boolean |
isSoftKeyMiddle(int keyCode,
int gameAction)
Checks if the given keycode is the middle softkey |
boolean |
isSoftKeyRight(int keyCode,
int gameAction)
Checks if the given keycode is the right softkey |
void |
keyPressed(int keyCode)
Handles key events. |
void |
keyReleased(int keyCode)
Is called when a key is released. |
void |
keyRepeated(int keyCode)
Just maps the event to the the keyPressed method. |
void |
notifyScreenStateChanged()
Notifies the screen state change listener about a change in this screen. |
protected void |
notifyStateListener(Item item)
Adds the given item to the queue for state notifications. |
void |
paint(javax.microedition.lcdui.Graphics g)
Paints the screen. |
protected void |
paintScreen(javax.microedition.lcdui.Graphics g)
Paints the screen. |
void |
pointerDragged(int x,
int y)
|
void |
pointerPressed(int x,
int y)
|
void |
pointerReleased(int x,
int y)
|
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this item. |
void |
removeAllCommands()
Removes all commands from this screen. |
void |
removeCommand(javax.microedition.lcdui.Command cmd)
|
protected void |
removeItemCommands(Item item)
Removes the commands of the given item. |
protected void |
requestInit()
Reinitializes this screen's content area. |
protected void |
requestRepaint()
Forwards a repaint request only when those requests should not be ignored. |
protected void |
requestRepaint(int x,
int y,
int width,
int height)
Forwards a repaint request only when those requests should not be ignored. |
void |
scrollRelative(int amount)
Scrolls this screen by the given amount. |
void |
setCommandListener(javax.microedition.lcdui.CommandListener listener)
|
void |
setFullScreenMode(boolean enable)
|
void |
setInfo(java.lang.String infoText)
Sets the information which should be shown to the user. |
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 |
setItemStateListener(javax.microedition.lcdui.ItemStateListener iListener)
Sets the ItemStateListener for the Screen,
replacing any previous ItemStateListener. |
void |
setMenuBarStyle(Style menuBarStyle)
Sets the style for the menubar. |
void |
setMenuItemStyle(Style menuItemStyle)
Sets the style for menuItems. |
void |
setPolishTicker(Ticker ticker)
Set a ticker for use with this Screen, replacing any previous ticker. |
void |
setPolishTicker(Ticker ticker,
Style tickerStyle)
Set a ticker for use with this Screen, replacing any previous ticker. |
void |
setScreenData(java.lang.Object data)
Attaches data to this screen. |
void |
setScreenOrientation(int degrees)
Sets the screen orientation in 90 degrees steps. |
void |
setScreenStateListener(ScreenStateListener listener)
Sets the screen listener for this screen. |
void |
setScrollYOffset(int offset,
boolean smooth)
Sets the vertical scrolling offset of this screen. |
void |
setStyle(Style style)
Sets the style of this screen. |
protected void |
setSubTitle(Item subTitle)
Sets the subtitle element. |
void |
setTitle(Item item)
Sets an Item as the title for this screen. |
void |
setTitle(java.lang.String s)
Sets the title of the Screen. |
void |
setTitle(java.lang.String text,
Style tStyle)
Sets the title of the Screen. |
void |
showNotify()
Initialises this screen and informs all items about being painted soon. |
void |
sizeChanged(int width,
int height)
|
| Methods inherited from class javax.microedition.lcdui.Canvas |
|---|
getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints |
| Methods inherited from class javax.microedition.lcdui.Displayable |
|---|
getHeight, getTicker, getWidth, setTicker |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Item title
protected int subTitleHeight
protected int titleHeight
protected Background background
protected Border border
protected Style style
protected int screenHeight
protected int originalScreenHeight
protected int screenWidth
protected java.lang.String cssSelector
protected Container container
protected javax.microedition.lcdui.Command lastTriggeredCommand
protected int fullScreenHeight
protected int menuBarHeight
protected final ScrollBar scrollBar
protected boolean paintScrollBarOnRightSide
protected boolean scrollBarVisible
protected int infoHeight
public boolean keyPressedProcessed
public boolean keyReleasedProcessed
protected int contentX
protected int contentY
protected int contentWidth
protected int contentHeight
protected boolean isSetFullScreenCalled
protected int screenOrientationDegrees
protected ScreenStateListener screenStateListener
protected ItemStateListener itemStateListener
protected long lastInteractionTime
protected boolean ignoreRepaintRequests
protected boolean isRepaintRequested
protected boolean isInitRequested
protected int triggerReleasedKeyCode
protected long triggerReleasedTime
protected boolean isScrollBackground
| Constructor Detail |
|---|
public Screen(java.lang.String title,
boolean createDefaultContainer)
title - the title, or null for no titlecreateDefaultContainer - true when the default container should be created.
public Screen(java.lang.String title,
boolean createDefaultContainer,
Style style)
title - the title, or null for no titlestyle - the style of this screencreateDefaultContainer - true when the default container should be created.
public Screen(java.lang.String title,
Style style,
boolean createDefaultContainer)
title - the title, or null for no titlestyle - the style of this screencreateDefaultContainer - true when the default container should be created.| Method Detail |
|---|
protected void requestInit()
protected void requestRepaint()
ignoreRepaintRequests
protected void requestRepaint(int x,
int y,
int width,
int height)
x - the x coordinate of the area that needs to be refreshedy - the y coordinate of the area that needs to be refreshedwidth - the width of the area that needs to be refreshedheight - the height of the area that needs to be refreshedignoreRepaintRequestsprotected boolean checkForRequestInit(Item source)
source - the source of the event
protected void calculateContentArea(int x,
int y,
int width,
int height)
x - left start of the content area, might later be adjusted by an external scrollindicatory - top start of the content area, is adjusted by the top margin, title height, subtitle height,
info height and maybe ticker height (when the ticker should be painted at the top).width - width of the content area, might later be adjusted by an external scrollindicatorheight - height of the content area, is adjusted by the title height, subtitle height,
info height and ticker height.public void showNotify()
showNotify in interface AccessibleCanvasshowNotify in class javax.microedition.lcdui.Canvaspublic void hideNotify()
hideNotify in interface AccessibleCanvashideNotify in class javax.microedition.lcdui.Canvaspublic void setStyle(Style style)
style - the style
public void animate(long currentTime,
ClippingRegion repaintRegion)
currentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedpublic boolean animate()
animate(long, ClippingRegion)public void paint(javax.microedition.lcdui.Graphics g)
paint in interface AccessibleCanvaspaint in class javax.microedition.lcdui.Canvasg - the graphics context.paintScreen(Graphics)protected void paintScreen(javax.microedition.lcdui.Graphics g)
g - the graphics on which the screen should be paintedcontentX,
contentY,
contentWidth,
contentHeight,
paintScrollIndicator,
paintScrollIndicatorUp,
paintScrollIndicatorDownpublic java.lang.String getTitle()
getTitle in class javax.microedition.lcdui.Displayablepublic void setTitle(java.lang.String s)
startApp
returns back to the implementation.
setTitle in class javax.microedition.lcdui.Displayables - - the new title, or null for no title
public void setTitle(java.lang.String text,
Style tStyle)
startApp
returns back to the implementation.
text - the new title, or null for no titletStyle - the new style for the title, is ignored when nullpublic void setTitle(Item item)
item - the title Itempublic void setInfo(java.lang.String infoText)
infoText - the text which will be shown to the userpublic void setPolishTicker(Ticker ticker)
startApp
returns back to the implementation.
ticker - - the ticker object used on this screen
public void setPolishTicker(Ticker ticker,
Style tickerStyle)
startApp
returns back to the implementation.
ticker - the ticker object used on this screentickerStyle - the style of the tickerpublic Ticker getPolishTicker()
public int getGameAction(int keyCode)
getGameAction in class javax.microedition.lcdui.Canvaspublic void keyPressed(int keyCode)
keyPressed in interface AccessibleCanvaskeyPressed in class javax.microedition.lcdui.CanvaskeyCode - The code of the pressed keypublic void keyRepeated(int keyCode)
keyRepeated in interface AccessibleCanvaskeyRepeated in class javax.microedition.lcdui.CanvaskeyCode - the code of the key, which is pressed repeatedlypublic void keyReleased(int keyCode)
keyReleased in interface AccessibleCanvaskeyReleased in class javax.microedition.lcdui.CanvaskeyCode - the code of the key, which has been releasedprotected abstract java.lang.String createCssSelector()
protected Item[] getRootItems()
protected boolean handleKeyPressed(int keyCode,
int gameAction)
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleKeyRepeated(int keyCode,
int gameAction)
keyCode - the code of the repeated key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleKeyReleased(int keyCode,
int gameAction)
keyCode - the code of the released key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
public void setScreenStateListener(ScreenStateListener listener)
listener - the listener that is notified whenever the user changes the internal state of this screen.public void notifyScreenStateChanged()
public void setCommandListener(javax.microedition.lcdui.CommandListener listener)
setCommandListener in class javax.microedition.lcdui.Displayablepublic javax.microedition.lcdui.CommandListener getCommandListener()
public void addCommand(javax.microedition.lcdui.Command cmd)
addCommand in class javax.microedition.lcdui.Displayable
public void addCommand(javax.microedition.lcdui.Command cmd,
Style commandStyle)
cmd - the commandcommandStyle - the style for the commandpublic CommandItem getCommandItem(javax.microedition.lcdui.Command command)
command - the command
public void removeAllCommands()
public void addSubCommand(javax.microedition.lcdui.Command child,
javax.microedition.lcdui.Command parent)
child - the child commandparent - the parent command
public void addSubCommand(javax.microedition.lcdui.Command child,
javax.microedition.lcdui.Command parent,
Style commandStyle)
child - the child commandparent - the parent commandcommandStyle - the style for the command
java.lang.IllegalStateException - when the parent command has not been added beforepublic void removeCommand(javax.microedition.lcdui.Command cmd)
removeCommand in class javax.microedition.lcdui.Displayable
protected void setItemCommands(ArrayList commandsList,
Item item)
commandsList - item - the item which has at least one commandremoveItemCommands(Item)protected void removeItemCommands(Item item)
item - the item which has at least one commandsetItemCommands(ArrayList,Item)protected void callCommandListener(javax.microedition.lcdui.Command cmd)
cmd - the command wich should be issued to the listenerpublic int getAvailableHeight()
public void commandAction(javax.microedition.lcdui.Command command,
javax.microedition.lcdui.Displayable screen)
public void pointerPressed(int x,
int y)
pointerPressed in interface AccessibleCanvaspointerPressed in class javax.microedition.lcdui.Canvas
public void pointerDragged(int x,
int y)
pointerDragged in interface AccessibleCanvaspointerDragged in class javax.microedition.lcdui.Canvas
public void pointerReleased(int x,
int y)
pointerReleased in interface AccessibleCanvaspointerReleased in class javax.microedition.lcdui.Canvas
protected boolean handlePointerPressed(int x,
int y)
x - the absolute x position of the pointer pressingy - the absolute y position of the pointer pressing
protected boolean handlePointerReleased(int x,
int y)
x - the absolute x position of the pointer pressingy - the absolute y position of the pointer pressing
protected boolean handleCommand(javax.microedition.lcdui.Command cmd)
cmd - the command
public void setFullScreenMode(boolean enable)
setFullScreenMode in class javax.microedition.lcdui.Canvas
public void sizeChanged(int width,
int height)
sizeChanged in interface AccessibleCanvassizeChanged in class javax.microedition.lcdui.Canvaspublic int getScreenHeight()
public void focus(Item item)
item - the item which is already shown on this screen.
public void focus(Item item,
boolean force)
item - 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(int index)
index - the index of the item which is already shown on this screen.
public void focus(int index,
boolean force)
index - the index of 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(int index,
Item item,
boolean force)
index - the index of the item which is already shown on this screen.item - 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)protected void setSubTitle(Item subTitle)
subTitle - the new subtitle element.public boolean isShown()
isShown in class javax.microedition.lcdui.Displayabletrue if the screen is currently shown, false otherwiseDisplayable.isShown()public Item getCurrentItem()
public int getCurrentIndex()
public boolean isMenuOpened()
public void closeMenu()
public void releaseResources()
public void scrollRelative(int amount)
amount - the number of pixels, positive values scroll upwards, negative scroll downwardspublic void setScreenData(java.lang.Object data)
data - the screen specific dataUiAccess.setData(Screen, Object),
UiAccess.getData(Screen)public java.lang.Object getScreenData()
UiAccess.setData(Screen, Object),
UiAccess.getData(Screen)
public Item getItemAt(int x,
int y)
x - horizontal position in pixelsy - vertical position in pixels
public Style getScreenStyle()
public void setItemStateListener(ItemStateListener iListener)
ItemStateListener for the Screen,
replacing any previous ItemStateListener.
If
iListener is null, simply
removes the previous ItemStateListener.
iListener - the new listener, or null to remove itpublic void setItemStateListener(javax.microedition.lcdui.ItemStateListener iListener)
ItemStateListener for the Screen,
replacing any previous ItemStateListener.
If
iListener is null, simply
removes the previous ItemStateListener.
iListener - the new listener, or null to remove itprotected void notifyStateListener(Item item)
item - the item which contents have been edited.protected boolean isKeyboardAccessible()
protected int getScrollBarWidth()
public int getScreenContentHeight()
public int getScreenContentWidth()
public int getScreenFullHeight()
public int getScreenFullWidth()
public void setMenuItemStyle(Style menuItemStyle)
menuItemStyle - the style for menu itemspublic MenuBar getMenuBar()
public void setMenuBarStyle(Style menuBarStyle)
menuBarStyle - public int getScrollYOffset()
public void setScrollYOffset(int offset,
boolean smooth)
offset - either the new offsetsmooth - scroll to this new offset smooth if allowedpublic void setScreenOrientation(int degrees)
degrees - the screen orientation in degrees: 90, 180, 270 or 0
public boolean isGameActionFire(int keyCode,
int gameAction)
keyCode - the key codegameAction - the game action
public final boolean isSoftKeyLeft(int keyCode,
int gameAction)
keyCode - the key codegameAction - the associated game action
public final boolean isSoftKeyRight(int keyCode,
int gameAction)
keyCode - the key codegameAction - the associated game action
public final boolean isSoftKeyMiddle(int keyCode,
int gameAction)
keyCode - the key codegameAction - the associated game action
public boolean isSoftKey(int keyCode)
keyCode - the keycode
public boolean isSoftKey(int keyCode,
int gameAction)
keyCode - the key codegameAction - the associated game action
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||