|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
de.enough.polish.ui.FakeStringCustomItem
public class FakeStringCustomItem
Meant for classes that want to be compatible with javax.microedition.lcdui.CustomItem for IDEs only while extending de.enough.polish.ui.StringItem in reality.
Subclasses can change the hierarchy with preprocessing like this:
public class MyCustomItem
//#if polish.LibraryBuild
extends FakeStringCustomItem
//#else
//# extends StringItem
//#endif
This allows subclasses to access all fields and methods of the J2ME Polish item class.
Note that this class can never be used in reality. Ever.
| Field Summary | |
|---|---|
protected BitMapFont |
bitMapFont
|
protected BitMapFontViewer |
bitMapFontViewer
|
protected boolean |
clipText
|
protected javax.microedition.lcdui.Font |
font
|
protected java.lang.String |
text
|
protected int |
textColor
|
protected TextEffect |
textEffect
|
protected int |
textHorizontalAdjustment
|
protected java.lang.String[] |
textLines
|
protected int |
textVerticalAdjustment
|
protected boolean |
useSingleLine
|
protected int |
xOffset
|
| Fields inherited from class javax.microedition.lcdui.CustomItem |
|---|
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL |
| Constructor Summary | |
|---|---|
FakeStringCustomItem(java.lang.String label,
java.lang.String text)
Creates a new StringItem object. |
|
FakeStringCustomItem(java.lang.String label,
java.lang.String text,
int appearanceMode)
Creates a new StringItem object with the given label,
textual content, and appearance mode. |
|
FakeStringCustomItem(java.lang.String label,
java.lang.String text,
int appearanceMode,
Style style)
Creates a new StringItem object with the given label,
textual content, and appearance mode. |
|
FakeStringCustomItem(java.lang.String label,
java.lang.String text,
Style style)
Creates a new StringItem object. |
|
| Method Summary | |
|---|---|
boolean |
animate()
Animates this item. |
protected java.lang.String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected void |
defocus(Style originalStyle)
Removes the focus from this item. |
javax.microedition.lcdui.Font |
getFont()
Gets the application's preferred font for rendering this StringItem. |
java.lang.String |
getText()
Gets the text contents of the StringItem, or
null if the StringItem is
empty. |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this item. |
void |
setFont(javax.microedition.lcdui.Font font)
Sets the application's preferred font for rendering this StringItem. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setText(java.lang.String text)
Sets the text contents of the StringItem. |
void |
setText(java.lang.String text,
Style style)
Sets the text contents of the StringItem along with a style. |
protected void |
showNotify()
Called by the system to notify the item that it is now at least partially visible, when it previously had been completely invisible. |
java.lang.String |
toString()
Generates a String representation of this item. |
| Methods inherited from class javax.microedition.lcdui.CustomItem |
|---|
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String text
protected java.lang.String[] textLines
protected int textColor
protected javax.microedition.lcdui.Font font
protected BitMapFont bitMapFont
protected BitMapFontViewer bitMapFontViewer
protected boolean useSingleLine
protected boolean clipText
protected int xOffset
protected int textHorizontalAdjustment
protected int textVerticalAdjustment
protected TextEffect textEffect
| Constructor Detail |
|---|
public FakeStringCustomItem(java.lang.String label,
java.lang.String text)
StringItem object. Calling this
constructor is equivalent to calling
StringItem(label, text, Item.PLAIN, null);
label - the Item labeltext - the text contentsStringItem.StringItem(String, String, int, Style)
public FakeStringCustomItem(java.lang.String label,
java.lang.String text,
Style style)
StringItem object. Calling this
constructor is equivalent to calling
StringItem(label, text, Item.PLAIN, style);
label - the Item labeltext - the text contentsstyle - the styleStringItem.StringItem(String, String, int, Style)
public FakeStringCustomItem(java.lang.String label,
java.lang.String text,
int appearanceMode)
StringItem object with the given label,
textual content, and appearance mode.
Either label or text may be present or null.
The appearanceMode parameter
(see Appearance Modes)
is a hint to the platform of the application's intended use
for this StringItem. To provide hyperlink- or
button-like behavior,
the application should associate a default Command with this
StringItem and add an
ItemCommandListener to this
StringItem.
Here is an example showing the use of a
StringItem as a button:
StringItem strItem = new StringItem("Default: ", "Set", Item.BUTTON);
strItem.setDefaultCommand(
new Command("Set", Command.ITEM, 1);
// icl is ItemCommandListener
strItem.setItemCommandListener(icl);
label - the StringItem's label, or null if no labeltext - the StringItem's text contents, or null if the contents are initially emptyappearanceMode - the appearance mode of the StringItem, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTON
java.lang.IllegalArgumentException - if appearanceMode invalid
public FakeStringCustomItem(java.lang.String label,
java.lang.String text,
int appearanceMode,
Style style)
StringItem object with the given label,
textual content, and appearance mode.
Either label or text may be present or null.
The appearanceMode parameter
(see Appearance Modes)
is a hint to the platform of the application's intended use
for this StringItem. To provide hyperlink- or
button-like behavior,
the application should associate a default Command with this
StringItem and add an
ItemCommandListener to this
StringItem.
Here is an example showing the use of a
StringItem as a button:
StringItem strItem = new StringItem("Default: ", "Set", Item.BUTTON);
strItem.setDefaultCommand(
new Command("Set", Command.ITEM, 1);
// icl is ItemCommandListener
strItem.setItemCommandListener(icl);
label - the StringItem's label, or null if no labeltext - the StringItem's text contents, or null if the contents are initially emptyappearanceMode - the appearance mode of the StringItem, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTONstyle - the style for this item
java.lang.IllegalArgumentException - if appearanceMode invalid| Method Detail |
|---|
public boolean animate()
FakeCustomItem
animate in class FakeCustomItemprotected void defocus(Style originalStyle)
FakeCustomItem
defocus in class FakeCustomItemoriginalStyle - the original style which will be restored.protected void hideNotify()
FakeCustomItempaint() calls will be made on this item
until after a showNotify() has been called again.
The default implementation of this method sets the isShown field to false.
hideNotify in class FakeCustomItemprotected void showNotify()
FakeCustomItempaint() calls after
showNotify() has been called.
The default implementation of this method sets the isShown field to true.
showNotify in class FakeCustomItempublic java.lang.String getText()
StringItem, or
null if the StringItem is
empty.
setText(java.lang.String)public void setText(java.lang.String text)
StringItem.
If text
is null,
the StringItem
is set to be empty.
text - the new contentgetText()
public void setText(java.lang.String text,
Style style)
StringItem along with a style.
If text is null,
the StringItem
is set to be empty.
text - the new contentstyle - the new style, is ignored when nullgetText()public void setFont(javax.microedition.lcdui.Font font)
StringItem.
The font is a hint, and the implementation may disregard
the application's preferred font.
The font parameter must be a valid Font
object or null. If the font parameter is
null, the implementation must use its default font
to render the StringItem.
font - - the preferred font to use to render this StringItemgetFont()public javax.microedition.lcdui.Font getFont()
StringItem. The
value returned is the font that had been set by the application,
even if that value had been disregarded by the implementation.
If no font had been set by the application, or if the application
explicitly set the font to null, the value is the default
font chosen by the implementation.
setFont(javax.microedition.lcdui.Font)
public void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
FakeCustomItem
paintContent in class FakeCustomItemx - 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 void initContent(int firstLineWidth,
int lineWidth)
FakeCustomItem
initContent in class FakeCustomItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesFakeCustomItem.contentWidth,
FakeCustomItem.contentHeight,
FakeCustomItem.preferredWidth,
FakeCustomItem.preferredHeightpublic void setStyle(Style style)
FakeCustomItem
setStyle in class FakeCustomItemstyle - the new style for this item.protected java.lang.String createCssSelector()
FakeCustomItem
createCssSelector in class FakeCustomItempublic java.lang.String toString()
FakeCustomItem
toString in class FakeCustomItempublic void releaseResources()
FakeCustomItem
releaseResources in class FakeCustomItem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||