org.jpop.gui
Class PoplogDocBrowser

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.jpop.gui.PoplogDocBrowser
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
JeditPoplogDocBrowser

public class PoplogDocBrowser
extends javax.swing.JPanel

A GUI browser for poplog documentation

Version:
1.0
Author:
dsm
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int DEFAULT_PORT
          The default port the server should listen to
static java.lang.String DEFAULT_SERVER
          Name of default server
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PoplogDocBrowser(boolean startServer, java.lang.String cacheDir)
          Constructor for PoplogDocBrowser
PoplogDocBrowser(boolean startServer, java.lang.String cacheDir, boolean floating)
          Constructor for PoplogDocBrowser
PoplogDocBrowser(java.lang.String serverName, int port, java.lang.String cacheDir)
          Constructor for PoplogDocBrowser
PoplogDocBrowser(java.lang.String serverName, int port, java.lang.String cacheDir, boolean floating)
          Constructor for PoplogDocBrowser
 
Method Summary
 void addTab(java.lang.String name, java.io.BufferedReader document)
          Adds a tab to the PoplogDocBrowser object
 void addWindowListener(java.awt.event.WindowListener wl)
          Adds a window listener to the PoplogDocBrowser object
 void close()
          close the server if open and perform any other cleanup necessary
 void closeButtonClicked(PoplogDocView pdv)
          When the close button of a tab is clicked
 void commandButtonActionPerformed()
          Sends the text in the text area to be parsed by the client unless it starts with '#', in which case it is assumed to be a request for info on the browser itself.
 void debug(java.lang.String msg)
          Add a debugging message to the log window
 void displayException(java.lang.Exception e)
          Show a dialog with the text of the exception
 void docAreaKeyTyped(PoplogDocView pdv, java.awt.event.KeyEvent e)
          When a key is typed in the text area of a PoplogDocView
 java.lang.String getCacheDir()
          Gets the cache dir value of the PoplogDocBrowser object
 void getHelp()
          Gets the help attribute of the PoplogDocBrowser object
 void getInfo()
          Gets the info attribute of the PoplogDocBrowser object
 void getLicense()
          Gets the license attribute of the PoplogDocBrowser object
 int getPort()
          Gets the port value of the PoplogDocBrowser object
 java.lang.String getServerName()
          Gets the server name value of the PoplogDocBrowser object
 void getVersion()
          Gets the version attribute of the PoplogDocBrowser object
 void goToHistoryDown()
          Moves the history one position down
 void goToHistoryEnd()
          Moves the history to the end
 void goToHistoryStart()
          Moves the history to the start
 void goToHistoryUp()
          Moves the history one position up
static void main(java.lang.String[] args)
          The main program for the PoplogDocBrowser class
protected  void makeSplitPane()
          This method makes the central split pane, if overriden then only the tree view will show
 void rootsTreeKeyTyped(java.awt.event.KeyEvent e)
          Event handler for when a key is typed in the tree view
 void rootsTreeMouseDoubleClicked(int x, int y)
          Event handler for when a double click happens in the tree view
 void setCommandFieldText(java.lang.String s)
          Sets the text in the command field
 void setList(java.lang.String name, java.io.BufferedReader document)
          Sets the list in the tree view
 void setStatusText(java.lang.String msg)
          Sets the text in the bottom label to msg
 void setVisible(boolean b)
          Sets the visible value of the PoplogDocBrowser object
 void treeSelectionMade(javax.swing.tree.DefaultMutableTreeNode node)
          Handler for a selection made in the tree view
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port the server should listen to

See Also:
Constant Field Values

DEFAULT_SERVER

public static final java.lang.String DEFAULT_SERVER
Name of default server

See Also:
Constant Field Values
Constructor Detail

PoplogDocBrowser

public PoplogDocBrowser(java.lang.String serverName,
                        int port,
                        java.lang.String cacheDir)
Constructor for PoplogDocBrowser

Parameters:
serverName - Name of the doc server
port - port server listens to
cacheDir - Name of the directory where cache is to be stored or can be found. If null no cache will be used

PoplogDocBrowser

public PoplogDocBrowser(java.lang.String serverName,
                        int port,
                        java.lang.String cacheDir,
                        boolean floating)
Constructor for PoplogDocBrowser

Parameters:
serverName - Name of the doc server
port - port server listens to
cacheDir - Name of the directory where cache is to be stored or can be found. If null no cache will be used
floating - true when the thing should be displayed in an internally managed JFrame

PoplogDocBrowser

public PoplogDocBrowser(boolean startServer,
                        java.lang.String cacheDir)
Constructor for PoplogDocBrowser

Parameters:
startServer - if true, the client starts a server locally and uses it to run queries against. else it assumes the server is already running and accessible in the default location (localhost:4567)
cacheDir - Name of the directory where cache is to be stored or can be foundIf null no cache will be used

PoplogDocBrowser

public PoplogDocBrowser(boolean startServer,
                        java.lang.String cacheDir,
                        boolean floating)
Constructor for PoplogDocBrowser

Parameters:
startServer - if true, the client starts a server locally and uses it to run queries against. else it assumes the server is already running and accessible in the default location (localhost:4567)
cacheDir - Name of the directory where cache is to be stored or can be foundIf null no cache will be used
floating - true when the thing should be displayed in an internally managed JFrame
Method Detail

main

public static void main(java.lang.String[] args)
The main program for the PoplogDocBrowser class

Parameters:
args - The command line arguments

setCommandFieldText

public void setCommandFieldText(java.lang.String s)
Sets the text in the command field

Parameters:
s - The new text for the command field

setList

public void setList(java.lang.String name,
                    java.io.BufferedReader document)
Sets the list in the tree view

Parameters:
name - the name of the list
document - The document list to be added to the tree view

setStatusText

public void setStatusText(java.lang.String msg)
Sets the text in the bottom label to msg

Parameters:
msg - The new statusText value

setVisible

public void setVisible(boolean b)
Sets the visible value of the PoplogDocBrowser object

Parameters:
b - The new visible value

getServerName

public java.lang.String getServerName()
Gets the server name value of the PoplogDocBrowser object

Returns:
The serverName value

getPort

public int getPort()
Gets the port value of the PoplogDocBrowser object

Returns:
The port value

getCacheDir

public java.lang.String getCacheDir()
Gets the cache dir value of the PoplogDocBrowser object

Returns:
The cacheDir value

getHelp

public void getHelp()
Gets the help attribute of the PoplogDocBrowser object


getInfo

public void getInfo()
Gets the info attribute of the PoplogDocBrowser object


getLicense

public void getLicense()
Gets the license attribute of the PoplogDocBrowser object


getVersion

public void getVersion()
Gets the version attribute of the PoplogDocBrowser object


debug

public void debug(java.lang.String msg)
Add a debugging message to the log window

Parameters:
msg -

addWindowListener

public void addWindowListener(java.awt.event.WindowListener wl)
Adds a window listener to the PoplogDocBrowser object

Parameters:
wl - The windowListener to be added to the object

addTab

public void addTab(java.lang.String name,
                   java.io.BufferedReader document)
Adds a tab to the PoplogDocBrowser object

Parameters:
name - the name of the document
document - The document to be added to the tabs

close

public void close()
           throws java.io.IOException
close the server if open and perform any other cleanup necessary

Throws:
java.io.IOException - If we can't close

closeButtonClicked

public void closeButtonClicked(PoplogDocView pdv)
When the close button of a tab is clicked

Parameters:
pdv - The doc view to close

commandButtonActionPerformed

public void commandButtonActionPerformed()
Sends the text in the text area to be parsed by the client unless it starts with '#', in which case it is assumed to be a request for info on the browser itself. Also called when ENTER is pressed interfacethe text filed The following are valid requests:
  {HELP|REF|TEACH|DOC} [filename] -> poplog docs
  LIST [listname] -> doc lists
  ${HELP|VERSION|INFO|LICENSE} -> doc server help -> don't work?!?!?!
  *{HELP|VERSION|INFO|LICENSE} -> doc client help
  #{HELP|VERSION|INFO|LICENSE} -> doc browser help
 


displayException

public void displayException(java.lang.Exception e)
Show a dialog with the text of the exception

Parameters:
e - the exception to display

docAreaKeyTyped

public void docAreaKeyTyped(PoplogDocView pdv,
                            java.awt.event.KeyEvent e)
When a key is typed in the text area of a PoplogDocView

Parameters:
pdv - The PoplogDocView where the key was typed
e - The key event

goToHistoryDown

public void goToHistoryDown()
Moves the history one position down


goToHistoryEnd

public void goToHistoryEnd()
Moves the history to the end


goToHistoryStart

public void goToHistoryStart()
Moves the history to the start


goToHistoryUp

public void goToHistoryUp()
Moves the history one position up


rootsTreeKeyTyped

public void rootsTreeKeyTyped(java.awt.event.KeyEvent e)
Event handler for when a key is typed in the tree view

Parameters:
e - The key event

rootsTreeMouseDoubleClicked

public void rootsTreeMouseDoubleClicked(int x,
                                        int y)
Event handler for when a double click happens in the tree view

Parameters:
x - The x coordinate of the click
y - The y coordinate of the click

treeSelectionMade

public void treeSelectionMade(javax.swing.tree.DefaultMutableTreeNode node)
Handler for a selection made in the tree view

Parameters:
node - The node that is now selected

makeSplitPane

protected void makeSplitPane()
This method makes the central split pane, if overriden then only the tree view will show