example.mmademo
Class Utils

java.lang.Object
  extended by example.mmademo.Utils

public class Utils
extends java.lang.Object

Utility functions and listener interfaces


Nested Class Summary
(package private) static interface Utils.BreadCrumbTrail
          Interface to be implemented by classes that provide Back functionality.
(package private) static interface Utils.ContentHandler
          Interface implemented by classes that can handle (playback, display, etc.) url's.
(package private) static interface Utils.Interruptable
          Interface implemented by Displayable's that want to respond to the MIDlet's startApp() and pauseApp() calls.
(package private) static interface Utils.QueryListener
          Interface that is implemented by classes that use the query() functions.
 
Field Summary
static boolean DEBUG
           
 
Method Summary
static void debugOut(java.lang.String s)
           
static void debugOut(java.lang.Throwable t)
           
static void error(java.lang.String s, Utils.BreadCrumbTrail bct)
           
static void error(java.lang.Throwable t, Utils.BreadCrumbTrail bct)
           
static java.lang.String friendlyException(java.lang.Throwable t)
          "javax.microedition.rms.RecordStoreException: Bla" -> "RecordStoreException: Bla"
static void FYI(java.lang.String s, Utils.BreadCrumbTrail bct)
           
static java.lang.String guessContentType(java.lang.String url)
           
static java.lang.String mergeURL(java.lang.String[] url)
           
static void query(java.lang.String title, java.lang.String def, int maxSize, int constraints, Utils.QueryListener listener, Utils.BreadCrumbTrail bct)
          Prompts the user to enter a string.
static void query(java.lang.String title, java.lang.String def, int maxSize, Utils.QueryListener listener, Utils.BreadCrumbTrail bct)
          Prompts the user to enter a string.
static void sort(java.lang.String[] elements)
           
static java.lang.String[] splitURL(java.lang.String url)
          splits the URL in the parts E.g: http://www.12fb.com:80/Media/MIDI/fb.mid#1 0: protocol (e.g. http) 1: host (e.g. www.12fb.com) 2: port (e.g. 80) 3: path (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Method Detail

debugOut

public static void debugOut(java.lang.String s)

debugOut

public static void debugOut(java.lang.Throwable t)

error

public static void error(java.lang.Throwable t,
                         Utils.BreadCrumbTrail bct)

error

public static void error(java.lang.String s,
                         Utils.BreadCrumbTrail bct)

FYI

public static void FYI(java.lang.String s,
                       Utils.BreadCrumbTrail bct)

friendlyException

public static java.lang.String friendlyException(java.lang.Throwable t)
"javax.microedition.rms.RecordStoreException: Bla" -> "RecordStoreException: Bla"


query

public static void query(java.lang.String title,
                         java.lang.String def,
                         int maxSize,
                         Utils.QueryListener listener,
                         Utils.BreadCrumbTrail bct)
Prompts the user to enter a string.

Caution: this must be called in a different Thread than the lcdui event dispatcher. Unfortunately !

Parameters:
title - - title of the query window
def - - a default value that appears in the input field
maxSize - - max number of characters
listener - -
bct - -

query

public static void query(java.lang.String title,
                         java.lang.String def,
                         int maxSize,
                         int constraints,
                         Utils.QueryListener listener,
                         Utils.BreadCrumbTrail bct)
Prompts the user to enter a string.

When the user finished entering the text, the listener's methods are called. If the user pressed the OK button, the listener's queryOK method is called with the entered text as parameter. The listener need not care about hiding the displayable.

Parameters:
title - - title of the query window
def - - a default value that appears in the input field
maxSize - - max number of characters
constraints - - see javax.microedition.lcdui.TextBox
listener - - the QueryListener which receives the events

splitURL

public static java.lang.String[] splitURL(java.lang.String url)
                                   throws java.lang.Exception
splits the URL in the parts E.g: http://www.12fb.com:80/Media/MIDI/fb.mid#1 0: protocol (e.g. http) 1: host (e.g. www.12fb.com) 2: port (e.g. 80) 3: path (e.g. /Media/MIDI) 4: file (e.g. fb.mid) 5: anchor (e.g. 1) LIMITATION: URL must end with a slash if it is a directory

Throws:
java.lang.Exception

mergeURL

public static java.lang.String mergeURL(java.lang.String[] url)

guessContentType

public static java.lang.String guessContentType(java.lang.String url)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

sort

public static void sort(java.lang.String[] elements)