|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.midlet.MIDlet
example.imageviewer.ImageViewer
public class ImageViewer
Simple Image Viewer for PNG images. This application uses the CHAPI API both to invoke a content handler via a URL and to handle an Invocation request. The application implements the CHAPI request listener to respond to requests. The listener constructs an Image from the URL and displays it. A "Back" command is made available to finish the request. A response listener is used to handle the response as an informational alert to the user. The application provides a simple user interface to enter a URL and a "Go" command to invoke the URL. A "Save" command is used to invoke a ScreenSaver application.
Field Summary | |
---|---|
(package private) static java.lang.String[] |
ACCESS_ALLOWED
The list of applications allowed to access. |
(package private) javax.microedition.lcdui.Command |
backCommand
The Back Command to dismiss the viewer. |
(package private) static java.lang.String |
CALLER_CLASSNAME
The application class that will be calling Registry functions. |
(package private) static java.lang.String |
CH_CLASSNAME
The content handlers class that implements the image viewer. |
(package private) static java.lang.String |
CHID
The Content Handler ID. |
(package private) javax.microedition.lcdui.Display |
display
The Display for the viewer. |
(package private) javax.microedition.lcdui.Form |
form
The Form to display the image. |
(package private) javax.microedition.lcdui.Command |
goCommand
The Go Command to invoke the link. |
(package private) javax.microedition.content.ContentHandlerServer |
handler
ContentHandlerServer from which to get requests. |
(package private) javax.microedition.lcdui.ImageItem |
imageItem
The ImageItem displaying the image. |
(package private) javax.microedition.content.Invocation |
invoc
Current invocation, null if no current Invocation. |
(package private) static java.lang.String |
PNG_SUFFIX
The suffix supported. |
(package private) static java.lang.String |
PNG_TYPE
The type for PNG. |
(package private) javax.microedition.content.Registry |
registry
Access to Registry functions and responses. |
(package private) javax.microedition.lcdui.Command |
saveCommand
The Save Command to invoke the screen saver. |
(package private) javax.microedition.lcdui.TextField |
urlField
The TextField to input a URL. |
Constructor Summary | |
---|---|
ImageViewer()
Initialize the viewer user interface and listeners for requests and responses. |
Method Summary | |
---|---|
void |
commandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable s)
Handle command on the Form. |
void |
destroyApp(boolean force)
Cleanup and destroy the application. |
(package private) void |
displayImage(javax.microedition.content.Invocation invoc)
Fetch the Image and display. |
(package private) void |
doInvoke(java.lang.String url)
Invoke the URL provided. |
(package private) void |
doSave()
Saving the image to a ScreenSaver application. |
(package private) boolean |
finish(int status)
Finish the current invocation if any. |
void |
invocationRequestNotify(javax.microedition.content.ContentHandlerServer h)
Process a new Invocation request. |
void |
invocationResponseNotify(javax.microedition.content.Registry r)
Process a response to a previous request. |
void |
pauseApp()
Pause the application; no additional action needed. |
(package private) void |
register()
Dynamic registration of content handler. |
(package private) void |
showImage(javax.microedition.lcdui.Image image)
Show an image. |
(package private) void |
showURL()
Switch to show the URL input field. |
void |
startApp()
Start the application; no additional action needed. |
Methods inherited from class javax.microedition.midlet.MIDlet |
---|
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final java.lang.String PNG_TYPE
static final java.lang.String PNG_SUFFIX
static final java.lang.String CHID
static final java.lang.String[] ACCESS_ALLOWED
static final java.lang.String CH_CLASSNAME
static final java.lang.String CALLER_CLASSNAME
javax.microedition.content.Invocation invoc
javax.microedition.content.ContentHandlerServer handler
javax.microedition.content.Registry registry
javax.microedition.lcdui.Display display
javax.microedition.lcdui.Form form
javax.microedition.lcdui.ImageItem imageItem
javax.microedition.lcdui.TextField urlField
javax.microedition.lcdui.Command backCommand
javax.microedition.lcdui.Command goCommand
javax.microedition.lcdui.Command saveCommand
Constructor Detail |
---|
public ImageViewer()
Method Detail |
---|
void showURL()
void showImage(javax.microedition.lcdui.Image image)
image
- the Image to displaypublic void startApp()
startApp
in class javax.microedition.midlet.MIDlet
public void pauseApp()
pauseApp
in class javax.microedition.midlet.MIDlet
public void destroyApp(boolean force)
destroyApp
in class javax.microedition.midlet.MIDlet
force
- true to force the exit (always exit)public void invocationRequestNotify(javax.microedition.content.ContentHandlerServer h)
invocationRequestNotify
in interface javax.microedition.content.RequestListener
h
- the ContentHandlerServer with the new requestpublic void invocationResponseNotify(javax.microedition.content.Registry r)
invocationResponseNotify
in interface javax.microedition.content.ResponseListener
r
- the Registry with the responsepublic void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
commandAction
in interface javax.microedition.lcdui.CommandListener
c
- the Commands
- the Displayable the command occurred onvoid doInvoke(java.lang.String url)
url
- the URL of an imageboolean finish(int status)
status
- the status to pass to finish
void displayImage(javax.microedition.content.Invocation invoc)
invoc
- an Invocation with the URL and contentsvoid register()
void doSave()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |