edu.princeton.wordnet.browser
Class Controller

java.lang.Object
  extended by edu.princeton.wordnet.browser.Controller
All Implemented Interfaces:
LookerUp
Direct Known Subclasses:
UI

public abstract class Controller
extends java.lang.Object
implements LookerUp

Controller

Author:
Bernard Bou

Nested Class Summary
(package private) static class Controller.Code
          Command codes
 
Field Summary
private static org.apache.log4j.Logger LOG
           
private  java.lang.String[] theArgs
          Command line arguments
protected  java.util.Properties theSettings
          Settings
 
Constructor Summary
Controller(java.lang.String[] theseArgs)
          Constructor
 
Method Summary
protected abstract  void addHistory(java.lang.String thisLookup)
          Add lookup to history
private  void collapse()
          Collapse tree
protected abstract  boolean confirm(java.lang.String[] thisMessage)
          Confirm
private  void connect(java.lang.Runnable onConnected)
          Connect client
private  void console(boolean show)
          Show/Hide console
private  void editLinkSettings()
          Edit link filter
private  void editStyleSettings()
          Edit styles
protected  void execute(Controller.Code thisCode, java.lang.Object... theseParams)
          Run command
private  void expand()
          Expand tree
private  void exportDocument()
          Export document
private  void exportDocumentXsl()
          Export document
protected abstract  java.beans.PropertyChangeListener getConsolePropertyListener()
          Get console property listener
private static java.io.File getFile(java.lang.String thisUrlString)
          Get file from Url
protected abstract  java.lang.String getLookup()
          Get lookup
private  java.util.Map<java.lang.String,java.lang.String> getTransformerParameters()
          Get transformer parameters
protected abstract  TreeView getTreeView()
          Get selected treeview
protected abstract  java.util.List<TreeView> getTreeViews()
          Get tree views
private  void help()
          Help with browser
private  void importDocument()
          Import document
private  void importDocument(java.net.URL thisUrl)
          Import document
private  void initialLookup()
          Task lookup
protected abstract  void internalHelp()
          Help
(package private)  void lookup()
          Lookup
 void lookup(java.lang.String thisLookup)
          Look up
private  void lookupLexDomains()
          List LexDomains
private  void lookupLinks()
          List Links
private  void lookupPos()
          List POS
private  void lookupXml()
          Lookup XML
 void lookupXml(java.lang.String thisLookup)
          Lookup XML
private  void lookupXMLRaw()
          Export document to XML view
 void lookupXmlRaw(java.lang.String thisLookup)
          Lookup raw XML
protected abstract  HtmlView makeHtmlView(java.lang.String thisTitle, java.lang.String thisTooltip)
          Make Html view
(package private) abstract  void makeTextView(java.lang.String thisTitle, java.lang.String thisTooltip, java.lang.String thisText)
          Make text view
protected abstract  void makeTreeView(TreeView thisView, java.lang.String thisTitle, java.lang.String thisTooltip, javax.swing.tree.TreeModel thisTreeModel)
          Make tree view
protected  java.lang.String mangle(java.lang.String thatString)
          Mangle string
protected abstract  void quit()
          Quit
private  java.util.List<java.lang.String> readArgs()
          Parse lookups from command line
protected abstract  void reportClientError(java.lang.Throwable t)
          Report Client Error
protected abstract  void reportException(java.lang.Exception e)
          Report Exception
protected abstract  void setConnected(boolean isConnected)
          Set status connected
protected abstract  void setSearching(boolean isSearching)
          Set status searching
protected abstract  void setStatus(java.lang.String thisMessage)
          Set status
protected  void start()
          Start
private  void transformToFile(org.dom4j.Document thisDocument, java.lang.String thisExportUrl, java.lang.String thisXsltUrlString, java.lang.String thisOutputFileUrl)
          Transform to file
private  void transformToHtmlView(org.dom4j.Document thisDocument, java.lang.String thisXsltUrlString, java.lang.String thisWord)
          Transform to view
private  void transformToView(org.dom4j.Document thisDocument, java.lang.String thisExportUrl, java.lang.String thisXsltUrlString, java.lang.String thisWord)
          Transform to view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

theArgs

private final java.lang.String[] theArgs
Command line arguments


theSettings

protected java.util.Properties theSettings
Settings

Constructor Detail

Controller

public Controller(java.lang.String[] theseArgs)
           throws java.io.IOException
Constructor

Parameters:
theseArgs - command line arguments
Throws:
java.io.IOException
Method Detail

makeTreeView

protected abstract void makeTreeView(TreeView thisView,
                                     java.lang.String thisTitle,
                                     java.lang.String thisTooltip,
                                     javax.swing.tree.TreeModel thisTreeModel)
Make tree view

Parameters:
thisView - treeview
thisTitle - title
thisTooltip - tooltip
thisTreeModel - treemodel

getTreeView

protected abstract TreeView getTreeView()
Get selected treeview

