|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
de.enough.polish.ui.FakeContainerCustomItem
de.enough.polish.browser.Browser
public abstract class Browser
TODO: Write good docs. polish.Browser.UserAgent polish.Browser.MaxRedirects polish.Browser.Gzip polish.Browser.POISupport polish.Browser.PaintDownloadIndicator
HttpProtocolHandler,
ResourceProtocolHandler,
RedirectHttpConnection| Field Summary | |
|---|---|
protected BrowserListener |
browserListener
|
protected Container |
currentContainer
Currently used container for storing parsing results. |
protected java.lang.String |
currentDocumentBase
|
protected java.util.Stack |
history
|
protected Gauge |
loadingIndicator
|
protected HashMap |
protocolHandlersByProtocol
|
protected ArrayList |
tagHandlers
|
protected HashMap |
tagHandlersByTag
|
| Fields inherited from class de.enough.polish.ui.FakeContainerCustomItem |
|---|
allowCycling, autoFocusEnabled, autoFocusIndex, availableHeight, containerView, enableScrolling, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressY, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollSmooth, targetYOffset, yOffset |
| Fields inherited from class javax.microedition.lcdui.CustomItem |
|---|
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL |
| Constructor Summary | |
|---|---|
Browser()
Creates a new Browser without any protocol handlers, tag handlers or style. |
|
Browser(ProtocolHandler[] protocolHandlers)
Creates a new Browser with the specified handlers and style. |
|
Browser(ProtocolHandler[] protocolHandlers,
Style style)
Creates a new Browser with the specified handlers and style. |
|
Browser(java.lang.String[] tagNames,
TagHandler[] tagHandlers,
ProtocolHandler[] protocolHandlers)
Creates a new Browser with the specified handlers and style. |
|
Browser(java.lang.String[] tagNames,
TagHandler[] tagHandlers,
ProtocolHandler[] protocolHandlers,
Style style)
Creates a new Browser with the specified handlers and style. |
|
Browser(Style style)
Creates a new Browser without any protocol handler or tag handlers. |
|
| Method Summary | |
|---|---|
void |
add(Item item)
Adds an item to this container. |
void |
add(javax.microedition.lcdui.Item item)
|
void |
addAttributeCommand(java.lang.String attributeName,
java.lang.String attributeValue,
javax.microedition.lcdui.Command command)
|
void |
addAttributeCommand(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue,
javax.microedition.lcdui.Command command)
|
void |
addProtocolHandler(ProtocolHandler handler)
|
void |
addProtocolHandler(java.lang.String protocolName,
ProtocolHandler handler)
|
void |
addTagCommand(java.lang.String tagName,
javax.microedition.lcdui.Command command)
|
void |
addTagHandler(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue,
TagHandler handler)
|
void |
addTagHandler(java.lang.String tagName,
TagHandler handler)
|
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
void |
cancel()
|
boolean |
canGoBack()
Checks if the browser can go back |
void |
clearHistory()
Clears the history |
Container |
closeContainer()
Closes the current container If the current container only contains a single item, that item will be extracted and directly appended using the current container's style. |
void |
followLink()
|
BrowserListener |
getBrowserListener()
|
protected static ProtocolHandler[] |
getDefaultProtocolHandlers()
Instantiates and returns the default tag handlers for "http", "https" and "resource" URLs. |
protected ProtocolHandler |
getProtocolHandler(java.lang.String protocolName)
|
protected ProtocolHandler |
getProtocolHandlerForURL(java.lang.String url)
|
TagHandler |
getTagHandler(java.lang.String tagName)
|
TagHandler |
getTagHandler(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue)
|
void |
go(int historySteps)
Schedules the given history document for loading. |
void |
go(java.lang.String url)
Schedules the given URL for loading. |
void |
go(java.lang.String url,
java.lang.String postData)
Schedules the given URL for loading with HTTP POST data. |
boolean |
goBack()
Goes back one history step. |
protected void |
goImpl(java.lang.String url,
java.lang.String postData)
|
boolean |
handleCommand(javax.microedition.lcdui.Command command)
Tries to handle the specified command. |
protected abstract void |
handleText(java.lang.String text)
Handles normal text. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
boolean |
isCanceled()
|
boolean |
isRunning()
|
boolean |
isWorking()
|
javax.microedition.lcdui.Image |
loadImage(java.lang.String url)
|
void |
loadPage(java.io.InputStream in)
Loads a new HTML page with the specified input stream |
void |
loadPage(java.io.InputStream in,
java.lang.String encoding)
Loads a new HTML page with the specified input stream |
void |
loadPage(java.io.Reader reader)
Loads a page from a given Reader. |
void |
loadPage(java.lang.String document)
|
void |
loadPartialPage(java.io.Reader reader)
Loads a page from a given Reader. |
java.lang.String |
makeAbsoluteURL(java.lang.String url)
Takes a possibly relative URL, and generate an absolute URL, merging with the current documentbase if needed. |
protected void |
notifyDownloadEnd()
|
protected void |
notifyDownloadStart(java.lang.String url)
|
protected void |
notifyPageEnd()
|
protected void |
notifyPageError(java.lang.String url,
java.lang.Exception e)
|
protected void |
notifyPageStart(java.lang.String url)
|
void |
openContainer(Container container)
Opens a new Container into which forthcoming elements should be added. |
void |
openContainer(FakeContainerCustomItem container)
Opens a new Container into which forthcoming elements should be added. |
void |
openContainer(Style containerStyle)
Opens a new Container into which forthcoming elements should be added. |
protected void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
protected java.lang.String |
protocolAndHostOf(java.lang.String url)
"http://foo.bar.com/baz/blah.html" => "http://foo.bar.com" |
protected java.lang.String |
protocolAndPathOf(java.lang.String url)
"http://foo.bar.com/baz/boo/blah.html" => "http://foo.bar.com/baz/boo" " "http://foo.bar.com" => "http://foo.bar.com" "resource://baz/blah.html" => "resource://baz" "resource://blah.html" => "resource://" |
void |
requestStop()
|
void |
run()
|
protected void |
schedule(java.lang.String url,
java.lang.String postData)
|
void |
setBackCommand(javax.microedition.lcdui.Command cmdBack)
Sets the back command for this browser. |
void |
setBrowserListener(BrowserListener browserListener)
|
| Methods inherited from class javax.microedition.lcdui.CustomItem |
|---|
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String currentDocumentBase
protected HashMap protocolHandlersByProtocol
protected HashMap tagHandlersByTag
protected ArrayList tagHandlers
protected java.util.Stack history
protected Gauge loadingIndicator
protected BrowserListener browserListener
protected Container currentContainer
| Constructor Detail |
|---|
public Browser()
public Browser(Style style)
style - the style of this browserpublic Browser(ProtocolHandler[] protocolHandlers)
protocolHandlers - the tag handlers
public Browser(ProtocolHandler[] protocolHandlers,
Style style)
protocolHandlers - the tag handlersstyle - the style to use for the browser item
public Browser(java.lang.String[] tagNames,
TagHandler[] tagHandlers,
ProtocolHandler[] protocolHandlers)
tagNames - the names of the tags that the taghandler should handle (this allows to use a single taghandler for several tags)tagHandlers - the tag handlersprotocolHandlers - the protocol handlers
public Browser(java.lang.String[] tagNames,
TagHandler[] tagHandlers,
ProtocolHandler[] protocolHandlers,
Style style)
tagNames - the names of the tags that the taghandler should handle (this allows to use a single taghandler for several tags)tagHandlers - the tag handlersprotocolHandlers - the protocol handlersstyle - the style of this browser| Method Detail |
|---|
protected static ProtocolHandler[] getDefaultProtocolHandlers()
HttpProtocolHandler,
ResourceProtocolHandler
public void addTagCommand(java.lang.String tagName,
javax.microedition.lcdui.Command command)
public void addAttributeCommand(java.lang.String attributeName,
java.lang.String attributeValue,
javax.microedition.lcdui.Command command)
public void addAttributeCommand(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue,
javax.microedition.lcdui.Command command)
public void addProtocolHandler(ProtocolHandler handler)
public void addProtocolHandler(java.lang.String protocolName,
ProtocolHandler handler)
protected ProtocolHandler getProtocolHandler(java.lang.String protocolName)
protected ProtocolHandler getProtocolHandlerForURL(java.lang.String url)
throws java.io.IOException
java.io.IOException
public void addTagHandler(java.lang.String tagName,
TagHandler handler)
public void addTagHandler(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue,
TagHandler handler)
public TagHandler getTagHandler(java.lang.String tagName)
public TagHandler getTagHandler(java.lang.String tagName,
java.lang.String attributeName,
java.lang.String attributeValue)
public void openContainer(Style containerStyle)
containerStyle - the style of the containerpublic void openContainer(Container container)
container - the new the containerpublic void openContainer(FakeContainerCustomItem container)
container - the new the containerpublic Container closeContainer()
protected abstract void handleText(java.lang.String text)
text - the textpublic void add(Item item)
FakeContainerCustomItem
add in class FakeContainerCustomItemitem - the item which should be added.public void add(javax.microedition.lcdui.Item item)
add in class FakeContainerCustomItem
public void loadPage(java.io.Reader reader)
throws java.io.IOException
Reader.
reader - the reader to load the page from
java.io.IOException - of an error occurs
public void loadPartialPage(java.io.Reader reader)
throws java.io.IOException
Reader.
reader - the reader to load the page from
java.io.IOException - of an error occursprotected java.lang.String protocolAndHostOf(java.lang.String url)
"resource://baz/blah.html" => "resource://"
url - the URL to the get protocol and host part from
public java.lang.String makeAbsoluteURL(java.lang.String url)
url - the (possibly relative) URL
public void loadPage(java.lang.String document)
public void loadPage(java.io.InputStream in)
throws java.io.IOException
in - the input stream
java.io.IOException - when the page could not be read or when the input stream is null
public void loadPage(java.io.InputStream in,
java.lang.String encoding)
throws java.io.IOException
in - the input streamencoding - the encoding, is ignored when null
java.io.IOException - when the page could not be read or when the input stream is null or when the specified encoding is not supportedpublic javax.microedition.lcdui.Image loadImage(java.lang.String url)
protected java.lang.String protocolAndPathOf(java.lang.String url)
url - the URL to the get protocol and path part from
public boolean handleCommand(javax.microedition.lcdui.Command command)
FakeCustomItem
handleCommand in class FakeContainerCustomItemcommand - the command
protected void goImpl(java.lang.String url,
java.lang.String postData)
protected void initContent(int firstLineWidth,
int lineWidth)
FakeCustomItem
initContent in class FakeContainerCustomItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesFakeCustomItem.contentWidth,
FakeCustomItem.contentHeight,
FakeCustomItem.preferredWidth,
FakeCustomItem.preferredHeight
protected void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
FakeCustomItem
paintContent in class FakeContainerCustomItemx - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.
public void animate(long currentTime,
ClippingRegion repaintRegion)
FakeCustomItem
animate in class FakeContainerCustomItemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animated#addRelativeRegion(ClippingRegion, int, int, int, int)public void run()
run in interface java.lang.Runnable
protected void schedule(java.lang.String url,
java.lang.String postData)
public void cancel()
public void requestStop()
public boolean isRunning()
public boolean isCanceled()
public boolean isWorking()
public void go(java.lang.String url)
url - the URL that should be loaded
public void go(java.lang.String url,
java.lang.String postData)
url - the URL that should be loadedpostData - the data to be sent via HTTP POSTpublic void go(int historySteps)
historySteps - the steps that should go back, e.g. 1 for the last page that has been shownpublic void followLink()
public void setBackCommand(javax.microedition.lcdui.Command cmdBack)
cmdBack - the back command - set to null to remove it completelypublic boolean goBack()
go(int)public boolean canGoBack()
goBack()public void clearHistory()
goBack(),
go(int)
protected void notifyPageError(java.lang.String url,
java.lang.Exception e)
protected void notifyPageStart(java.lang.String url)
protected void notifyPageEnd()
protected void notifyDownloadStart(java.lang.String url)
protected void notifyDownloadEnd()
public BrowserListener getBrowserListener()
public void setBrowserListener(BrowserListener browserListener)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||