org.merlotxml.merlot
Class XMLEditorDocUI

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.merlotxml.merlot.XMLEditorDocUI
All Implemented Interfaces:
javax.accessibility.Accessible, javax.swing.event.ChangeListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, MerlotConstants, java.awt.event.MouseListener, java.io.Serializable, StatusListener

public class XMLEditorDocUI
extends javax.swing.JPanel
implements java.awt.event.MouseListener, MerlotConstants, javax.swing.event.ChangeListener, StatusListener

XML Document UI L&F code

Author:
Kelly A. Campbell
See Also:
Serialized Form

Nested Class Summary
 class XMLEditorDocUI.EditorNodeListener
          Description of the Class
protected  class XMLEditorDocUI.EditTableColumnsAction
          Description of the Class
protected  class XMLEditorDocUI.NodeAddActionListener
          Description of the Class
protected  class XMLEditorDocUI.NodeAddSpecialCommentActionListener
          Description of the Class
protected  class XMLEditorDocUI.NodeAddSpecialPIActionListener
          Description of the Class
protected  class XMLEditorDocUI.ShowNodeActionListener
          Description of the Class
 class XMLEditorDocUI.StatusCleaner
          Description of the Class
 
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
protected  javax.swing.JPanel _currentEditPanel
          The current edit panel which is displayed in the right-hand pane
protected  MerlotDOMNode _currentNode
          The current node this editor is editing in the right-hand pane
protected  XMLEditorDoc _doc
          Description of the Field
protected  javax.swing.JPanel _editPanel
          The panel which contains the node editor
protected  javax.swing.JMenuBar _menuBar
          Description of the Field
protected  javax.swing.JSplitPane _splitPane
          Description of the Field
protected  javax.swing.JLabel _status1
          Description of the Field
protected  javax.swing.JLabel _status2
          Description of the Field
protected  javax.swing.JLabel _status3
          Description of the Field
protected  javax.swing.JPanel _statusPanel
          Description of the Field
protected  com.sun.javax.swing.JTreeTable _table
          Description of the Field
protected  javax.swing.JPanel _treePanel
          Description of the Field
protected  javax.swing.JMenu _treePasteMenu
          Description of the Field
protected  DOMTreeTableAdapter _XMLmodel
          Description of the Field
protected static long STATUS_DISPLAY_TIME
          Description of the Field
 
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 org.merlotxml.merlot.MerlotConstants
ACTION_MENU_ACCELERATOR, ACTION_MENU_ICON, ACTION_NAME, ACTION_SHORT_DESCRIPTION, ACTION_SMALL_ICON, AFTER, BEFORE, ERR, INTO, UI, XML
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
XMLEditorDocUI(XMLEditorDoc doc)
          Constructor for the XMLEditorDocUI object
 
Method Summary
protected  void addItemsToMenu(java.util.List menuItems, javax.swing.MenuElement menu)
          Adds a feature to the ItemsToMenu attribute of the XMLEditorDocUI object
protected  javax.swing.JMenu createTreePasteMenu()
          Description of the Method
 void deleteNode(MerlotDOMNode node)
          Description of the Method
protected  void doPopup(java.awt.event.MouseEvent e)
          Description of the Method
 void editNode(MerlotDOMNode node, boolean brandSpankinNew)
          Displays a node for editing in the workspace panel.
 void editText(MerlotDOMNode node)
          Description of the Method
protected  void enablePasteItems(MerlotDOMNode node)
          This enables or disables the proper paste items in the paste menu based on the node parameter as the parent or sibling and a peek at the Transferable in the clipboard.
 MerlotDOMNode getCurrentNode()
          Gets the currentNode attribute of the XMLEditorDocUI object
protected  javax.swing.JMenuBar getMenuBar()
          Gets the menuBar attribute of the XMLEditorDocUI object
protected  javax.swing.JMenu getNodeAddMenu(MerlotDOMNode node, int where)
          Creates the add-> menu popup for right-click actions on a particular node.
protected  javax.swing.JMenu getNodeAddSpecialMenu(MerlotDOMNode node, int context)
          Gets the nodeAddSpecialMenu attribute of the XMLEditorDocUI object
 MerlotDOMNode getNodeForPath(javax.swing.tree.TreePath tp)
          Gets the nodeForPath attribute of the XMLEditorDocUI object
 MerlotDOMNode getNodeForRow(int row)
          Gets the nodeForRow attribute of the XMLEditorDocUI object
 java.util.Vector getNodeHistory()
          Gets the nodeHistory attribute of the XMLEditorDocUI object
protected  java.util.List getNodeMenuItems(MerlotDOMNode node)
          Gets the nodeMenuItems attribute of the XMLEditorDocUI object
protected  java.util.List getNodePluginMenuItems(MerlotDOMNode node)
          Gets the nodePluginMenuItems attribute of the XMLEditorDocUI object
protected  javax.swing.JPopupMenu getNodePopupMenu(MerlotDOMNode node)
          Gets the nodePopupMenu attribute of the XMLEditorDocUI object
 MerlotDOMNode getSelectedNode()
          Gets the Node object that is the current selection in the document tree.
 MerlotDOMNode[] getSelectedNodes()
          Gets the selectedNodes attribute of the XMLEditorDocUI object
 int getSelectedRow()
          Gets the selectedRow attribute of the XMLEditorDocUI object
 java.awt.datatransfer.Transferable getTransferable()
          gets the transfer data for the current selection, or null if no selection exists
protected  int getTreeTableColumnWidth(java.lang.String name)
           
 java.awt.Dimension getWorkspaceSize()
          Returns the dimensions of the workspace
 void mouseClicked(java.awt.event.MouseEvent e)
          Description of the Method
 void mouseEntered(java.awt.event.MouseEvent e)
          Description of the Method
 void mouseExited(java.awt.event.MouseEvent e)
          Description of the Method
 void mousePressed(java.awt.event.MouseEvent e)
          Description of the Method
 void mouseReleased(java.awt.event.MouseEvent e)
          Description of the Method
 void refreshNode(MerlotDOMNode node, boolean cancelOnly)
          Refreshs a panel (accessible via the node).
 boolean saveOpenEditors()
          Description of the Method
 void selectNode(MerlotDOMNode node)
          Description of the Method
 void setRoot(MerlotDOMNode node)
          Set the tree root and highlight the node in the JTree
protected  void setSplitPanelSizes(boolean later)
           
 void setStatus(java.lang.String s)
          Sets the status attribute of the XMLEditorDocUI object
 void setStatus(java.lang.String s, int i)
          Sets the status attribute of the XMLEditorDocUI object
protected  void setTreeTableColumnWidth(java.lang.String name, int width)
           
protected  void setupPanel()
          This panel looks a little like Windows Explorer.
protected  javax.swing.JPanel setupTreeTable()
          Description of the Method
 void showNode(MerlotDOMNode node)
          Highlights the node in the JTree
 void stateChanged(javax.swing.event.ChangeEvent evt)
          Description of the Method
 void statusChanged(StatusEvent evt)
          Description of the Method
 void updateNodeMenu(javax.swing.JMenu menu)
          updates the given node menu for the selected node
 
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, setVisible, 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

_XMLmodel

protected DOMTreeTableAdapter _XMLmodel
Description of the Field


_doc

protected XMLEditorDoc _doc
Description of the Field


_table

protected com.sun.javax.swing.JTreeTable _table
Description of the Field


_treePanel

protected javax.swing.JPanel _treePanel
Description of the Field


_splitPane

protected javax.swing.JSplitPane _splitPane
Description of the Field


_editPanel

protected javax.swing.JPanel _editPanel
The panel which contains the node editor


_statusPanel

protected javax.swing.JPanel _statusPanel
Description of the Field


_status1

protected javax.swing.JLabel _status1
Description of the Field


_status2

protected javax.swing.JLabel _status2
Description of the Field


_status3

protected javax.swing.JLabel _status3
Description of the Field


_menuBar

protected javax.swing.JMenuBar _menuBar
Description of the Field


_treePasteMenu

protected javax.swing.JMenu _treePasteMenu
Description of the Field


_currentNode

protected MerlotDOMNode _currentNode
The current node this editor is editing in the right-hand pane


_currentEditPanel

protected javax.swing.JPanel _currentEditPanel
The current edit panel which is displayed in the right-hand pane


STATUS_DISPLAY_TIME

protected static final long STATUS_DISPLAY_TIME
Description of the Field

See Also:
Constant Field Values
Constructor Detail

XMLEditorDocUI

public XMLEditorDocUI(XMLEditorDoc doc)
Constructor for the XMLEditorDocUI object

Parameters:
doc - Description of the Parameter
Method Detail

setupPanel

protected void setupPanel()
This panel looks a little like Windows Explorer. It has a treetable at the left, a JSplitPane slider in the middle, and then an editing workspace at the right.


setSplitPanelSizes

protected void setSplitPanelSizes(boolean later)

createTreePasteMenu

protected javax.swing.JMenu createTreePasteMenu()
Description of the Method

Returns:
Description of the Return Value

getMenuBar

protected javax.swing.JMenuBar getMenuBar()
Gets the menuBar attribute of the XMLEditorDocUI object

Returns:
The menuBar value

getNodeHistory

public java.util.Vector getNodeHistory()
Gets the nodeHistory attribute of the XMLEditorDocUI object

Returns:
The nodeHistory value

getCurrentNode

public MerlotDOMNode getCurrentNode()
Gets the currentNode attribute of the XMLEditorDocUI object

Returns:
The currentNode value

setupTreeTable

protected javax.swing.JPanel setupTreeTable()
Description of the Method

Returns:
Description of the Return Value

editNode

public void editNode(MerlotDOMNode node,
                     boolean brandSpankinNew)
Displays a node for editing in the workspace panel.

Parameters:
node - the node to edit
brandSpankinNew - Description of the Parameter

editText

public void editText(MerlotDOMNode node)
Description of the Method

Parameters:
node - Description of the Parameter

deleteNode

public void deleteNode(MerlotDOMNode node)
Description of the Method

Parameters:
node - Description of the Parameter

saveOpenEditors

public boolean saveOpenEditors()
Description of the Method

Returns:
Description of the Return Value

getNodeMenuItems

protected java.util.List getNodeMenuItems(MerlotDOMNode node)
Gets the nodeMenuItems attribute of the XMLEditorDocUI object

Parameters:
node - Description of the Parameter
Returns:
The nodeMenuItems value

getNodePluginMenuItems

protected java.util.List getNodePluginMenuItems(MerlotDOMNode node)
Gets the nodePluginMenuItems attribute of the XMLEditorDocUI object

Parameters:
node - Description of the Parameter
Returns:
The nodePluginMenuItems value

addItemsToMenu

protected void addItemsToMenu(java.util.List menuItems,
                              javax.swing.MenuElement menu)
Adds a feature to the ItemsToMenu attribute of the XMLEditorDocUI object

Parameters:
menuItems - The feature to be added to the ItemsToMenu attribute
menu - The feature to be added to the ItemsToMenu attribute

getNodePopupMenu

protected javax.swing.JPopupMenu getNodePopupMenu(MerlotDOMNode node)
Gets the nodePopupMenu attribute of the XMLEditorDocUI object

Parameters:
node - Description of the Parameter
Returns:
The nodePopupMenu value

enablePasteItems

protected void enablePasteItems(MerlotDOMNode node)
This enables or disables the proper paste items in the paste menu based on the node parameter as the parent or sibling and a peek at the Transferable in the clipboard.

Parameters:
node - Description of the Parameter

getNodeAddMenu

protected javax.swing.JMenu getNodeAddMenu(MerlotDOMNode node,
                                           int where)
Creates the add-> menu popup for right-click actions on a particular node.

Parameters:
node - the node this is acting on.
where - what the add is for.. INTO, BEFORE, AFTER the context node
Returns:
a menu containing elements that can be added to a node. If the INTO param is passed, this also adds the add after and before submenus.

getNodeAddSpecialMenu

protected javax.swing.JMenu getNodeAddSpecialMenu(MerlotDOMNode node,
                                                  int context)
Gets the nodeAddSpecialMenu attribute of the XMLEditorDocUI object

Parameters:
node - Description of the Parameter
Returns:
The nodeAddSpecialMenu value

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Description of the Method

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - Description of the Parameter

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Description of the Method

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - Description of the Parameter

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Description of the Method

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - Description of the Parameter

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Description of the Method

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - Description of the Parameter

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Description of the Method

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - Description of the Parameter

doPopup

protected void doPopup(java.awt.event.MouseEvent e)
Description of the Method

Parameters:
e - Description of the Parameter

updateNodeMenu

public void updateNodeMenu(javax.swing.JMenu menu)
updates the given node menu for the selected node

Parameters:
menu - Description of the Parameter

getSelectedNode

public MerlotDOMNode getSelectedNode()
Gets the Node object that is the current selection in the document tree.

Returns:
The selectedNode value

getSelectedNodes

public MerlotDOMNode[] getSelectedNodes()
Gets the selectedNodes attribute of the XMLEditorDocUI object

Returns:
The selectedNodes value

getSelectedRow

public int getSelectedRow()
Gets the selectedRow attribute of the XMLEditorDocUI object

Returns:
The selectedRow value

selectNode

public void selectNode(MerlotDOMNode node)
Description of the Method

Parameters:
node - Description of the Parameter

getNodeForPath

public MerlotDOMNode getNodeForPath(javax.swing.tree.TreePath tp)
Gets the nodeForPath attribute of the XMLEditorDocUI object

Parameters:
tp - Description of the Parameter
Returns:
The nodeForPath value

getNodeForRow

public MerlotDOMNode getNodeForRow(int row)
Gets the nodeForRow attribute of the XMLEditorDocUI object

Parameters:
row - Description of the Parameter
Returns:
The nodeForRow value

refreshNode

public void refreshNode(MerlotDOMNode node,
                        boolean cancelOnly)
Refreshs a panel (accessible via the node). Works by cancelling and re-opening the node to edit. cancelOnly option cancels without re-opening.

Parameters:
node - Description of the Parameter
cancelOnly - Description of the Parameter

showNode

public void showNode(MerlotDOMNode node)
Highlights the node in the JTree

Parameters:
node - Description of the Parameter

getWorkspaceSize

public java.awt.Dimension getWorkspaceSize()
Returns the dimensions of the workspace

Returns:
The workspaceSize value

setRoot

public void setRoot(MerlotDOMNode node)
Set the tree root and highlight the node in the JTree

Parameters:
node - The new root value

getTransferable

public java.awt.datatransfer.Transferable getTransferable()
gets the transfer data for the current selection, or null if no selection exists

Returns:
The transferable value

setStatus

public void setStatus(java.lang.String s)
Sets the status attribute of the XMLEditorDocUI object

Parameters:
s - The new status value

setStatus

public void setStatus(java.lang.String s,
                      int i)
Sets the status attribute of the XMLEditorDocUI object

Parameters:
s - The new status value
i - The new status value

statusChanged

public void statusChanged(StatusEvent evt)
Description of the Method

Specified by:
statusChanged in interface StatusListener
Parameters:
evt - Description of the Parameter

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent evt)
Description of the Method

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
evt - Description of the Parameter

getTreeTableColumnWidth

protected int getTreeTableColumnWidth(java.lang.String name)

setTreeTableColumnWidth

protected void setTreeTableColumnWidth(java.lang.String name,
                                       int width)