com.submersion.jspshop.adminbrowse
Class AdminBrowse

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--com.submersion.jspshop.adminbrowse.AdminBrowse
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class AdminBrowse
extends javax.swing.JApplet

Java applet for browsing of trees (be it object or class)

See Also:
NetConnect, Serialized Form

Inner Class Summary
private  class AdminBrowse.PopupHandler
           
private  class AdminBrowse.TreeHandler
           
 
Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private  java.lang.String addMode
          The AddMode parameter, passed from the html page.
private  java.lang.String clickParam
          The ClickParam parameter, passed from the html page.
private  java.lang.String clickURL
          The ClickURL parameter, passed from the html page.
private  java.lang.String context
          The Context parameter, passed from the html page.
private  java.lang.String deleteMode
          The DeleteMode parameter, passed from the html page.
private  java.util.HashMap indices
          Contains a hashCode, ID lookup for JTree Nodes
private  java.lang.String modeParam
          The ModeParam parameter, passed from the html page.
private  java.lang.String path
          The Path parameter, passed from the html page.
private  java.lang.String rootName
          The RootName parameter, passed from the html page.
private  javax.swing.JTree tree
          JTree object
private  javax.swing.tree.DefaultTreeModel treeModel
          A DefaultTreeModel for underlying data structure
private  java.lang.String url
          The URL parameter, passed from the html page.
private  java.lang.String urlParam
          The URLParam parameter, passed from the html page.
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AdminBrowse()
           
 
Method Summary
private  void createLayer(javax.swing.tree.DefaultMutableTreeNode node, java.lang.String context)
          Using the netConnect and the URL parameter, creates a Layer under specified node, using context as a starting ID.
private  javax.swing.tree.DefaultMutableTreeNode createRootNode()
          Creates the root Node depending on what sort of data setup there is.
private  java.lang.String createURL(java.lang.String context)
          Concatenates a new String containing the URL that is used to get data from.
private  void expandPath(java.lang.String path)
          Expands the JTree to the path specified.
private  javax.swing.tree.DefaultMutableTreeNode findNode(javax.swing.tree.DefaultMutableTreeNode node, int key)
          Finds a node by it's hashCode
private  javax.swing.tree.DefaultMutableTreeNode findNodeByID(java.lang.String id)
          Uses the indices field to find a node by it's ID (from the context passed, or from the data provided by the corresponding JSP page)
 void init()
          Initialisation sequence starts here.
private  void initialiseProperties()
          Read the properties from the Applet tags, validate them, and store them in local variables
private  void openMode(javax.swing.tree.DefaultMutableTreeNode treeNode, java.lang.String mode, javax.swing.tree.TreePath treePath)
          Creates A URL using the ClickURL and Mode parameters, then goes to that URL.
private  void openNode(javax.swing.tree.DefaultMutableTreeNode treeNode, javax.swing.tree.TreePath treePath)
          Creates A URL using the ClickURL and ClickParam parameters, then goes to that URL.
private  java.lang.String[] split(java.lang.String str, java.lang.String delim)
          Helper function that splits apart a String by it's delimiter and returns an Array of that string.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, createRootPaneException, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paint, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, transferFocus, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

indices

private java.util.HashMap indices
Contains a hashCode, ID lookup for JTree Nodes

treeModel

private javax.swing.tree.DefaultTreeModel treeModel
A DefaultTreeModel for underlying data structure

tree

private javax.swing.JTree tree
JTree object

path

private java.lang.String path
The Path parameter, passed from the html page. Contains a comma seperated path to describe which node should be selected

clickURL

private java.lang.String clickURL
The ClickURL parameter, passed from the html page. Contains a URL that should be called when a node is opened

clickParam

private java.lang.String clickParam
The ClickParam parameter, passed from the html page. Contains the name of the parameter that should be passed when a Node is opened

modeParam

private java.lang.String modeParam
The ModeParam parameter, passed from the html page. Contains the name of the parameter that should represent the mode passed to the clickURL

deleteMode

private java.lang.String deleteMode
The DeleteMode parameter, passed from the html page. Contains the value of the mode for deletion.

addMode

private java.lang.String addMode
The AddMode parameter, passed from the html page. Contains the value of the mode for adding

context

private java.lang.String context
The Context parameter, passed from the html page. Contains the ID from which the tree should be built.

rootName

private java.lang.String rootName
The RootName parameter, passed from the html page. Contains the name of the Root node (In case you don't want to use the default -1)

url

private java.lang.String url
The URL parameter, passed from the html page. Contains the URL from which to get Data from.

urlParam

private java.lang.String urlParam
The URLParam parameter, passed from the html page. Contains the parameter that should be passed to get new data.
Constructor Detail

AdminBrowse

public AdminBrowse()
Method Detail

init

public void init()
Initialisation sequence starts here. Create the initial view of the tree, add the listeners, and display.
Overrides:
init in class java.applet.Applet

expandPath

private void expandPath(java.lang.String path)
Expands the JTree to the path specified.
Parameters:
path - A comma seperated path containing the Objects to expand. For example, Object,User,Anonymous would expand first the Object node, then the User node, then select the Anonymous node

findNodeByID

private javax.swing.tree.DefaultMutableTreeNode findNodeByID(java.lang.String id)
Uses the indices field to find a node by it's ID (from the context passed, or from the data provided by the corresponding JSP page)
Parameters:
id - The ID to look for.
Returns:
A TreeNode that represents the ID passed

findNode

private javax.swing.tree.DefaultMutableTreeNode findNode(javax.swing.tree.DefaultMutableTreeNode node,
                                                         int key)
Finds a node by it's hashCode
Parameters:
node - The node to start searching at.
key - The hashcode for the node to look for.
Returns:
A TreeNode matching the hashcode specified

split

private java.lang.String[] split(java.lang.String str,
                                 java.lang.String delim)
Helper function that splits apart a String by it's delimiter and returns an Array of that string.
Parameters:
str - String to split.
delim - Delimiter to split by.
Returns:
An array containing the seperate peices that were delimited by the delimiter

createLayer

private void createLayer(javax.swing.tree.DefaultMutableTreeNode node,
                         java.lang.String context)
Using the netConnect and the URL parameter, creates a Layer under specified node, using context as a starting ID.
Parameters:
node - The node of which to create the layer under
context - The ID of the object to look for children for.

createRootNode

private javax.swing.tree.DefaultMutableTreeNode createRootNode()
Creates the root Node depending on what sort of data setup there is.
Returns:
The new RootNode

createURL

private java.lang.String createURL(java.lang.String context)
Concatenates a new String containing the URL that is used to get data from.
Parameters:
context - The ID of the object that the URL is getting created for.
Returns:
A String containing a URL

initialiseProperties

private void initialiseProperties()
Read the properties from the Applet tags, validate them, and store them in local variables

openNode

private void openNode(javax.swing.tree.DefaultMutableTreeNode treeNode,
                      javax.swing.tree.TreePath treePath)
Creates A URL using the ClickURL and ClickParam parameters, then goes to that URL.
Parameters:
treeNode - The node selected.
treePath - The TreePath to the node selected.

openMode

private void openMode(javax.swing.tree.DefaultMutableTreeNode treeNode,
                      java.lang.String mode,
                      javax.swing.tree.TreePath treePath)
Creates A URL using the ClickURL and Mode parameters, then goes to that URL.
Parameters:
treeNode - The TreeNode selected.
mode - The Mode to use, for example add,delete.
treePath - The path to the TreeNode selected.