|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.nokia.mid.ui.CanvasItem com.nokia.mid.ui.BrowserItem
public class BrowserItem
BrowserItem renders an html page defined by a URL. It can be placed on a Canvas or on a CustomItem To invoke a URL and upload a file or download an image to the file system the appropriate permissions are needed like: javax.microedition.io.Connector.http, javax.microedition.io.Connector.https javax.microedition.io.Connector.file.read or javax.microedition.io.Connector.file.write When an application goes to background and releasing its UI it must also release the BrowserItem by calling the destroy function.
Field Summary |
---|
Fields inherited from class com.nokia.mid.ui.CanvasItem |
---|
SCALE_AVERAGE, SCALE_NEAREST, SCALE_NOT_ALLOWED |
Method Summary | |
---|---|
void |
confirmDialogDone(boolean yesno)
This function should be called when the user has selected yes or no from a confirm dialog |
void |
destroy()
Destroys the BrowserItem, releases its resources after the call this item cannot be used any more, but a new one can be aquired |
void |
fileSelectDialogDone(java.lang.String file)
This function should be called when the user has finished file selection |
static BrowserItem |
getBrowserItem()
Returns the BrowserItem the application can use (currently only 1 per application) The system supports only 2 BrowserItems in total shared by the applications |
int |
getHeight()
Gets the height of this BrowserItem in pixels. |
java.lang.Object |
getParent()
Gets the current parent of this CanvasItem |
int |
getPositionX()
Gets the rendering position of this BrowserItem . |
int |
getPositionY()
Sets the rendering position of this BrowserItem . |
java.lang.String |
getTitle()
Gets the title of the currently loaded page |
java.lang.String |
getUrl()
Gets the url of the currently loaded page |
int |
getWidth()
Gets the width of this BrowserItem in pixels. |
int |
getZPosition()
Returns the Z-position, or the elevation, of the item. |
void |
invokeUrl(java.lang.String url)
Invokes a url |
boolean |
isVisible()
Returns the visibility of the browser |
void |
loadHistoryByUrl(java.lang.String url)
Makes the browser to load a url from the history |
void |
noteDialogDone()
This function should be called when the note dialog has been closed |
void |
reload()
Reloads the current page |
int |
saveSelectedImage(java.lang.String filePath)
Saves the selected image to the file system |
void |
scale(int width,
int height)
Overrides the CanvasItem 's scale method as on BrowserItem it is not supported |
void |
scale(int x,
int y,
int width,
int height)
Overrides the CanvasItem 's scale method as on BrowserItem it is not supported |
void |
selectListDialogDone(int[] ids)
This function should be called when the user has finished list selection |
void |
setBrowserListener(BrowserListener listener)
Sets the BrowserItem's listener to get notifications from the BrowserItem |
void |
setParent(java.lang.Object theParent)
Set the parent object of this BrowserItem . |
void |
setPosition(int x,
int y)
Sets the rendering position of this BrowserItem . |
void |
setScalingMode(int scaleMode,
boolean aspectRatioPreserved,
int anchor)
Overrides the CanvasItem 's method as on BrowserItem it is not supported |
void |
setSize(int width,
int height)
Sets the size of this BrowserItem in pixels. |
void |
setSize(int x,
int y,
int width,
int height)
Sets the size of this BrowserItem in pixels and resets the current anchor position. |
void |
setVisible(boolean visible)
Sets the visibility value of BrowserItem . |
void |
setZPosition(int z)
Sets the Z-position, or the elevation, of the item. |
void |
stop()
Stops loading |
Methods inherited from class com.nokia.mid.ui.CanvasItem |
---|
isValidImageAnchor |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static BrowserItem getBrowserItem() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if there is no free BrowserItem available in the system to returnpublic void setParent(java.lang.Object theParent)
BrowserItem
.
Typically the parent object would be Canvas or CustomItem. Setting the parameter to
null removes the association to the parent. If
setParent(null)
is called for a BrowserItem
yet
not having any parent or setParent(parent)
is called with
the same parent, the call is silently ignored.
setParent
in class CanvasItem
theParent
- the parent object
java.lang.IllegalArgumentException
- if parent is not a valid object with which a
BrowserItem
can be associated, or if BrowserItem
is already set to another another parent
java.lang.IllegalStateException
- if the item is already destroyedpublic void setSize(int width, int height)
BrowserItem
in pixels.
setSize
in class CanvasItem
width
- width in pixelsheight
- height in pixels
java.lang.IllegalArgumentException
- if the width or height is less than one pixel
java.lang.IllegalStateException
- if the item is already destroyedfor more details
public void setSize(int x, int y, int width, int height)
BrowserItem
in pixels and resets the current anchor position.
This call has the same effect as calling consecutively the following two methods
setSize(int, int)
and setPosition(int, int)
.
setSize
in class CanvasItem
x
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointwidth
- the new width in pixelsheight
- the new height in pixels
java.lang.IllegalArgumentException
- if the width or height is less than one pixel
java.lang.IllegalStateException
- if the item is already destroyedsetPosition(int, int)
,
setSize(int, int)
public int getHeight()
BrowserItem
in pixels.
getHeight
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic int getWidth()
BrowserItem
in pixels.
getWidth
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic void setPosition(int x, int y)
Sets the rendering position of this BrowserItem
. The anchor
point given is relative to the upper left corner of the parent,
Canvas
or CustomItem
.
The BrowserItem
may be placed fully off or partially of the
visible area of the parent, Canvas
or CustomItem
, by the
setPosition
method; in this case the BrowserItem
is just partly visible.
setPosition
in class CanvasItem
x
- the x coordinate of the anchor point, in pixels.y
- the y coordinate of the anchor point, in pixels.
java.lang.IllegalStateException
- if a valid parent object has not been set.
java.lang.IllegalStateException
- if the item is already destroyedsetParent(java.lang.Object parent)
public int getPositionX()
Gets the rendering position of this BrowserItem
. The origin is
relative to the coordinate system of parent.
getPositionX
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic int getPositionY()
Sets the rendering position of this BrowserItem
. The origin is
relative to the coordinate system of parent.
getPositionY
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic void setVisible(boolean visible)
Sets the visibility value of BrowserItem
. Initially
BrowserItem
is not visible so it must be explicitly set to
visible in order it to appear on UI.
Setting visibility to true shows the BrowserItem with its content.
If the BrowserItem is already visible
calling setVisible(true)
does nothing.
Setting the visibility to false hides the BrowserItem and its content. If the
BrowserItem is already hidden calling setVisible(false)
does
nothing.
setVisible
in class CanvasItem
visible
- visibility of the BrowserItem
java.lang.IllegalStateException
- if a valid parent object has not been set.
java.lang.IllegalStateException
- if the item is already destroyedsetParent(java.lang.Object parent)
public void setZPosition(int z)
Sets the Z-position, or the elevation, of the item.
The elevation decides the stacking order of neighboring items. An item of high Z-position will be drawn on top of an item with a lower Z-position if they share the same parent item.
The z-position is unique for each item meaning that changing a Z-position of an item may change the Z-position of the items that share the same parent item. The Z-position does not affect the item's size in any way.
When items are added with CanvasItem.setParent(java.lang.Object)
they will get a
Z-position that is increased by 1 from the item that is the top most item
at that time.
setZPosition
in class CanvasItem
z
- the Z-position of the item.
java.lang.IllegalArgumentException
- If z
< 0
java.lang.IllegalStateException
- if a valid parent object has not been set or item is destroyedgetZPosition()
,
setParent(java.lang.Object parent)
public int getZPosition()
Returns the Z-position, or the elevation, of the item. The Z-position decides the stacking order of neighboring items.
getZPosition
in class CanvasItem
java.lang.IllegalStateException
- if a valid parent object has not been set or item is destroyedsetZPosition(int)
,
setParent(java.lang.Object parent)
public void scale(int width, int height)
CanvasItem
's scale method as on BrowserItem it is not supported
scale
in class CanvasItem
width
- the new width in pixelsheight
- the new height in pixels
java.lang.IllegalStateException
- if the item is already destroyedscalling mode settings
public void scale(int x, int y, int width, int height)
CanvasItem
's scale method as on BrowserItem it is not supported
scale
in class CanvasItem
x
- the x coordinate of the anchor pointy
- the y coordinate of the anchor pointwidth
- the new width in pixelsheight
- the new height in pixels
java.lang.IllegalStateException
- if the item is already destroyedscaling mode settings
,
setPosition(int, int)
,
scale(int, int)
public void setScalingMode(int scaleMode, boolean aspectRatioPreserved, int anchor)
CanvasItem
's method as on BrowserItem it is not supported
setScalingMode
in class CanvasItem
scaleMode
- scaling mode: SCALE_NEAREST or SCALE_AVERAGE or SCALE_NOT_ALLOWEDaspectRatioPreserved
- set to true to preserve aspect ration when scalinganchor
- the anchor point for positioning the window
java.lang.IllegalArgumentException
- if scaleMode or/and anchor are not a legal values.
java.lang.IllegalStateException
- if the item is already destroyedfor more details
public java.lang.Object getParent()
getParent
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic void destroy()
java.lang.IllegalStateException
- if the item is already destroyedpublic boolean isVisible()
isVisible
in class CanvasItem
java.lang.IllegalStateException
- if the item is already destroyedpublic java.lang.String getUrl()
java.lang.IllegalStateException
- if the item is already destroyedpublic java.lang.String getTitle()
java.lang.IllegalStateException
- if the item is already destroyedpublic void invokeUrl(java.lang.String url) throws java.io.IOException, java.lang.SecurityException, java.lang.IllegalArgumentException, javax.microedition.io.ConnectionNotFoundException
url
- the url to be loaded and rendered
java.lang.IllegalStateException
- if the item is already destroyed
java.io.IOException
- if network connection problem happens
java.lang.SecurityException
- if no permission to open network connection
java.lang.IllegalArgumentException
- If a parameter is invalid
javax.microedition.io.ConnectionNotFoundException
- If the target of the name cannot be found, or if the requested protocol type is not supportedpublic void loadHistoryByUrl(java.lang.String url) throws java.io.IOException, java.lang.SecurityException, java.lang.IllegalArgumentException, javax.microedition.io.ConnectionNotFoundException
url
- the url to be loaded from history
java.lang.IllegalStateException
- if the item is already destroyed
java.io.IOException
- if network connection problem happens
java.lang.SecurityException
- if no permission to open network connection
java.lang.IllegalArgumentException
- If a parameter is invalid
javax.microedition.io.ConnectionNotFoundException
- If the target of the name cannot be found, or if the requested protocol type is not supportedpublic void reload()
java.lang.IllegalStateException
- if the item is already destroyedpublic void stop()
java.lang.IllegalStateException
- if the item is already destroyedpublic void noteDialogDone()
java.lang.IllegalStateException
- if the item is already destroyedpublic void confirmDialogDone(boolean yesno)
yesno
- the user's selection
java.lang.IllegalStateException
- if the item is already destroyedpublic void fileSelectDialogDone(java.lang.String file) throws java.io.IOException, java.lang.SecurityException, java.lang.IllegalArgumentException, javax.microedition.io.ConnectionNotFoundException
file
- the path to the file
java.lang.IllegalStateException
- if the item is already destroyed
java.io.IOException
- if file connection problem happens
java.lang.SecurityException
- if no permission to access the file
java.lang.IllegalArgumentException
- If a parameter is invalid
javax.microedition.io.ConnectionNotFoundException
- If the target of the name cannot be found, or if the requested protocol type is not supportedpublic void selectListDialogDone(int[] ids)
ids
- the selected ids
java.lang.IllegalStateException
- if the item is already destroyed
java.lang.IllegalArgumentException
- if the ids are not from list provided at onSelectListDialog()public int saveSelectedImage(java.lang.String filePath) throws java.io.IOException, java.lang.SecurityException, java.lang.IllegalArgumentException, javax.microedition.io.ConnectionNotFoundException
filePath
- the path where the image should be saved
java.lang.IllegalStateException
- if the item is already destroyed
java.io.IOException
- if file connection problem happens
java.lang.SecurityException
- if no permission to access the file
java.lang.IllegalArgumentException
- If a parameter is invalid
javax.microedition.io.ConnectionNotFoundException
- If the target of the name cannot be found, or if the requested protocol type is not supportedpublic void setBrowserListener(BrowserListener listener)
listener
- to be notified
java.lang.IllegalStateException
- if the item is already destroyed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |