treebolic
Class Widget

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by treebolic.Widget
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, IWidget, IProviderContext

public class Widget
extends javax.swing.JPanel
implements IWidget, IProviderContext

Treebolic's main panel. Call either init() to feed the data

Author:
Bernard Bou
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private static boolean animateOnStart
          Animate on start flag
private static boolean debug
          Loading data on separate thread
private static boolean fromDom
          XML is parsed by DOM parser
private static long serialVersionUID
           
private  IContext theContext
          Context for operations (provides some glue to the context, application)
private  Controller theController
          Controller
private  java.util.Hashtable<java.lang.String,java.awt.Image> theImages
          Name-to-image map, used to void loading twice the same images
private  java.net.URL theImagesBase
          Images base Url
private  AbstractLayerOut theLayerOut
          Provider
private  java.awt.MediaTracker theMediaTracker
          Media tracker
private  Model theModel
          Model
private  Progress theProgress
          Progress
private  IProvider theProvider
          Provider
private  Statusbar theStatusbar
          Status bar
private  Toolbar theToolbar
          Toolbar
private static java.lang.String theVersion
          Version
private  View theView
          View
private  Weigher theWeigher
          Weigher
private static boolean threaded
          Loading data on separate thread
 
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
Widget(IContext thisContext)
          Constructor
 
Method Summary
 void focus(java.lang.String thisNodeId)
          Focus
private  java.net.URL getBase()
          Get base url
 IContext getContext()
          Get context
