|
||||||||||
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.
Field Summary | |
---|---|
static boolean |
firstIsLeft
|
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 firstAction,
java.lang.String secondAction)
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 void |
customizeAlertLabels(java.io.ByteArrayInputStream okLabelRenderer,
java.io.ByteArrayInputStream cancelLabelRenderer,
java.io.ByteArrayInputStream yesLabelRenderer,
java.io.ByteArrayInputStream noLabelRenderer)
Cutomize Kuix alert labels. |
static void |
customizeScreenMenuLabels(java.io.ByteArrayInputStream selectLabelRenderer,
java.io.ByteArrayInputStream cancelLabelRenderer)
Cutomize Kuix screen menu labels. |
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 boolean |
loadI18nBundle(java.lang.String messageBundle)
Load a new bundle and append messages to the messages table. |
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 PopupBox |
showPopupBox(java.io.InputStream inputStream,
DataProvider dataProvider)
Create and display a PopupBox from its XML definition. |
static PopupBox |
showPopupBox(java.lang.String xmlFilePath,
DataProvider dataProvider)
Create and display a PopupBox from its XML definition. |
static PopupBox |
showPopupBox(java.lang.String styleClass,
int duration,
java.lang.Object content,
java.lang.Object firstLabel,
java.lang.String firstAction,
java.lang.Object secondLabel,
java.lang.String secondAction,
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 |
Field Detail |
---|
public static boolean firstIsLeft
Method Detail |
---|
public static FrameHandler getFrameHandler()
public static KuixConverter getConverter()
public 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 void customizeAlertLabels(java.io.ByteArrayInputStream okLabelRenderer, java.io.ByteArrayInputStream cancelLabelRenderer, java.io.ByteArrayInputStream yesLabelRenderer, java.io.ByteArrayInputStream noLabelRenderer)
okLabelRenderer
- the renderer (xml input stream) used as ok labelcancelLabelRenderer
- the renderer (xml input stream) used as cancel labelyesLabelRenderer
- the renderer (xml input stream) used as yes labelnoLabelRenderer
- the renderer (xml input stream) used as no labelpublic static void customizeScreenMenuLabels(java.io.ByteArrayInputStream selectLabelRenderer, java.io.ByteArrayInputStream cancelLabelRenderer)
selectLabelRenderer
- the renderer (xml input stream) used as select labelcancelLabelRenderer
- the renderer (xml input stream) used as cancel labelpublic static PopupBox showPopupBox(java.lang.String xmlFilePath, DataProvider dataProvider)
PopupBox
from its XML definition.
xmlFilePath
- dataProvider
-
PopupBox
instancepublic static PopupBox showPopupBox(java.io.InputStream inputStream, DataProvider dataProvider)
PopupBox
from its XML definition.
inputStream
- dataProvider
-
PopupBox
instancepublic static PopupBox showPopupBox(java.lang.String styleClass, int duration, java.lang.Object content, java.lang.Object firstLabel, java.lang.String firstAction, java.lang.Object secondLabel, java.lang.String secondAction, 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 PopupBox
content
- the content could be a Widget
or a String
firstLabel
- the label or widget of the first buttonfirstAction
- action of the first buttonsecondLabel
- the label or widget of the second buttonsecondAction
- action of the second buttonbuttonOnActions
- The ordred buttons onAction
PopupBox
instancepublic 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
instancepublic static PopupBox alert(java.lang.String message, int options, java.lang.String firstAction, java.lang.String secondAction)
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");Caution :
KuixConstants.ALERT_OK
and KuixConstants.ALERT_YES
are always placed on the first menuItem and then couldn't be displaye together.KuixConstants.ALERT_CANCEL
and KuixConstants.ALERT_NO
are always placed on the second menuItem and then couldn't be displaye together.
message
- the text message to displayoptions
- the options KuixConstants
okAction
- the ok onAction nameyesAction
- the yes onAction namenoAction
- the no onAction namecancelAction
- the cancel onAction name
PopupBox
instancepublic static PopupBox alert(java.lang.String message, int options)
PopupBox
with a
single text message an single OK button. 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
instancepublic 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
instanceprotected 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 instancepublic static Screen loadScreen(java.io.InputStream inputStream, DataProvider dataProvider)
Screen
widget from an XML InputStream
.
inputStream
- dataProvider
-
Screen
widget instancepublic 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
instancepublic 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
instancepublic 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.Exception
public 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 resourcepublic 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
-
Method
public 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 widget
public 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
true
if the intialization was succesfull,
false
if there was any problem.public static boolean loadI18nBundle(java.lang.String messageBundle)
messageBundle
-
true
if the intialization was succesfull,
false
if there was any problem.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 |