com.sun.lwuit.impl
Class LWUITImplementation

java.lang.Object
  extended by com.sun.lwuit.impl.LWUITImplementation

public abstract class LWUITImplementation
extends java.lang.Object

Represents a vendor extension mechanizm for LWUIT, WARNING: this class is for internal use only and is subject to change in future API revisions. To replace the way in which LWUIT performs its task this class can be extended and its functionality replaced or enhanced.

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 Summary
LWUITImplementation()
           
 
Method Summary
 boolean animateImage(java.lang.Object nativeImage, long lastFrame)
          Callback to allow images animated by the underlying system to change their state e.g. for SVG or animated gif support.
 void browserBack(PeerComponent browserPeer)
          Navigates back in the history
 void browserClearHistory(PeerComponent browserPeer)
          Clears navigation history
 void browserExecute(PeerComponent browserPeer, java.lang.String javaScript)
          Executes the given JavaScript string within the current context
 void browserExposeInJavaScript(PeerComponent browserPeer, java.lang.Object o, java.lang.String name)
          Allows exposing the given object to JavaScript code so the JavaScript code can invoke methods and access fields on the given object.
 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
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 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 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
abstract  int charsWidth(java.lang.Object nativeFont, char[] ch, int offset, int length)
          Return the width of the given characters in the given native font instance
abstract  int charWidth(java.lang.Object nativeFont, char ch)
          Return the width of the specific character when rendered alone
 void cleanupAudio(java.lang.Object handle)
          Stops the audio playback and cleans up the resources related to it immediately.
