org.switchboard.browser
Class Browser

java.lang.Object
  extended by HttpClient
      extended by org.switchboard.browser.Browser
All Implemented Interfaces:
TreeModel
Direct Known Subclasses:
AllMusicMood, Feed, FoafFile, ShoutcastResult

public class Browser
extends HttpClient
implements TreeModel


Constructor Summary
Browser()
           
Browser(String strURL)
           
 
Method Summary
 void addCookie(Cookie cookie)
           
 void addCookie(String domain, String name, String value)
           
 void addListener(BrowserListener listener)
           
 void addTreeModelListener(TreeModelListener l)
           
 void clearCookies()
           
 boolean getAcceptCookies()
           
 Object getChild(Object parent, int index)
           
 int getChildCount(Object parent)
           
 String[] getImages()
          Gets the URLs of all of the images on the webpage
 int getIndexOfChild(Object parent, Object child)
           
 String[] getLinks()
          Gets all of the links on the page
 Object getRoot()
           
 String[] getSentences()
           
 String getTitle()
          Gets the title of the webpage
 String getURL()
           
 boolean isLeaf(Object node)
           
static void main(String[] args)
           
 void newHTML(String title, String body)
           
 void newXML()
           
 int numImages()
           
 int open(String strURL)
           
 String[] query(String xquery)
           
 int refresh()
           
 void removeTreeModelListener(TreeModelListener l)
           
 void save(File dest)
           
 void save(URL dest)
           
 void setAcceptCookies(boolean bool)
           
 void setTag(String xQuery, String newContent)
           
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Browser

public Browser()

Browser

public Browser(String strURL)
Method Detail

main

public static void main(String[] args)

refresh

public int refresh()

setAcceptCookies

public void setAcceptCookies(boolean bool)

getAcceptCookies

public boolean getAcceptCookies()

addCookie

public void addCookie(String domain,
                      String name,
                      String value)

addCookie

public void addCookie(Cookie cookie)

clearCookies

public void clearCookies()

open

public int open(String strURL)

addListener

public void addListener(BrowserListener listener)

query

public String[] query(String xquery)

save

public void save(URL dest)
          throws IOException,
                 MalformedURLException
Throws:
IOException
MalformedURLException

save

public void save(File dest)
          throws IOException
Throws:
IOException

newHTML

public void newHTML(String title,
                    String body)

getURL

public String getURL()

newXML

public void newXML()

getSentences

public String[] getSentences()

numImages

public int numImages()

getImages

public String[] getImages()
Gets the URLs of all of the images on the webpage

Returns:
An array of Strings with the URLs of all of the images on the page.

getLinks

public String[] getLinks()
Gets all of the links on the page

Returns:
An array of Strings with the URLs of all of the links on the page.

getTitle

public String getTitle()
Gets the title of the webpage

Returns:
The text inside the title tag of the webpage

setTag

public void setTag(String xQuery,
                   String newContent)

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel

getChild

public Object getChild(Object parent,
                       int index)
Specified by:
getChild in interface TreeModel

getChildCount

public int getChildCount(Object parent)
Specified by:
getChildCount in interface TreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Specified by:
getIndexOfChild in interface TreeModel

getRoot

public Object getRoot()
Specified by:
getRoot in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Specified by:
isLeaf in interface TreeModel

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Specified by:
valueForPathChanged in interface TreeModel