private  INode getFocusNode()
          Get node to initially receive focus
 java.lang.String getParameter(java.lang.String thisName)
          Get parameter
 java.lang.String getTarget()
          Get target
 java.lang.String getVersion()
          Get version
 void init()
          Init (typically called by embedding applet's init()).
protected  void init(IProvider thisProvider, java.lang.String thisSource)
          Init from provider and source
 void init(Model thisModel)
          Init from model
 void init(java.lang.String thisProviderName, java.lang.String thisSource)
          Init (typically called by embedding applet's init()).
protected  void initProcess(java.lang.String thisSource)
          Init (typically called by embedding applet's init()).
 void link(java.lang.String thisUrlString, java.lang.String thisUrlTarget)
          Link to Url
private  void loadImage(IEdge thisEdge)
          Load edge image
private  java.awt.Image loadImage(java.lang.String thisSource)
          Load image given its source
private  void loadImages()
           
private  void loadImages(INode thisNode)
          Load node and node's children's images
private  void loadImages(java.util.List<IEdge> thisEdgeList)
          Load edges' images
private  void loadTopImages(Settings theseSettings)
          Load top images
private  java.net.URL makeImageURL(java.lang.String thisImageSource)
          Get image Url
private  IProvider makeProvider(java.lang.String thisProviderName)
          Make provider
 java.net.URL makeURL(java.lang.String thisSource)
          Make URL from source string
 java.lang.String match(java.lang.String thisTargetString, java.lang.String thisScopeString, java.lang.String thisModeString)
          Match node against string
 void mount(INode thisMountingNode, java.lang.String thisSource)
          Mount a source at node
 void putInformation(java.lang.String thisHeader, java.lang.String thisContent, boolean isLink)
          Put information
 void putMessage(java.lang.String thisString)
          Put status string (such as error)
 void putProgress(java.lang.String thisString, boolean fail)
          Put progress
 void reinit(java.lang.String thisSource)
          Re-init from same provider and new source (this assumes the provider is loaded)
 void umount(INode thisMountedNode)
          Unmount at mountpoint node
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

debug

private static boolean debug
Loading data on separate thread


threaded

private static final boolean threaded
Loading data on separate thread

See Also:
Constant Field Values

fromDom

private static final boolean fromDom
XML is parsed by DOM parser

See Also:
Constant Field Values

animateOnStart

private static final boolean animateOnStart
Animate on start flag

See Also:
Constant Field Values

theVersion

private static final java.lang.String theVersion
Version

See Also:
Constant Field Values

theContext

private final IContext theContext
Context for operations (provides some glue to the context, application)

See Also:
IContext

theModel

private Model theModel
Model


theView

private View theView
View


theController

private final Controller theController
Controller


theProvider

private IProvider theProvider
Provider


theWeigher

private final Weigher theWeigher
Weigher


theLayerOut

private final AbstractLayerOut theLayerOut
Provider


theToolbar

private Toolbar theToolbar
Toolbar


theStatusbar

private Statusbar theStatusbar
Status bar


theProgress

private Progress theProgress
Progress


theMediaTracker

private java.awt.MediaTracker theMediaTracker
Media tracker


theImages

private java.util.Hashtable<java.lang.String,java.awt.Image> theImages
Name-to-image map, used to void loading twice the same images


theImagesBase

private java.net.URL theImagesBase
Images base Url

Constructor Detail

Widget

public Widget(IContext thisContext)
Constructor

Parameters:
thisContext - context
Method Detail

init

public void init()
Description copied from interface: IWidget
Init (typically called by embedding applet's init()). Data source and data provider have not yet been determined.

Specified by:
init in interface IWidget

init

public void init(java.lang.String thisProviderName,
                 java.lang.String thisSource)
Description copied from interface: IWidget
Init (typically called by embedding applet's init()). Data source and data provider names have been determined.

Specified by:
init in interface IWidget
Parameters:
thisProviderName - provider class name (null will default to XML provider)
thisSource - source (anything the provider will make sense of)

reinit

public void reinit(java.lang.String thisSource)
Description copied from interface: IWidget
Re-init from same provider and new source (this assumes the provider is loaded)

Specified by:
reinit in interface IWidget
Parameters:
thisSource - data source

initProcess

protected void initProcess(java.lang.String thisSource)
Init (typically called by embedding applet's init()). Data source and data provider have not yet been determined.

Parameters:
thisSource - source (anything the provider will make sense of)

init

protected void init(IProvider thisProvider,
                    java.lang.String thisSource)
Init from provider and source

Parameters:
thisProvider - data provider
thisSource - data source

init

public void init(Model thisModel)
Description copied from interface: IWidget
Init from model

Specified by:
init in interface IWidget
Parameters:
thisModel - model

mount

public void mount(INode thisMountingNode,
                  java.lang.String thisSource)
Mount a source at node

Parameters:
thisMountingNode - mounting node
thisSource - mounted source

umount

public void umount(INode thisMountedNode)
Unmount at mountpoint node

Parameters:
thisMountedNode - mounted node

getVersion

public java.lang.String getVersion()
Get version

Specified by:
getVersion in interface IWidget
Returns:
version

getContext

public IContext getContext()
Get context

Returns:
context

makeProvider

private IProvider makeProvider(java.lang.String thisProviderName)
Make provider

Parameters:
thisProviderName - provider name
Returns:
provider

getParameter

public java.lang.String getParameter(java.lang.String thisName)
Description copied from interface: IProviderContext
Get parameter

Specified by:
getParameter in interface IProviderContext
Parameters:
thisName - parameter name
Returns:
parameter value

makeURL

public java.net.URL makeURL(java.lang.String thisSource)
Description copied from interface: IProviderContext
Make URL from source string

Specified by:
makeURL in interface IProviderContext
Returns:
URL or null

getBase

private java.net.URL getBase()
Get base url

Returns:
base url

makeImageURL

private java.net.URL makeImageURL(java.lang.String thisImageSource)
Get image Url

Parameters:
thisImageSource - image source
Returns:
image url

loadImages

private void loadImages()

loadImages

private void loadImages(INode thisNode)
Load node and node's children's images

Parameters:
thisNode - starting node

loadImages

private void loadImages(java.util.List<IEdge> thisEdgeList)
Load edges' images

Parameters:
thisEdgeList - edge list

loadImage

private void loadImage(IEdge thisEdge)
Load edge image

Parameters:
thisEdge - edge

loadTopImages

private void loadTopImages(Settings theseSettings)
Load top images

Parameters:
theseSettings - settings

loadImage

private java.awt.Image loadImage(java.lang.String thisSource)
Load image given its source

Parameters:
thisSource - source
Returns:
image

getFocusNode

private INode getFocusNode()
Get node to initially receive focus

Returns:
node

putProgress

public void putProgress(java.lang.String thisString,
                        boolean fail)
Description copied from interface: IProviderContext
Put progress

Specified by:
putProgress in interface IProviderContext
Parameters:
thisString - message

putMessage

public void putMessage(java.lang.String thisString)
Description copied from interface: IProviderContext
Put status string (such as error)

Specified by:
putMessage in interface IProviderContext
Parameters:
thisString - message

getTarget

public java.lang.String getTarget()
Get target

Returns:
target

putInformation

public void putInformation(java.lang.String thisHeader,
                           java.lang.String thisContent,
                           boolean isLink)
Put information

Parameters:
thisHeader - header
thisContent - content

focus

public void focus(java.lang.String thisNodeId)
Description copied from interface: IWidget
Focus

Specified by:
focus in interface IWidget
Parameters:
thisNodeId - node id to get focus

match

public java.lang.String match(java.lang.String thisTargetString,
                              java.lang.String thisScopeString,
                              java.lang.String thisModeString)
Description copied from interface: IWidget
Match node against string

Specified by:
match in interface IWidget
Parameters:
thisTargetString - string to search for
thisScopeString - scope ("label", "content", "link", "id")
thisModeString - mode ("equals", "startswith", "includes")
Returns:
node id

link

public void link(java.lang.String thisUrlString,
                 java.lang.String thisUrlTarget)
Description copied from interface: IWidget
Link to Url

Specified by:
link in interface IWidget
Parameters:
thisUrlString - url string
thisUrlTarget - target string