abstract  void clipRect(java.lang.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(java.lang.Object graphics, Rectangle rect)
          Changes the current clipping rectangle to subset the current clipping with the given clipping.
 void confirmControlView()
          Callback method allowing the implementation to confirm that it controls the view just before a new form is installed.
 java.lang.String convertBidiLogicalToVisual(java.lang.String s)
          Converts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen.
protected  java.lang.Object convertBuiltinSound(java.io.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 copyToClipboard(java.lang.Object obj)
          Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used
 java.lang.Object createAudio(java.io.InputStream stream, java.lang.String mimeType, java.lang.Runnable onCompletion)
          Plays the sound in the given stream
 java.lang.Object createAudio(java.lang.String uri, java.lang.Runnable onCompletion)
          Plays the sound in the given URI which is partially platform specific.
 PeerComponent createBrowserComponent(java.lang.Object browserComponent)
          If the implementation supports the creation of a browser component it should be returned in this method
abstract  java.lang.Object createFont(int face, int style, int size)
          Creates a new instance of a native font
abstract  java.lang.Object createImage(byte[] bytes, int offset, int len)
          Create a nativate image from its compressed byte data
abstract  java.lang.Object createImage(java.io.InputStream i)
          Creates a native image from a given input stream
abstract  java.lang.Object createImage(int[] rgb, int width, int height)
          Create a platform native image object from the given RGB data
abstract  java.lang.Object createImage(java.lang.String path)
          Creates a native image from a file in the system jar
abstract  java.lang.Object createMutableImage(int width, int height, int fillColor)
          Creates a modifable native image that can return a graphics object
 java.lang.Object createNativeIndexed(IndexedImage image)
          Creates a native image representing the indexed image
 PeerComponent createNativePeer(java.lang.Object nativeComponent)
          Creates a peer component for the given lightweight component
 java.lang.Object createSoftWeakRef(java.lang.Object o)
          Creates a soft/weak reference to an object that allows it to be collected yet caches it.
 java.lang.Object createSVGImage(java.lang.String baseURL, byte[] data)
          Creates an SVG Image from the given byte array data and the base URL
 java.lang.Object createVideoComponent(java.lang.Object player)
          Deprecated. replaced by the new video component
 VideoComponent createVideoPeer(java.io.InputStream stream, java.lang.String type)
          Create a video component
 VideoComponent createVideoPeer(java.lang.String url)
          Create a video component
 void deinitialize()
          Allows subclasses to cleanup if necessary
abstract  void drawArc(java.lang.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(java.lang.Object graphics, java.lang.Object img, int x, int y)
          Draws the image so its top left coordinate corresponds to x/y
 void drawImage(java.lang.Object graphics, java.lang.Object img, int x, int y, int w, int h)
          Draws the image so its top left coordinate corresponds to x/y
 void drawImageArea(java.lang.Object nativeGraphics, java.lang.Object img, int x, int y, int imageX, int imageY, int imageWidth, int imageHeight)
          Draws a portion of the image
 void drawImageRotated(java.lang.Object graphics, java.lang.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
abstract  void drawLine(java.lang.Object graphics, int x1, int y1, int x2, int y2)
          Draws a line between the 2 X/Y coordinates
 void drawPolygon(java.lang.Object graphics, int[] xPoints, int[] yPoints, int nPoints)
          Draws a closed polygon defined by arrays of x and y coordinates.
abstract  void drawRect(java.lang.Object graphics, int x, int y, int width, int height)
          Draws a rectangle in the given coordinates
abstract  void drawRGB(java.lang.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(java.lang.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.
abstract  void drawString(java.lang.Object graphics, java.lang.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, java.lang.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(java.lang.String url)
          Executes the given URL on the native platform
 void exitApplication()
          Exits the application...
 java.lang.Object extractHardRef(java.lang.Object o)
          Extracts the hard reference from the soft/weak reference given
abstract  void fillArc(java.lang.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(java.lang.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(java.lang.Object graphics, int[] xPoints, int[] yPoints, int nPoints)
          Fills a closed polygon defined by arrays of x and y coordinates.
 void fillRadialGradient(java.lang.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.
abstract  void fillRect(java.lang.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 fillRectRadialGradient(java.lang.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(java.lang.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 fillTriangle(java.lang.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
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
abstract  int getAlpha(java.lang.Object graphics)
          Alpha value from 0-255 can be ignored for some operations
 int getAudioDuration(java.lang.Object handle)
          Returns the length in milli seconds of the audio file
 int getAudioTime(java.lang.Object handle)
          Returns the time in seconds in the audio file
abstract  int getBackKeyCode()
          Returns the keycode for the back key
abstract  int getBackspaceKeyCode()
          Returns the keycode for the backspace key
 java.lang.String getBrowserTitle(PeerComponent browserPeer)
          The page title
 java.lang.String getBrowserURL(PeerComponent browserPeer)
          The page URL
 int getCharLocation(java.lang.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. logical ordering.
abstract  int getClearKeyCode()
          Returns the keycode for the clear key
abstract  int getClipHeight(java.lang.Object graphics)
          Returns the clipping coordinate
 Rectangle getClipRect(java.lang.Object graphics)
          Returns the internal clipping rectangle.
abstract  int getClipWidth(java.lang.Object graphics)
          Returns the clipping coordinate
abstract  int getClipX(java.lang.Object graphics)
          Returns the clipping coordinate
abstract  int getClipY(java.lang.Object graphics)
          Returns the clipping coordinate
abstract  int getColor(java.lang.Object graphics)
          Returns the current color
 Graphics getComponentScreenGraphics(Component cmp, Graphics currentContext)
          This method allows customizing/creating a graphics context per component which is useful for some elaborate implementations of LWUIT.
 Form getCurrentForm()
          Returns the current form, this method is for internal use only and does not take transitions/menus into consideration
abstract  java.lang.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 alwyas correspond to resolution and an implementation might decide to change the density based on DPI constraints.
abstract  int getDisplayHeight()
          Returns the height dimention of the display controlled by this implementation
 java.lang.Object getDisplayLock()
          Returns a lock object which can be synchrnoized against, this lock is used by the EDT.
abstract  int getDisplayWidth()
          Returns the width dimention 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.
 int getFace(java.lang.Object nativeFont)
          Optional operation returning the font face for the font
 java.lang.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 LWUIT for the game action behavior
abstract  int getHeight(java.lang.Object nativeFont)
          Return the total height of the font
abstract  int getImageHeight(java.lang.Object i)
          Returns the height of a native image
abstract  int getImageWidth(java.lang.Object i)
          Returns the width of a native image
 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
protected  Graphics getLWUITGraphics()
          Returns a graphics object for use by the painting
 long getMediaTime(java.lang.Object player)
          Deprecated. replaced by the new video component
abstract  java.lang.Object getNativeGraphics()
          Returns the native graphics object on which all rendering operations occur
abstract  java.lang.Object getNativeGraphics(java.lang.Object image)
          Returns the native graphics object on the given native image occur
 java.lang.Object getPasteDataFromClipboard()
          Returns the current content of the clipboard
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns the property from the underlying platform deployment or the default value if no deployment values are supported.
 java.io.InputStream getResourceAsStream(java.lang.Class cls, java.lang.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  void getRGB(java.lang.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
 int getSize(java.lang.Object nativeFont)
          Optional operation returning the font size for system fonts
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
 int getStyle(java.lang.Object nativeFont)
          Optional operation returning the font style for system fonts
 java.lang.Object getSVGDocument(java.lang.Object svgImage)
          Returns a platform specific DOM object that can be manipulated by the user to change the SVG Image
 int getTranslateX(java.lang.Object graphics)
          Returns the current x translate value
 int getTranslateY(java.lang.Object graphics)
          Returns the current y translate value
 java.lang.Object getVideoControl(java.lang.Object player)
          Returns the video control for the media player
 int getVideoHeight(java.lang.Object videoControl)
          Deprecated. replaced by the new video component
 int getVideoWidth(java.lang.Object videoControl)
          Deprecated. replaced by the new video component
 int getVolume()
          Returns the media playback volume in percentage
 boolean handleEDTException(java.lang.Throwable err)
          Invoked when an exception occurs on the EDT, allows the implementation to take control of the device to produce testing information.
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.
protected  void hideNotify()
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
abstract  void init(java.lang.Object m)
          Invoked by the display init method allowing the implementation to "bind"
 void initEDT()
          Some implementations might need to perform initializations of the EDT thread
 void installBuiltinSound(java.lang.String soundIdentifier, java.io.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).
 void installNativeTheme()
          Installs the native theme, this is only applicable if hasNativeTheme() returned true.
 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 isAnimation(java.lang.Object nativeImage)
          Animations should return true to allow the native image animation to update
 boolean isAntiAliased(java.lang.Object graphics)
          Returns anti-aliasing mode for regular rendering operations
 boolean isAntiAliasedText(java.lang.Object graphics)
          Returns anti-aliasing mode for font rendering operations
 boolean isAntiAliasedTextSupported()
          Indicates whether the underlying implementation allows for anti-aliased fonts
 boolean isAntiAliasingSupported()
          Indicates whether the underlying implementation allows for anti-aliasing in regular drawing operations
 boolean isBidiAlgorithm()
          Indicates whether LWUIT should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
 boolean isBuiltinSoundAvailable(java.lang.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 isLookupFontSupported()
          Indicates whether loading a font by a string is supported by the platform
 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 isNativeIndexed()
          Returns true if indexed images should be used natively
 boolean isNativeInputSupported()
          Indicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.
 boolean isOpaque(Image lwuitImage, java.lang.Object nativeImage)
          Returns true if the image was opaque
 boolean isPortrait()
          Returns true if the device is currently in portrait mode
 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 LWUIT will just scale the images on its own before drawing
 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
abstract  boolean isTouchDevice()
          Returns true if the device will send touch events
 boolean isTranslationSupported()
          LWUIT 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 stream.
protected  void keyPressed(int keyCode)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void keyReleased(int keyCode)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
 java.lang.Object loadNativeFont(java.lang.String lookup)
          Loads a native font based on a lookup for a font name and attributes.
 java.lang.Object loadTrueTypeFont(java.io.InputStream stream)
          Loads the truetype font from the input stream without closing the stream, this method should return the native font.
 void lockOrientation(boolean portrait)
          On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode
 boolean minimizeApplication()
          Minimizes the current application if minimization is supported by the platform (may fail).
 void notifyCommandBehavior(int commandBehavior)
          This method notifies the implementation about the chosen commands behavior
 int numAlphaLevels()
          Return the number of alpha levels supported by the implementation.
 int numColors()
          Returns the number of colors applicable on the device, note that the API does not support gray scale devices.
 void paintDirty()
          Invoked by the EDT to paint the dirty regions
protected  void paintOverlay(Graphics g)
          Allows for painting an overlay on top of the implementation for notices during testing etc.
 void paintVideo(Component cmp, boolean fullScreen, java.lang.Object nativeGraphics, java.lang.Object video, java.lang.Object player)
          Deprecated. replaced by the version that accepts the video component instance
 void pauseAudio(java.lang.Object handle)
          Pauses the playback of the audio file
 void playAudio(java.lang.Object handle)
          Starts playing the audio file
 void playBuiltinSound(java.lang.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(java.lang.Object data)
          This method allows implementations to store sound objects natively e.g.
protected  boolean playUserSound(java.lang.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 LWUIT.
protected  void pointerDragged(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHover(int[] x, int[] y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHover(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHoverPressed(int[] x, int[] y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHoverPressed(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHoverReleased(int[] x, int[] y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerHoverReleased(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerPressed(int[] x, int[] y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerPressed(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerReleased(int[] x, int[] y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
protected  void pointerReleased(int x, int y)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
 void repaint(Animation cmp)
          Invoked to add an element to the paintQueue
 void resetAffine(java.lang.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(java.lang.Object nativeGraphics, float angle)
          Rotates the coordinate system around a radian angle using the affine transform
 java.lang.Object rotate(java.lang.Object image, int degrees)
          Returns an instance of this image rotated by the given number of degrees.
 void saveTextEditingState()
          Invoked if LWUIT needs to dispose the native text editing but would like the editor to store its state.
 void scale(java.lang.Object nativeGraphics, float x, float y)
          Scales the coordinate system using the affine transform
abstract  java.lang.Object scale(java.lang.Object nativeImage, int width, int height)
          Scales a native image and returns the scaled version
abstract  void setAlpha(java.lang.Object graphics, int alpha)
          Alpha value from 0-255 can be ignored for some operations
 void setAntiAliased(java.lang.Object graphics, boolean a)
          Toggles anti-aliasing mode for regular rendering operations
 void setAntiAliasedText(java.lang.Object graphics, boolean a)
          Toggles anti-aliasing mode for font rendering operations
 void setAudioTime(java.lang.Object handle, int time)
          Sets the position in the audio file
 void setBidiAlgorithm(boolean activate)
          Indicates whether LWUIT should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.
 void setBrowserPage(PeerComponent browserPeer, java.lang.String html, java.lang.String baseUrl)
          Shows the given HTML in the native viewer
 void setBrowserProperty(PeerComponent browserPeer, java.lang.String key, java.lang.Object value)
          This method allows customizing the properties of a web view in various ways including platform specific settings.
 void setBrowserURL(PeerComponent browserPeer, java.lang.String url)
          Sets the page URL, jar: URL's must be supported by the implementation
 void setBuiltinSoundsEnabled(boolean enabled)
          Allows muting/unmuting the builtin sounds easily
abstract  void setClip(java.lang.Object graphics, int x, int y, int width, int height)
          Installs a new clipping rectangle
 void setClipRect(java.lang.Object graphics, Rectangle rect)
          Installs a new clipping rectangle
abstract  void setColor(java.lang.Object graphics, int RGB)
          Sets the current rgb color while ignoring any potential alpha component within said color value.
 void setCurrentForm(Form f)
          This method is used internally to determine the actual current form it doesn't perform the logic of transitions etc. and shouldn't be invoked by developers
 void setDisplayLock(java.lang.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 setLWUITGraphics(Graphics g)
          Installs the LWUIT graphics object into the implementation
 long setMediaTime(java.lang.Object player, long now)
          Deprecated. replaced by the new video component
 void setNativeCommands(java.util.Vector commands)
          Places the following commands on the native menu system
abstract  void setNativeFont(java.lang.Object graphics, java.lang.Object font)
          Installs a native font object
 void setVideoFullScreen(java.lang.Object player, boolean fullscreen)
          Deprecated. replaced by the new video component
 void setVideoFullScreen(VideoComponent v, boolean fullscreen)
          Toggles the fullscreen mode
 void setVideoLoopCount(java.lang.Object player, int count)
          Deprecated. replaced by the new video component
 void setVideoVisible(java.lang.Object vc, boolean visible)
          Deprecated. replaced by the new video component
 void setVolume(int vol)
          Sets the media playback volume in percentage
 void shear(java.lang.Object nativeGraphics, float x, float y)
          Shear the graphics coordinate system using the affine transform
 void showNativeScreen(java.lang.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 LWUIT.
protected  void sizeChanged(int w, int h)
          Subclasses should invoke this method, it delegates the event to the display and into LWUIT.
 void startVideo(java.lang.Object player, java.lang.Object videoControl)
          Deprecated. replaced by the new video component
 void stopVideo(java.lang.Object player, java.lang.Object videoControl)
          Deprecated. replaced by the new video component
abstract  int stringWidth(java.lang.Object nativeFont, java.lang.String str)
          Return the width of the given string in this font instance
 void translate(java.lang.Object graphics, int x, int y)
          Translates the X/Y location for drawing on the underlying surface.
 void vibrate(int duration)
          Vibrates the device for the given length of time
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LWUITImplementation

public LWUITImplementation()
Method Detail

init

public abstract void init(java.lang.Object m)
Invoked by the display init method allowing the implementation to "bind"

Parameters:
m - the object passed to the Display init method

initEDT

public void initEDT()
Some implementations might need to perform initializations of the EDT thread


deinitialize

public void deinitialize()
Allows subclasses to cleanup if necessary


playDialogSound

public void playDialogSound(int type)
Invoked when a dialog is shown, this method allows a dialog to play a sound

Parameters:
type - the type of the dialog matching the dialog classes defined types

vibrate

public void vibrate(int duration)
Vibrates the device for the given length of time

Parameters:
duration - length of time to vibrate

flashBacklight

public void flashBacklight(int duration)
Flash the backlight of the device for the given length of time

Parameters:
duration - length of time to flash the backlight

getDisplayWidth

public abstract int getDisplayWidth()
Returns the width dimention of the display controlled by this implementation

Returns:
the width

getDisplayHeight

public abstract int getDisplayHeight()
Returns the height dimention of the display controlled by this implementation

Returns:
the height

handleEDTException

public boolean handleEDTException(java.lang.Throwable err)
Invoked when an exception occurs on the EDT, allows the implementation to take control of the device to produce testing information.

Parameters:
err - the exception that was caught in the EDT loop
Returns:
false by default, true if the exception shouldn't be handled further by the EDT

editString

public abstract void editString(Component cmp,
                                int maxSize,
                                int constraint,
                                java.lang.String text,
                                int initiatingKeycode)
Encapsulates the editing code which is specific to the platform, some platforms would allow "in place editing" MIDP does not.

Parameters:
cmp - the TextArea component
maxSize - the maximum size from the text area
constraint - the constraints of the text area
text - the string to edit
initiatingKeycode - the keycode used to initiate the edit.

saveTextEditingState

public void saveTextEditingState()
Invoked if LWUIT needs to dispose the native text editing but would like the editor to store its state.


hasPendingPaints

public boolean hasPendingPaints()
Returns true if the implementation still has elements to paint.

Returns:
false by default

getVideoControl

public java.lang.Object getVideoControl(java.lang.Object player)
Returns the video control for the media player

Parameters:
player - the media player
Returns:
the video control for the media player

numAlphaLevels

public int numAlphaLevels()
Return the number of alpha levels supported by the implementation.

Returns:
the number of alpha levels supported by the implementation

numColors

public int numColors()
Returns the number of colors applicable on the device, note that the API does not support gray scale devices.

Returns:
the number of colors applicable on the device

getComponentScreenGraphics

public Graphics getComponentScreenGraphics(Component cmp,
                                           Graphics currentContext)
This method allows customizing/creating a graphics context per component which is useful for some elaborate implementations of LWUIT. This method is only relevant for elborate components such as container which render their own components rather than invoke repaint()

Parameters:
cmp - component being rendered
currentContext - the current graphics context
Returns:
a graphics object thats appropriate for the given component.

paintOverlay

protected void paintOverlay(Graphics g)
Allows for painting an overlay on top of the implementation for notices during testing etc.

Parameters:
g - graphics context on which to draw the overlay

paintDirty

public void paintDirty()
Invoked by the EDT to paint the dirty regions


edtIdle

public void edtIdle(boolean enter)
This method is a callback from the edt before the edt enters to an idle state

Parameters:
enter - true before the edt sleeps and false when exits from the idle state

flushGraphics

public abstract void flushGraphics(int x,
                                   int y,
                                   int width,
                                   int height)
Flush the currently painted drawing onto the screen if using a double buffer

Parameters:
x - position of the dirty region
y - position of the dirty region
width - width of the dirty region
height - height of the dirty region

flushGraphics

public abstract void flushGraphics()
Flush the currently painted drawing onto the screen if using a double buffer


getLWUITGraphics

protected Graphics getLWUITGraphics()
Returns a graphics object for use by the painting

Returns:
a graphics object, either recycled or new, this object will be used on the EDT

setLWUITGraphics

public void setLWUITGraphics(Graphics g)
Installs the LWUIT graphics object into the implementation

Parameters:
g - graphics object for use by the implementation

setDisplayLock

public void setDisplayLock(java.lang.Object lock)
Installs the display lock allowing implementors to synchronize against the Display mutex, this method is invoked internally and should not be used.

Parameters:
lock - the mutex from display

getDisplayLock

public java.lang.Object getDisplayLock()
Returns a lock object which can be synchrnoized against, this lock is used by the EDT.

Returns:
a lock object

cancelRepaint

public 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. This happens sometimes in cases where a replace() operation changes a component to a new component that has an animation() the animation might have triggered a repaint before the removeComponent method was invoked

Parameters:
cmp - the component to

repaint

public void repaint(Animation cmp)
Invoked to add an element to the paintQueue

Parameters:
cmp - component or animation to push into the paint queue

getRGB

public abstract void getRGB(java.lang.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

Parameters:
nativeImage - native platform image object
arr - int array to store RGB data
offset - position within the array to start
x - x position within the image
y - y position within the image
width - width to extract
height - height to extract

createImage

public abstract java.lang.Object createImage(int[] rgb,
                                             int width,
                                             int height)
Create a platform native image object from the given RGB data

Parameters:
rgb - ARGB data from which to create a platform image
width - width for the resulting image
height - height for the resulting image
Returns:
platform image object

createImage

public abstract java.lang.Object createImage(java.lang.String path)
                                      throws java.io.IOException
Creates a native image from a file in the system jar

Parameters:
path - within the jar
Returns:
native system image
Throws:
java.io.IOException - if thrown by loading

createImage

public abstract java.lang.Object createImage(java.io.InputStream i)
                                      throws java.io.IOException
Creates a native image from a given input stream

Parameters:
i - input stream from which to load the image
Returns:
native system image
Throws:
java.io.IOException - if thrown by loading

createMutableImage

public abstract java.lang.Object createMutableImage(int width,
                                                    int height,
                                                    int fillColor)
Creates a modifable native image that can return a graphics object

Parameters:
width - the width of the mutable image
height - the height of the mutable image
fillColor - the ARGB fill color, alpha may be ignored based on the value of isAlphaMutableImageSupported
Returns:
the native image

isAlphaMutableImageSupported

public boolean isAlphaMutableImageSupported()
Indicates whether mutable images respect alpha values when constructed

Returns:
true if mutable images can have an alpha value when initially created

createImage

public abstract java.lang.Object createImage(byte[] bytes,
                                             int offset,
                                             int len)
Create a nativate image from its compressed byte data

Parameters:
bytes - the byte array representing the image data
offset - offset within the byte array
len - the length for the image within the byte array
Returns:
a native image

getImageWidth

public abstract int getImageWidth(java.lang.Object i)
Returns the width of a native image

Parameters:
i - the native image
Returns:
the width of the native image

getImageHeight

public abstract int getImageHeight(java.lang.Object i)
Returns the height of a native image

Parameters:
i - the native image
Returns:
the height of the native image

scale

public abstract java.lang.Object scale(java.lang.Object nativeImage,
                                       int width,
                                       int height)
Scales a native image and returns the scaled version

Parameters:
nativeImage - image to scale
width - width of the resulting image
height - height of the resulting image
Returns:
scaled image instance

rotate

public java.lang.Object rotate(java.lang.Object image,
                               int degrees)
Returns an instance of this image rotated by the given number of degrees. By default 90 degree angle divisions are supported, anything else is implementation dependent. This method assumes a square image. Notice that it is inefficient in the current implementation to rotate to non-square angles,

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.

Parameters:
degrees - A degree in right angle must be larger than 0 and up to 359 degrees
Returns:
new image instance with the closest possible rotation

getSoftkeyCount

public abstract int getSoftkeyCount()
Returns the number of softkeys on the device

Returns:
the number of softkey buttons on the device

getSoftkeyCode

public abstract int[] getSoftkeyCode(int index)
Returns the softkey keycode for the given softkey index

Parameters:
index - the index of the softkey
Returns:
the set of keycodes which can indicate the softkey, multiple keycodes might apply to the same functionality

getClearKeyCode

public abstract int getClearKeyCode()
Returns the keycode for the clear key

Returns:
the system key code for this device

getBackspaceKeyCode

public abstract int getBackspaceKeyCode()
Returns the keycode for the backspace key

Returns:
the system key code for this device

getBackKeyCode

public abstract int getBackKeyCode()
Returns the keycode for the back key

Returns:
the system key code for this device

getGameAction

public abstract int getGameAction(int keyCode)
Returns the display game action for the given keyCode if applicable to match the contrct of LWUIT for the game action behavior

Parameters:
keyCode - the device keycode
Returns:
a game action or 0

getKeyCode

public abstract int getKeyCode(int gameAction)
Returns a keycode which can be sent to getGameAction

Parameters:
gameAction - the game action
Returns:
key code matching the given game action

isTouchDevice

public abstract boolean isTouchDevice()
Returns true if the device will send touch events

Returns:
true if the device will send touch events

setCurrentForm

public void setCurrentForm(Form f)
This method is used internally to determine the actual current form it doesn't perform the logic of transitions etc. and shouldn't be invoked by developers

Parameters:
f - the current form

confirmControlView

public void confirmControlView()
Callback method allowing the implementation to confirm that it controls the view just before a new form is installed.


getCurrentForm

public Form getCurrentForm()
Returns the current form, this method is for internal use only and does not take transitions/menus into consideration

Returns:
The internal current form

isTranslationSupported

public boolean isTranslationSupported()
LWUIT can translate all coordinates and never requires a call to translate this works well for some devices which have hairy issues with translate. However for some platforms where translate can be leveraged with affine transforms this can be a problem. These platforms can choose to translate on their own

Returns:
true if the implementation is interested in receiving translate calls and handling them.

translate

public void translate(java.lang.Object graphics,
                      int x,
                      int y)
Translates the X/Y location for drawing on the underlying surface. Translation is incremental so the new value will be added to the current translation and in order to reset translation we have to invoke translate(-getTranslateX(), -getTranslateY())

Parameters:
graphics - the graphics context
x - the x coordinate
y - the y coordinate

getTranslateX

public int getTranslateX(java.lang.Object graphics)
Returns the current x translate value

Parameters:
graphics - the graphics context
Returns:
the current x translate value

getTranslateY

public int getTranslateY(java.lang.Object graphics)
Returns the current y translate value

Parameters:
graphics - the graphics context
Returns:
the current y translate value

getColor

public abstract int getColor(java.lang.Object graphics)
Returns the current color

Parameters:
graphics - the graphics context
Returns:
the RGB graphics color

setColor

public abstract void setColor(java.lang.Object graphics,
                              int RGB)
Sets the current rgb color while ignoring any potential alpha component within said color value.

Parameters:
graphics - the graphics context
RGB - the RGB value for the color.

setAlpha

public abstract void setAlpha(java.lang.Object graphics,
                              int alpha)
Alpha value from 0-255 can be ignored for some operations

Parameters:
graphics - the graphics context
alpha - the alpha channel

getAlpha

public abstract int getAlpha(java.lang.Object graphics)
Alpha value from 0-255 can be ignored for some operations

Parameters:
graphics - the graphics context
Returns:
the alpha channel

isAlphaGlobal

public boolean isAlphaGlobal()
Returns true if alpha can be applied for all elements globally and efficiently otherwise alpha should be ignored. Notice that fillRect MUST always support alpha regardless of the value of this variable!

Returns:
true if alpha support is natively implemented

isAntiAliasingSupported

public boolean isAntiAliasingSupported()
Indicates whether the underlying implementation allows for anti-aliasing in regular drawing operations

Returns:
false by default

isAntiAliasedTextSupported

public boolean isAntiAliasedTextSupported()
Indicates whether the underlying implementation allows for anti-aliased fonts

Returns:
false by default

setAntiAliased

public void setAntiAliased(java.lang.Object graphics,
                           boolean a)
Toggles anti-aliasing mode for regular rendering operations

Parameters:
graphics - the graphics context
a - true to activate Anti-aliasing, false to disable it

isAntiAliased

public boolean isAntiAliased(java.lang.Object graphics)
Returns anti-aliasing mode for regular rendering operations

Parameters:
graphics - the graphics context
Returns:
true if Anti-aliasing is active, false otherwise

setAntiAliasedText

public void setAntiAliasedText(java.lang.Object graphics,
                               boolean a)
Toggles anti-aliasing mode for font rendering operations

Parameters:
graphics - the graphics context
a - true to activate Anti-aliasing, false to disable it

isAntiAliasedText

public boolean isAntiAliasedText(java.lang.Object graphics)
Returns anti-aliasing mode for font rendering operations

Parameters:
graphics - the graphics context
Returns:
true if Anti-aliasing is active, false otherwise

setNativeFont

public abstract void setNativeFont(java.lang.Object graphics,
                                   java.lang.Object font)
Installs a native font object

Parameters:
graphics - the graphics context
font - the native font object

getClipRect

public Rectangle getClipRect(java.lang.Object graphics)
Returns the internal clipping rectangle. This method must create a new rectangle object to prevent corruption by modification.

Parameters:
graphics - the graphics context
Returns:
the clipping rectangle.

getClipX

public abstract int getClipX(java.lang.Object graphics)
Returns the clipping coordinate

Parameters:
graphics - the graphics context
Returns:
the clipping coordinate

getClipY

public abstract int getClipY(java.lang.Object graphics)
Returns the clipping coordinate

Parameters:
graphics - the graphics context
Returns:
the clipping coordinate

getClipWidth

public abstract int getClipWidth(java.lang.Object graphics)
Returns the clipping coordinate

Parameters:
graphics - the graphics context
Returns:
the clipping coordinate

getClipHeight

public abstract int getClipHeight(java.lang.Object graphics)
Returns the clipping coordinate

Parameters:
graphics - the graphics context
Returns:
the clipping coordinate

setClipRect

public void setClipRect(java.lang.Object graphics,
                        Rectangle rect)
Installs a new clipping rectangle

Parameters:
graphics - the graphics context
rect - rectangle representing the new clipping area

setClip

public abstract void setClip(java.lang.Object graphics,
                             int x,
                             int y,
                             int width,
                             int height)
Installs a new clipping rectangle

Parameters:
graphics - the graphics context
x - coordinate
y - coordinate
width - size
height - size
rect - rectangle representing the new clipping area

clipRect

public void clipRect(java.lang.Object graphics,
                     Rectangle rect)
Changes the current clipping rectangle to subset the current clipping with the given clipping.

Parameters:
graphics - the graphics context
rect - rectangle representing the new clipping area

clipRect

public abstract void clipRect(java.lang.Object graphics,
                              int x,
                              int y,
                              int width,
                              int height)
Changes the current clipping rectangle to subset the current clipping with the given clipping.

Parameters:
graphics - the graphics context
x - coordinate
y - coordinate
width - size
height - size
rect - rectangle representing the new clipping area

drawLine

public abstract void drawLine(java.lang.Object graphics,
                              int x1,
                              int y1,
                              int x2,
                              int y2)
Draws a line between the 2 X/Y coordinates

Parameters:
graphics - the graphics context
x1 - first x position
y1 - first y position
x2 - second x position
y2 - second y position

fillRect

public abstract void fillRect(java.lang.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.

Parameters:
graphics - the graphics context
x - 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.

drawRect

public abstract void drawRect(java.lang.Object graphics,
                              int x,
                              int y,
                              int width,
                              int height)
Draws a rectangle in the given coordinates

Parameters:
graphics - the graphics context
x - 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.

drawRoundRect

public abstract void drawRoundRect(java.lang.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.

Parameters:
graphics - the graphics context
x - 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.

fillRoundRect

public abstract void fillRoundRect(java.lang.Object graphics,
                                   int x,
                                   int y,
                                   int width,
                                   int height,
                                   int arcWidth,
                                   int arcHeight)
Fills a rounded rectangle in the same way as drawRoundRect

Parameters:
graphics - the graphics context
x - 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.
See Also:
drawRoundRect(java.lang.Object, int, int, int, int, int, int)

fillArc

public abstract void fillArc(java.lang.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. The resulting arc begins at startAngle and extends for arcAngle degrees.

Parameters:
graphics - the graphics context
x - 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.

drawArc

public abstract void drawArc(java.lang.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

Parameters:
graphics - the graphics context
x - 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.

drawString

public abstract void drawString(java.lang.Object graphics,
                                java.lang.String str,
                                int x,
                                int y)
Draw a string using the current font and color in the x,y coordinates. The font is drawn from the top position and not the baseline.

Parameters:
graphics - the graphics context
str - the string to be drawn.
x - the x coordinate.
y - the y coordinate.

drawImage

public abstract void drawImage(java.lang.Object graphics,
                               java.lang.Object img,
                               int x,
                               int y)
Draws the image so its top left coordinate corresponds to x/y

Parameters:
graphics - the graphics context
img - the specified native image to be drawn
x - the x coordinate.
y - the y coordinate.

drawImage

public void drawImage(java.lang.Object graphics,
                      java.lang.Object img,
                      int x,
                      int y,
                      int w,
                      int h)
Draws the image so its top left coordinate corresponds to x/y

Parameters:
graphics - the graphics context
img - the specified native image to be drawn
x - the x coordinate.
y - the y coordinate.
w - the width
h - the height

isScaledImageDrawingSupported

public boolean isScaledImageDrawingSupported()
Indicates if image scaling on the fly is supported by the platform, if not LWUIT will just scale the images on its own before drawing


drawImageArea

public void drawImageArea(java.lang.Object nativeGraphics,
                          java.lang.Object img,
                          int x,
                          int y,
                          int imageX,
                          int imageY,
                          int imageWidth,
                          int imageHeight)
Draws a portion of the image

Parameters:
nativeGraphics - the graphics context
img - the specified native image to be drawn
x - the x coordinate.
y - the y coordinate.
imageX - location within the image to draw
imageY - location within the image to draw
imageWidth - size of the location within the image to draw
imageHeight - size of the location within the image to draw

drawImageRotated

public void drawImageRotated(java.lang.Object graphics,
                             java.lang.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

Parameters:
graphics - the graphics context
img - the specified native image to be drawn
x - the x coordinate.
y - the y coordinate.
degrees - either 0, 90, 180 or 270 degree rotation for the image drawing

isRotationDrawingSupported

public 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!

Returns:
true if drawImageRotated will draw an image

fillTriangle

public void fillTriangle(java.lang.Object graphics,
                         int x1,
                         int y1,
                         int x2,
                         int y2,
                         int x3,
                         int y3)
Draws a filled triangle with the given coordinates

Parameters:
graphics - the graphics context
x1 - the x coordinate of the first vertex of the triangle
y1 - the y coordinate of the first vertex of the triangle
x2 - the x coordinate of the second vertex of the triangle
y2 - the y coordinate of the second vertex of the triangle
x3 - the x coordinate of the third vertex of the triangle
y3 - the y coordinate of the third vertex of the triangle

drawRGB

public abstract void drawRGB(java.lang.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. Renders a series of device-independent RGB+transparency values in a specified region. The values are stored in rgbData in a format with 24 bits of RGB and an eight-bit alpha value (0xAARRGGBB), with the first value stored at the specified offset. The scanlength specifies the relative offset within the array between the corresponding pixels of consecutive rows. Any value for scanlength is acceptable (even negative values) provided that all resulting references are within the bounds of the rgbData array. The ARGB data is rasterized horizontally from left to right within each row. The ARGB values are rendered in the region specified by x, y, width and height, and the operation is subject to the current clip region and translation for this Graphics object.

Parameters:
graphics - the graphics context
rgbData - an array of ARGB values in the format 0xAARRGGBB
offset - the array index of the first ARGB value
x - the horizontal location of the region to be rendered
y - the vertical location of the region to be rendered
w - the width of the region to be rendered
h - the height of the region to be rendered
processAlpha - true if rgbData has an alpha channel, false if all pixels are fully opaque

getNativeGraphics

public abstract java.lang.Object getNativeGraphics()
Returns the native graphics object on which all rendering operations occur

Returns:
a native graphics context

getNativeGraphics

public abstract java.lang.Object getNativeGraphics(java.lang.Object image)
Returns the native graphics object on the given native image occur

Parameters:
image - the native image on which the graphics will draw
Returns:
a native graphics context

charsWidth

public abstract int charsWidth(java.lang.Object nativeFont,
                               char[] ch,
                               int offset,
                               int length)
Return the width of the given characters in the given native font instance

Parameters:
nativeFont - the font for which the string width should be calculated
ch - array of characters
offset - characters offsets
length - characters length
Returns:
the width of the given characters in this font instance

stringWidth

public abstract int stringWidth(java.lang.Object nativeFont,
                                java.lang.String str)
Return the width of the given string in this font instance

Parameters:
nativeFont - the font for which the string width should be calculated
str - the given string *
Returns:
the width of the given string in this font instance

charWidth

public abstract int charWidth(java.lang.Object nativeFont,
                              char ch)
Return the width of the specific character when rendered alone

Parameters:
nativeFont - the font for which the string width should be calculated
ch - the specific character
Returns:
the width of the specific character when rendered alone

getHeight

public abstract int getHeight(java.lang.Object nativeFont)
Return the total height of the font

Parameters:
nativeFont - the font for which the string width should be calculated
Returns:
the total height of the font

getDefaultFont

public abstract java.lang.Object getDefaultFont()
Return the global default font instance, if font is passed as null this font should be used

Returns:
the global default font instance

getFace

public int getFace(java.lang.Object nativeFont)
Optional operation returning the font face for the font

Parameters:
nativeFont - the font for which the string width should be calculated
Returns:
Optional operation returning the font face for system fonts

getSize

public int getSize(java.lang.Object nativeFont)
Optional operation returning the font size for system fonts

Parameters:
nativeFont - the font for which the string width should be calculated
Returns:
Optional operation returning the font size for system fonts

getStyle

public int getStyle(java.lang.Object nativeFont)
Optional operation returning the font style for system fonts

Parameters:
nativeFont - the font for which the string width should be calculated
Returns:
Optional operation returning the font style for system fonts

createFont

public abstract java.lang.Object createFont(int face,
                                            int style,
                                            int size)
Creates a new instance of a native font

Parameters:
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_LARGE
Returns:
a native font object

keyPressed

protected void keyPressed(int keyCode)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
keyCode - the key for the event

keyReleased

protected void keyReleased(int keyCode)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
keyCode - the key for the event

pointerDragged

protected void pointerDragged(int x,
                              int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerPressed

protected void pointerPressed(int x,
                              int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerReleased

protected void pointerReleased(int x,
                               int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHover

protected void pointerHover(int[] x,
                            int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHoverReleased

protected void pointerHoverReleased(int[] x,
                                    int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHoverReleased

protected void pointerHoverReleased(int x,
                                    int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHoverPressed

protected void pointerHoverPressed(int[] x,
                                   int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHoverPressed

protected void pointerHoverPressed(int x,
                                   int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerHover

protected void pointerHover(int x,
                            int y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerDragged

protected void pointerDragged(int[] x,
                              int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

hasDragStarted

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". This method is invoked by pointer dragged to determine whether to propogate the actual pointer drag event to LWUIT.

Parameters:
x - the position of the current drag event
y - the position of the current drag event
Returns:
true if the drag should propogate into LWUIT

hasDragStarted

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". This method is invoked by pointer dragged to determine whether to propogate the actual pointer drag event to LWUIT.

Parameters:
x - the position of the current drag event
y - the position of the current drag event
Returns:
true if the drag should propogate into LWUIT

getDragStartPercentage

public int getDragStartPercentage()
This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.

Returns:
motion percentage

setDragStartPercentage

public void setDragStartPercentage(int dragStartPercentage)
This method allows us to manipulate the drag started detection logic. If the pointer was dragged for more than this percentage of the display size it is safe to assume that a drag is in progress.

Parameters:
dragStartPercentage - percentage of the screen required to initiate drag

getDragAutoActivationThreshold

protected int getDragAutoActivationThreshold()
This method allows subclasses to manipulate the drag started detection logic. If more than this number of drag events were delivered it is safe to assume a drag has started This number must be bigger than 0!

Returns:
number representing a minimum number of motion events to start a drag operation

pointerPressed

protected void pointerPressed(int[] x,
                              int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

pointerReleased

protected void pointerReleased(int[] x,
                               int[] y)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
x - the position of the event
y - the position of the event

sizeChanged

protected void sizeChanged(int w,
                           int h)
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
w - the size of the screen
h - the size of the screen

hideNotify

protected void hideNotify()
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
w - the size of the screen
h - the size of the screen

showNotify

protected void showNotify()
Subclasses should invoke this method, it delegates the event to the display and into LWUIT.

Parameters:
w - the size of the screen
h - the size of the screen

fillRectRadialGradient

public void fillRectRadialGradient(java.lang.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. Notice that a radial gradient will result in a circular shape, to create a square use fillRect or draw a larger shape and clip to the appropriate size.

Parameters:
graphics - the graphics context
startColor - the starting RGB color
endColor - the ending RGB color
x - the x coordinate
y - the y coordinate
width - the width of the region to be filled
height - the height of the region to be filled
relativeX - indicates the relative position of the gradient within the drawing region
relativeY - indicates the relative position of the gradient within the drawing region
relativeSize - indicates the relative size of the gradient within the drawing region

fillRadialGradient

public void fillRadialGradient(java.lang.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. Notice that a radial gradient will result in a circular shape, to create a square use fillRect or draw a larger shape and clip to the appropriate size.

Parameters:
graphics - the graphics context
startColor - the starting RGB color
endColor - the ending RGB color
x - the x coordinate
y - the y coordinate
width - the width of the region to be filled
height - the height of the region to be filled

fillLinearGradient

public void fillLinearGradient(java.lang.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

Parameters:
graphics - the graphics context
startColor - the starting RGB color
endColor - the ending RGB color
x - the x coordinate
y - the y coordinate
width - the width of the region to be filled
height - the height of the region to be filled
horizontal - indicating wheter it is a horizontal fill or vertical

fillPolygon

public void fillPolygon(java.lang.Object graphics,
                        int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point.

Parameters:
graphics - the graphics context
xPoints - - a an array of x coordinates.
yPoints - - a an array of y coordinates.
nPoints - - a the total number of points.

drawPolygon

public void drawPolygon(java.lang.Object graphics,
                        int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point.

Parameters:
graphics - the graphics context
xPoints - - a an array of x coordinates.
yPoints - - a an array of y coordinates.
nPoints - - a the total number of points.

getKeyboardType

public 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

Returns:
KEYBOARD_TYPE_UNKNOWN

isNativeInputSupported

public boolean isNativeInputSupported()
Indicates whether the device supports native in place editing in which case lightweight input logic shouldn't be used for input.

Returns:
false by default

isMultiTouch

public boolean isMultiTouch()
Indicates whether the device supports multi-touch events, this is only relevant when touch events are supported

Returns:
false by default

isClickTouchScreen

public boolean isClickTouchScreen()
Indicates whether the device has a double layer screen thus allowing two stages to touch events: click and hover. This is true for devices such as the storm but can also be true for a PC with a mouse pointer floating on top.

A click touch screen will also send pointer hover events to the underlying software and will only send the standard pointer events on click.

Returns:
false by default

isNativeIndexed

public boolean isNativeIndexed()
Returns true if indexed images should be used natively

Returns:
true if a native image should be used for indexed images

createNativeIndexed

public java.lang.Object createNativeIndexed(IndexedImage image)
Creates a native image representing the indexed image

Parameters:
image - the indexed image
Returns:
a native version of the indexed image

createVideoComponent

public java.lang.Object createVideoComponent(java.lang.Object player)
Deprecated. replaced by the new video component

Create a video/media component

Parameters:
player - object responsible for playback lifecycle
Returns:
the video control

getVideoWidth

public int getVideoWidth(java.lang.Object videoControl)
Deprecated. replaced by the new video component

Returns the video width

Parameters:
videoControl - the control for the video
Returns:
the width

getVideoHeight

public int getVideoHeight(java.lang.Object videoControl)
Deprecated. replaced by the new video component

Returns the video height

Parameters:
videoControl - the control for the video
Returns:
the height

setVideoVisible

public void setVideoVisible(java.lang.Object vc,
                            boolean visible)
Deprecated. replaced by the new video component

Sets the video visibility

Parameters:
vc - video control instance
visible - whether the video is visible

startVideo

public void startVideo(java.lang.Object player,
                       java.lang.Object videoControl)
Deprecated. replaced by the new video component

Starts the video

Parameters:
player - the player object
videoControl - the video control

stopVideo

public void stopVideo(java.lang.Object player,
                      java.lang.Object videoControl)
Deprecated. replaced by the new video component

Stop the video

Parameters:
player - the player object
videoControl - the video control

setVideoLoopCount

public void setVideoLoopCount(java.lang.Object player,
                              int count)
Deprecated. replaced by the new video component

Set the number of times the media should loop

Parameters:
player - the player object
count - the number of times the media should loop

getMediaTime

public long getMediaTime(java.lang.Object player)
Deprecated. replaced by the new video component

Return the duration of the media

Parameters:
player - the player object
Returns:
the duration of the media

setMediaTime

public long setMediaTime(java.lang.Object player,
                         long now)
Deprecated. replaced by the new video component

"Jump" to a point in time within the media

Parameters:
player - the player object
now - the point in time to "Jump" to
Returns:
the media time in microseconds

setVideoFullScreen

public void setVideoFullScreen(java.lang.Object player,
                               boolean fullscreen)
Deprecated. replaced by the new video component

Toggles the fullscreen mode

Parameters:
player - the player object
fullscreen - true for fullscreen mode

paintVideo

public void paintVideo(Component cmp,
                       boolean fullScreen,
                       java.lang.Object nativeGraphics,
                       java.lang.Object video,
                       java.lang.Object player)
Deprecated. replaced by the version that accepts the video component instance

Paint the video for the media component

Parameters:
cmp - the media component
fullScreen - indicates whether this is fullscreen or not
nativeGraphics - the native graphics object
video - the native videoo control
player - the native player object

isOpaque

public boolean isOpaque(Image lwuitImage,
                        java.lang.Object nativeImage)
Returns true if the image was opaque

Parameters:
lwuitImage - the lwuit image
nativeImage - the image object to test
Returns:
true if the image is opaque

isAffineSupported

public boolean isAffineSupported()
Indicates whether the underlying implementation can draw using an affine transform hence methods such as rotate, scale and shear would work

Returns:
true if an affine transformation matrix is present

resetAffine

public void resetAffine(java.lang.Object nativeGraphics)
Resets the affine transform to the default value

Parameters:
nativeGraphics - the native graphics object

scale

public void scale(java.lang.Object nativeGraphics,
                  float x,
                  float y)
Scales the coordinate system using the affine transform

Parameters:
nativeGraphics - the native graphics object
scale - factor for x
scale - factor for y

rotate

public void rotate(java.lang.Object nativeGraphics,
                   float angle)
Rotates the coordinate system around a radian angle using the affine transform

Parameters:
angle - the rotation angle in radians
nativeGraphics - the native graphics object

shear

public void shear(java.lang.Object nativeGraphics,
                  float x,
                  float y)
Shear the graphics coordinate system using the affine transform

Parameters:
shear - factor for x
shear - factor for y
nativeGraphics - the native graphics object

isSVGSupported

public boolean isSVGSupported()
Indicates whether the underlying platform supports creating an SVG Image

Returns:
true if the method create SVG image would return a valid image object from an SVG Input stream

createSVGImage

public java.lang.Object createSVGImage(java.lang.String baseURL,
                                       byte[] data)
                                throws java.io.IOException
Creates an SVG Image from the given byte array data and the base URL

Parameters:
baseURL - URL which is used to resolve relative references within the SVG file
data - the conten of the SVG file
Returns:
a native image that can be used within the image object
Throws:
java.io.IOException - if resource lookup fail SVG is unsupported

getSVGDocument

public java.lang.Object getSVGDocument(java.lang.Object svgImage)
Returns a platform specific DOM object that can be manipulated by the user to change the SVG Image

Parameters:
svgImage - the underlying image object
Returns:
Platform dependent object, when JSR 226 is supported an SVGSVGElement might be returned.

animateImage

public boolean animateImage(java.lang.Object nativeImage,
                            long lastFrame)
Callback to allow images animated by the underlying system to change their state e.g. for SVG or animated gif support. This method returns true if an animation state has changed requiring a repaint.

Parameters:
nativeImage - a native image used within the image object
lastFrame - the time the last frame of animation was shown
Returns:
true if a repaint is required since the image state changed, false otherwise

getFontPlatformNames

public java.lang.String[] getFontPlatformNames()
Returns a list of the platform names ordered by priority, platform names are used to choose a font based on platform. Since a platform might support several layers for choice in narrowing platform font selection

Returns:
the platform names ordered according to priority.

loadTrueTypeFont

public java.lang.Object loadTrueTypeFont(java.io.InputStream stream)
                                  throws java.io.IOException
Loads the truetype font from the input stream without closing the stream, this method should return the native font.

Parameters:
stream - from which to load the font
Returns:
the native font created from the stream
Throws:
java.io.IOException - will be thrown in case of an io error

isTrueTypeSupported

public boolean isTrueTypeSupported()
Returns true if the system supports dynamically loading truetype fonts from a stream.

Returns:
true if the system supports dynamically loading truetype fonts from a stream.

loadNativeFont

public java.lang.Object loadNativeFont(java.lang.String lookup)
Loads a native font based on a lookup for a font name and attributes. Font lookup values can be separated by commas and thus allow fallback if the primary font isn't supported by the platform.

Parameters:
lookup - string describing the font
Returns:
the native font object

isLookupFontSupported

public boolean isLookupFontSupported()
Indicates whether loading a font by a string is supported by the platform

Returns:
true if the platform supports font lookup

minimizeApplication

public boolean minimizeApplication()
Minimizes the current application if minimization is supported by the platform (may fail). Returns false if minimization failed.

Returns:
false if minimization failed true if it succeeded or seems to be successful

restoreMinimizedApplication

public void restoreMinimizedApplication()
Restore the minimized application if minimization is supported by the platform


isMinimized

public boolean isMinimized()
Indicates whether an application is minimized

Returns:
true if the application is minimized

cacheRadialGradients

protected boolean cacheRadialGradients()
Indicates whether the implementation is interested in caching radial gradients for drawing.

Returns:
true to activate radial gradient caching

cacheLinearGradients

protected boolean cacheLinearGradients()
Indicates whether the implementation is interested in caching linear gradients for drawing.

Returns:
true to activate linear gradient caching

isThirdSoftButton

public boolean isThirdSoftButton()
Indicates the default status to apply to the 3rd softbutton variable

Returns:
true if the 3rd softbutton should be set as true
See Also:
Display.isThirdSoftButton(), com.sun.lwuit.Display#setThirdSoftButton()

getDragPathLength

public int getDragPathLength()
Indicates how many drag points are used to calculate dragging speed

Returns:
the size of points to calculate the speed

getDragPathTime

public int getDragPathTime()
Indicates what drag points are valid for the drag speed calculation. Points that are older then the current time - the path time are ignored

Returns:
the relevance time per point

getDragSpeed

public float getDragSpeed(float[] points,
                          long[] dragPathTime,
                          int dragPathOffset,
                          int dragPathLength)
This method returns the dragging speed based on the latest dragged events

Parameters:
points - array of locations
dragPathTime - the time difference between each point
dragPathOffset - the offset in the arrays
dragPathLength -

isBidiAlgorithm

public boolean isBidiAlgorithm()
Indicates whether LWUIT should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.

Returns:
true if the bidi algorithm should be considered

setBidiAlgorithm

public void setBidiAlgorithm(boolean activate)
Indicates whether LWUIT should consider the bidi RTL algorithm when drawing text or navigating with the text field cursor.

Parameters:
activate - set to true to activate the bidi algorithm, false to disable it

convertBidiLogicalToVisual

public java.lang.String convertBidiLogicalToVisual(java.lang.String s)
Converts the given string from logical bidi layout to visual bidi layout so it can be rendered properly on the screen. This method is only necessary for devices/platforms that don't have "built in" bidi support such as Sony Ericsson devices. See this for more on visual vs. logical ordering.

Parameters:
s - a "logical" string with RTL characters
Returns:
a "visual" renderable string

getCharLocation

public int getCharLocation(java.lang.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. logical ordering.

Parameters:
source - the string in which we are looking for the position
index - the "logical" location of the cursor
Returns:
the "visual" location of the cursor

isRTLOrWhitespace

public boolean isRTLOrWhitespace(char c)
Returns true if the given character is an RTL character or a space character

Parameters:
c - character to test
Returns:
true if bidi is active and this is a

isRTL

public boolean isRTL(char c)
Returns true if the given character is an RTL character

Parameters:
c - character to test
Returns:
true if the charcter is an RTL character

getResourceAsStream

public java.io.InputStream getResourceAsStream(java.lang.Class cls,
                                               java.lang.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.

Parameters:
cls - class to load the resource from
resource - relative/absolute URL based on the Java convention
Returns:
input stream for the resource or null if not found

isAnimation

public boolean isAnimation(java.lang.Object nativeImage)
Animations should return true to allow the native image animation to update

Parameters:
nativeImage - underlying native imae
Returns:
true if this is an animation

createNativePeer

public PeerComponent createNativePeer(java.lang.Object nativeComponent)
Creates a peer component for the given lightweight component

Parameters:
nativeComponent - a platform specific "native component"
Returns:
a LWUIT peer component that can be manipulated just like any other LWUIT component but would internally encapsulate the given native peer

createVideoPeer

public VideoComponent createVideoPeer(java.lang.String url)
                               throws java.io.IOException
Create a video component

Parameters:
uri - the platform specific location for the sound
Returns:
a VideoComponent that can be used to control the playback of the video
Throws:
java.io.IOException - if the allocation fails

createVideoPeer

public VideoComponent createVideoPeer(java.io.InputStream stream,
                                      java.lang.String type)
                               throws java.io.IOException
Create a video component

Parameters:
stream - the stream containing the media data
mimeType - the type of the data in the stream
Returns:
a VideoComponent that can be used to control the playback of the video
Throws:
java.io.IOException - if the allocation fails

setVideoFullScreen

public void setVideoFullScreen(VideoComponent v,
                               boolean fullscreen)
Toggles the fullscreen mode

Parameters:
v - video component
fullscreen - true for fullscreen mode

showNativeScreen

public void showNativeScreen(java.lang.Object nativeFullScreenPeer)
Shows a native Form/Canvas or some other heavyweight native screen

Parameters:
nativeFullScreenPeer - the native screen peer

setNativeCommands

public void setNativeCommands(java.util.Vector commands)
Places the following commands on the native menu system

Parameters:
commands - the LWUIT commands to use

exitApplication

public void exitApplication()
Exits the application...


getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Returns the property from the underlying platform deployment or the default value if no deployment values are supported. This is equivalent to the getAppProperty from the jad file.

The implementation should be responsible for the following keys to return reasonable valid values for the application:

  1. AppName
  2. UserAgent - ideally although not required
  3. AppVersion
  4. Platform - Similar to microedition.platform

Parameters:
key - the key of the property
defaultValue - a default return value
Returns:
the value of the property

execute

public void execute(java.lang.String url)
Executes the given URL on the native platform

Parameters:
url - the url to execute

getDeviceDensity

public int getDeviceDensity()
Returns one of the density variables appropriate for this device, notice that density doesn't alwyas correspond to resolution and an implementation might decide to change the density based on DPI constraints.

Returns:
one of the DENSITY constants of Display

playBuiltinSound

public void playBuiltinSound(java.lang.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.

Parameters:
soundIdentifier - the sound identifier which can match one of the common constants in this class or be a user/implementation defined sound

playUserSound

protected boolean playUserSound(java.lang.String soundIdentifier)
Plays a sound defined by the user

Parameters:
soundIdentifier - the sound identifier which can match one of the common constants in this class or be a user/implementation defined sound
Returns:
true if a user sound exists and was sent to playback

playNativeBuiltinSound

protected void playNativeBuiltinSound(java.lang.Object data)
This method allows implementations to store sound objects natively e.g. in files, byte arrays whatever

Parameters:
data - native data object

convertBuiltinSound

protected java.lang.Object convertBuiltinSound(java.io.InputStream i)
                                        throws java.io.IOException
Converts a sound object to a form which will be easy for the implementation to play later on. E.g. a byte array or a file/file name and return an object that will allow playNativeBuiltinSound() to use

Parameters:
i - stream containing a sound file
Returns:
native playback object
Throws:
java.io.IOException - thrown by the stream

installBuiltinSound

public void installBuiltinSound(java.lang.String soundIdentifier,
                                java.io.InputStream data)
                         throws java.io.IOException
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).

Parameters:
soundIdentifier - the sound string passed to playBuiltinSound
data - an input stream containing platform specific audio file, its usually safe to assume that wav/mp3 would be supported.
Throws:
java.io.IOException - if the stream throws an exception

isBuiltinSoundAvailable

public boolean isBuiltinSoundAvailable(java.lang.String soundIdentifier)
Indicates whether a user installed or system sound is available

Parameters:
soundIdentifier - the sound string passed to playBuiltinSound
Returns:
true if a sound of this given type is avilable

setBuiltinSoundsEnabled

public void setBuiltinSoundsEnabled(boolean enabled)
Allows muting/unmuting the builtin sounds easily

Parameters:
enabled - indicates whether the sound is muted

isBuiltinSoundsEnabled

public boolean isBuiltinSoundsEnabled()
Allows muting/unmuting the builtin sounds easily

Returns:
true if the sound is *not* muted

createAudio

public java.lang.Object createAudio(java.lang.String uri,
                                    java.lang.Runnable onCompletion)
                             throws java.io.IOException
Plays the sound in the given URI which is partially platform specific.

Parameters:
uri - the platform specific location for the sound
onCompletion - invoked when the audio file finishes playing, may be null
Returns:
a handle that can be used to control the playback of the audio
Throws:
java.io.IOException - if the URI access fails

createAudio

public java.lang.Object createAudio(java.io.InputStream stream,
                                    java.lang.String mimeType,
                                    java.lang.Runnable onCompletion)
                             throws java.io.IOException
Plays the sound in the given stream

Parameters:
stream - the stream containing the media data
mimeType - the type of the data in the stream
onCompletion - invoked when the audio file finishes playing, may be null
Returns:
a handle that can be used to control the playback of the audio
Throws:
java.io.IOException - if the URI access fails

playAudio

public void playAudio(java.lang.Object handle)
Starts playing the audio file

Parameters:
handle - the handle object returned by create audio

pauseAudio

public void pauseAudio(java.lang.Object handle)
Pauses the playback of the audio file

Parameters:
handle - the handle object returned by create audio

getAudioTime

public int getAudioTime(java.lang.Object handle)
Returns the time in seconds in the audio file

Parameters:
handle - the handle object returned by play audio
Returns:
time in milli seconds

setAudioTime

public void setAudioTime(java.lang.Object handle,
                         int time)
Sets the position in the audio file

Parameters:
handle - the handle object returned by play audio
time - in milli seconds

getAudioDuration

public int getAudioDuration(java.lang.Object handle)
Returns the length in milli seconds of the audio file

Parameters:
handle - the handle object returned by play audio
Returns:
time in milli seconds

cleanupAudio

public void cleanupAudio(java.lang.Object handle)
Stops the audio playback and cleans up the resources related to it immediately.

Parameters:
handle - the playback handle

setVolume

public void setVolume(int vol)
Sets the media playback volume in percentage

Parameters:
vol - the volume for media playback

getVolume

public int getVolume()
Returns the media playback volume in percentage

Returns:
the volume percentage

createSoftWeakRef

public java.lang.Object createSoftWeakRef(java.lang.Object o)
Creates a soft/weak reference to an object that allows it to be collected yet caches it. This method is in the porting layer since CLDC only includes weak references while some platforms include nothing at all and some include the superior soft references.

Parameters:
o - object to cache
Returns:
a caching object or null if caching isn't supported

extractHardRef

public java.lang.Object extractHardRef(java.lang.Object o)
Extracts the hard reference from the soft/weak reference given

Parameters:
o - the reference returned by createSoftWeakRef
Returns:
the original object submitted or null

notifyCommandBehavior

public void notifyCommandBehavior(int commandBehavior)
This method notifies the implementation about the chosen commands behavior

Parameters:
commandBehavior - see Display.COMMAND_BEHAVIOR...

hasNativeTheme

public boolean hasNativeTheme()
Indicates if the implemenetation has a native underlying theme

Returns:
true if the implementation has a native theme available

installNativeTheme

public void installNativeTheme()
Installs the native theme, this is only applicable if hasNativeTheme() returned true. Notice that this method might replace the DefaultLookAndFeel instance and the default transitions.


copyToClipboard

public void copyToClipboard(java.lang.Object obj)
Performs a clipboard copy operation, if the native clipboard is supported by the implementation it would be used

Parameters:
obj - object to copy, while this can be any arbitrary object it is recommended that only Strings or LWUIT image objects be used to copy

getPasteDataFromClipboard

public java.lang.Object getPasteDataFromClipboard()
Returns the current content of the clipboard

Returns:
can be any object or null see copyToClipboard

isPortrait

public boolean isPortrait()
Returns true if the device is currently in portrait mode

Returns:
true if the device is in portrait mode

canForceOrientation

public 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

Returns:
true if lockOrientation would work

lockOrientation

public void lockOrientation(boolean portrait)
On devices that return true for canForceOrientation() this method can lock the device orientation either to portrait or landscape mode

Parameters:
portrait - true to lock to portrait mode, false to lock to landscape mode

isNativeBrowserComponentSupported

public boolean isNativeBrowserComponentSupported()
An implementation can return true if it supports embedding a native browser widget

Returns:
true if the implementation supports embedding a native browser widget

createBrowserComponent

public PeerComponent createBrowserComponent(java.lang.Object browserComponent)
If the implementation supports the creation of a browser component it should be returned in this method

Parameters:
browserComponent - instance of the browser component thru which events should be fired
Returns:
an instance of the native browser peer or null

setBrowserProperty

public void setBrowserProperty(PeerComponent browserPeer,
                               java.lang.String key,
                               java.lang.Object value)
This method allows customizing the properties of a web view in various ways including platform specific settings. When a property isn't supported by a specific platform it is just ignored.

Parameters:
browserPeer - browser instance
key - see the documentation with the LWUIT Implementation for further details
value - see the documentation with the LWUIT Implementation for further details

getBrowserTitle

public java.lang.String getBrowserTitle(PeerComponent browserPeer)
The page title

Parameters:
browserPeer - browser instance
Returns:
the title

getBrowserURL

public java.lang.String getBrowserURL(PeerComponent browserPeer)
The page URL

Parameters:
browserPeer - browser instance
Returns:
the URL

setBrowserURL

public void setBrowserURL(PeerComponent browserPeer,
                          java.lang.String url)
Sets the page URL, jar: URL's must be supported by the implementation

Parameters:
browserPeer - browser instance
url - the URL

browserReload

public void browserReload(PeerComponent browserPeer)
Reload the current page

Parameters:
browserPeer - browser instance

browserHasBack

public boolean browserHasBack(PeerComponent browserPeer)
Indicates whether back is currently available

Parameters:
browserPeer - browser instance
Returns:
true if back should work

browserHasForward

public boolean browserHasForward(PeerComponent browserPeer)
Indicates whether forward is currently available

Parameters:
browserPeer - browser instance
Returns:
true if forward should work

browserBack

public void browserBack(PeerComponent browserPeer)
Navigates back in the history

Parameters:
browserPeer - browser instance

browserForward

public void browserForward(PeerComponent browserPeer)
Navigates forward in the history

Parameters:
browserPeer - browser instance

browserClearHistory

public void browserClearHistory(PeerComponent browserPeer)
Clears navigation history

Parameters:
browserPeer - browser instance

setBrowserPage

public void setBrowserPage(PeerComponent browserPeer,
                           java.lang.String html,
                           java.lang.String baseUrl)
Shows the given HTML in the native viewer

Parameters:
browserPeer - browser instance
html - HTML web page
baseUrl - base URL to associate with the HTML

browserExecute

public void browserExecute(PeerComponent browserPeer,
                           java.lang.String javaScript)
Executes the given JavaScript string within the current context

Parameters:
browserPeer - browser instance
javaScript - the JavaScript string

browserExposeInJavaScript

public void browserExposeInJavaScript(PeerComponent browserPeer,
                                      java.lang.Object o,
                                      java.lang.String name)
Allows exposing the given object to JavaScript code so the JavaScript code can invoke methods and access fields on the given object. Notice that on RIM devices which don't support reflection this object must implement the propriatery Scriptable interface http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/script/Scriptable.html

Parameters:
browserPeer - browser instance
o - the object to invoke, notice all public fields and methods would be exposed to JavaScript
name - the name to expose within JavaScript

convertToPixels

public int convertToPixels(int dipCount,
                           boolean horizontal)
Converts the dips count to pixels, dips are roughly 1mm in length. This is a very rough estimate and not to be relied upon

Parameters:
dipCount - the dips that we will convert to pixels
horizontal - indicates pixels in the horizontal plane
Returns:
value in pixels

isTablet

public boolean isTablet()
Indicates whether the device is a tablet, notice that this is often a guess

Returns:
true if the device is assumed to be a tablet