Returns:
selected treeview or null

getTreeViews

protected abstract java.util.List<TreeView> getTreeViews()
Get tree views

Returns:
list of tree view

makeHtmlView

protected abstract HtmlView makeHtmlView(java.lang.String thisTitle,
                                         java.lang.String thisTooltip)
Make Html view

Parameters:
thisTitle - title
thisTooltip - tooltip

makeTextView

abstract void makeTextView(java.lang.String thisTitle,
                           java.lang.String thisTooltip,
                           java.lang.String thisText)
Make text view

Parameters:
thisTitle - title
thisTooltip - tooltip
thisText - text

getLookup

protected abstract java.lang.String getLookup()
Get lookup

Returns:
lookup string

addHistory

protected abstract void addHistory(java.lang.String thisLookup)
Add lookup to history

Parameters:
thisLookup -

setStatus

protected abstract void setStatus(java.lang.String thisMessage)
Set status

Parameters:
thisMessage - message

setConnected

protected abstract void setConnected(boolean isConnected)
Set status connected

Parameters:
isConnected - whether client is connected

setSearching

protected abstract void setSearching(boolean isSearching)
Set status searching

Parameters:
isSearching - whether client is searching

internalHelp

protected abstract void internalHelp()
Help


quit

protected abstract void quit()
Quit


confirm

protected abstract boolean confirm(java.lang.String[] thisMessage)
Confirm

Parameters:
thisMessage - message
Returns:
true if confirmed

reportClientError

protected abstract void reportClientError(java.lang.Throwable t)
Report Client Error

Parameters:
t - Throwable

reportException

protected abstract void reportException(java.lang.Exception e)
Report Exception

Parameters:
e - Exception

getConsolePropertyListener

protected abstract java.beans.PropertyChangeListener getConsolePropertyListener()
Get console property listener


start

protected void start()
Start


connect

private void connect(java.lang.Runnable onConnected)
Connect client

Parameters:
onConnected - called when connected

execute

protected void execute(Controller.Code thisCode,
                       java.lang.Object... theseParams)
Run command

Parameters:
thisCode - command code

initialLookup

private void initialLookup()
Task lookup


lookup

void lookup()
Lookup


lookupXml

private void lookupXml()
Lookup XML


lookupXMLRaw

private void lookupXMLRaw()
Export document to XML view


lookup

public void lookup(java.lang.String thisLookup)
Description copied from interface: LookerUp
Look up

Specified by:
lookup in interface LookerUp
Parameters:
thisLookup - word to look up

lookupXml

public void lookupXml(java.lang.String thisLookup)
Lookup XML

Parameters:
thisLookup - lookup target

lookupXmlRaw

public void lookupXmlRaw(java.lang.String thisLookup)
Lookup raw XML

Parameters:
thisLookup - lookup target

importDocument

private void importDocument()
Import document

Throws:
java.net.MalformedURLException

importDocument

private void importDocument(java.net.URL thisUrl)
                     throws java.lang.Exception
Import document

Parameters:
thisUrl - document url
Throws:
java.lang.Exception

exportDocument

private void exportDocument()
Export document


exportDocumentXsl

private void exportDocumentXsl()
Export document


transformToView

private void transformToView(org.dom4j.Document thisDocument,
                             java.lang.String thisExportUrl,
                             java.lang.String thisXsltUrlString,
                             java.lang.String thisWord)
Transform to view


transformToHtmlView

private void transformToHtmlView(org.dom4j.Document thisDocument,
                                 java.lang.String thisXsltUrlString,
                                 java.lang.String thisWord)
Transform to view


transformToFile

private void transformToFile(org.dom4j.Document thisDocument,
                             java.lang.String thisExportUrl,
                             java.lang.String thisXsltUrlString,
                             java.lang.String thisOutputFileUrl)
Transform to file


lookupPos

private void lookupPos()
List POS


lookupLexDomains

private void lookupLexDomains()
List LexDomains


lookupLinks

private void lookupLinks()
List Links


editLinkSettings

private void editLinkSettings()
Edit link filter


editStyleSettings

private void editStyleSettings()
Edit styles

Throws:
java.net.MalformedURLException

expand

private void expand()
Expand tree


collapse

private void collapse()
Collapse tree


getFile

private static java.io.File getFile(java.lang.String thisUrlString)
Get file from Url

Parameters:
thisUrlString - url string
Returns:
file

getTransformerParameters

private java.util.Map<java.lang.String,java.lang.String> getTransformerParameters()
Get transformer parameters

Returns:
name-value map

mangle

protected java.lang.String mangle(java.lang.String thatString)
Mangle string

Parameters:
thatString - string to mangle
Returns:
mangled string

help

private void help()
Help with browser


console

private void console(boolean show)
Show/Hide console

Parameters:
show - show/hide switch

readArgs

private java.util.List<java.lang.String> readArgs()
Parse lookups from command line

Returns:
context data from command line