|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.kalmeo.kuix.core.Kuix
public final class Kuix
This class is the central class for Kuix framework management. It pertmits to
load XML files, load CSS files. It contains the FrameHandler object
instance that manages Frames.
| Method Summary | |
|---|---|
static PopupBox |
alert(java.lang.String message)
Open an alert box with the message text and default style class. |
static PopupBox |
alert(java.lang.String message,
int options)
Open an alert box with options. |
static PopupBox |
alert(java.lang.String message,
int options,
java.lang.String okAction,
java.lang.String yesAction,
java.lang.String noAction,
java.lang.String cancelAction)
Create an open an alert box. |
static PopupBox |
alert(java.lang.String message,
java.lang.Throwable throwable)
Open an alert box with the Throwable object message and 'alerterror'
style class. |
static PopupBox |
alert(java.lang.Throwable throwable)
Open an alert box with the Throwable object message and
'alerterror' style class. |
static void |
callActionMethod(Method method)
Call the specified action method |
static void |
cleanUp()
Clean all instances |
static void |
clearStyleCache(Widget target,
boolean propagateToChildren)
Clear style cache from the specified Widget and its childs |
protected static java.lang.String |
composeAltertMessage(java.lang.String message,
java.lang.Throwable throwable)
Compose an alert message by using the given message and
throwable. |
static KuixCanvas |
getCanvas()
Returns the KuixCanvas unique instance. |
static KuixConverter |
getConverter()
|
static FrameHandler |
getFrameHandler()
|
static java.lang.String |
getLocale()
Returns the last used locale, or null if never set. |
static java.lang.String |
getMessage(java.lang.String key)
Finds a localized string in a message bundle. |
static java.lang.String |
getMessage(java.lang.String key,
java.lang.Object[] args)
Finds a localized string in a message bundle and formats the message by passing requested parameters. |
static java.io.ByteArrayInputStream |
getResourceAsByteArrayInputStream(java.lang.Class clazz,
java.lang.String path)
Convert resource to a ByteArrayInputStream. |
static java.util.Vector |
getStyles(Widget widget)
Returns the list of Style associated to the widget or
null if no style was found. |
static java.io.InputStream |
getXmlResourceInputStream(java.lang.String xmlFilePath)
Returns a new InputStream relative to the desired
xmlFilePath. |
static boolean |
initI18nSupport()
Initializes internationalization support based on currently set locale (obtained from "microedition.locale" system property). |
static boolean |
initI18nSupport(java.lang.String locale)
Explicit initialization of the internationalization support. |
static boolean |
initI18nSupport(java.lang.String messageBundle,
java.lang.String locale)
Explicit initialization of the internationalization support. |
static void |
initialize(Display display,
KuixCanvas canvas,
KuixConverter converter)
Initialize the Kuix engine be giving the KuixCanvas object
instance. |
static boolean |
isInitialized()
Returns the Kuix engine initialization state. |
static void |
loadCss(java.io.InputStream inputStream)
Parse an load a CSS style definitions and register them. |
static void |
loadCss(java.lang.String cssFilePath)
Parse an load a CSS style definitions and register it into the StyleManager. |
static void |
loadMenuContent(Menu menu,
java.io.InputStream inputStream,
DataProvider dataProvider)
Reload the first menu content from an xml definition provides by an inputStream. |
static void |
loadMenuContent(Menu menu,
java.lang.String xmlFilePath,
DataProvider dataProvider)
Reload the menu content from an xml definition. |
static Screen |
loadScreen(java.io.InputStream inputStream,
DataProvider dataProvider)
Load a Screen widget from an XML InputStream. |
static Screen |
loadScreen(java.lang.String xmlFilePath,
DataProvider dataProvider)
Load a Screen widget from a XML file. |
static Widget |
loadWidget(java.io.InputStream inputStream,
DataProvider dataProvider)
Load a Widget from an XML InputStream. |
static Widget |
loadWidget(java.lang.String xmlFilePath,
DataProvider dataProvider)
Load a Widget from a XML file. |
static void |
loadXml(Widget rootWidget,
java.io.InputStream inputStream)
Parse and load an XML UI definition and place the content as child of rootWidget. |
static void |
loadXml(Widget rootWidget,
java.io.InputStream inputStream,
DataProvider dataProvider)
Parse and load an XML UI definition and place the content as child of rootWidget. |
static void |
loadXml(Widget rootWidget,
java.io.InputStream inputStream,
DataProvider dataProvider,
boolean append,
boolean mergeRootWidget)
Parse an load an XML ui definition and place the content as child of rootWidget. |
static Method |
parseMethod(java.lang.String data,
Widget owner)
Returns the parsed Method, or null if no method could be extract. |
static java.lang.String |
processI18nPattern(java.lang.String pattern)
Process the internationalization and replace found keys by their values. |
static void |
registerStyle(Style style)
Register a Style. |
static void |
removeAllStyles()
Remove all registred styles |
static void |
setConverter(KuixConverter converter)
Deprecated. override the KuixMIDlet.createNewConverterInstance() method
or invoke
Kuix.initialize(KuixCanvas, KuixConverter)
instead. |
static PopupBox |
showPopupBox(java.lang.String styleClass,
int duration,
java.lang.Object content,
int progress,
java.lang.String[] buttonTexts,
int[] buttonShortcutKeyCodes,
java.lang.String[] buttonOnActions,
java.lang.String onCloseAction)
Create and display a PopupBox. |
static PopupBox |
splash(int duration,
Widget content,
java.lang.String onCloseAction)
Display a splash PopupBox |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static FrameHandler getFrameHandler()
public static KuixConverter getConverter()
public static void setConverter(KuixConverter converter)
KuixMIDlet.createNewConverterInstance() method
or invoke
Kuix.initialize(KuixCanvas, KuixConverter)
instead.
converter - the converter to setpublic static KuixCanvas getCanvas()
KuixCanvas unique instance.
public static boolean isInitialized()
true if the engine is initialized with a KuixCanvas.
public static void initialize(Display display,
KuixCanvas canvas,
KuixConverter converter)
KuixCanvas object
instance.
display - the Display instance. Set this value to
null if you don't want the canvas is
displayed during this method.canvas - converter - public static void cleanUp()
public static PopupBox showPopupBox(java.lang.String styleClass,
int duration,
java.lang.Object content,
int progress,
java.lang.String[] buttonTexts,
int[] buttonShortcutKeyCodes,
java.lang.String[] buttonOnActions,
java.lang.String onCloseAction)
PopupBox.
This method is a full feature of all PopupBox helpers like alert, splash.
styleClass - The PopupBox style classduration - the duration of the PopupBoxcontent - the content could be a Widget or a Stringprogress - a fixed-point integer representing progress valuebuttonTexts - The ordered buttons textbuttonShortcutKeyCodes - The ordred buttons shortcut kuixKeyCodebuttonOnActions - The ordred buttons onAction
PopupBox instance
public static PopupBox splash(int duration,
Widget content,
java.lang.String onCloseAction)
PopupBox
duration - the duration of the splash (in ms)content - the splash widget content
PopupBox instance
public static PopupBox alert(java.lang.String message,
int options,
java.lang.String okAction,
java.lang.String yesAction,
java.lang.String noAction,
java.lang.String cancelAction)
options
parameter.
Example:
alert("Hello world", KuixConstants.ALERT_OK | KuixConstants.ALERT_INFO, "doOk", null, null, null);
alert("Is it rainning ?", KuixConstants.ALERT_YES | KuixConstants.ALERT_NO | KuixConstants.ALERT_QUESTION, null, null, "doYes", "doNo");
message - the text message to displayoptions - the options KuixConstantsokAction - the ok onAction nameyesAction - the yes onAction namenoAction - the no onAction namecancelAction - the cancel onAction name
PopupBox instance
public static PopupBox alert(java.lang.String message,
int options)
PopupBox with a
single text message an single OK button (mapped to FIRE key). If you try
to use other buttons with options, they will be ignored.
message - the message to displayoptions - KuixConstants
PopupBox instancepublic static PopupBox alert(java.lang.String message)
message - the message to display
PopupBox instance
public static PopupBox alert(java.lang.String message,
java.lang.Throwable throwable)
Throwable object message and 'alerterror'
style class.
message - the message to displaythrowable - the Throwable to get message or class name
PopupBox instancepublic static PopupBox alert(java.lang.Throwable throwable)
Throwable object message and
'alerterror' style class.
throwable - the Throwable to get message or class name
PopupBox instance
protected static java.lang.String composeAltertMessage(java.lang.String message,
java.lang.Throwable throwable)
message and
throwable.
message - throwable -
public static Screen loadScreen(java.lang.String xmlFilePath,
DataProvider dataProvider)
Screen widget from a XML file. If xmlFilePath
is a relative path (i.e: myScreen.xml) the default xml
folder location is automaticaly added and the path become :
/xml/myScreen.xml. Absolute paths are kept.
xmlFilePath - dataProvider -
Screen widget instance
public static Screen loadScreen(java.io.InputStream inputStream,
DataProvider dataProvider)
Screen widget from an XML InputStream.
inputStream - dataProvider -
Screen widget instance
public static Widget loadWidget(java.lang.String xmlFilePath,
DataProvider dataProvider)
Widget from a XML file. If xmlFilePath is a
relative path (i.e: myWidget.xml) the default xml folder
location is automaticaly added and the path become :
/xml/myWidget.xml. Absolute paths are kept.
xmlFilePath - dataProvider -
Widget instance
public static Widget loadWidget(java.io.InputStream inputStream,
DataProvider dataProvider)
Widget from an XML InputStream.desiredWidgetClass need to extends Widget and
correspond to the root xml widget tag.
inputStream - dataProvider -
Widget instance
public static void loadMenuContent(Menu menu,
java.lang.String xmlFilePath,
DataProvider dataProvider)
menu content from an xml definition.cleanUp and removeAll
previous menu content, but not its attributes (like id or
class).
menu - xmlFilePath - dataProvider -
public static void loadMenuContent(Menu menu,
java.io.InputStream inputStream,
DataProvider dataProvider)
cleanUp and removeAll
previous menu content, but not its attributes (like id or
class).
menu - inputStream - dataProvider -
public static void loadXml(Widget rootWidget,
java.io.InputStream inputStream)
rootWidget. Initial rootWidget content is removed.
rootWidget - inputStream -
java.lang.Exception
public static void loadXml(Widget rootWidget,
java.io.InputStream inputStream,
DataProvider dataProvider)
rootWidget. Initial rootWidget content is removed.
rootWidget - inputStream - dataProvider -
java.lang.Exception
public static void loadXml(Widget rootWidget,
java.io.InputStream inputStream,
DataProvider dataProvider,
boolean append,
boolean mergeRootWidget)
rootWidget.
rootWidget - inputStream - dataProvider - append - if false loaded content replace current
rootWidget's content.mergeRootWidget - if true and if loaded content's root
widget tag equals rootWidget's tag the given
rootWidget instance represents the new content
root else a new widget instance is created and added to the
rootWidget.
java.lang.Exceptionpublic static void loadCss(java.lang.String cssFilePath)
cssFilePath is a relative path (i.e:
myStyle.css) the default css folder location is
automaticaly added and the path become : /css/myStyle.css.
Absolute paths are kept.
cssFilePath - public static void loadCss(java.io.InputStream inputStream)
inputStream - public static void callActionMethod(Method method)
method - public static java.io.InputStream getXmlResourceInputStream(java.lang.String xmlFilePath)
InputStream relative to the desired
xmlFilePath.xmlFilePath is a relative path (i.e:
myResource.xml) the default xml folder location is
automaticaly added and the path become : /xml/myResource.xml.
Absolute paths are kept.
xmlFilePath -
InputStream relative to the desired xml resource
public static java.io.ByteArrayInputStream getResourceAsByteArrayInputStream(java.lang.Class clazz,
java.lang.String path)
clazz - The Class where the getResourceAsStream() function is called.path - Path of the resource file
ByteArrayInputStream, or null if an error occure.
public static Method parseMethod(java.lang.String data,
Widget owner)
Method, or null if no method could be extract.
data - owner -
Methodpublic static void registerStyle(Style style)
Style. If an equivalent Style was already registred
the new style properties are copied.
style - public static java.util.Vector getStyles(Widget widget)
Style associated to the widget or
null if no style was found.
widget -
Style associated to the widgetpublic static void removeAllStyles()
public static void clearStyleCache(Widget target,
boolean propagateToChildren)
Widget and its childs
target - propagateToChildren - public static boolean initI18nSupport()
getMessage(java.lang.String)
method is attempted for the first time.
You can call this method explicitly to see whether there was any problem
with initialization of the i18n support. Method returns a status
of the successfulness.
public static boolean initI18nSupport(java.lang.String locale)
messages_fr.properties files is available), you should
initialize the i18n support (by calling
initI18nSupport("fr");) before using
getMessage(java.lang.String) method for the first time.
locale - locale which will be used to determine which message file
from bundle will be used
public static boolean initI18nSupport(java.lang.String messageBundle,
java.lang.String locale)
messages_fr.properties files is available), you should
initialize the i18n support (by calling
initI18nSupport("fr");) before using
getMessage(java.lang.String) method for the first time.
messageBundle - full custom messages bundle pathlocale - locale which will be used to determine which message file
from bundle will be used
public static final java.lang.String getMessage(java.lang.String key)
key - key of the localized string to look for
DEFAULT_UNKNOWN_I18N_MESSAGE string is returnedpublic static java.lang.String getLocale()
public static final java.lang.String getMessage(java.lang.String key,
java.lang.Object[] args)
key - key of the localized string to look forargs - array of arguments to use for formatting the message
DEFAULT_UNKNOWN_I18N_MESSAGE string is returnedpublic static java.lang.String processI18nPattern(java.lang.String pattern)
Syntax : %KEY% if value is like
KEY=Hello world, thanks for using Kuix.
Syntax : %KEY(arg0,arg1)% if value is like
KEY=Hello {0}, thanks for using {1}.
pattern -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||