public abstract class CodenameOneImplementation extends Object
It is the responsibility of the implementation class to grab and fire all events to the Display specifically for key, pointer events and screen resolution.
| Constructor and Description |
|---|
CodenameOneImplementation() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompletionHandler(Media media,
Runnable onCompletion)
Adds a callback to a Media element that will be called when the media finishes playing.
|
void |
addConnectionToQueue(ConnectionRequest req)
This method is called by the NetworkManager when a request is added to the queue.
|
void |
addCookie(Cookie c)
Adds/replaces a cookie to be sent to the given domain
|
void |
addCookie(Cookie[] cookiesArray) |
void |
addHeavyActionListener(Object peer,
ActionListener l)
Adds an action listener which will be run in response to the native button's
click event.
|
void |
addNativeBrowserWindowOnLoadListener(Object window,
ActionListener l)
Adds a load listener to a native browser window.
|
void |
afterComponentPaint(Component c,
Graphics g)
Called after internal paint of component finishes
|
boolean |
animateImage(Object nativeImage,
long lastFrame)
Callback to allow images animated by the underlying system to change their state
e.g.
|
boolean |
areMutableImagesFast()
On most platforms it is quite fast to draw on a mutable image and then render that
image, however some platforms have much slower mutable images in comparison to just
drawing on the screen.
|
void |
beforeComponentPaint(Component c,
Graphics g)
Called before internal paint of component starts
|
void |
blockCopyPaste(boolean blockCopyPaste)
Blocks or enables copy and paste in the entire app.
|
void |
browserBack(PeerComponent browserPeer)
Navigates back in the history
|
void |
browserClearHistory(PeerComponent browserPeer)
Clears navigation history
|
void |
browserDestroy(PeerComponent internal)
Release browser native resources
|
void |
browserExecute(PeerComponent browserPeer,
String javaScript)
Executes the given JavaScript string within the current context
|
String |
browserExecuteAndReturnString(PeerComponent internal,
String javaScript)
Executes javascript and returns string.
|
void |
browserExposeInJavaScript(PeerComponent browserPeer,
Object o,
String name)
Deprecated.
This method was never well-supported across platforms other than Android - and it will no longer work
even in Android for SDK >= 17, unless o's class has the @JavascriptInterface annotation which
would only be available if implemented inside a Native Interface. Don't use this.
|
void |
browserForward(PeerComponent browserPeer)
Navigates forward in the history
|
boolean |
browserHasBack(PeerComponent browserPeer)
Indicates whether back is currently available
|
boolean |
browserHasForward(PeerComponent browserPeer)
Indicates whether forward is currently available
|
void |
browserReload(PeerComponent browserPeer)
Reload the current page
|
void |
browserStop(PeerComponent browserPeer)
Stops loading the current page
|
protected boolean |
cacheLinearGradients()
Indicates whether the implementation is interested in caching linear gradients for
drawing.
|
protected boolean |
cacheRadialGradients()
Indicates whether the implementation is interested in caching radial gradients for
drawing.
|
void |
cancelLocalNotification(String notificationId) |
void |
cancelRepaint(Animation cmp)
Removes an entry from the paint queue if it exists, this is important for cases
in which a component was repainted and immediately removed from its parent container
afterwards.
|
boolean |
canDial()
Returns true if the device has dialing capabilities
|
Boolean |
canExecute(String url)
Returns true if executing this URL should work, returns false if it will not
and null if this is unknown.
|
boolean |
canForceOrientation()
Returns true if the device allows forcing the orientation via code, feature phones do not allow this
although some include a jad property allowing for this feature
|
boolean |
canGetSSLCertificates()
Checks if the platform supports getting SSL certificates.
|
boolean |
canInstallOnHomescreen()
Checks to see if you can prompt the user to install the app on their homescreen.
|
void |
captureAudio(ActionListener response) |
void |
captureAudio(MediaRecorderBuilder recordingOptions,
ActionListener response)
Captures a audio and notifies with the raw data when available
|
AsyncResource<Image> |
captureBrowserScreenshot(PeerComponent browserPeer)
Captures a screenshot from a browser component asynchronously.
|
void |
capturePhoto(ActionListener response)
Captures a photo and notifies with the image data when available
|
Image |
captureScreen()
Captures a screenshot of the screen.
|
void |
captureVideo(ActionListener response)
Captures a video and notifies with the data when available
|
void |
captureVideo(VideoCaptureConstraints constraints,
ActionListener response)
Captures a video, and notifies with the data when available.
|
abstract int |
charsWidth(Object nativeFont,
char[] ch,
int offset,
int length)
Return the width of the given characters in the given native font instance
|
abstract int |
charWidth(Object nativeFont,
char ch)
Return the width of the specific character when rendered alone
|
boolean |
checkSSLCertificatesRequiresCallbackFromNative()
SSL certificate checks must be performed via a callback from the native side,
rather than explicitly checking as part of NetworkManager's connection
flow.
|
void |
cleanup(Object o)
Closes the object (connection, stream etc.) without throwing any exception, even if the
object is null
|
void |
clearNativeCookies() |
void |
clearRect(Object graphics,
int x,
int y,
int width,
int height) |
void |
clearStorage()
Deletes all the files in the application storage
|
abstract void |
clipRect(Object graphics,
int x,
int y,
int width,
int height)
Changes the current clipping rectangle to subset the current clipping with
the given clipping.
|
void |
clipRect(Object graphics,
Rectangle rect)
Changes the current clipping rectangle to subset the current clipping with
the given clipping.
|
void |
closingOutput(OutputStream s)
Allows binding logic to occur before closing the output stream
such as syncing
|
void |
componentRemoved(Component c)
Indicates to the port that the component was removed from the view and its
UI should be removed in the next flush operation.
|
void |
concatenateTransform(Object t1,
Object t2)
Concatenates two transforms and sets the first transform to be the result of the concatenation.
|
void |
confirmControlView()
Callback method allowing the implementation to confirm that it controls the
view just before a new form is installed.
|
abstract Object |
connect(String url,
boolean read,
boolean write)
Connects to a given URL, returns a connection object to be used with the implementation
later
|
Object |
connect(String url,
boolean read,
boolean write,
int timeout)
Connects to a given URL, returns a connection object to be used with the implementation
later
|
Object |
connectSocket(String host,
int port)
Creates a socket to connect to the given host on the given port
|
Object |
connectSocket(String host,
int port,
int connectTimeout)
Creates a socket to connect to the given host on the given port
|
String |
convertBidiLogicalToVisual(String s)
Converts the given string from logical bidi layout to visual bidi layout so
it can be rendered properly on the screen.
|
protected Object |
convertBuiltinSound(InputStream i)
Converts a sound object to a form which will be easy for the implementation
to play later on.
|
int |
convertToPixels(int dipCount,
boolean horizontal)
Converts the dips count to pixels, dips are roughly 1mm in length.
|
void |
copySelectionToClipboard(TextSelection sel)
Copies the current text selection to the clipboard.
|
void |
copyToClipboard(Object obj)
Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used
|
void |
copyTransform(Object src,
Object dest)
Copies the setting of one transform into another.
|
Media |
createBackgroundMedia(String uri)
Creates an audio media that can be played in the background.
|
AsyncResource<Media> |
createBackgroundMediaAsync(String uri)
Creates an audio media that can be played in the background.
|
PeerComponent |
createBrowserComponent(Object browserComponent)
If the implementation supports the creation of a browser component it should be returned in this
method
|
String |
createContact(String firstName,
String surname,
String officePhone,
String homePhone,
String cellPhone,
String email)
Create a contact to the device contacts book
|
abstract Object |
createFont(int face,
int style,
int size)
Creates a new instance of a native font
|
Object |
createHeavyButton(Button aThis)
Creates the native side of a
HeavyButton. |
abstract Object |
createImage(byte[] bytes,
int offset,
int len)
Create a nativate image from its compressed byte data
|
abstract Object |
createImage(InputStream i)
Creates a native image from a given input stream
|
abstract Object |
createImage(int[] rgb,
int width,
int height)
Create a platform native image object from the given RGB data
|
Image |
createImage(Shape shape,
Stroke stroke,
int color) |
abstract Object |
createImage(String path)
Creates a native image from a file in the system jar or file system storage.
|
Media |
createMedia(InputStream stream,
String mimeType,
Runnable onCompletion)
Plays the sound in the given stream
|
Media |
createMedia(String uri,
boolean isVideo,
Runnable onCompletion)
Plays the sound in the given URI which is partially platform specific.
|
AsyncResource<Media> |
createMediaAsync(InputStream stream,
String mimeType,
Runnable onCompletion)
Creates media asynchronously.
|
AsyncResource<Media> |
createMediaAsync(String uri,
boolean video,
Runnable onCompletion)
Creates media asynchronously.
|
Media |
createMediaRecorder(MediaRecorderBuilder builder)
Creates a Media recorder Object which will record from the device mic to
a file in the given path.
|
Media |
createMediaRecorder(String path,
String mimeType)
Creates a Media recorder Object which will record from the device mic to
a file in the given path.
|
abstract Object |
createMutableImage(int width,
int height,
int fillColor)
Creates a modifable native image that can return a graphics object
|
Object |
createNativeBrowserWindow(String startURL)
Creates a native web browser window object.
|
Object |
createNativeIndexed(Image image)
Creates a native image representing the indexed image
|
Object |
createNativeOverlay(Component cmp)
Creates a native overlay for the given component.
|
PeerComponent |
createNativePeer(Object nativeComponent)
Creates a peer component for the given lightweight component
|
protected BrowserComponent |
createSharedJavascriptContext()
Creates a shared javascript context.
|
Object |
createSoftWeakRef(Object o)
Creates a soft/weak reference to an object that allows it to be collected
yet caches it.
|
abstract InputStream |
createStorageInputStream(String name)
Creates an input stream to the given storage source file
|
abstract OutputStream |
createStorageOutputStream(String name)
Creates an output stream to the storage with the given name
|
Object |
createSVGImage(String baseURL,
byte[] data)
Creates an SVG Image from the given byte array data and the base URL
|
void |
deinitialize()
Allows subclasses to cleanup if necessary
|
void |
deinitializeHeavyButton(Object peer)
Deinitializes a heavy button.
|
void |
deinitializeTextSelection(TextSelection aThis)
Deinitializes text selection.
|
boolean |
deleteContact(String id)
removed a contact from the device contacts book
|
void |
deleteDB(String databaseName)
Deletes database
|
abstract void |
deleteFile(String file)
Deletes the specific file or empty directory.
|
abstract void |
deleteStorageFile(String name)
Deletes the given file name from the storage
|
void |
deregisterPush()
Stop receiving push notifications to this client application
|
static void |
deregisterPushFromServer()
For use by implementations, stop receiving push notifications from the server
|
Object |
deriveTrueTypeFont(Object font,
float size,
int weight)
Creates a font based on this truetype font with the given pixel, WARNING! This method
will only work in the case of truetype fonts!
|
void |
dial(String phoneNumber)
Opens the device Dialer application with the given phone number
|
void |
disconnectSocket(Object socket)
Disconnects the current socket from the server/client on the other side
|
void |
dismissNotification(Object o)
Removes the notification previously posted with the notify status bar method
|
void |
disposeGraphics(Object graphics)
Cleans up resources used by graphics object
|
void |
downloadImageToCache(String url,
SuccessCallback<Image> onSuccess,
FailureCallback<Image> onFail)
Downloads an image from a URL to the cache.
|
void |
downloadImageToFileSystem(String url,
String fileName,
SuccessCallback<Image> onSuccess,
FailureCallback<Image> onFail)
Downloads an image to file system.
|
void |
downloadImageToStorage(String url,
String fileName,
SuccessCallback<Image> onSuccess,
FailureCallback<Image> onFail)
Downloads an image to storage.
|
abstract void |
drawArc(Object graphics,
int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws a circular or elliptical arc based on the given angles and bounding
box
|
abstract void |
drawImage(Object graphics,
Object img,
int x,
int y)
Draws the image so its top left coordinate corresponds to x/y
|
void |
drawImage(Object graphics,
Object img,
int x,
int y,
int w,
int h)
Draws the image so its top left coordinate corresponds to x/y
|
void |
drawImageArea(Object nativeGraphics,
Object img,
int x,
int y,
int imageX,
int imageY,
int imageWidth,
int imageHeight)
Draws a portion of the image
|
void |
drawImageRotated(Object graphics,
Object img,
int x,
int y,
int degrees)
Draws the image so its top left coordinate corresponds to x/y with a fast
native rotation in a square angle which must be one of 0, 90, 180 or 270
|
void |
drawingEncodedImage(EncodedImage img)
This method is used by the JavaSE implementation for performance logging
|
void |
drawLabelComponent(Object nativeGraphics,
int cmpX,
int cmpY,
int cmpHeight,
int cmpWidth,
Style style,
String text,
Object icon,
Object stateIcon,
int preserveSpaceForState,
int gap,
boolean rtl,
boolean isOppositeSide,
int textPosition,
int stringWidth,
boolean isTickerRunning,
int tickerShiftText,
boolean endsWith3Points,
int valign)
Draws a label on the given graphics context, this method allows optimizing the very common drawing operation
using platform native code
|
protected int |
drawLabelText(Object nativeGraphics,
int textDecoration,
boolean rtl,
boolean isTickerRunning,
boolean endsWith3Points,
Object nativeFont,
int txtW,
int textSpaceW,
int shiftText,
String text,
int x,
int y,
int fontHeight)
Draws the text of a label
|
abstract void |
drawLine(Object graphics,
int x1,
int y1,
int x2,
int y2)
Draws a line between the 2 X/Y coordinates
|
void |
drawPolygon(Object graphics,
int[] xPoints,
int[] yPoints,
int nPoints)
Draws a closed polygon defined by arrays of x and y coordinates.
|
abstract void |
drawRect(Object graphics,
int x,
int y,
int width,
int height)
Draws a rectangle in the given coordinates
|
void |
drawRect(Object graphics,
int x,
int y,
int width,
int height,
int thickness)
Draws a rectangle in the given coordinates
|
abstract void |
drawRGB(Object graphics,
int[] rgbData,
int offset,
int x,
int y,
int w,
int h,
boolean processAlpha)
Draws the RGB values based on the MIDP API of a similar name.
|
abstract void |
drawRoundRect(Object graphics,
int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Draws a rounded corner rectangle in the given coordinates with the arcWidth/height
matching the last two arguments respectively.
|
void |
drawShape(Object graphics,
Shape shape,
Stroke stroke)
Draws outline of shape on the given graphics context.
|
void |
drawString(Object nativeGraphics,
Object nativeFont,
String str,
int x,
int y,
int textDecoration)
Draw a string using the current font and color in the x,y coordinates.
|
abstract void |
drawString(Object graphics,
String str,
int x,
int y)
Draw a string using the current font and color in the x,y coordinates.
|
abstract void |
editString(Component cmp,
int maxSize,
int constraint,
String text,
int initiatingKeycode)
Encapsulates the editing code which is specific to the platform, some platforms
would allow "in place editing" MIDP does not.
|
void |
editStringImpl(Component cmp,
int maxSize,
int constraint,
String text,
int initiatingKeycode)
Encapsulates the editing code which is specific to the platform, some platforms
would allow "in place editing" MIDP does not.
|
void |
edtIdle(boolean enter)
This method is a callback from the edt before the edt enters to an idle
state
|
void |
execute(String url)
Executes the given URL on the native platform
|
void |
execute(String url,
ActionListener response)
Executes the given URL on the native platform, this method is useful if
the platform has the ability to send an event to the app when the execution
has ended, currently this works only for Android platform to invoke other
intents.
|
abstract boolean |
exists(String file)
Indicates whether the given file exists
|
boolean |
existsDB(String databaseName)
Indicates weather a database exists
|
void |
exit()
Exits the application...
|
void |
exitApplication()
Exits the application...
|
boolean |
exitFullScreen()
Exit full-screen mode.
|
Object |
extractHardRef(Object o)
Extracts the hard reference from the soft/weak reference given
|
abstract void |
fillArc(Object graphics,
int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Fills a circular or elliptical arc based on the given angles and bounding
box.
|
void |
fillLinearGradient(Object graphics,
int startColor,
int endColor,
int x,
int y,
int width,
int height,
boolean horizontal)
Draws a linear gradient in the given coordinates with the given colors,
doesn't take alpha into consideration when drawing the gradient
|
void |
fillPolygon(Object graphics,
int[] xPoints,
int[] yPoints,
int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates.
|
void |
fillRadialGradient(Object graphics,
int startColor,
int endColor,
int x,
int y,
int width,
int height)
Draws a radial gradient in the given coordinates with the given colors,
doesn't take alpha into consideration when drawing the gradient.
|
void |
fillRadialGradient(Object graphics,
int startColor,
int endColor,
int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
Draws a radial gradient in the given coordinates with the given colors,
doesn't take alpha into consideration when drawing the gradient.
|
abstract void |
fillRect(Object graphics,
int x,
int y,
int width,
int height)
Fills the rectangle from the given position according to the width/height
minus 1 pixel according to the convention in Java.
|
void |
fillRect(Object nativeGraphics,
int x,
int y,
int w,
int h,
byte alpha)
Fills a rectangle with an optionally translucent fill color
|
void |
fillRectRadialGradient(Object graphics,
int startColor,
int endColor,
int x,
int y,
int width,
int height,
float relativeX,
float relativeY,
float relativeSize)
Draws a radial gradient in the given coordinates with the given colors,
doesn't take alpha into consideration when drawing the gradient.
|
abstract void |
fillRoundRect(Object graphics,
int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
Fills a rounded rectangle in the same way as drawRoundRect
|
void |
fillShape(Object graphics,
Shape shape)
Fills the given shape in the specified graphics context using the graphics context's
currently selected color and alpha.
|
void |
fillTriangle(Object graphics,
int x1,
int y1,
int x2,
int y2,
int x3,
int y3)
Draws a filled triangle with the given coordinates
|
void |
flashBacklight(int duration)
Flash the backlight of the device for the given length of time
|
Image |
flipImageHorizontally(Image image,
boolean maintainOpacity)
Flips the given image on the horizontal axis
|
Image |
flipImageVertically(Image image,
boolean maintainOpacity)
Flips the given image on the vertical axis
|
abstract void |
flushGraphics()
Flush the currently painted drawing onto the screen if using a double buffer
|
abstract void |
flushGraphics(int x,
int y,
int width,
int height)
Flush the currently painted drawing onto the screen if using a double buffer
|
void |
flushStorageCache()
Flush the storage cache allowing implementations that cache storage objects
to store
|
Image |
gaussianBlurImage(Image image,
float radius) |
int |
getActualDisplayHeight()
Returns the display height ignoring manipulations performed by the VKB
|
String[] |
getAllContacts(boolean withNumbers)
Gets all contacts from the address book of the device
|
Contact[] |
getAllContacts(boolean withNumbers,
boolean includesFullName,
boolean includesPicture,
boolean includesNumbers,
boolean includesEmail,
boolean includeAddress)
Notice: this method might be very slow and should be invoked on a separate thread!
It might have platform specific optimizations over getAllContacts followed by looping
over individual contacts but that isn't guaranteed.
|
abstract int |
getAlpha(Object graphics)
Alpha value from 0-255 can be ignored for some operations
|
String[] |
getAPIds()
Returns the ids of the access points available if supported
|
String |
getAPName(String id)
Returns the user displayable name for the given access point
|
String |
getAppArg() |
String |
getAppHomePath()
This will return the application home directory.
|
Image |
getApplicationIconImage()
Returns an image representing the application icon, or null if not supported.
|
protected static String |
getApplicationKey()
Returns the key for the application comprised of the builders email coupled with the
package name.
|
int |
getAPType(String id)
Returns the type of the access point
|
String[] |
getAvailableRecordingMimeTypes()
Gets the available recording MimeTypes
|
abstract int |
getBackKeyCode()
Returns the keycode for the back key
|
abstract int |
getBackspaceKeyCode()
Returns the keycode for the backspace key
|
String |
getBrowserTitle(PeerComponent browserPeer)
The page title
|
String |
getBrowserURL(PeerComponent browserPeer)
The page URL
|
String |
getCachesDir()
Returns a device specific directory designed for cache style files, or null if
hasCachesDir()
is false |
int |
getCharLocation(String source,
int index)
Returns the index of the given char within the source string, the actual
index isn't necessarily the same when bidi is involved
See this
for more on visual vs.
|
abstract int |
getClearKeyCode()
Returns the keycode for the clear key
|
abstract int |
getClipHeight(Object graphics)
Returns the clipping coordinate
|
Rectangle |
getClipRect(Object graphics)
Returns the internal clipping rectangle.
|
abstract int |
getClipWidth(Object graphics)
Returns the clipping coordinate
|
abstract int |
getClipX(Object graphics)
Returns the clipping coordinate
|
abstract int |
getClipY(Object graphics)
Returns the clipping coordinate
|
protected Graphics |
getCodenameOneGraphics()
Returns a graphics object for use by the painting
|
CodeScanner |
getCodeScanner()
Deprecated.
Use cn1-codescan cn1lib instead.
|
abstract int |
getColor(Object graphics)
Returns the current color
|
int |
getCommandBehavior()
Indicates the way commands should be added to a form as one of the ocmmand constants defined
in this class
|
Graphics |
getComponentScreenGraphics(Component cmp,
Graphics currentContext)
This method allows customizing/creating a graphics context per component which is useful for
some elaborate implementations of Codename One.
|
Contact |
getContactById(String id)
Get a Contact according to it's contact id.
|
Contact |
getContactById(String id,
boolean includesFullName,
boolean includesPicture,
boolean includesNumbers,
boolean includesEmail,
boolean includeAddress)
This method returns a Contact by the contact id and fills it's data
according to the given flags
|
abstract int |
getContentLength(Object connection)
Returns the content length for this connection
|
Vector |
getCookiesForURL(String url)
Returns the cookies for this URL
|
String |
getCurrentAccessPoint()
Returns the id of the current access point
|
Form |
getCurrentForm()
Returns the current form, this method is for internal use only and does not
take transitions/menus into consideration
|
String |
getDatabasePath(String databaseName)
Returns the file path of the Database if exists and if supported on
the platform.
|
abstract Object |
getDefaultFont()
Return the global default font instance, if font is passed as null
this font should be used
|
int |
getDeviceDensity()
Returns one of the density variables appropriate for this device, notice that
density doesn't always correspond to resolution and an implementation might
decide to change the density based on DPI constraints.
|
abstract int |
getDisplayHeight()
Returns the height dimension of the display controlled by this implementation
|
Object |
getDisplayLock()
Returns a lock object which can be synchronized against, this lock is used
by the EDT.
|
Rectangle |
getDisplaySafeArea(Rectangle rect)
This method returns a rectangle defining the "safe" area of the display, which excludes
areas on the screen that are covered by notches, task bars, rounded corners, etc.
|
abstract int |
getDisplayWidth()
Returns the width dimension of the display controlled by this implementation
|
protected int |
getDragAutoActivationThreshold()
This method allows subclasses to manipulate the drag started detection logic.
|
int |
getDragPathLength()
Indicates how many drag points are used to calculate dragging speed
|
int |
getDragPathTime()
Indicates what drag points are valid for the drag speed calculation.
|
float |
getDragSpeed(float[] points,
long[] dragPathTime,
int dragPathOffset,
int dragPathLength)
This method returns the dragging speed based on the latest dragged
events
|
int |
getDragStartPercentage()
This method allows us to manipulate the drag started detection logic.
|
Component |
getEditingText()
Gets the component that is currently editing text
|
int |
getEDTThreadPriority()
Returns the platform EDT thread priority
|
int |
getFace(Object nativeFont)
Optional operation returning the font face for the font
|
long |
getFileLastModified(String file)
Returns the time that the file denoted by this abstract pathname was
last modified.
|
abstract long |
getFileLength(String file)
Returns the length of the file
|
abstract char |
getFileSystemSeparator()
Returns the file system separator char normally '/'
|
int |
getFontAscent(Object nativeFont)
Returns the ascent of the specified native font instance.
|
int |
getFontDescent(Object nativeFont)
Returns the descent below the baseline that a font can span.
|
String[] |
getFontPlatformNames()
Returns a list of the platform names ordered by priority, platform names are
used to choose a font based on platform.
|
abstract int |
getGameAction(int keyCode)
Returns the display game action for the given keyCode if applicable to match
the contrct of Codename One for the game action behavior
|
abstract String |
getHeaderField(String name,
Object connection)
Returns the HTTP response header field
|
abstract String[] |
getHeaderFieldNames(Object connection)
Returns the HTTP response header field
|
abstract String[] |
getHeaderFields(String name,
Object connection)
Returns the HTTP response header fields, returns optionally more than one result or null if
no field is present.
|
abstract int |
getHeight(Object nativeFont)
Return the total height of the font
|
String |
getHostOrIP()
Returns the device host or ip address if available
|
static Class |
getImageArrayClass()
This is a temporary workaround for an XMLVM Bug!
|
abstract int |
getImageHeight(Object i)
Returns the height of a native image
|
ImageIO |
getImageIO()
Returns the image IO instance that allows scaling image files.
|
abstract int |
getImageWidth(Object i)
Returns the width of a native image
|
Purchase |
getInAppPurchase()
Returns the native OS purchase implementation if applicable, if not this
method will fallback to a cross platform purchase manager.
|
int |
getInvisibleAreaUnderVKB()
Returns the height of the VKB when it is open for an implementation that requires
us to allow scrolling further
|
int |
getKeyboardType()
Returns the type of the input device one of:
KEYBOARD_TYPE_UNKNOWN, KEYBOARD_TYPE_NUMERIC, KEYBOARD_TYPE_QWERTY,
KEYBOARD_TYPE_VIRTUAL, KEYBOARD_TYPE_HALF_QWERTY
|
abstract int |
getKeyCode(int gameAction)
Returns a keycode which can be sent to getGameAction
|
String |
getLineSeparator() |
String[] |
getLinkedContactIds(Contact c)
Gets the IDs of all contacts that are linked to the provided contact.
|
abstract L10NManager |
getLocalizationManager() |
LocationManager |
getLocationManager()
This method returns the platform Location Control
|
String |
getMsisdn()
Returns the MSISDN for devices that expose it
|
abstract Object |
getNativeGraphics()
Returns the native graphics object on which all rendering operations occur
|
abstract Object |
getNativeGraphics(Object image)
Returns the native graphics object on the given native image occur
|
Transition |
getNativeTransition(Transition t)
This method allows a native implementation to implement a native version of a given transition that
can be faster
|
static Class |
getObjectArrayClass()
This is a temporary workaround for an XMLVM Bug!
|
protected String |
getPackageName()
Returns the package name for the application
|
Object |
getPasteDataFromClipboard()
Returns the current content of the clipboard
|
abstract String |
getPlatformName()
Returns a 2-3 letter code representing the platform name for the platform override
|
String[] |
getPlatformOverrides()
Returns the suffixes for ovr files that should be used when loading a layered resource file on this platform
|
int |
getPreferredBackgroundFetchInterval()
Gets the preferred time (in seconds) between background fetches.
|
Map<String,String> |
getProjectBuildHints()
Returns the build hints for the simulator, this will only work in the debug environment and it's
designed to allow extensions/API's to verify user settings/build hints exist
|
String |
getProperty(String key,
String defaultValue)
Returns the property from the underlying platform deployment or the default
value if no deployment values are supported.
|
static PurchaseCallback |
getPurchaseCallback()
Returns the purchase callback instance
|
int |
getRenderingHints(Object nativeGraphics)
Gets the rendering hints for this graphics context
|
InputStream |
getResourceAsStream(Class cls,
String resource)
This method is essentially equivalent to cls.getResourceAsStream(String)
however some platforms might define unique ways in which to load resources
within the implementation.
|
abstract int |
getResponseCode(Object connection)
Returns the server response code for the request
|
abstract String |
getResponseMessage(Object connection)
Returns the server response message for the request
|
abstract void |
getRGB(Object nativeImage,
int[] arr,
int offset,
int x,
int y,
int width,
int height)
Extracts RGB data from the given native image and places it in the given array
|
abstract long |
getRootAvailableSpace(String root)
Returns the available space in the given root directory
|
abstract long |
getRootSizeBytes(String root)
Returns the size of the given root directory
|
int |
getRootType(String root)
Returns the type of the root often by guessing
|
BrowserComponent |
getSharedJavscriptContext()
Gets a reference to an application-wide shared Javascript context that can be used for running
Javascript commands.
|
int |
getSize(Object nativeFont)
Optional operation returning the font size for system fonts
|
int |
getSMSSupport()
Indicates the level of SMS support in the platform as one of: SMS_NOT_SUPPORTED (for desktop, tablet etc.),
SMS_SEAMLESS (no UI interaction), SMS_INTERACTIVE (with compose UI), SMS_BOTH.
|
int |
getSocketAvailableInput(Object socket)
Returns whether data is available for input on the socket
|
int |
getSocketErrorCode(Object socket)
Returns the pending error code on the given socket
|
String |
getSocketErrorMessage(Object socket)
Return the pending error message on the given socket
|
abstract int[] |
getSoftkeyCode(int index)
Returns the softkey keycode for the given softkey index
|
abstract int |
getSoftkeyCount()
Returns the number of softkeys on the device
|
String[] |
getSSLCertificates(Object connection,
String url)
Gets the SSL certificates for a connection
|
Object |
getStorageData()
The storage data is used by some storage implementations (e.g.
|
int |
getStorageEntrySize(String name)
Returns the size of the entry in bytes
|
static Class |
getStringArray2DClass()
This is a temporary workaround for an XMLVM Bug!
|
static Class |
getStringArrayClass()
This is a temporary workaround for an XMLVM Bug!
|
int |
getStyle(Object nativeFont)
Optional operation returning the font style for system fonts
|
Object |
getSVGDocument(Object svgImage)
Returns a platform specific DOM object that can be manipulated by the user
to change the SVG Image
|
Transform |
getTransform(Object graphics)
Deprecated.
|
void |
getTransform(Object nativeGraphics,
Transform t)
Sets the given transform to the current transform in the given graphics object.
|
int |
getTranslateX(Object graphics)
Returns the current x translate value
|
int |
getTranslateY(Object graphics)
Returns the current y translate value
|
String |
getUdid()
Returns the UDID for devices that support it
|
String |
getURLDomain(String url)
Returns the domain for the given URL
|
String |
getURLPath(String url) |
boolean |
handleEDTException(Throwable err)
Invoked when an exception occurs on the EDT, allows the implementation to
take control of the device to produce testing information.
|
boolean |
hasCachesDir()
Returns true if the device has a directory dedicated for "cache" files
|
boolean |
hasCamera()
Returns true if the device has camera false otherwise.
|
protected boolean |
hasDragStarted(int[] x,
int[] y)
This method can be overriden by subclasses to indicate whether a drag
event has started or whether the device is just sending out "noise".
|
protected boolean |
hasDragStarted(int x,
int y)
This method can be overriden by subclasses to indicate whether a drag
event has started or whether the device is just sending out "noise".
|
boolean |
hasNativeTheme()
Indicates if the implemenetation has a native underlying theme
|
boolean |
hasPendingPaints()
Returns true if the implementation still has elements to paint.
|
void |
hideNativeOverlay(Component cmp,
Object nativeOverlay)
Hides the native overlay for a component.
|
protected void |
hideNotify()
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
void |
hideTextEditor()
In case of scrolling we can hide the text editor unless the user starts typing again,
this is only relevant for the async mode...
|
abstract void |
init(Object m)
Invoked by the display init method allowing the implementation to "bind"
|
protected void |
initDefaultUserAgent()
Some old platforms might need this but for modern platforms the user agent should "just work".
|
void |
initEDT()
Some implementations might need to perform initializations of the EDT thread
|
void |
initHeavyButton(Object peer)
Initializes a heavy button.
|
void |
initializeTextSelection(TextSelection aThis)
Initializes text selection.
|
void |
initImpl(Object m)
Invoked by the display init method allowing the implementation to "bind"
|
void |
installBuiltinSound(String soundIdentifier,
InputStream data)
Installs a replacement sound as the builtin sound responsible for the given
sound identifier (this will override the system sound if such a sound exists).
|
boolean |
installMessageListener(Object browserComponent)
Installs a message listener to allow webpages inside a browser component to send
messages to CN1 cross-domain.
|
void |
installNativeTheme()
Installs the native theme, this is only applicable if hasNativeTheme() returned true.
|
void |
installTar()
Installs a tar file from the build server into the file system storage so it can be used with respect for hierarchy
|
boolean |
instanceofByteArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofDoubleArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofFloatArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofIntArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofLongArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofObjArray(Object o)
Workaround for XMLVM bug
|
boolean |
instanceofShortArray(Object o)
Workaround for XMLVM bug
|
boolean |
isAffineSupported()
Indicates whether the underlying implementation can draw using an affine
transform hence methods such as rotate, scale and shear would work
|
boolean |
isAlphaGlobal()
Returns true if alpha can be applied for all elements globally and efficiently
otherwise alpha should be ignored.
|
boolean |
isAlphaMutableImageSupported()
Indicates whether mutable images respect alpha values when constructed
|
boolean |
isAltGraphKeyDown()
Checks whether the altgraph key is currently down.
|
boolean |
isAltKeyDown()
Checks whether the alt key is currently down.
|
boolean |
isAnimation(Object nativeImage)
Animations should return true to allow the native image animation to update
|
boolean |
isAntiAliased(Object graphics)
Returns anti-aliasing mode for regular rendering operations
|
boolean |
isAntiAliasedText(Object graphics)
Returns anti-aliasing mode for font rendering operations
|
boolean |
isAntiAliasedTextSupported()
Indicates whether the underlying implementation allows for anti-aliased fonts
|
boolean |
isAntiAliasedTextSupported(Object graphics) |
boolean |
isAntiAliasingSupported()
Indicates whether the underlying implementation allows for anti-aliasing in regular
drawing operations
|
boolean |
isAntiAliasingSupported(Object graphics) |
boolean |
isAPSupported()
Indicates whether looking up an access point is supported by this device
|
boolean |
isAsyncEditMode()
Returns true if edit string will return immediately and broadcast editing events directly to the text field
|
boolean |
isBackgroundFetchSupported()
Checks to see if the current platform supports background fetch.
|
boolean |
isBadgingSupported()
Returns true if the underlying OS supports numeric badges on icons.
|
boolean |
isBaselineTextSupported()
Checks whether the implementation supports drawing text on the baseline.
|
boolean |
isBidiAlgorithm()
Indicates whether Codename One should consider the bidi RTL algorithm
when drawing text or navigating with the text field cursor.
|
boolean |
isBuiltinSoundAvailable(String soundIdentifier)
Indicates whether a user installed or system sound is available
|
boolean |
isBuiltinSoundsEnabled()
Allows muting/unmuting the builtin sounds easily
|
boolean |
isClickTouchScreen()
Indicates whether the device has a double layer screen thus allowing two
stages to touch events: click and hover.
|
boolean |
isContactsPermissionGranted()
Some platforms allow the user to block contacts access on a per application basis (specifically iOS).
|
boolean |
isControlKeyDown()
Checks whether the control key is currently down.
|
Boolean |
isDarkMode()
Returns true if the platform is in dark mode, null is returned for
unknown status
|
boolean |
isDatabaseCustomPathSupported()
Checks if this platform supports custom database paths.
|
boolean |
isDesktop()
Returns true if this is a desktop application
|
abstract boolean |
isDirectory(String file)
Indicates whether the given file is a directory
|
boolean |
isEditingText()
Returns true if we are currently editing a component
|
boolean |
isEditingText(Component c)
Returns true if we are currently editing this component
|
boolean |
isFullScreenSupported()
Checks if the platform supports full-screen mode.
|
boolean |
isGalleryTypeSupported(int type)
Checks if the given gallery type is supported on this platform.
|
boolean |
isGaussianBlurSupported() |
boolean |
isGetAllContactsFast()
Indicates if the getAllContacts is platform optimized, notice that the method
might still take seconds or more to run so you should still use a separate thread!
|
abstract boolean |
isHidden(String file)
Indicates the hidden state of the file
|
boolean |
isInFullScreenMode()
Checks to see if the app is currently running in full-screen mode.
|
boolean |
isInitialized()
Returns true if the implementation is initialized.
|
boolean |
isJailbrokenDevice()
Returns true if this device is jailbroken or rooted, false if not or unknown.
|
protected boolean |
isLogged()
Indicates whether logging is turned on
|
boolean |
isLookupFontSupported()
Indicates whether loading a font by a string is supported by the platform
|
boolean |
isMetaKeyDown()
Checks whether the meta key is currently down.
|
boolean |
isMinimized()
Indicates whether an application is minimized
|
boolean |
isMultiTouch()
Indicates whether the device supports multi-touch events, this is only
relevant when touch events are supported
|
boolean |
isNativeBrowserComponentSupported()
An implementation can return true if it supports embedding a native browser widget
|
boolean |
isNativeCookieSharingSupported()
Checks if this platform supports sharing cookies between Native components (e.g.
|
boolean |
isNativeEditorVisible(Component c)
Checks whether the native text editor is currently visible over top of the
given component (usually a
TextArea |
boolean |
isNativeFontSchemeSupported()
Indicates whether the implementation supports loading a font "natively" to handle one of the common
native prefixes
|
boolean |
isNativeIndexed()
Returns true if indexed images should be used natively
|
boolean |
isNativeInputImmediate()
Indicates whether the device should switch to native input immediately on first touch
|
boolean |
isNativeInputSupported()
Indicates whether the device supports native in place editing in which case
lightweight input logic shouldn't be used for input.
|
boolean |
isNativePickerTypeSupported(int pickerType)
Indicates whether the native picker dialog is supported for the given type
which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
|
boolean |
isNativeShareSupported()
Indicates if the underlying platform supports sharing capabilities
|
boolean |
isNativeTitle()
Indicates if the title of the Form is native title(in android ICS devices
if the command behavior is native the ActionBar is used to display the title
and the menu)
|
boolean |
isNativeVideoPlayerControlsIncluded()
Indicates if the native video player includes its own play/pause etc.
|
boolean |
isNotificationSupported()
Indicates whether the notify status bar method will present a notification to the user
|
boolean |
isOpaque(Image codenameOneImage,
Object nativeImage)
Returns true if the image was opaque
|
boolean |
isOpenNativeNavigationAppSupported()
Returns true if the underlying OS supports opening the native navigation
application
|
boolean |
isPerspectiveTransformSupported()
Checks of the Transform class can be used on this platform to perform perspective transforms.
|
boolean |
isPerspectiveTransformSupported(Object graphics)
Checks if 3d/perspective transformations are supported in the provided graphics context.
|
boolean |
isPortrait()
Returns true if the device is currently in portrait mode
|
boolean |
isReadTimeoutSupported()
Checks if this platform supports read timeout in network connections.
|
boolean |
isRightMouseButtonDown()
Checks if last mouse press was a right click.
|
boolean |
isRotationDrawingSupported()
Indicates whether drawImageRotated is supported by the platform for FAST drawing,
if not then its not worth calling the method which will be unimplemented!
|
boolean |
isRTL(char c)
Returns true if the given character is an RTL character
|
boolean |
isRTLOrWhitespace(char c)
Returns true if the given character is an RTL character or a space
character
|
boolean |
isScaledImageDrawingSupported()
Indicates if image scaling on the fly is supported by the platform, if not Codename One will just scale the images on its own before drawing
|
boolean |
isScreenLockSupported()
Checks if the device supports locking the screen display from dimming, allowing
the developer to keep the screen display on.
|
boolean |
isScrollWheeling() |
boolean |
isServerSocketAvailable()
Indicates whether the underlying implementation supports server sockets
|
boolean |
isSetCursorSupported()
Checks if this platform supports custom cursors.
|
boolean |
isShapeClipSupported(Object graphics)
Checks if clipping shapes is supported by the provided graphics context.
|
boolean |
isShapeSupported(Object graphics)
Checks if drawing shapes is supported by the provided graphics context.
|
boolean |
isShiftKeyDown()
Checks whether the shift key is currently down.
|
boolean |
isSimulator()
Allows detecting development mode so debugging code and special cases can be used to simplify flow
|
boolean |
isSocketAvailable()
Indicates whether the underlying implementation supports sockets
|
boolean |
isSocketConnected(Object socket)
Indicates whether the socket is currently connected
|
boolean |
isSVGSupported()
Indicates whether the underlying platform supports creating an SVG Image
|
boolean |
isTablet()
Indicates whether the device is a tablet, notice that this is often a guess
|
boolean |
isThirdSoftButton()
Indicates the default status to apply to the 3rd softbutton variable
|
boolean |
isTimeoutSupported()
Indicates whether the underlying implementation supports the notion of a network operation
timeout.
|
abstract boolean |
isTouchDevice()
Returns true if the device will send touch events
|
boolean |
isTransformSupported()
Checks if the Transform class can be used on this platform.
|
boolean |
isTransformSupported(Object graphics)
Checks if matrix transformations are supported in the provided graphics context.
|
boolean |
isTranslationSupported()
Codename One can translate all coordinates and never requires a call to translate
this works well for some devices which have hairy issues with translate.
|
boolean |
isTrueTypeSupported()
Returns true if the system supports dynamically loading truetype fonts from
a file.
|
boolean |
isURLWithCustomHeadersSupported()
Returns true if setBrowserURL with custom headers is supported
|
boolean |
isUseNativeCookieStore()
Uses the native cookie store if applicable, this might break simulator compatibility
|
protected void |
keyPressed(int keyCode)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
keyReleased(int keyCode)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
Object |
listenSocket(int port)
Listens on the given port similar to the accept method of server socket in Java.
|
abstract String[] |
listFiles(String directory)
Lists the files within the given directory, returns relative file names and not
full file names.
|
abstract String[] |
listFilesystemRoots()
Returns the filesystem roots from which the structure of the file system
can be traversed
|
abstract String[] |
listStorageEntries()
Lists the names of the storage files
|
Object |
loadNativeFont(String lookup)
Loads a native font based on a lookup for a font name and attributes.
|
Object |
loadTrueTypeFont(String fontName,
String fileName)
Creates a true type font with the given name/filename (font name might be different from the file name
and is required by some devices e.g.
|
void |
lockOrientation(boolean portrait)
On devices that return true for canForceOrientation() this method can lock the device orientation
either to portrait or landscape mode
|
void |
lockScreen()
If Locking isScreenLockSupported() returns true calling this method will
lock the screen display on
|
protected void |
log(String content)
Dispatch the message to the logger
|
void |
logStreamClose(String name,
boolean isInput,
int count)
Logs the closing of a stream
|
void |
logStreamCreate(String name,
boolean isInput,
int count)
Logs the creation of a stream
|
void |
logStreamDoubleClose(String name,
boolean isInput)
Logs the closing of a stream
|
Object |
makeTransformAffine(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Makes a transform given the specified AffineTransform values.
|
Object |
makeTransformCamera(float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ)
Makes a transform to simulate a camera's perspective at a given location.
|
Object |
makeTransformIdentity()
Makes a new identity native transform.
|
Object |
makeTransformInverse(Object nativeTransform)
Gets the inverse transformation for the provided transform.
|
Object |
makeTransformOrtho(float left,
float right,
float bottom,
float top,
float near,
float far)
Makes a new orthographic projection transform.
|
Object |
makeTransformPerspective(float fovy,
float aspect,
float zNear,
float zFar)
Makes a new perspective transform.
|
Object |
makeTransformRotation(float angle,
float x,
float y,
float z)
Makes a new native rotation transform.
|
Object |
makeTransformScale(float scaleX,
float scaleY,
float scaleZ)
Makes a new native scale transform.
|
Object |
makeTransformTranslation(float translateX,
float translateY,
float translateZ)
Makes a new native translation transform.
|
boolean |
minimizeApplication()
Minimizes the current application if minimization is supported by the platform (may fail).
|
abstract void |
mkdir(String directory)
Creates the given directory
|
void |
nativeBrowserWindowAddCloseListener(Object window,
ActionListener l)
Adds close listener to native browser window.
|
void |
nativeBrowserWindowCleanup(Object window)
Cleans up and disposes of a native browser window.
|
void |
nativeBrowserWindowEval(Object window,
BrowserWindow.EvalRequest req)
Evaluates javascript on native browser window.
|
void |
nativeBrowserWindowHide(Object window)
Hides a native browser window.
|
void |
nativeBrowserWindowRemoveCloseListener(Object window,
ActionListener l)
Removes close listener from native browser window.
|
void |
nativeBrowserWindowSetSize(Object window,
int width,
int height)
Sets the size of a native browser window.
|
void |
nativeBrowserWindowSetTitle(Object window,
String title)
Sets the window title of a native browser window.
|
void |
nativeBrowserWindowShow(Object window)
Shows a native browser window.
|
boolean |
nativeEditorPaintsHint() |
void |
nothingWithinComponentPaint(Component c)
Indicates to the port that the component won't be painted due to clipping
|
void |
notifyCommandBehavior(int commandBehavior)
This method notifies the implementation about the chosen commands
behavior
|
Object |
notifyStatusBar(String tickerText,
String contentTitle,
String contentBody,
boolean vibrate,
boolean flashLights,
Hashtable args)
Deprecated.
use scheduleLocalNotification instead
|
int |
numAlphaLevels()
Deprecated.
this method isn't implemented in most modern devices
|
int |
numColors()
Deprecated.
this method isn't implemented in most modern devices
|
void |
onCanInstallOnHomescreen(Runnable r)
A callback fired when you are allowed to prompt the user to install the app on their homescreen.
|
void |
onShow(Form f)
Callback before showing a specific form
|
InputStream |
openFileInputStream(String file)
Returns an input stream for the given connection
|
OutputStream |
openFileOutputStream(String file)
Returns an output stream for the given file
|
void |
openGallery(ActionListener response,
int type)
Opens the device gallery
The method returns immediately and the response will be sent asynchronously
to the given ActionListener Object
use this in the actionPerformed to retrieve the file path
String path = (String) evt.getSource();
|
void |
openImageGallery(ActionListener response)
Opens the device image gallery
|
abstract InputStream |
openInputStream(Object connection)
Returns an input stream for the given connection
|
void |
openNativeNavigationApp(double latitude,
double longitude)
Opens the native navigation app in the given coordinate.
|
void |
openNativeNavigationApp(String location)
Opens the native navigation app with the given search location
|
Database |
openOrCreateDB(String databaseName)
Opens a database or create one if not exists
|
abstract OutputStream |
openOutputStream(Object connection)
Returns an output stream for the given connection
|
abstract OutputStream |
openOutputStream(Object connection,
int offset)
Returns an output stream for the given connection
|
void |
paintComponentBackground(Object nativeGraphics,
int x,
int y,
int width,
int height,
Style s)
Paints the background of a component based on the style values on the
given graphics context, the style could be accessed from the drawing
thread in read only capacity to make the code slightly more efficient
|
void |
paintDirty()
Invoked by the EDT to paint the dirty regions
|
boolean |
paintNativePeersBehind()
A flag that can be overridden by a platform to indicate that native
peers are rendered behind the main codename one graphics layer.
|
protected void |
paintOverlay(Graphics g)
Allows for painting an overlay on top of the implementation for notices during
testing etc.
|
boolean |
platformUsesInputMode()
Checks to see if this is a platform that uses the
TextField.setInputMode(java.lang.String). |
void |
playBuiltinSound(String soundIdentifier)
Plays a builtin device sound matching the given identifier, implementations
and themes can offer additional identifiers to the ones that are already built
in.
|
void |
playDialogSound(int type)
Invoked when a dialog is shown, this method allows a dialog to play a sound
|
protected void |
playNativeBuiltinSound(Object data)
This method allows implementations to store sound objects natively e.g.
|
protected boolean |
playUserSound(String soundIdentifier)
Plays a sound defined by the user
|
protected void |
pointerDragged(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerDragged(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHover(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHover(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHoverPressed(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHoverPressed(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHoverReleased(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerHoverReleased(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerPressed(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerPressed(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerReleased(int[] x,
int[] y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
pointerReleased(int x,
int y)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
void |
popClip(Object graphics)
Pops the clip from the top of the clip stack and sets it as the current clip.
|
void |
postInit()
Callback allowing the implementation to perform an operation on the init thread
after initialization was completed
|
void |
postMessage(MessageEvent message)
Posts a message to the native platform.
|
boolean |
postMessage(Object browserComponent,
String message,
String targetOrigin)
Posts a message to the window in a BrowserComponent.
|
void |
printStackTraceToStream(Throwable t,
Writer o)
Allows the logger to print the stack trace into the log when the native
platform supports that
|
boolean |
promptInstallOnHomescreen()
Prompts the user to install this app on their homescreen.
|
void |
pushClip(Object graphics)
Pushes the current clip onto the clip stack so that it can be retrieved later
by
popClip(java.lang.Object). |
protected void |
pushReceived(String data) |
byte[] |
readFromSocketStream(Object socket)
Read pending bytes from the socket
|
void |
refreshContacts()
Clears the addressbook cache.
|
void |
refreshNativeTitle()
if the title is native(e.g the android action bar), notify the native title
that is needs to be refreshed
|
protected static void |
registerPollingFallback()
Registers a polling thread to simulate push notification
|
void |
registerPush(Hashtable metaData,
boolean noFallback)
User register to receive push notification
|
static void |
registerPushOnServer(String id,
String applicationKey,
byte pushType,
String udid,
String packageName)
Sends a server request to register push support.
|
static boolean |
registerServerPush(String id,
String applicationKey,
byte pushType,
String udid,
String packageName)
Sends a server request to register push support.
|
void |
releaseImage(Object image)
Allows buggy implementations (Android) to release image objects
|
void |
removeCompletionHandler(Media media,
Runnable onCompletion)
Removes onComplete callback from Media element.
|
protected void |
removeCookiesForDomain(String domain) |
void |
removeHeavyActionListener(Object peer,
ActionListener l)
Removes a heavy action listener from a heavy button.
|
void |
removeNativeBrowserWindowOnLoadListener(Object window,
ActionListener l)
Removes a load listener from a native browser window.
|
abstract void |
rename(String file,
String newName)
Renames a file to the given name, expects the new name to be relative to the
current directory
|
void |
repaint(Animation cmp)
Invoked to add an element to the paintQueue
|
protected void |
repaintTextEditor(boolean focus)
Allows the implementation to refresh the text field
|
boolean |
requestFullScreen()
Attempt to enter full-screen mode.
|
boolean |
requiresHeavyButtonForCopyToClipboard()
Checks whether the current platform requires a heavy button for copy to clipboard functionality to work.
|
void |
resetAffine(Object nativeGraphics)
Resets the affine transform to the default value
|
void |
restoreMinimizedApplication()
Restore the minimized application if minimization is supported by the platform
|
void |
rotate(Object nativeGraphics,
float angle)
Rotates the coordinate system around a radian angle using the affine transform
|
void |
rotate(Object nativeGraphics,
float angle,
int pivotX,
int pivotY)
Rotates the coordinate system around a radian angle using the affine transform
|
Object |
rotate(Object image,
int degrees)
Returns an instance of this image rotated by the given number of degrees.
|
Image |
rotate180Degrees(Image image,
boolean maintainOpacity)
Rotates the given image by 180 degrees
|
Image |
rotate270Degrees(Image image,
boolean maintainOpacity)
Rotates the given image by 270 degrees while changing the ratio of the picture
|
Image |
rotate90Degrees(Image image,
boolean maintainOpacity)
Rotates the given image by 90 degrees while changing the ratio of the picture
|
void |
saveTextEditingState()
Invoked if Codename One needs to dispose the native text editing but would like the editor
to store its state.
|
void |
scale(Object nativeGraphics,
float x,
float y)
Scales the coordinate system using the affine transform
|
abstract Object |
scale(Object nativeImage,
int width,
int height)
Scales a native image and returns the scaled version
|
void |
scalePoints(int pointSize,
float sX,
float sY,
float sZ,
float[] in,
int srcPos,
float[] out,
int destPos,
int numPoints)
Scales a set of points.
|
void |
scheduleLocalNotification(LocalNotification notif,
long firstTime,
int repeat) |
void |
sendMessage(String[] recipients,
String subject,
Message msg)
Send an email using the platform mail client
|
protected void |
sendPushRegistrationError(String message,
int errorCode)
Allows implementations to send an error to the push callback
|
protected void |
sendRegisteredForPush(String id) |
void |
sendSMS(String phoneNumber,
String message,
boolean interactive)
Sends a SMS message to the given phone number
|
abstract void |
setAlpha(Object graphics,
int alpha)
Alpha value from 0-255 can be ignored for some operations
|
void |
setAntiAliased(Object graphics,
boolean a)
Toggles anti-aliasing mode for regular rendering operations
|
void |
setAntiAliasedText(Object graphics,
boolean a)
Toggles anti-aliasing mode for font rendering operations
|
void |
setAppArg(String arg) |
void |
setBadgeNumber(int number)
Sets the number that appears on the application icon in iOS
|
void |
setBidiAlgorithm(boolean activate)
Indicates whether Codename One should consider the bidi RTL algorithm
when drawing text or navigating with the text field cursor.
|
void |
setBrowserPage(PeerComponent browserPeer,
String html,
String baseUrl)
Shows the given HTML in the native viewer
|
void |
setBrowserPageInHierarchy(PeerComponent browserPeer,
String url)
Sets a relative URL from the html hierarchy
|
void |
setBrowserProperty(PeerComponent browserPeer,
String key,
Object value)
This method allows customizing the properties of a web view in various ways including platform specific settings.
|
void |
setBrowserURL(PeerComponent browserPeer,
String url)
Sets the page URL, jar: URL's must be supported by the implementation
|
void |
setBrowserURL(PeerComponent browserPeer,
String url,
Map<String,String> headers)
Sets the page URL, jar: URL's must be supported by the implementation
|
void |
setBuiltinSoundsEnabled(boolean enabled)
Allows muting/unmuting the builtin sounds easily
|
void |
setChunkedStreamingMode(Object connection,
int bufferLen)
This method is used to enable streaming of a HTTP request body without
internal buffering, when the content length is not known in advance.
|
abstract void |
setClip(Object graphics,
int x,
int y,
int width,
int height)
Installs a new clipping rectangle
|
void |
setClip(Object graphics,
Shape shape)
Clips the Graphics context to the Shape.
|
void |
setClipRect(Object graphics,
Rectangle rect)
Installs a new clipping rectangle
|
void |
setCodenameOneGraphics(Graphics g)
Installs the Codename One graphics object into the implementation
|
abstract void |
setColor(Object graphics,
int RGB)
Sets the current rgb color while ignoring any potential alpha component within
said color value.
|
void |
setCommandBehavior(int commandBehavior)
Indicates the way commands should be added to a form as one of the ocmmand constants defined
in this class
|
void |
setConnectionId(Object connection,
int id) |
void |
setCurrentAccessPoint(String id)
Returns the id of the current access point
|
void |
setCurrentForm(Form f)
This method is used internally to determine the actual current form
it doesn't perform the logic of transitions etc.
|
void |
setDisplayLock(Object lock)
Installs the display lock allowing implementors to synchronize against the
Display mutex, this method is invoked internally and should not be used.
|
void |
setDragStartPercentage(int dragStartPercentage)
This method allows us to manipulate the drag started detection logic.
|
void |
setFocusedEditingText(Component cmp)
Sets current editingText value and sets it focused.
|
abstract void |
setHeader(Object connection,
String key,
String val)
Indicates the HTTP header value for an HTTP connection
|
abstract void |
setHidden(String file,
boolean h)
Toggles the hidden state of the file
|
void |
setHttpMethod(Object connection,
String method)
Requests special http method such as put or delete
|
void |
setImageName(Object nativeImage,
String name)
Allows for easier debugging of native implementations by setting the image name to
the native image object
|
void |
setInsecure(Object connection,
boolean insecure)
Sets connection to be insecure.
|
void |
setLogListener(ActionListener al)
This method is useful strictly for debugging, the logger can use it to track
file opening/closing thus detecting potential file resource leaks that
can cause serious problems in some OS's.
|
void |
setNativeBrowserScrollingEnabled(PeerComponent browserPeer,
boolean e)
Allows disabling the browsers native scrolling on devices that support it
|
void |
setNativeCommands(Vector commands)
Places the following commands on the native menu system
|
abstract void |
setNativeFont(Object graphics,
Object font)
Installs a native font object
|
static void |
setOnExit(Runnable on)
Set a task to be executed once the implementation is being destroyed
|
void |
setPinchToZoomEnabled(PeerComponent browserPeer,
boolean e)
Some platforms require that you enable pinch to zoom explicitly.
|
void |
setPlatformHint(String key,
String value)
Makes it easier to pass hints to the underlying implementation for quicker hacks/pipelines
|
void |
setPollingFrequency(int freq)
Sets the frequency for polling the server in case of polling based push notification
|
abstract void |
setPostRequest(Object connection,
boolean p)
Indicates the whether the request method is GET or POST
|
void |
setPreferredBackgroundFetchInterval(int seconds)
Sets the preferred time interval between background fetches.
|
void |
setProjectBuildHint(String key,
String value)
Sets a build hint into the settings while overwriting any previous value.
|
static void |
setPurchaseCallback(PurchaseCallback pc)
Allows the system to register the purchase callback instance
|
static void |
setPushCallback(PushCallback push)
Allows the system to register to receive push callbacks
|
void |
setReadTimeout(Object connection,
int readTimeout)
Sets the read timeout of a connection.
|
void |
setRenderingHints(Object nativeGraphics,
int hints)
Sets the rendering hints for a graphics context.
|
void |
setStorageData(Object storageData)
The storage data is used by some storage implementations (e.g.
|
void |
setThreadPriority(Thread t,
int p)
Allows an implementation to modify setting thread priority, some implementations
don't handle thread priorities well
|
void |
setTimeout(int t)
This will work only if http timeout is supported
|
void |
setTransform(Object graphics,
Transform transform)
Sets the transformation matrix to be applied to all drawing operations.
|
void |
setTransformAffine(Object nativeTransform,
double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Sets transform to the given specified AffineTransform values.
|
void |
setTransformCamera(Object nativeTransform,
float eyeX,
float eyeY,
float eyeZ,
float centerX,
float centerY,
float centerZ,
float upX,
float upY,
float upZ) |
void |
setTransformIdentity(Object transform)
Sets the given native transform to the identiy transform
|
void |
setTransformInverse(Object nativeTransform) |
void |
setTransformOrtho(Object nativeTransform,
float left,
float right,
float bottom,
float top,
float near,
float far) |
void |
setTransformPerspective(Object nativeTransform,
float fovy,
float aspect,
float zNear,
float zFar) |
void |
setTransformRotation(Object nativeTransform,
float angle,
float x,
float y,
float z) |
void |
setTransformScale(Object nativeTransform,
float scaleX,
float scaleY,
float scaleZ) |
void |
setTransformTranslation(Object nativeTransform,
float translateX,
float translateY,
float translateZ) |
void |
setUseNativeCookieStore(boolean useNativeCookieStore)
Uses the native cookie store if applicable, this might break simulator compatibility
|
void |
share(String text,
String image,
String mimeType)
Share the required information using the platform sharing services.
|
void |
share(String text,
String image,
String mimeType,
Rectangle sourceRect)
Share the required information using the platform sharing services.
|
void |
shear(Object nativeGraphics,
float x,
float y)
Shear the graphics coordinate system using the affine transform
|
boolean |
shouldAutoDetectAccessPoint()
This callback allows highly broken devices like the blackberry to automatically detect the network
type
|
boolean |
shouldPaintBackground()
Indicates the implementation is capable of keeping the background painted by being non-destructive.
|
boolean |
shouldWriteUTFAsGetBytes()
For some reason the standard code for writing UTF8 output in a server request
doesn't work as expected on SE/CDC stacks.
|
Object |
showNativePicker(int type,
Component source,
Object currentValue,
Object data)
Shows a native modal dialog allowing us to perform the picking for the given type
which can include one of PICKER_TYPE_DATE_AND_TIME, PICKER_TYPE_TIME, PICKER_TYPE_DATE
|
void |
showNativeScreen(Object nativeFullScreenPeer)
Shows a native Form/Canvas or some other heavyweight native screen
|
protected void |
showNotify()
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
protected void |
sizeChanged(int w,
int h)
Subclasses should invoke this method, it delegates the event to the display and into
Codename One.
|
void |
splitString(String source,
char separator,
ArrayList<String> out) |
void |
startRemoteControl()
Starts the remote control service.
|
void |
startThread(String name,
Runnable r)
Some devices need more elaborate thread creation logic e.g.
|
protected static void |
stopPolling()
Stops the polling push loop
|
void |
stopRemoteControl()
Stops the remote control service.
|
void |
stopTextEditing()
Invoked for special cases to stop text editing and clear native editing state
|
void |
stopTextEditing(Runnable onFinish)
Invoked for special cases to stop text editing and clear native editing state
|
abstract boolean |
storageFileExists(String name)
Returns true if the given storage file exists
|
abstract int |
stringWidth(Object nativeFont,
String str)
Return the width of the given string in this font instance
|
boolean |
supportsBrowserExecuteAndReturnString(PeerComponent internal) |
boolean |
supportsNativeImageCache()
Returns true if the platform supports a native image cache.
|
boolean |
supportsNativeTextAreaVerticalAlignment()
Checks whether the platform's native text areas support vertical alignment.
|
void |
systemOut(String content)
System print
|
void |
tileImage(Object graphics,
Object img,
int x,
int y,
int w,
int h)
Allows an implementation to optimize image tiling rendering logic
|
String |
toNativePath(String path)
Converts a FileSystemStorage path to a native path.
|
boolean |
transformEqualsImpl(Transform t1,
Transform t2) |
boolean |
transformNativeEqualsImpl(Object t1,
Object t2) |
void |
transformPoint(Object nativeTransform,
float[] in,
float[] out)
Transforms a point and stores the result in a provided array.
|
void |
transformPoints(Object nativeTransform,
int pointSize,
float[] in,
int srcPos,
float[] out,
int destPos,
int numPoints)
Transforms a set of points using the provided transform.
|
void |
transformRotate(Object nativeTransform,
float angle,
float x,
float y,
float z)
Rotates the provided transform.
|
void |
transformScale(Object nativeTransform,
float x,
float y,
float z)
Scales the provided transform by the provide scale factors.
|
void |
transformTranslate(Object nativeTransform,
float x,
float y,
float z)
Translates the transform by the specified amounts.
|
void |
translate(Object graphics,
int x,
int y)
Translates the X/Y location for drawing on the underlying surface.
|
void |
translatePoints(int pointSize,
float tX,
float tY,
float tZ,
float[] in,
int srcPos,
float[] out,
int destPos,
int numPoints)
Translates a set of points.
|
boolean |
uninstallMessageListener(Object browserComponent)
Uninstalls a message listener to allow webpages inside a browser component to send
messages to CN1 cross-domain.
|
void |
unlockOrientation()
This is the reverse method for lock orientation allowing orientation lock to be disabled
|
void |
unlockScreen()
Unlock the screen display allowing the screen to dim.
|
void |
updateHeavyButtonBounds(Object peer,
int x,
int y,
int width,
int height)
Updates the bounds of the native heavy button to match the bounds of the lightweight button.
|
void |
updateNativeEditorText(Component c,
String text)
Called when TextArea text is changed.
|
void |
updateNativeOverlay(Component cmp,
Object nativeOverlay)
Updates the native overlay after the component has been repositioned.
|
boolean |
usesInvokeAndBlockForEditString()
Using invokeAndBlock inside EditString creates peculiar behaviour that needs
to be worked around.
|
void |
vibrate(int duration)
Vibrates the device for the given length of time
|
void |
writeToSocketStream(Object socket,
byte[] data)
Write the following byte array to the socket
|
public static void setOnExit(Runnable on)
public final void initImpl(Object m)
m - the object passed to the Display init methodpublic boolean isInitialized()
protected void sendPushRegistrationError(String message, int errorCode)
message - the error messageerrorCode - the error codepublic static void setPushCallback(PushCallback push)
push - the callback objectpublic static void setPurchaseCallback(PurchaseCallback pc)
pc - the pc callbackpublic static PurchaseCallback getPurchaseCallback()
public abstract void init(Object m)
m - the object passed to the Display init methodpublic void initEDT()
public void deinitialize()
public void playDialogSound(int type)
type - the type of the dialog matching the dialog classes defined typespublic void vibrate(int duration)
duration - length of time to vibratepublic void flashBacklight(int duration)
duration - length of time to flash the backlightpublic abstract int getDisplayWidth()
public abstract int getDisplayHeight()
public int getActualDisplayHeight()
public boolean handleEDTException(Throwable err)
err - the exception that was caught in the EDT looppublic final void editStringImpl(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode)
cmp - the TextArea componentmaxSize - the maximum size from the text areaconstraint - the constraints of the text areatext - the string to editinitiatingKeycode - the keycode used to initiate the edit.public void setFocusedEditingText(Component cmp)
public void stopTextEditing()
public void stopTextEditing(Runnable onFinish)
public boolean usesInvokeAndBlockForEditString()
public abstract void editString(Component cmp, int maxSize, int constraint, String text, int initiatingKeycode)
cmp - the TextArea componentmaxSize - the maximum size from the text areaconstraint - the constraints of the text areatext - the string to editinitiatingKeycode - the keycode used to initiate the edit.public boolean nativeEditorPaintsHint()
public boolean isEditingText()
public boolean platformUsesInputMode()
TextField.setInputMode(java.lang.String).public boolean isNativeEditorVisible(Component c)
TextAreac - The textarea/component we are checkingpublic void updateNativeEditorText(Component c, String text)
c - The TextArea that is being edited.text - public void hideTextEditor()
public String getAppArg()
public void setAppArg(String arg)
protected final void repaintTextEditor(boolean focus)
public boolean isEditingText(Component c)
public Component getEditingText()
public boolean isAsyncEditMode()
public int getInvisibleAreaUnderVKB()
public void saveTextEditingState()
public boolean hasPendingPaints()
public int numAlphaLevels()
public int numColors()
public Graphics getComponentScreenGraphics(Component cmp, Graphics currentContext)
cmp - component being renderedcurrentContext - the current graphics contextprotected void paintOverlay(Graphics g)
g - graphics context on which to draw the overlaypublic void paintDirty()
public void edtIdle(boolean enter)
enter - true before the edt sleeps and false when exits from the
idle statepublic abstract void flushGraphics(int x,
int y,
int width,
int height)
x - position of the dirty regiony - position of the dirty regionwidth - width of the dirty regionheight - height of the dirty regionpublic abstract void flushGraphics()
protected Graphics getCodenameOneGraphics()
public void setCodenameOneGraphics(Graphics g)
g - graphics object for use by the implementationpublic boolean paintNativePeersBehind()
public void setDisplayLock(Object lock)
lock - the mutex from displaypublic Object getDisplayLock()
public void cancelRepaint(Animation cmp)
cmp - the component topublic void repaint(Animation cmp)
cmp - component or animation to push into the paint queuepublic abstract void getRGB(Object nativeImage, int[] arr, int offset, int x, int y, int width, int height)
nativeImage - native platform image objectarr - int array to store RGB dataoffset - position within the array to startx - x position within the imagey - y position within the imagewidth - width to extractheight - height to extractpublic abstract Object createImage(int[] rgb, int width, int height)
rgb - ARGB data from which to create a platform imagewidth - width for the resulting imageheight - height for the resulting imagepublic abstract Object createImage(String path) throws IOException
path - If path begins with file: this will load a file from FileSystemStorage. Otherwise it will load from jar.IOException - if thrown by loadingpublic abstract Object createImage(InputStream i) throws IOException
i - input stream from which to load the imageIOException - if thrown by loadingpublic abstract Object createMutableImage(int width, int height, int fillColor)
width - the width of the mutable imageheight - the height of the mutable imagefillColor - the ARGB fill color, alpha may be ignored based on the value of
isAlphaMutableImageSupportedpublic boolean isAlphaMutableImageSupported()
public abstract Object createImage(byte[] bytes, int offset, int len)
bytes - the byte array representing the image dataoffset - offset within the byte arraylen - the length for the image within the byte arraypublic abstract int getImageWidth(Object i)
i - the native imagepublic abstract int getImageHeight(Object i)
i - the native imagepublic abstract Object scale(Object nativeImage, int width, int height)
nativeImage - image to scalewidth - width of the resulting imageheight - height of the resulting imagepublic Object rotate(Object image, int degrees)
E.g. rotating an image to 45, 90 and 135 degrees is inefficient. Use rotatate to 45, 90 and then rotate the 45 to another 90 degrees to achieve the same effect with less memory.
degrees - A degree in right angle must be larger than 0 and up to 359 degreespublic Image rotate90Degrees(Image image, boolean maintainOpacity)
image - the imagemaintainOpacity - whether the opacity in the image should be maintainedpublic Image rotate180Degrees(Image image, boolean maintainOpacity)
image - the imagemaintainOpacity - whether the opacity in the image should be maintainedpublic Image rotate270Degrees(Image image, boolean maintainOpacity)
image - the imagemaintainOpacity - whether the opacity in the image should be maintainedpublic Image flipImageHorizontally(Image image, boolean maintainOpacity)
image - the imagemaintainOpacity - whether the opacity in the image should be maintainedpublic Image flipImageVertically(Image image, boolean maintainOpacity)
image - the imagemaintainOpacity - whether the opacity in the image should be maintainedpublic boolean supportsNativeImageCache()
FileSystemStorage.hasCachesDir(). A native image cache
is an image cache that the platform provides that is full transparent to Codename One
with respect to how images are stored, and whether they are cached. Currently only
the Javascript port supprts a native image cache.
This is used by URLImage.createCachedImage(java.lang.String, java.lang.String, com.codename1.ui.Image, int)
to determine if it should use a cached image, or to defer to its storage and filesystem methods.
Display.supportsNativeImageCache()public void downloadImageToCache(String url, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail)
supportsNativeImageCache() (e.g. Javascript) override this method to defer to the
platform's handling of cached images. Platforms that have a caches directory (FileSystemStorage.hasCachesDir()
will use that directory to cache the image. Other platforms will just download to storage.url - The URL of the image to download.onSuccess - Callback on success.onFail - Callback on fail.URLImage#createToCache(com.codename1.ui.EncodedImage, java.lang.String, com.codename1.ui.URLImage.ImageAdapter)public void downloadImageToStorage(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail)
Some platforms may override this method to use platform-level caching. E.g. Javascript will use the browser cache for downloading the image.
url - The URL of the image to download.fileName - The storage key to be used to store the image.onSuccess - Callback on success. Will be executed on EDT.onFail - Callback on failure. Will be executed on EDT.public void downloadImageToFileSystem(String url, String fileName, SuccessCallback<Image> onSuccess, FailureCallback<Image> onFail)
Some platforms may override this method to use platform-level caching. E.g. Javascript will use the browser cache for downloading the image.
url - The URL of the image to download.fileName - The storage key to be used to store the image.onSuccess - Callback on success. Will be executed on EDT.onFail - Callback on failure. Will be executed on EDT.public abstract int getSoftkeyCount()
public abstract int[] getSoftkeyCode(int index)
index - the index of the softkeypublic abstract int getClearKeyCode()
public abstract int getBackspaceKeyCode()
public abstract int getBackKeyCode()
public abstract int getGameAction(int keyCode)
keyCode - the device keycodepublic abstract int getKeyCode(int gameAction)
gameAction - the game actionpublic abstract boolean isTouchDevice()
public void onShow(Form f)
f - the form shownpublic void setCurrentForm(Form f)
f - the current formpublic void confirmControlView()
public Form getCurrentForm()
public boolean isTranslationSupported()
public void translate(Object graphics, int x, int y)
translate(-getTranslateX(), -getTranslateY()) graphics - the graphics contextx - the x coordinatey - the y coordinatepublic int getTranslateX(Object graphics)
graphics - the graphics contextpublic int getTranslateY(Object graphics)
graphics - the graphics contextpublic abstract int getColor(Object graphics)
graphics - the graphics contextpublic abstract void setColor(Object graphics, int RGB)
graphics - the graphics contextRGB - the RGB value for the color.public abstract void setAlpha(Object graphics, int alpha)
graphics - the graphics contextalpha - the alpha channelpublic abstract int getAlpha(Object graphics)
graphics - the graphics contextpublic boolean isAlphaGlobal()
public boolean isAntiAliasingSupported()
public boolean isAntiAliasingSupported(Object graphics)
public boolean isAntiAliasedTextSupported()
public boolean isAntiAliasedTextSupported(Object graphics)
public void setAntiAliased(Object graphics, boolean a)
graphics - the graphics contexta - true to activate Anti-aliasing, false to disable itpublic boolean isAntiAliased(Object graphics)
graphics - the graphics contextpublic void setAntiAliasedText(Object graphics, boolean a)
graphics - the graphics contexta - true to activate Anti-aliasing, false to disable itpublic boolean isAntiAliasedText(Object graphics)
graphics - the graphics contextpublic abstract void setNativeFont(Object graphics, Object font)
graphics - the graphics contextfont - the native font objectpublic Rectangle getClipRect(Object graphics)
graphics - the graphics contextpublic abstract int getClipX(Object graphics)
graphics - the graphics contextpublic abstract int getClipY(Object graphics)
graphics - the graphics contextpublic abstract int getClipWidth(Object graphics)
graphics - the graphics contextpublic abstract int getClipHeight(Object graphics)
graphics - the graphics contextpublic void setClipRect(Object graphics, Rectangle rect)
graphics - the graphics contextrect - rectangle representing the new clipping areapublic abstract void setClip(Object graphics, int x, int y, int width, int height)
graphics - the graphics contextx - coordinatey - coordinatewidth - sizeheight - sizerect - rectangle representing the new clipping areapublic void setClip(Object graphics, Shape shape)
graphics - the graphics contextshape - The shape to clip.public void clipRect(Object graphics, Rectangle rect)
graphics - the graphics contextrect - rectangle representing the new clipping areapublic abstract void clipRect(Object graphics, int x, int y, int width, int height)
graphics - the graphics contextx - coordinatey - coordinatewidth - sizeheight - sizerect - rectangle representing the new clipping areapublic void pushClip(Object graphics)
popClip(java.lang.Object).graphics - The native graphics context.public void disposeGraphics(Object graphics)
graphics - public void popClip(Object graphics)
graphics - The native graphics context.public abstract void drawLine(Object graphics, int x1, int y1, int x2, int y2)
graphics - the graphics contextx1 - first x positiony1 - first y positionx2 - second x positiony2 - second y positionpublic abstract void fillRect(Object graphics, int x, int y, int width, int height)
graphics - the graphics contextx - the x coordinate of the rectangle to be filled.y - the y coordinate of the rectangle to be filled.width - the width of the rectangle to be filled.height - the height of the rectangle to be filled.public void clearRect(Object graphics, int x, int y, int width, int height)
public abstract void drawRect(Object graphics, int x, int y, int width, int height)
graphics - the graphics contextx - the x coordinate of the rectangle to be drawn.y - the y coordinate of the rectangle to be drawn.width - the width of the rectangle to be drawn.height - the height of the rectangle to be drawn.public void drawRect(Object graphics, int x, int y, int width, int height, int thickness)
graphics - the graphics contextx - the x coordinate of the rectangle to be drawn.y - the y coordinate of the rectangle to be drawn.width - the width of the rectangle to be drawn.height - the height of the rectangle to be drawn.thickness - the thickness in pixelspublic abstract void drawRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight)
graphics - the graphics contextx - the x coordinate of the rectangle to be drawn.y - the y coordinate of the rectangle to be drawn.width - the width of the rectangle to be drawn.height - the height of the rectangle to be drawn.arcWidth - the horizontal diameter of the arc at the four corners.arcHeight - the vertical diameter of the arc at the four corners.public abstract void fillRoundRect(Object graphics, int x, int y, int width, int height, int arcWidth, int arcHeight)
graphics - the graphics contextx - the x coordinate of the rectangle to be filled.y - the y coordinate of the rectangle to be filled.width - the width of the rectangle to be filled.height - the height of the rectangle to be filled.arcWidth - the horizontal diameter of the arc at the four corners.arcHeight - the vertical diameter of the arc at the four corners.drawRoundRect(java.lang.Object, int, int, int, int, int, int)public abstract void fillArc(Object graphics, int x, int y, int width, int height, int startAngle, int arcAngle)
graphics - the graphics contextx - the x coordinate of the upper-left corner of the arc to be filled.y - the y coordinate of the upper-left corner of the arc to be filled.width - the width of the arc to be filled.height - the height of the arc to be filled.startAngle - the beginning angle.arcAngle - the angular extent of the arc, relative to the start angle.public abstract void drawArc(Object graphics, int x, int y, int width, int height, int startAngle, int arcAngle)
graphics - the graphics contextx - the x coordinate of the upper-left corner of the arc to be drawn.y - the y coordinate of the upper-left corner of the arc to be drawn.width - the width of the arc to be drawn.height - the height of the arc to be drawn.startAngle - the beginning angle.arcAngle - the angular extent of the arc, relative to the start angle.public abstract void drawString(Object graphics, String str, int x, int y)
graphics - the graphics contextstr - the string to be drawn.x - the x coordinate.y - the y coordinate.public abstract void drawImage(Object graphics, Object img, int x, int y)
graphics - the graphics contextimg - the specified native image to be drawnx - the x coordinate.y - the y coordinate.public void drawImage(Object graphics, Object img, int x, int y, int w, int h)
graphics - the graphics contextimg - the specified native image to be drawnx - the x coordinate.y - the y coordinate.w - the widthh - the heightpublic void drawShape(Object graphics, Shape shape, Stroke stroke)
The last 4 parameters specify a bounding box for drawing the Shape. The shape's bounds will be made to fit this box exactly for drawing. This allows for resizing the shape on the GPU if graphics acceleration is supported.
graphics - the graphics contextshape - the shape to draw.stroke - The stroke to use for drawing the contour.to determine of the graphics context supports drawing
shapes.public void fillShape(Object graphics, Shape shape)
graphics - shape - To learn what x, y, w, and h do.public void setTransform(Object graphics, Transform transform)
If isTransformSupported() returns false, then this method won't do anything.
If isPerspectiveTransformSupported() returns false, then this method will only deal with 2D transformation matrices (i.e. the upper left 3x3 matrix of the provided transformation matrix.
graphics - m - The transformation matrix. Can be 3x3 or 4x4.To check if this graphics context supports transformations.,
To check if this graphics context
supports perspective/3D transformations.public Transform getTransform(Object graphics)
getTransform(java.lang.Object, com.codename1.ui.Transform) instead.graphics - isTransformSupported(),
isPerspectiveTransformSupported()public boolean isTransformSupported(Object graphics)
graphics - setTransform(),
getTransform(),
isPerspectiveTransformSupported()public boolean isPerspectiveTransformSupported(Object graphics)
graphics - setTransform(),
getTransform(),
isTransformSupported()public boolean isShapeSupported(Object graphics)
graphics - public boolean isShapeClipSupported(Object graphics)
graphics - public void tileImage(Object graphics, Object img, int x, int y, int w, int h)
graphics - the graphics objectimg - the imagex - coordinate to tile the image alongy - coordinate to tile the image alongw - coordinate to tile the image alongh - coordinate to tile the image alongpublic boolean isNativeVideoPlayerControlsIncluded()
public boolean isScaledImageDrawingSupported()
public void drawImageArea(Object nativeGraphics, Object img, int x, int y, int imageX, int imageY, int imageWidth, int imageHeight)
nativeGraphics - the graphics contextimg - the specified native image to be drawnx - the x coordinate.y - the y coordinate.imageX - location within the image to drawimageY - location within the image to drawimageWidth - size of the location within the image to drawimageHeight - size of the location within the image to drawpublic void drawImageRotated(Object graphics, Object img, int x, int y, int degrees)
graphics - the graphics contextimg - the specified native image to be drawnx - the x coordinate.y - the y coordinate.degrees - either 0, 90, 180 or 270 degree rotation for the image drawingpublic boolean isRotationDrawingSupported()
public void fillTriangle(Object graphics, int x1, int y1, int x2, int y2, int x3, int y3)
graphics - the graphics contextx1 - the x coordinate of the first vertex of the triangley1 - the y coordinate of the first vertex of the trianglex2 - the x coordinate of the second vertex of the triangley2 - the y coordinate of the second vertex of the trianglex3 - the x coordinate of the third vertex of the triangley3 - the y coordinate of the third vertex of the trianglepublic abstract void drawRGB(Object graphics, int[] rgbData, int offset, int x, int y, int w, int h, boolean processAlpha)
graphics - the graphics contextrgbData - an array of ARGB values in the format 0xAARRGGBBoffset - the array index of the first ARGB valuex - the horizontal location of the region to be renderedy - the vertical location of the region to be renderedw - the width of the region to be renderedh - the height of the region to be renderedprocessAlpha - true if rgbData has an alpha channel, false if
all pixels are fully opaquepublic abstract Object getNativeGraphics()
public abstract Object getNativeGraphics(Object image)
image - the native image on which the graphics will drawpublic abstract int charsWidth(Object nativeFont, char[] ch, int offset, int length)
nativeFont - the font for which the string width should be calculatedch - array of charactersoffset - characters offsetslength - characters lengthpublic int getFontAscent(Object nativeFont)
nativeFont - public int getFontDescent(Object nativeFont)
nativeFont - public boolean isBaselineTextSupported()
public abstract int stringWidth(Object nativeFont, String str)
nativeFont - the font for which the string width should be calculatedstr - the given string *public abstract int charWidth(Object nativeFont, char ch)
nativeFont - the font for which the string width should be calculatedch - the specific characterpublic abstract int getHeight(Object nativeFont)
nativeFont - the font for which the string width should be calculatedpublic abstract Object getDefaultFont()
public int getFace(Object nativeFont)
nativeFont - the font for which the string width should be calculatedpublic int getSize(Object nativeFont)
nativeFont - the font for which the string width should be calculatedpublic int getStyle(Object nativeFont)
nativeFont - the font for which the string width should be calculatedpublic abstract Object createFont(int face, int style, int size)
face - the face of the font, can be one of FACE_SYSTEM,
FACE_PROPORTIONAL, FACE_MONOSPACE.style - the style of the font.
The value is an OR'ed combination of STYLE_BOLD, STYLE_ITALIC, and
STYLE_UNDERLINED; or the value is zero (STYLE_PLAIN).size - the size of the font, can be one of SIZE_SMALL,
SIZE_MEDIUM, SIZE_LARGEprotected void keyPressed(int keyCode)
keyCode - the key for the eventprotected void keyReleased(int keyCode)
keyCode - the key for the eventpublic boolean isRightMouseButtonDown()
public boolean isAltKeyDown()
public boolean isShiftKeyDown()
public boolean isAltGraphKeyDown()
public boolean isControlKeyDown()
public boolean isMetaKeyDown()
protected void pointerDragged(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerPressed(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerReleased(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerHover(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected void pointerHoverReleased(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected void pointerHoverReleased(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerHoverPressed(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected void pointerHoverPressed(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerHover(int x,
int y)
x - the position of the eventy - the position of the eventprotected void pointerDragged(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected boolean hasDragStarted(int[] x,
int[] y)
x - the position of the current drag eventy - the position of the current drag eventprotected boolean hasDragStarted(int x,
int y)
x - the position of the current drag eventy - the position of the current drag eventpublic int getDragStartPercentage()
public void setDragStartPercentage(int dragStartPercentage)
dragStartPercentage - percentage of the screen required to initiate dragprotected int getDragAutoActivationThreshold()
protected void pointerPressed(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected void pointerReleased(int[] x,
int[] y)
x - the position of the eventy - the position of the eventprotected void sizeChanged(int w,
int h)
w - the size of the screenh - the size of the screenprotected void hideNotify()
protected void showNotify()
public void fillRectRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, float relativeX, float relativeY, float relativeSize)
graphics - the graphics contextstartColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filledrelativeX - indicates the relative position of the gradient within the drawing regionrelativeY - indicates the relative position of the gradient within the drawing regionrelativeSize - indicates the relative size of the gradient within the drawing regionpublic void fillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height)
graphics - the graphics contextstartColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filledpublic void fillRadialGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, int startAngle, int arcAngle)
graphics - the graphics contextstartColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filledstartAngle - the beginning angle. Zero is at 3 o'clock. Positive angles are counter-clockwise.arcAngle - the angular extent of the arc, relative to the start angle. Positive angles are counter-clockwise.public void fillLinearGradient(Object graphics, int startColor, int endColor, int x, int y, int width, int height, boolean horizontal)
graphics - the graphics contextstartColor - the starting RGB colorendColor - the ending RGB colorx - the x coordinatey - the y coordinatewidth - the width of the region to be filledheight - the height of the region to be filledhorizontal - indicating wheter it is a horizontal fill or verticalpublic void fillPolygon(Object graphics, int[] xPoints, int[] yPoints, int nPoints)
graphics - the graphics contextxPoints - - a an array of x coordinates.yPoints - - a an array of y coordinates.nPoints - - a the total number of points.public void drawPolygon(Object graphics, int[] xPoints, int[] yPoints, int nPoints)
graphics - the graphics contextxPoints - - a an array of x coordinates.yPoints - - a an array of y coordinates.nPoints - - a the total number of points.public int getKeyboardType()
public boolean isNativeInputSupported()
public boolean isNativeInputImmediate()
public boolean isMultiTouch()
public boolean isClickTouchScreen()
A click touch screen will also send pointer hover events to the underlying software and will only send the standard pointer events on click.
public boolean isNativeIndexed()
public Object createNativeIndexed(Image image)
image - the indexed imagepublic boolean isOpaque(Image codenameOneImage, Object nativeImage)
codenameOneImage - the Codename One imagenativeImage - the image object to testpublic boolean isAffineSupported()
public void resetAffine(Object nativeGraphics)
nativeGraphics - the native graphics objectpublic void scale(Object nativeGraphics, float x, float y)
nativeGraphics - the native graphics objectx - factor for xy - factor for ypublic void rotate(Object nativeGraphics, float angle)
angle - the rotation angle in radiansnativeGraphics - the native graphics objectpublic void rotate(Object nativeGraphics, float angle, int pivotX, int pivotY)
angle - the rotation angle in radianspivotX - the pivot locationpivotY - the pivot locationnativeGraphics - the native graphics objectpublic void shear(Object nativeGraphics, float x, float y)
x - factor for xy - factor for ynativeGraphics - the native graphics objectpublic boolean isSVGSupported()
public Object createSVGImage(String baseURL, byte[] data) throws IOException
baseURL - URL which is used to resolve relative references within the SVG filedata - the content of the SVG fileIOException - if resource lookup fail SVG is unsupportedpublic Object getSVGDocument(Object svgImage)
svgImage - the underlying image objectpublic boolean animateImage(Object nativeImage, long lastFrame)
nativeImage - a native image used within the image objectlastFrame - the time the last frame of animation was shownpublic String[] getFontPlatformNames()
public Object loadTrueTypeFont(String fontName, String fileName)
fontName - the name of the fontfileName - the file name of the font as it appears in the src directory of the projectpublic boolean isNativeFontSchemeSupported()
public Object deriveTrueTypeFont(Object font, float size, int weight)
font - the native font instancesize - the size of the font in pixelsweight - PLAIN, BOLD or ITALIC weight based on the constants in this classpublic boolean isTrueTypeSupported()
public Object loadNativeFont(String lookup)
lookup - string describing the fontpublic boolean isLookupFontSupported()
public boolean minimizeApplication()
public void restoreMinimizedApplication()
public boolean isMinimized()
protected boolean cacheRadialGradients()
protected boolean cacheLinearGradients()
public boolean isThirdSoftButton()
Display.isThirdSoftButton(),
com.codename1.ui.Display#setThirdSoftButton()public int getDragPathLength()
public int getDragPathTime()
public float getDragSpeed(float[] points,
long[] dragPathTime,
int dragPathOffset,
int dragPathLength)
points - array of locationsdragPathTime - the time difference between each pointdragPathOffset - the offset in the arraysdragPathLength - public boolean isBidiAlgorithm()
public void setBidiAlgorithm(boolean activate)
activate - set to true to activate the bidi algorithm, false to
disable itpublic String convertBidiLogicalToVisual(String s)
s - a "logical" string with RTL characterspublic int getCharLocation(String source, int index)
source - the string in which we are looking for the positionindex - the "logical" location of the cursorpublic boolean isRTLOrWhitespace(char c)
c - character to testpublic boolean isRTL(char c)
c - character to testpublic InputStream getResourceAsStream(Class cls, String resource)
cls - class to load the resource fromresource - relative/absolute URL based on the Java conventionpublic boolean isAnimation(Object nativeImage)
nativeImage - underlying native imaepublic PeerComponent createNativePeer(Object nativeComponent)
nativeComponent - a platform specific "native component"public void showNativeScreen(Object nativeFullScreenPeer)
nativeFullScreenPeer - the native screen peerpublic void setNativeCommands(Vector commands)
commands - the Codename One commands to usepublic void exitApplication()
public void exit()
public String getProperty(String key, String defaultValue)
The implementation should be responsible for the following keys to return reasonable valid values for the application:
key - the key of the propertydefaultValue - a default return valuepublic Boolean canExecute(String url)
url - the url that would be executedpublic void execute(String url)
url - the url to executepublic void execute(String url, ActionListener response)
url - the url to executeresponse - a callback from the platform when this execution returned
to the applicationpublic int getDeviceDensity()
public Rectangle getDisplaySafeArea(Rectangle rect)
This feature was primarily added to deal with the task bar on the iPhone X, which is displayed on the screen near the bottom edge, and can interfere with components that are laid out at the bottom of the screen.
Most platforms will simply return a Rectangle with bounds (0, 0, displayWidth, displayHeight). iPhone X will return a rectangle that excludes the notch, and task bar regions.
rect - Out parameter where safe bounds are set.Form.getSafeArea()public void playBuiltinSound(String soundIdentifier)
soundIdentifier - the sound identifier which can match one of the
common constants in this class or be a user/implementation defined soundprotected boolean playUserSound(String soundIdentifier)
soundIdentifier - the sound identifier which can match one of the
common constants in this class or be a user/implementation defined soundprotected void playNativeBuiltinSound(Object data)
data - native data objectprotected Object convertBuiltinSound(InputStream i) throws IOException
i - stream containing a sound fileIOException - thrown by the streampublic void installBuiltinSound(String soundIdentifier, InputStream data) throws IOException
soundIdentifier - the sound string passed to playBuiltinSounddata - an input stream containing platform specific audio file, its usually safe
to assume that wav/mp3 would be supported.IOException - if the stream throws an exceptionpublic boolean isBuiltinSoundAvailable(String soundIdentifier)
soundIdentifier - the sound string passed to playBuiltinSoundpublic void setBuiltinSoundsEnabled(boolean enabled)
enabled - indicates whether the sound is mutedpublic boolean isBuiltinSoundsEnabled()
public Media createMedia(String uri, boolean isVideo, Runnable onCompletion) throws IOException
uri - the platform specific location for the soundonCompletion - invoked when the audio file finishes playing, may be nullIOException - if the URI access failspublic AsyncResource<Media> createMediaAsync(String uri, boolean video, Runnable onCompletion)
uri - the platform specific location for the soundonCompletion - invoked when the audio file finishes playing, may be nullcreateMedia(java.lang.String, boolean, java.lang.Runnable)public void addCompletionHandler(Media media, Runnable onCompletion)
media - The media to add the callback to.onCompletion - The callback that will run on the EDT when the playback completes.removeCompletionHandler(com.codename1.media.Media, java.lang.Runnable),
Display.addCompletionHandler(com.codename1.media.Media, java.lang.Runnable)public void removeCompletionHandler(Media media, Runnable onCompletion)
media - The media element.onCompletion - The callback.addCompletionHandler(com.codename1.media.Media, java.lang.Runnable),
Display.removeCompletionHandler(com.codename1.media.Media, java.lang.Runnable)public Media createMedia(InputStream stream, String mimeType, Runnable onCompletion) throws IOException
stream - the stream containing the media datamimeType - the type of the data in the streamonCompletion - invoked when the audio file finishes playing, may be nullIOException - if the URI access failscreateMediaAsync(java.io.InputStream, java.lang.String, java.lang.Runnable)public AsyncResource<Media> createMediaAsync(InputStream stream, String mimeType, Runnable onCompletion)
stream - the stream containing the media datamimeType - the type of the data in the streamonCompletion - invoked when the audio file finishes playing, may be nullcreateMedia(java.io.InputStream, java.lang.String, java.lang.Runnable)public Media createBackgroundMedia(String uri) throws IOException
uri - the uri of the media can start with jar://, file://, http://
(can also use rtsp:// if supported on the platform)IOException - if creation of media from the given URI has failedpublic AsyncResource<Media> createBackgroundMediaAsync(String uri)
uri - the uri of the media can start with jar://, file://, http://
(can also use rtsp:// if supported on the platform)IOException - if creation of media from the given URI has failedpublic Object createSoftWeakRef(Object o)
o - object to cachepublic Object extractHardRef(Object o)
o - the reference returned by createSoftWeakRefpublic void notifyCommandBehavior(int commandBehavior)
commandBehavior - see Display.COMMAND_BEHAVIOR...public boolean hasNativeTheme()
public void installNativeTheme()
public void copyToClipboard(Object obj)
obj - object to copy, while this can be any arbitrary object it is recommended that only Strings or Codename One
image objects be used to copypublic Object getPasteDataFromClipboard()
public boolean isPortrait()
public boolean canForceOrientation()
public void lockOrientation(boolean portrait)
portrait - true to lock to portrait mode, false to lock to landscape modepublic void unlockOrientation()
public boolean isNativeBrowserComponentSupported()
public void setPinchToZoomEnabled(PeerComponent browserPeer, boolean e)
browserPeer - browser instancee - true to enable pinch to zoom, false to disable itpublic void setNativeBrowserScrollingEnabled(PeerComponent browserPeer, boolean e)
browserPeer - browser instancee - true to enables scrolling and false disables itpublic PeerComponent createBrowserComponent(Object browserComponent)
browserComponent - instance of the browser component thru which events should be firedpublic boolean postMessage(Object browserComponent, String message, String targetOrigin)
This is only overridden by the Javascript port to provide proper CORS handling. Other ports use the implementation in BrowserComponent.
Web pages wishing to receive messages via this mechanism should register a "message" event listener. See Javascript postMessage() docs for more details about this.
browserComponent - The browser component peer.message - The message to sendtargetOrigin - The target origin for the message.BrowserComponent.postMessage(java.lang.String, java.lang.String),
installMessageListener(java.lang.Object),
uninstallMessageListener(java.lang.Object)public boolean installMessageListener(Object browserComponent)
This will be overridden by the Javascript port only to handle CORS. Other ports
use the default implementation in BrowserComponent.
browserComponent - The browser component peer.postMessage(java.lang.Object, java.lang.String, java.lang.String),
BrowserComponent.onMessage,
BrowserComponent.postMessage(java.lang.String, java.lang.String)public boolean uninstallMessageListener(Object browserComponent)
This will be overridden by the Javascript port only to handle CORS. Other ports
use the default implementation in BrowserComponent.
browserComponent - The browser component peer.postMessage(java.lang.Object, java.lang.String, java.lang.String),
BrowserComponent.onMessage,
BrowserComponent.postMessage(java.lang.String, java.lang.String)public Object createNativeOverlay(Component cmp)
Creates a native overlay for the given component. A native overlay is a native component that is always present over the given component. It can be used to help processing user events in a more native way. In the Javascript port, native overlays are used on TextFields, for example, so that users can tap on the text field and activate the keyboard. This was necessary because iOS doesn't allow us to programmatically activate the keyboard. Without a native overlay, the user would first have to tap the lightweight keyboard - upon which we create a native text field, and then the user would have to tap again to activate the keyboard. Using native overlays in that case yields better UX.
When using native overlays, you will need to implement createNativeOverlay(com.codename1.ui.Component),
hideNativeOverlay(com.codename1.ui.Component, java.lang.Object), and updateNativeOverlay(com.codename1.ui.Component, java.lang.Object).
createNativeOverlay(com.codename1.ui.Component) is called in Component.initComponent() (i.e. when the component is added to the form).
This is where you would create the native view and add it to the native view hierarchy above the CN1 canvas.
updateNativeOverlay(com.codename1.ui.Component, java.lang.Object) is called in Component.laidOut() (i.e. when the component is resized/positioned).
This is where you can reposition the native view or change its properties to be appropriate for the "occasion". hideNativeOverlay(com.codename1.ui.Component, java.lang.Object)
is called in Component.deinitialize() (i.e. when the component is removed from the form). You should destroy the native view and remove it from the native view hierarchy here.
cmp - The component to create the overlay for.hideNativeOverlay(com.codename1.ui.Component, java.lang.Object),
updateNativeOverlay(com.codename1.ui.Component, java.lang.Object),
Component.showNativeOverlay()public void hideNativeOverlay(Component cmp, Object nativeOverlay)
cmp - The componentnativeOverlay - The native overlay.createNativeOverlay(com.codename1.ui.Component),
updateNativeOverlay(com.codename1.ui.Component, java.lang.Object),
Component.hideNativeOverlay()public void updateNativeOverlay(Component cmp, Object nativeOverlay)
cmp - The componentnativeOverlay - The native overlaycreateNativeOverlay(com.codename1.ui.Component),
hideNativeOverlay(com.codename1.ui.Component, java.lang.Object),
Component.updateNativeOverlay()public void setBrowserProperty(PeerComponent browserPeer, String key, Object value)
browserPeer - browser instancekey - see the documentation with the Codename One Implementation for further detailsvalue - see the documentation with the Codename One Implementation for further detailspublic String getBrowserTitle(PeerComponent browserPeer)
browserPeer - browser instancepublic String getBrowserURL(PeerComponent browserPeer)
browserPeer - browser instancepublic AsyncResource<Image> captureBrowserScreenshot(PeerComponent browserPeer)
browserPeer - The browser instanceBrowserComponent.captureScreenshot() will just use Component.toImage()
for screenshots.public void setBrowserPageInHierarchy(PeerComponent browserPeer, String url) throws IOException
browserPeer - the peer componenturl - the url relative to the HTML directoryIOExceptionpublic void setBrowserURL(PeerComponent browserPeer, String url, Map<String,String> headers)
browserPeer - browser instanceurl - the URLheaders - custom headers for the request URLpublic boolean isURLWithCustomHeadersSupported()
public void setBrowserURL(PeerComponent browserPeer, String url)
browserPeer - browser instanceurl - the URLpublic void browserReload(PeerComponent browserPeer)
browserPeer - browser instancepublic boolean browserHasBack(PeerComponent browserPeer)
browserPeer - browser instancepublic boolean browserHasForward(PeerComponent browserPeer)
browserPeer - browser instancepublic void browserBack(PeerComponent browserPeer)
browserPeer - browser instancepublic void browserStop(PeerComponent browserPeer)
browserPeer - browser instancepublic void browserDestroy(PeerComponent internal)
internal - browser instancepublic void browserForward(PeerComponent browserPeer)
browserPeer - browser instancepublic void browserClearHistory(PeerComponent browserPeer)
browserPeer - browser instancepublic void setBrowserPage(PeerComponent browserPeer, String html, String baseUrl)
browserPeer - browser instancehtml - HTML web pagebaseUrl - base URL to associate with the HTMLpublic void browserExecute(PeerComponent browserPeer, String javaScript)
browserPeer - browser instancejavaScript - the JavaScript stringpublic String browserExecuteAndReturnString(PeerComponent internal, String javaScript)
internal - The peer browser component.javaScript - The javascript to execute.public boolean supportsBrowserExecuteAndReturnString(PeerComponent internal)
public void browserExposeInJavaScript(PeerComponent browserPeer, Object o, String name)
browserPeer - browser instanceo - the object to invoke, notice all public fields and methods would be exposed to JavaScriptname - the name to expose within JavaScriptpublic int convertToPixels(int dipCount,
boolean horizontal)
dipCount - the dips that we will convert to pixelshorizontal - indicates pixels in the horizontal planepublic boolean isTablet()
public boolean isDesktop()
public boolean canDial()
public void setThreadPriority(Thread t, int p)
t - the threadp - the prioritypublic void postInit()
protected void initDefaultUserAgent()
public void setImageName(Object nativeImage, String name)
nativeImage - the native imagename - the name/file name identifying the imagepublic boolean areMutableImagesFast()
protected final void removeCookiesForDomain(String domain)
public void addCookie(Cookie[] cookiesArray)
public boolean isNativeCookieSharingSupported()
public void addCookie(Cookie c)
c - cookie to addpublic String getURLDomain(String url)
url - a urlpublic Vector getCookiesForURL(String url)
url - the url on which we are checking for cookiespublic void clearNativeCookies()
public abstract Object connect(String url, boolean read, boolean write) throws IOException
url - the URL to connect toread - indicates whether the connection will be read fromwrite - indicates whether writing will occur into the connectionIOExceptionpublic String[] getSSLCertificates(Object connection, String url) throws IOException
connection - The connection.url - The url of the connection.IOExceptionpublic boolean canGetSSLCertificates()
public boolean checkSSLCertificatesRequiresCallbackFromNative()
public void setConnectionId(Object connection, int id)
public void addConnectionToQueue(ConnectionRequest req)
req - The ConnectionRequest that is queued.public Object connect(String url, boolean read, boolean write, int timeout) throws IOException
url - the URL to connect toread - indicates whether the connection will be read fromwrite - indicates whether writing will occur into the connectiontimeout - the timeout version of this methodIOExceptionpublic void setHttpMethod(Object connection, String method) throws IOException
connection - the connection objectmethod - the method stringIOExceptionpublic abstract void setHeader(Object connection, String key, String val)
connection - the connection objectkey - the key for the headerval - the value for the headerpublic void setChunkedStreamingMode(Object connection, int bufferLen)
connection - the connection objectbufferLen - The number of bytes to write in each chunk. If chunklen
is less than or equal to zero, a default value will be used.public void cleanup(Object o)
o - Connection, Stream or other closeable objectpublic boolean isSetCursorSupported()
Form.setEnableCursors(boolean),
Component.setCursor(int),
ComponentSelector.setCursor(int)public abstract int getContentLength(Object connection)
connection - the connectionpublic abstract OutputStream openOutputStream(Object connection) throws IOException
connection - the connection to open an output stream onIOException - thrown by underlying implemnetationpublic abstract OutputStream openOutputStream(Object connection, int offset) throws IOException
connection - the connection to open an output stream onoffset - position in the fileIOException - thrown by underlying implemnetationpublic abstract InputStream openInputStream(Object connection) throws IOException
connection - the connection to open an input stream onIOException - thrown by underlying implemnetationpublic OutputStream openFileOutputStream(String file) throws IOException
file - the file to which we should open a streamIOException - thrown by underlying implemnetationpublic InputStream openFileInputStream(String file) throws IOException
file - the file to which we should open a streamIOException - thrown by underlying implemnetationpublic abstract void setPostRequest(Object connection, boolean p)
connection - the connection objectp - true for post false for getpublic abstract int getResponseCode(Object connection) throws IOException
connection - the connection objectIOException - if the request failedpublic abstract String getResponseMessage(Object connection) throws IOException
connection - the connection objectIOException - if the request failedpublic abstract String getHeaderField(String name, Object connection) throws IOException
name - field name for http headerconnection - the connection objectIOException - if the request failedpublic abstract String[] getHeaderFieldNames(Object connection) throws IOException
connection - the connection objectIOException - if the request failedpublic abstract String[] getHeaderFields(String name, Object connection) throws IOException
name - field name for http headerconnection - the connection objectIOException - if the request failedpublic boolean isTimeoutSupported()
public void setTimeout(int t)
t - time in millisecondspublic void flushStorageCache()
public void setStorageData(Object storageData)
storageData - the name for the storage or its contextpublic Object getStorageData()
public abstract void deleteStorageFile(String name)
name - the name of the storage filepublic void clearStorage()
public abstract OutputStream createStorageOutputStream(String name) throws IOException
name - the storage file nameIOExceptionpublic abstract InputStream createStorageInputStream(String name) throws IOException
name - the name of the source fileIOExceptionpublic abstract boolean storageFileExists(String name)
name - the storage file namepublic abstract String[] listStorageEntries()
public int getStorageEntrySize(String name)
name - the entry namepublic abstract String[] listFilesystemRoots()
public abstract String[] listFiles(String directory) throws IOException
directory - the directory in which files should be listedIOExceptionpublic abstract long getRootSizeBytes(String root)
root - the root directory in the filesystempublic abstract long getRootAvailableSpace(String root)
root - the root directory in the filesystempublic abstract void mkdir(String directory)
directory - the directory name to createpublic abstract void deleteFile(String file)
file - file or empty directory to deletepublic abstract boolean isHidden(String file)
file - filepublic abstract void setHidden(String file, boolean h)
file - fileh - hidden statepublic abstract long getFileLength(String file)
file - filepublic long getFileLastModified(String file)
public abstract boolean isDirectory(String file)
file - filepublic abstract boolean exists(String file)
file - filepublic abstract void rename(String file, String newName)
file - absolute file namenewName - relative new namepublic abstract char getFileSystemSeparator()
public String getLineSeparator()
public boolean isAPSupported()
public String[] getAPIds()
public int getAPType(String id)
id - access point idpublic String getAPName(String id)
id - the id of the access pointpublic String getCurrentAccessPoint()
public void setCurrentAccessPoint(String id)
id - id of the current access pointpublic boolean shouldWriteUTFAsGetBytes()
public void startThread(String name, Runnable r)
name - the name of the threadr - the runnablepublic void closingOutput(OutputStream s)
s - the closing streampublic void printStackTraceToStream(Throwable t, Writer o)
t - the exceptiono - the writerpublic void setLogListener(ActionListener al)
al - action listener to receive the callbackprotected boolean isLogged()
protected void log(String content)
content - content of the messagepublic void systemOut(String content)
content - public void logStreamCreate(String name, boolean isInput, int count)
name - the name of the streamisInput - whether the stream is an input or output streamcount - the number of streams of this typepublic void logStreamClose(String name, boolean isInput, int count)
name - the name of the streamisInput - whether the stream is an input or output streamcount - the number of streams of this typepublic void logStreamDoubleClose(String name, boolean isInput)
name - the name of the streamisInput - whether the stream is an input or output streampublic int getRootType(String root)
root - the root whose type we are checkingpublic LocationManager getLocationManager()
public void releaseImage(Object image)
image - native image objectpublic void capturePhoto(ActionListener response)
response - callback for the resulting imagepublic Image captureScreen()
public void captureAudio(ActionListener response)
public final BrowserComponent getSharedJavscriptContext()
BrowserComponent API.
When running on other platforms, this shared context will be an off-screen browser component.
protected BrowserComponent createSharedJavascriptContext()
public void captureAudio(MediaRecorderBuilder recordingOptions, ActionListener response)
response - callback for the resulting datapublic void captureVideo(ActionListener response)
response - callback for the resulting videopublic void captureVideo(VideoCaptureConstraints constraints, ActionListener response)
constraints - Constraints for the capture.response - Callback for the resulting video.Capture.captureVideo(com.codename1.capture.VideoCaptureConstraints, com.codename1.ui.events.ActionListener)public boolean isGalleryTypeSupported(int type)
type - A gallery type constant. E.g. CN1Constants.GALLERY_IMAGE, CN1Constants.GALLERY_VIDEO, CN1Constants.GALLERY_ALL, CN1Constants.GALLERY_IMAGE_MULTI, CN1Constants.GALLERY_VIDEO_MULTI, CN1Constants.GALLERY_ALL_MULTIpublic void openGallery(ActionListener response, int type)
response - a callback Object to retrieve the file pathtype - one of the following GALLERY_IMAGE, GALLERY_VIDEO, GALLERY_ALLRuntimeException - if this feature failed or unsupported on the platformpublic void openImageGallery(ActionListener response)
response - callback for the resulting imagepublic abstract String getPlatformName()
public String[] getPlatformOverrides()
public boolean shouldAutoDetectAccessPoint()
public void sendMessage(String[] recipients, String subject, Message msg)
recipients - array of e-mail addressessubject - e-mail subjectmsg - the Message to sendpublic void dial(String phoneNumber)
phoneNumber - public void sendSMS(String phoneNumber, String message, boolean interactive) throws IOException
phoneNumber - to send the smsmessage - the content of the smsIOException - if for some reason sending failedpublic int getSMSSupport()
public Image getApplicationIconImage()
public static Class getStringArrayClass()
public static Class getStringArray2DClass()
public static Class getImageArrayClass()
public static Class getObjectArrayClass()
public String[] getAllContacts(boolean withNumbers)
withNumbers - if true returns only contacts that has a numberpublic String[] getLinkedContactIds(Contact c)
c - The contactc.public Contact getContactById(String id)
id - unique id of the Contactpublic Contact[] getAllContacts(boolean withNumbers, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)
withNumbers - if true returns only contacts that has a numberincludesFullName - if true try to fetch the full name of the Contact(not just display name)includesPicture - if true try to fetch the Contact Picture if existsincludesNumbers - if true try to fetch all Contact numbersincludesEmail - if true try to fetch all Contact EmailsincludeAddress - if true try to fetch all Contact Addressespublic boolean isGetAllContactsFast()
public Contact getContactById(String id, boolean includesFullName, boolean includesPicture, boolean includesNumbers, boolean includesEmail, boolean includeAddress)
id - of the ContactincludesFullName - if true try to fetch the full name of the Contact(not just display name)includesPicture - if true try to fetch the Contact Picture if existsincludesNumbers - if true try to fetch all Contact numbersincludesEmail - if ture try to fetch all Contact EmailsincludeAddress - if ture try to fetch all Contact Addressespublic String createContact(String firstName, String surname, String officePhone, String homePhone, String cellPhone, String email)
firstName - the Contact firstNamesurname - the Contact familyNameofficePhone - the Contact work phone or nullhomePhone - the Contact home phone or nullcellPhone - the Contact mobile phone or nullemail - the Contact email or nullpublic boolean isContactsPermissionGranted()
public boolean deleteContact(String id)
id - the contact id to removepublic boolean isNativeShareSupported()
public void share(String text, String image, String mimeType)
text - String to share.image - file path to the image or nullmimeType - type of the image or null if no image to sharepublic void share(String text, String image, String mimeType, Rectangle sourceRect)
text - String to share.image - file path to the image or nullmimeType - type of the image or null if no image to sharesourceRect - The bounds of the button that was clicked to initiate
the share. This is used by some platforms (e.g. iPad2 on iOS 8 or
higher) to dictate where the popover dialog should be placed.public void beforeComponentPaint(Component c, Graphics g)
c - the component about to be paintedpublic void afterComponentPaint(Component c, Graphics g)
c - the component that was paintedpublic void nothingWithinComponentPaint(Component c)
c - the component that won't be paintedpublic void componentRemoved(Component c)
c - the removed component.public abstract L10NManager getLocalizationManager()
protected String getPackageName()
public boolean isTransformSupported()
isTransformSupported(java.lang.Object) but it is more general as it only verifies
that transforms can be performed, but not necessarily that they will be respected
by any particular graphics context.isTransformSupported(java.lang.Object)public boolean isPerspectiveTransformSupported()
isPerspectiveTransformSupported(java.lang.Object) but it is more general as it only verifies
that transforms can be performed, but not necessarily that they will be respected
by any particular graphics context.public Object makeTransformTranslation(float translateX, float translateY, float translateZ)
Transform class.
This can only be used if isTransformSupported() returns true.
translateX - The x-coordinate of the translation.translateY - The y-coordinate of the translation.translateZ - The z-coordinate of the translation.isTransformSupported()public void setTransformTranslation(Object nativeTransform, float translateX, float translateY, float translateZ)
public Object makeTransformScale(float scaleX, float scaleY, float scaleZ)
Transform class.
This can only be used if isTransformSupported() returns true.
scaleX - The x-scale factor of the transform.scaleY - The y-scale factor of the transform.scaleZ - The z-scale factor of the transform.isTransformSupported()public Object makeTransformAffine(double m00, double m10, double m01, double m11, double m02, double m12)
m00 - the X coordinate scaling element of the 3x3 matrixm10 - the Y coordinate shearing element of the 3x3 matrixm01 - the X coordinate shearing element of the 3x3 matrixm11 - the Y coordinate scaling element of the 3x3 matrixm02 - the X coordinate translation element of the 3x3 matrixm12 - the Y coordinate translation element of the 3x3 matrixpublic void setTransformAffine(Object nativeTransform, double m00, double m10, double m01, double m11, double m02, double m12)
nativeTransform - Platform-specific native transform.m00 - the X coordinate scaling element of the 3x3 matrixm10 - the Y coordinate shearing element of the 3x3 matrixm01 - the X coordinate shearing element of the 3x3 matrixm11 - the Y coordinate scaling element of the 3x3 matrixm02 - the X coordinate translation element of the 3x3 matrixm12 - the Y coordinate translation element of the 3x3 matrixpublic void setTransformScale(Object nativeTransform, float scaleX, float scaleY, float scaleZ)
public Object makeTransformRotation(float angle, float x, float y, float z)
Transform class.
This can only be used if isTransformSupported() returns true.
angle - The angle to rotate.x - The x-component of the vector around which to rotate.y - The y-component of the vector around which to rotate.z - The z-component of the vector around which to rotate.isTransformSupported()public void setTransformRotation(Object nativeTransform, float angle, float x, float y, float z)
public Object makeTransformPerspective(float fovy, float aspect, float zNear, float zFar)
Transform class.
This can only be used if isPerspectiveTransformSupported() returns true.
fovy - The y field of view angle.aspect - The aspect ratio.zNear - The nearest visible z coordinate.zFar - The farthest z coordinate.isPerspectiveTransformSupported()public void setTransformPerspective(Object nativeTransform, float fovy, float aspect, float zNear, float zFar)
public Object makeTransformOrtho(float left, float right, float bottom, float top, float near, float far)
Transform class.
This can only be used if isPerspectiveTransformSupported() returns true.
left - x-coordinate that is the left edge of the view.right - The x-coordinate that is the right edge of the view.bottom - The y-coordinate that is the bottom edge of the view.top - The y-coordinate that is the top edge of the view.near - The nearest visible z-coordinate.far - The farthest visible z-coordinate.isPerspectiveTransformSupported()public void setTransformOrtho(Object nativeTransform, float left, float right, float bottom, float top, float near, float far)
public Object makeTransformCamera(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
Transform class.
This can only be used if isTransformSupported() returns true.
eyeX - The x-coordinate of the camera's eye.eyeY - The y-coordinate of the camera's eye.eyeZ - The z-coordinate of the camera's eye.centerX - The center x coordinate of the view.centerY - The center y coordinate of the view.centerZ - The center z coordinate of the view.upX - The x-coordinate of the up vector for the camera.upY - The y-coordinate of the up vector for the camera.upZ - The z-coordinate of the up vector for the camera.isPerspectiveTransformSupported()public void setTransformCamera(Object nativeTransform, float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ)
public void transformRotate(Object nativeTransform, float angle, float x, float y, float z)
nativeTransform - The transform to rotate. Each implementation can decide the format
to use internally for transforms. This should return a transform in that internal format.
This is used by the Transform class.
This can only be used if isTransformSupported() returns true.
angle - The angle to rotate.x - The x-coordinate of the vector around which to rotate.y - The y-coordinate of the vector around which to rotate.z - The z-coordinate of the vector around which to rotate.isTransformSupported()public void transformTranslate(Object nativeTransform, float x, float y, float z)
nativeTransform - The native transform to translate. Each implementation can decide the format
to use internally for transforms. This should return a transform in that internal format.
This is used by the Transform class.
This can only be used if isTransformSupported() returns true.
x - The x translation.y - The y translation.z - The z translation.isTransformSupported()public void transformScale(Object nativeTransform, float x, float y, float z)
nativeTransform - Each implementation can decide the format
to use internally for transforms. This should return a transform in that internal format.
This is used by the Transform class.
This can only be used if isTransformSupported() returns true.
x - The x-scale factory - The y-scale factorz - The z-scale factorisTransformSupported()public Object makeTransformInverse(Object nativeTransform)
nativeTransform - The native transform of which to make the inverse. Each implementation can decide the format
to use internally for transforms. This should return a transform in that internal format.
This is used by the Transform class.
This can only be used if isTransformSupported() returns true.
Transform class.isTransformSupported()public void setTransformInverse(Object nativeTransform) throws Transform.NotInvertibleException
Transform.NotInvertibleExceptionpublic Object makeTransformIdentity()
Transform class.
This can only be used if isTransformSupported() returns true.
isTransformSupported()public void setTransformIdentity(Object transform)
transform - public void copyTransform(Object src, Object dest)
Transform class.
This can only be used if isTransformSupported() returns true.
src - The source native transform.dest - The destination native transform.isTransformSupported()public void concatenateTransform(Object t1, Object t2)
This can only be used if isTransformSupported() returns true.
t1 - The left native transform. The result will also be stored in this transform.t2 - The right native transform.isTransformSupported()public void transformPoint(Object nativeTransform, float[] in, float[] out)
nativeTransform - The native transform to use for the transformation. Each implementation can decide the format
to use internally for transforms. This should return a transform in that internal format.
This can only be used if isTransformSupported() returns true.
Transform class.in - A 2 or 3 element array representing either an (x,y) or (x,y,z) tuple to be transformed.out - A 2 or 3 element array (length should match ) to store the result of the transformation.isTransformSupported()public void transformPoints(Object nativeTransform, int pointSize, float[] in, int srcPos, float[] out, int destPos, int numPoints)
nativeTransform - The transform to use for transforming the pointspointSize - The size of the points (either 2 or 3)in - Input array of points.srcPos - The start position of the input arrayout - The output array of pointsdestPos - The start position of the output array.numPoints - The number of points to transform.public void translatePoints(int pointSize,
float tX,
float tY,
float tZ,
float[] in,
int srcPos,
float[] out,
int destPos,
int numPoints)
pointSize - The size of each point (2 or 3)tX - Size of translation along x-axistY - Size of translation along y-axistZ - Size of translation along z-axis (only used if pointSize == 3)in - Input array of points.srcPos - Start position in input arrayout - Output array of pointsdestPos - Start position in output arraynumPoints - Number of points to translate.public void scalePoints(int pointSize,
float sX,
float sY,
float sZ,
float[] in,
int srcPos,
float[] out,
int destPos,
int numPoints)
pointSize - The size of each point (2 or 3)sX - Scale factor along x-axissY - Scale factor along y-axissZ - Scale factor along z-axis (only used if pointSize == 3)in - Input array of points.srcPos - Start position in input arrayout - Output array of pointsdestPos - Start position in output arraynumPoints - Number of points to translate.public void refreshContacts()
public void getTransform(Object nativeGraphics, Transform t)
nativeGraphics - t - public boolean isScrollWheeling()
public void blockCopyPaste(boolean blockCopyPaste)
blockCopyPaste - True to block copy and paste. False to enable it.public boolean isDatabaseCustomPathSupported()
openOrCreateDB(java.lang.String)
will accept a file path (starting with "file://"public boolean requestFullScreen()
public boolean exitFullScreen()
public boolean isInFullScreenMode()
public boolean isFullScreenSupported()
requestFullScreen() should enter full-screen mode.public void initializeTextSelection(TextSelection aThis)
deinitializeTextSelection(com.codename1.ui.TextSelection)aThis - deinitializeTextSelection(com.codename1.ui.TextSelection)public void deinitializeTextSelection(TextSelection aThis)
aThis - initializeTextSelection(com.codename1.ui.TextSelection)public Object createHeavyButton(Button aThis)
HeavyButton. A HeavyButton
is a button that has a native button displayed over top of it. It is primarily used
in the Javascript port where some functions can only be executed as a direct result
of user interaction.aThis - The lightweight button for which a heavy peer is createdaddHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener)public void addHeavyActionListener(Object peer, ActionListener l)
ActionListener.actionPerformed(com.codename1.ui.events.ActionEvent) will
be executed on the native UI thread, not the EDT.peer - The peer.l - The action listener.createHeavyButton(com.codename1.ui.Button),
removeHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener)public void removeHeavyActionListener(Object peer, ActionListener l)
peer - THe heavy button peer.l - The action listener.addHeavyActionListener(java.lang.Object, com.codename1.ui.events.ActionListener),
createHeavyButton(com.codename1.ui.Button)public void updateHeavyButtonBounds(Object peer, int x, int y, int width, int height)
peer - The heavy peer.x - The absolute X coordinate of the light peer.y - The absolute Y coordinate of the light peer.width - The width of the light peer.height - The height of the light peer.public void initHeavyButton(Object peer)
peer - The heavy peer.createHeavyButton(com.codename1.ui.Button)public void deinitializeHeavyButton(Object peer)
peer - The heavy peer.initHeavyButton(java.lang.Object),
createHeavyButton(com.codename1.ui.Button)public boolean requiresHeavyButtonForCopyToClipboard()
createHeavyButton(com.codename1.ui.Button)public void copySelectionToClipboard(TextSelection sel)
sel - The current TextSelection instance for the current form.public void setRenderingHints(Object nativeGraphics, int hints)
nativeGraphics - The native graphics contexthints - HintsGraphics.RENDERING_HINT_FASTpublic int getRenderingHints(Object nativeGraphics)
nativeGraphics - The native graphics context.Graphics.RENDERING_HINT_FASTpublic void startRemoteControl()
RemoteControlListener with
the platform's remote control.
This is executed when the user registers a new listener using MediaManager.setRemoteControlListener(com.codename1.media.RemoteControlListener)
public void stopRemoteControl()
RemoteControlListener with the platform's remote control.
This is executed when a new listener is registered using MediaManager.setRemoteControlListener(com.codename1.media.RemoteControlListener)
public void setReadTimeout(Object connection, int readTimeout)
connection - readTimeout - public void setInsecure(Object connection, boolean insecure)
connection - insecure - True to make connection insecure.ConnectionRequest.setInsecure(boolean),
ConnectionRequest.isInsecure()public boolean isReadTimeoutSupported()
public Object createNativeBrowserWindow(String startURL)
startURL - The Start URL to open in the browser window.BrowserWindow,
addNativeBrowserWindowOnLoadListener(java.lang.Object, com.codename1.ui.events.ActionListener),
removeNativeBrowserWindowOnLoadListener(java.lang.Object, com.codename1.ui.events.ActionListener),
nativeBrowserWindowAddCloseListener(java.lang.Object, com.codename1.ui.events.ActionListener),
nativeBrowserWindowRemoveCloseListener(java.lang.Object, com.codename1.ui.events.ActionListener),
nativeBrowserWindowCleanup(java.lang.Object),
nativeBrowserWindowHide(java.lang.Object),
nativeBrowserWindowShow(java.lang.Object),
nativeBrowserWindowSetTitle(java.lang.Object, java.lang.String),
nativeBrowserWindowSetSize(java.lang.Object, int, int),
nativeBrowserWindowEval(java.lang.Object, com.codename1.ui.BrowserWindow.EvalRequest)public void addNativeBrowserWindowOnLoadListener(Object window, ActionListener l)
window - The window to add the listener to.l - The listenercreateNativeBrowserWindow(java.lang.String)public void removeNativeBrowserWindowOnLoadListener(Object window, ActionListener l)
window - The window from which to remove the listener.l - The listenercreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowSetSize(Object window, int width, int height)
window - The windowwidth - The width in pixels.height - The height in pixels.createNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowSetTitle(Object window, String title)
window - The windowtitle - The titlecreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowShow(Object window)
window - The windowcreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowHide(Object window)
window - The windowcreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowCleanup(Object window)
window - The windowcreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowEval(Object window, BrowserWindow.EvalRequest req)
window - The windowreq - The javascript eval request.createNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowAddCloseListener(Object window, ActionListener l)
window - The window.l - The listenercreateNativeBrowserWindow(java.lang.String)public void nativeBrowserWindowRemoveCloseListener(Object window, ActionListener l)
window - The window.l - The listenercreateNativeBrowserWindow(java.lang.String)public void registerPush(Hashtable metaData, boolean noFallback)
noFallback - some devices don't support an efficient push API and will resort to polling
to provide push like functionality. If this flag is set to true no polling will occur and
the error PushCallback.REGISTRATION_ERROR_SERVICE_NOT_AVAILABLE will be sent to the push interface.public void deregisterPush()
public Media createMediaRecorder(String path, String mimeType) throws IOException
path - a file path to where to store the recording, if the file does
not exists it will be created.mimeType - the output mime type that is supported see
getAvailableRecordingMimeTypes()IOExceptionpublic Media createMediaRecorder(MediaRecorderBuilder builder) throws IOException
builder - THe media builder with settings for the recorder.
getAvailableRecordingMimeTypes()IOExceptionprotected static void stopPolling()
protected static String getApplicationKey()
public static boolean registerServerPush(String id, String applicationKey, byte pushType, String udid, String packageName)
id - the platform specific push IDapplicationKey - the unique id of the applicationpushType - for server side typepackageName - the application package name used by the push servicepublic static void registerPushOnServer(String id, String applicationKey, byte pushType, String udid, String packageName)
id - the platform specific push IDapplicationKey - the unique id of the applicationpushType - for server side typepackageName - the application package name used by the push serviceprotected final void sendRegisteredForPush(String id)
protected final void pushReceived(String data)
public static void deregisterPushFromServer()
public void setPollingFrequency(int freq)
freq - the frequency in millisecondsprotected static void registerPollingFallback()
public ImageIO getImageIO()
public boolean instanceofObjArray(Object o)
public boolean instanceofByteArray(Object o)
public boolean instanceofShortArray(Object o)
public boolean instanceofLongArray(Object o)
public boolean instanceofIntArray(Object o)
public boolean instanceofFloatArray(Object o)
public boolean instanceofDoubleArray(Object o)
public String[] getAvailableRecordingMimeTypes()
public Database openOrCreateDB(String databaseName) throws IOException
databaseName - the name of the databaseIOException - if database cannot be createdpublic void deleteDB(String databaseName) throws IOException
databaseName - the name of the databaseIOException - if database cannot be deletedpublic boolean existsDB(String databaseName)
databaseName - the name of the databasepublic String getDatabasePath(String databaseName)
public boolean isNativeTitle()
public void refreshNativeTitle()
public int getCommandBehavior()
public void setCommandBehavior(int commandBehavior)
commandBehavior - the commandBehavior to setpublic Object notifyStatusBar(String tickerText, String contentTitle, String contentBody, boolean vibrate, boolean flashLights, Hashtable args)
tickerText - the ticker text of the NotificationcontentTitle - the title of the NotificationcontentBody - the content of the Notificationvibrate - enable/disable notification alertflashLights - enable/disable notification flashingargs - additional arguments to the notificationpublic boolean isNotificationSupported()
public void dismissNotification(Object o)
o - the object returned from the notifyStatusBar methodpublic boolean isBadgingSupported()
public void setBadgeNumber(int number)
number - number to show on the iconpublic boolean isOpenNativeNavigationAppSupported()
public void openNativeNavigationApp(double latitude,
double longitude)
latitude - longitude - public void openNativeNavigationApp(String location)
location - the location to search for in the native navigation mappublic String getUdid()
public String getMsisdn()
public Purchase getInAppPurchase()
public CodeScanner getCodeScanner()
public String toNativePath(String path)
path - The file system storage path.public String getAppHomePath()
public boolean hasCachesDir()
public String getCachesDir()
hasCachesDir()
is falsepublic boolean isUseNativeCookieStore()
public void setUseNativeCookieStore(boolean useNativeCookieStore)
useNativeCookieStore - the useNativeCookieStore to setpublic boolean shouldPaintBackground()
public Transition getNativeTransition(Transition t)
t - the transition that is about to executepublic boolean isScreenLockSupported()
public void lockScreen()
public void unlockScreen()
public boolean hasCamera()
public int getEDTThreadPriority()
public void drawingEncodedImage(EncodedImage img)
img - the image being drawnpublic boolean isNativePickerTypeSupported(int pickerType)
pickerType - the picker type constantpublic Object showNativePicker(int type, Component source, Object currentValue, Object data)
type - the picker type constantsource - the source component (optional) the native dialog will be placed in relation to this
component if applicablecurrentValue - the currently selected valuedata - additional meta data specific to the picker type when applicablepublic Object connectSocket(String host, int port)
host - the hostport - the portpublic Object connectSocket(String host, int port, int connectTimeout)
host - the hostport - the portconnectTimeout - connect timeout. 0 for infinite timeout.public Object listenSocket(int port)
port - the port to listen onpublic String getHostOrIP()
public void disconnectSocket(Object socket)
socket - the socket instancepublic boolean isSocketConnected(Object socket)
socket - is the socket we are connected topublic boolean isServerSocketAvailable()
public boolean isSocketAvailable()
public String getSocketErrorMessage(Object socket)
socket - the socket instancepublic int getSocketErrorCode(Object socket)
socket - the socket instancepublic int getSocketAvailableInput(Object socket)
socket - the socket instancepublic byte[] readFromSocketStream(Object socket)
socket - the socket objectpublic void writeToSocketStream(Object socket, byte[] data)
socket - the socket instancedata - the data writtenpublic void installTar()
throws IOException
IOExceptionpublic boolean isSimulator()
public void paintComponentBackground(Object nativeGraphics, int x, int y, int width, int height, Style s)
nativeGraphics - the graphics contextx - coordinate to drawy - coordinate to drawwidth - coordinate to drawheight - coordinate to draws - the style object to drawpublic void fillRect(Object nativeGraphics, int x, int y, int w, int h, byte alpha)
nativeGraphics - the underlying native graphics objectx - the x coordinate of the rectangle to be filledy - the y coordinate of the rectangle to be filledw - the width of the rectangle to be filledh - the height of the rectangle to be filledalpha - the alpha values specify semitransparencypublic void drawLabelComponent(Object nativeGraphics, int cmpX, int cmpY, int cmpHeight, int cmpWidth, Style style, String text, Object icon, Object stateIcon, int preserveSpaceForState, int gap, boolean rtl, boolean isOppositeSide, int textPosition, int stringWidth, boolean isTickerRunning, int tickerShiftText, boolean endsWith3Points, int valign)
protected int drawLabelText(Object nativeGraphics, int textDecoration, boolean rtl, boolean isTickerRunning, boolean endsWith3Points, Object nativeFont, int txtW, int textSpaceW, int shiftText, String text, int x, int y, int fontHeight)
nativeGraphics - graphics contexttextDecoration - decoration information for the texttext - the text for the labelx - position for the labely - position for the labeltxtW - stringWidth(text) equivalent which is faster than just
invoking string width all the timetextSpaceW - the width available for the componentpublic void drawString(Object nativeGraphics, Object nativeFont, String str, int x, int y, int textDecoration)
nativeGraphics - the graphics contextnativeFont - the font usedstr - the string to be drawn.x - the x coordinate.y - the y coordinate.textDecoration - Text decoration bitmask (See Style's
TEXT_DECORATION_* constants)public void setPlatformHint(String key, String value)
key - the keyvalue - the valuepublic void scheduleLocalNotification(LocalNotification notif, long firstTime, int repeat)
public void cancelLocalNotification(String notificationId)
public void setPreferredBackgroundFetchInterval(int seconds)
This method must be called in order to activate background fetch.>
Note: If the platform doesn't support background fetch (i.e. isBackgroundFetchSupported() returns false,
then this method does nothing.
seconds - The time interval in seconds.isBackgroundFetchSupported(),
getPreferredBackgroundFetchInterval(),
BackgroundFetch,
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)public int getPreferredBackgroundFetchInterval()
isBackgroundFetchSupported(),
setPreferredBackgroundFetchInterval(int),
BackgroundFetch,
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)public boolean isBackgroundFetchSupported()
setPreferredBackgroundFetchInterval(int),
getPreferredBackgroundFetchInterval(),
BackgroundFetch,
com.codename1.ui.Display.setPreferredBackgroundFetchInterval(int)public boolean isGaussianBlurSupported()
public boolean isJailbrokenDevice()
public Map<String,String> getProjectBuildHints()
public void setProjectBuildHint(String key, String value)
key - the build hint without the codename1.arg. prefixvalue - the value for the hintpublic boolean canInstallOnHomescreen()
Best practice is to use onCanInstallOnHomescreen(java.lang.Runnable) to be notified
when you are allowed to prompt the user for installation. Then call promptInstallOnHomescreen()
inside that method - or sometime after.
onCanInstallOnHomescreen(()->{
if (canInstallOnHomescreen()) {
if (promptInstallOnHomescreen()) {
// User accepted installation
} else {
// user rejected installation
}
}
});
https://developers.google.com/web/fundamentals/app-install-banners/promptInstallOnHomescreen(),
onCanInstallOnHomescreen(java.lang.Runnable)public boolean promptInstallOnHomescreen()
canInstallOnHomescreen(),
onCanInstallOnHomescreen(java.lang.Runnable)public void onCanInstallOnHomescreen(Runnable r)
r - Runnable that will be run when/if you are permitted to prompt the user to install
the app on their homescreen.public boolean supportsNativeTextAreaVerticalAlignment()
public void postMessage(MessageEvent message)
message - The message.public Boolean isDarkMode()
Copyright © 2021. All rights reserved.