org.formaria.editor.visualizer
Class ModelVisualiserPanel

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 org.formaria.editor.visualizer.ModelVisualiserPanel
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TreeSelectionListener

public class ModelVisualiserPanel
extends javax.swing.JPanel
implements javax.swing.event.TreeSelectionListener, java.awt.event.MouseListener

The main panel of the data model visualization.

Copyright (c) Formaria Ltd., 2001-2006, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.18 $

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
 
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
ModelVisualiserPanel(int preferredWidth)
           
ModelVisualiserPanel(int preferredWidth, VisualiserDebuggerEngine dEngine)
           
 
Method Summary
 void addAttribute(java.lang.String path, java.lang.String attribName)
          Add an attribute to the model
 void addMessageNode(java.lang.String message)
          Set a message in an empty tree
 void addNode(java.lang.String path, java.lang.String name)
          Add a new node to the model
 void addTable(java.lang.String path, java.lang.String name, int nrows, int ncols)
          Add a new table model to the model
 void centerScreen(java.awt.Rectangle parentRect)
          Centre the panel on screen.
 void copyAttrPathToClipboard()
          Copies selected attribute path to the clipboard
 void copyNodePathToClipboard()
          Copies selected node path to the clipboard
 boolean debugView()
           
 void deleteAttribute(java.lang.String path, java.lang.String attribName)
          Delete the selected attribute from the model
 void deleteNode(java.lang.String path)
          Deletes selected node from the model
 VisualiserDebuggerModel getDebuggerModel()
           
 ModelVisualiserTree getModelVisualiserTree()
          Get the model tree
 java.lang.String getProjectPath()
           
 DataModel getRootModel()
           
protected  javax.swing.JSplitPane getSplitPane()
          Get the splitpane
protected  java.lang.String getTreePath()
          Get the path of the selected treenode by looping the selected path array and placing a '/' between each item
protected  boolean isDbTableNodeSelected()
          Determines whether selected node is a database table node
 void mouseClicked(java.awt.event.MouseEvent me)
          The mouse was clicked on this component
 void mouseEntered(java.awt.event.MouseEvent me)
          The mouse entered this component's area
 void mouseExited(java.awt.event.MouseEvent me)
          The mouse exited this component's area
 void mousePressed(java.awt.event.MouseEvent me)
          The mouse button was pressed while over this component
 void mouseReleased(java.awt.event.MouseEvent me)
          Responds to a mouse button release by poping up a context menu for the component
 void propertyChange(java.beans.PropertyChangeEvent evt)
          This method gets called when a bound property is changed
 void refresh(java.lang.String selectedPath)
          Refresh the model representation
 void renameNode(java.lang.String path, java.lang.String name)
          Reset the node's ID
 void setDebuggerModel(VisualiserDebuggerModel dModel)
           
 void setModelTreeListener(ModelTreeListener mtl)
          Set listener for the tree
 void setNodeValue(java.lang.String path, java.lang.String attribName, java.lang.String value)
          Reset the node's value
 void setProjectPath(java.lang.String ppath)
           
 void setRootModel(DataModel root)
          Set the root mode node displayed by this visualizer
 void setSelectedPath(java.lang.String path)
          Set the selected path in the tree
 void valueChanged(javax.swing.event.TreeSelectionEvent evt)
          Update the table following a tree selection change
 
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
 

Constructor Detail

ModelVisualiserPanel

public ModelVisualiserPanel(int preferredWidth,
                            VisualiserDebuggerEngine dEngine)

ModelVisualiserPanel

public ModelVisualiserPanel(int preferredWidth)
Method Detail

debugView

public boolean debugView()

setRootModel

public void setRootModel(DataModel root)
Set the root mode node displayed by this visualizer

Parameters:
root - the root of the node hierarchy

addMessageNode

public void addMessageNode(java.lang.String message)
Set a message in an empty tree

Parameters:
message - the new message text

setModelTreeListener

public void setModelTreeListener(ModelTreeListener mtl)
Set listener for the tree

Parameters:
the - listener

setSelectedPath

public void setSelectedPath(java.lang.String path)
Set the selected path in the tree

Parameters:
the - selection path

getSplitPane

protected javax.swing.JSplitPane getSplitPane()
Get the splitpane

Returns:
the split pane

getModelVisualiserTree

public ModelVisualiserTree getModelVisualiserTree()
Get the model tree

Returns:
the tree

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent evt)
Update the table following a tree selection change

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener

getTreePath

protected java.lang.String getTreePath()
Get the path of the selected treenode by looping the selected path array and placing a '/' between each item

Returns:
the path to the selected DataModel

centerScreen

public void centerScreen(java.awt.Rectangle parentRect)
Centre the panel on screen.


mouseClicked

public void mouseClicked(java.awt.event.MouseEvent me)
The mouse was clicked on this component

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
me - the mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
The mouse button was pressed while over this component

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
me - the mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
Responds to a mouse button release by poping up a context menu for the component

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
me -

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent me)
The mouse entered this component's area

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
me - the mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent me)
The mouse exited this component's area

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
me - the mouse event

refresh

public void refresh(java.lang.String selectedPath)
Refresh the model representation

Parameters:
selectedPath - the selected path in the tree or null for no sleection

copyNodePathToClipboard

public void copyNodePathToClipboard()
Copies selected node path to the clipboard


copyAttrPathToClipboard

public void copyAttrPathToClipboard()
Copies selected attribute path to the clipboard


isDbTableNodeSelected

protected boolean isDbTableNodeSelected()
Determines whether selected node is a database table node


addAttribute

public void addAttribute(java.lang.String path,
                         java.lang.String attribName)
Add an attribute to the model

Parameters:
path - the selected path
attribName - the new attribute name

deleteAttribute

public void deleteAttribute(java.lang.String path,
                            java.lang.String attribName)
Delete the selected attribute from the model


addNode

public void addNode(java.lang.String path,
                    java.lang.String name)
Add a new node to the model

Parameters:
path - the path of the parent node
name - the name/ID of the new node

addTable

public void addTable(java.lang.String path,
                     java.lang.String name,
                     int nrows,
                     int ncols)
Add a new table model to the model

Parameters:
path - the path of the parent node
name - the name/ID of the new node

deleteNode

public void deleteNode(java.lang.String path)
Deletes selected node from the model

Parameters:
path - the path of the model node

renameNode

public void renameNode(java.lang.String path,
                       java.lang.String name)
Reset the node's ID

Parameters:
path - the path of the parent node
name - the name/ID of the new node

setNodeValue

public void setNodeValue(java.lang.String path,
                         java.lang.String attribName,
                         java.lang.String value)
Reset the node's value

Parameters:
path - the path of the parent node
name - the name/ID of the new node

getDebuggerModel

public VisualiserDebuggerModel getDebuggerModel()

setDebuggerModel

public void setDebuggerModel(VisualiserDebuggerModel dModel)

getRootModel

public DataModel getRootModel()

setProjectPath

public void setProjectPath(java.lang.String ppath)

getProjectPath

public java.lang.String getProjectPath()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
This method gets called when a bound property is changed