com.jaxfront.swing.ui.editor
Class AbstractEditorPanel

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 com.jaxfront.swing.ui.editor.AbstractEditorPanel
All Implemented Interfaces:
EditablePanel, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.TreeModelListener, javax.swing.event.TreeSelectionListener
Direct Known Subclasses:
EditorPanel

public abstract class AbstractEditorPanel
extends javax.swing.JPanel
implements EditablePanel, javax.swing.event.TreeModelListener, javax.swing.event.TreeSelectionListener

AbstractEditorPanel is an abstract class which is responsible for visualizing the JAXFront type tree. This class wraps the TypeWorkspace and the NavigationTree. Usually on the left is the NavigationTree where you can select a node that will be visualised by the TypeWorkspace on the right side.

Version:
1.60
See Also:
com.jaxfront.core.ui.EditorPanel, com.jaxfront.core.xui.editor.XUIEditorPanel, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
AbstractEditorPanel()
          EditorPanel constructor.
AbstractEditorPanel(Type type, java.awt.Window window)
          EditorPanel constructor.
 
Method Summary
 void addButton(javax.swing.JButton button)
          Adds a Button to the Workspace.
 void addButton(javax.swing.JButton button, int orientation)
          Adds a Button to the Workspace.
 void addHelpListener(HelpListener newListener)
          Add a new help listener to receive HelpEvents in case of a defined help definition.
 void clearWorkbench()
           
 void fireHelpEvent(Type source, java.lang.String helpID)
          Fires a HelpEvent for a help requestor (source type) and the according help identifier.
 javax.swing.JComponent getCenterComponent()
           
 Document getDOM()
          Returns the jaxfront document of this instance.
 javax.swing.JPanel getHelpPanel()
           
 int getLastDividerLocation()
          Returns the location of the divider (splitter).
 NavigationTree getNavigationTree()
          Returns the navigation tree.
 Type getRootType()
          Returns the root type of the jaxfront tree
 javax.swing.JScrollPane getScrollPane()
          Returns the scrollpane of the workspace.
 TreeNode getSelectedNode()
           
 TreeNode getSelectedTreeNode()
          Returns the selected TreeNode in the NavigationTree if any.
 Document getTargetDOM()
          If a target dom is specified, this method would return it.
 TreeModel getTreeModel()
          Returns the model from the instance of the class NavigationTree
 java.awt.Window getWindow()
          Returns the frame that is the holder of this instance
 TypeWorkspace getWorkspace()
          Returns the workspace that is a instance of TypeWorkspace.
 void highlightNode(TreeNode node)
           
 boolean isTopLevelEditor()
          Returns true if this editor is the top level editor.
 boolean isTreeSelect()
           
 boolean isXUIEditor()
          Returns true if this panel is used within the xui editor.
 void release()
          Memorymanagement - use this method to release the documents and to do a clean up.
 void removeHelpListener(HelpListener listener)
          Removes a HelpListener.
 void removeSaveButton()
          Removes the save button from the workspace.
 void selectNode(TreeNode node)
          Selects a TreeNode in the NavigationTree.
 void selectNode(Type type)
          Selects a TreeNode in the NavigationTree based on a type.
 void selectNode(Type type, boolean withoutVisualize)
           
 void selectRootNode()
          Selects the root TreeNode in the NavigationTree
 void setCenterComponent(javax.swing.JComponent centerComponent)
           
 void setHelpPanelPosition(java.lang.String position)
          Sets the position of the helpPanel: BorderLayout.WEST BorderLayout.EAST BorderLayout.NORTH BorderLayout.SOUTH (default)
 void setHighLightMode(boolean isOnlyHighLightMode)
           
 void setIsTreeSelect(boolean treeSelect)
           
 void setRootVisible(boolean visible)
          Determines whether or not the root node from the TreeModel is visible.
 void setSelectedNode(TreeNode treeNode)
           
 void setTargetDOM(Document dom)
           
 void setTargetMessageTable(javax.swing.JPanel component)
          Sets a component for holding the message table.
 void setTargetMessageTable(java.awt.Panel component)
          Sets a component for holding the message table.
abstract  void treeNodesChanged(javax.swing.event.TreeModelEvent e)
           Invoked after a node (or a set of siblings) has changed in some way.
abstract  void treeNodesInserted(javax.swing.event.TreeModelEvent e)
           Invoked after nodes have been inserted into the tree.
abstract  void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
           Invoked after nodes have been removed from the tree.
abstract  void treeStructureChanged(javax.swing.event.TreeModelEvent e)
           Invoked after the tree has drastically changed structure from a given node down.
abstract  void valueChanged(javax.swing.event.TreeSelectionEvent e)
          Called whenever the value of the selection changes.
abstract  Visualizer visualize(Type type, boolean forceRepaint)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jaxfront.core.ui.EditablePanel
removeTreeNodes
 

Constructor Detail

AbstractEditorPanel

public AbstractEditorPanel()
EditorPanel constructor.

See Also:
com.jaxfront.core.ui.EditorPanel

AbstractEditorPanel

public AbstractEditorPanel(Type type,
                           java.awt.Window window)
EditorPanel constructor.

Parameters:
type - the root type from the tree should be visualised
frame - the container (a frame), that holds this instance
See Also:
com.jaxfront.core.ui.EditorPanel
Method Detail

addButton

public void addButton(javax.swing.JButton button)
Adds a Button to the Workspace. The Location is west.

Parameters:
button - the button that will be added
See Also:
com.jaxfront.core.ui.TypeWorkspace#addButton(JButton button)

addButton

public void addButton(javax.swing.JButton button,
                      int orientation)
Adds a Button to the Workspace.

Parameters:
button - the button that will be added
orientation - the position of the button location
See Also:
com.jaxfront.core.ui.TypeWorkspace#addButton(JButton button, int orientation)

getDOM

public Document getDOM()
Returns the jaxfront document of this instance.

Returns:
the current document that has been visualised.

getWindow

public java.awt.Window getWindow()
Returns the frame that is the holder of this instance

Specified by:
getWindow in interface EditablePanel
Returns:
the holder of this instance

getLastDividerLocation

public int getLastDividerLocation()
Returns the location of the divider (splitter).

Returns:
int in pixel.

getRootType

public Type getRootType()
Returns the root type of the jaxfront tree

Returns:
the root type.

getTargetDOM

public Document getTargetDOM()
If a target dom is specified, this method would return it. Usually only the class XUIEditorPanel uses a target dom.

Specified by:
getTargetDOM in interface EditablePanel
Returns:
the target dom.

getTreeModel

public TreeModel getTreeModel()
Returns the model from the instance of the class NavigationTree

Specified by:
getTreeModel in interface EditablePanel
Returns:
the model of NavigationTree.

getSelectedTreeNode

public TreeNode getSelectedTreeNode()
Returns the selected TreeNode in the NavigationTree if any.

Specified by:
getSelectedTreeNode in interface EditablePanel
Returns:
the selected TreeNode.

getWorkspace

public TypeWorkspace getWorkspace()
Returns the workspace that is a instance of TypeWorkspace.

Returns:
the workspace.

getNavigationTree

public NavigationTree getNavigationTree()
Returns the navigation tree.

Returns:
NavigationTree the navigation tree

isTopLevelEditor

public boolean isTopLevelEditor()
Returns true if this editor is the top level editor. It is possible that a panel could have an inner panel and this editor belongs to an other inner panel.

Returns:
true, if this editor is the top level editor

isXUIEditor

public boolean isXUIEditor()
Returns true if this panel is used within the xui editor.

Returns:
true if the xui editor uses an instance of this class

release

public void release()
Memorymanagement - use this method to release the documents and to do a clean up.


removeSaveButton

public void removeSaveButton()
Removes the save button from the workspace. Note that you can define in a xui file if you want to use a button group or not.

See Also:
com.jaxfront.core.ui.TypeWorkspace#removeSaveButton()

selectNode

public void selectNode(TreeNode node)
Selects a TreeNode in the NavigationTree.

Specified by:
selectNode in interface EditablePanel
Parameters:
node - the node to be selected.
See Also:
com.jaxfront.core.ui.NavigationTree#setSelectionPath(TreeNode node)

selectNode

public void selectNode(Type type)
Selects a TreeNode in the NavigationTree based on a type.

Specified by:
selectNode in interface EditablePanel
Parameters:
type - the type to be selected.
See Also:
com.jaxfront.core.ui.NavigationTree#setSelectionPath(TreeNode node)

selectNode

public void selectNode(Type type,
                       boolean withoutVisualize)

getSelectedNode

public TreeNode getSelectedNode()

setSelectedNode

public void setSelectedNode(TreeNode treeNode)

highlightNode

public void highlightNode(TreeNode node)

selectRootNode

public void selectRootNode()
Selects the root TreeNode in the NavigationTree


setRootVisible

public void setRootVisible(boolean visible)
Determines whether or not the root node from the TreeModel is visible.

Parameters:
visible - true if the root node of the tree is to be displayed
See Also:
JTree.setRootVisible(boolean rootVisible)

treeNodesChanged

public abstract void treeNodesChanged(javax.swing.event.TreeModelEvent e)

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.

To indicate the root has changed, childIndices and children will be null.

e.path() returns the path the parent of the changed node(s).

e.childIndices() returns the index(es) of the changed node(s).

Specified by:
treeNodesChanged in interface javax.swing.event.TreeModelListener

treeNodesInserted

public abstract void treeNodesInserted(javax.swing.event.TreeModelEvent e)

Invoked after nodes have been inserted into the tree.

e.path() returns the parent of the new nodes

e.childIndices() returns the indices of the new nodes in ascending order.

Specified by:
treeNodesInserted in interface javax.swing.event.TreeModelListener

treeNodesRemoved

public abstract void treeNodesRemoved(javax.swing.event.TreeModelEvent e)

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

e.path() returns the former parent of the deleted nodes.

e.childIndices() returns the indices the nodes had before they were deleted in ascending order.

Specified by:
treeNodesRemoved in interface javax.swing.event.TreeModelListener

treeStructureChanged

public abstract void treeStructureChanged(javax.swing.event.TreeModelEvent e)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

e.path() holds the path to the node.

e.childIndices() returns null.

Specified by:
treeStructureChanged in interface javax.swing.event.TreeModelListener

valueChanged

public abstract void valueChanged(javax.swing.event.TreeSelectionEvent e)
Called whenever the value of the selection changes.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
e - the event that characterizes the change.

visualize

public abstract Visualizer visualize(Type type,
                                     boolean forceRepaint)
Specified by:
visualize in interface EditablePanel

getScrollPane

public javax.swing.JScrollPane getScrollPane()
Returns the scrollpane of the workspace.

Returns:
a JScrollPane

setTargetMessageTable

public void setTargetMessageTable(javax.swing.JPanel component)
Sets a component for holding the message table. This component must have a BorderLayout. The message table will be put into the BorderLayout center.

Parameters:
component - a JComponent defining a border layout

setTargetMessageTable

public void setTargetMessageTable(java.awt.Panel component)
Sets a component for holding the message table. This component must have a BorderLayout. The message table will be put into the BorderLayout center.

Parameters:
component - a Panel defining a border layout

setHighLightMode

public void setHighLightMode(boolean isOnlyHighLightMode)

setIsTreeSelect

public void setIsTreeSelect(boolean treeSelect)

isTreeSelect

public boolean isTreeSelect()

addHelpListener

public void addHelpListener(HelpListener newListener)
Add a new help listener to receive HelpEvents in case of a defined help definition.

Specified by:
addHelpListener in interface EditablePanel
Parameters:
newListener - HelpListener

fireHelpEvent

public void fireHelpEvent(Type source,
                          java.lang.String helpID)
Fires a HelpEvent for a help requestor (source type) and the according help identifier.

Specified by:
fireHelpEvent in interface EditablePanel
Parameters:
source - source the help requestor
helpID - any help identification for the target help system

removeHelpListener

public void removeHelpListener(HelpListener listener)
Removes a HelpListener.

Specified by:
removeHelpListener in interface EditablePanel
Parameters:
listener - HelpListener to remove

setTargetDOM

public void setTargetDOM(Document dom)

getHelpPanel

public javax.swing.JPanel getHelpPanel()

setHelpPanelPosition

public void setHelpPanelPosition(java.lang.String position)
Sets the position of the helpPanel: BorderLayout.WEST BorderLayout.EAST BorderLayout.NORTH BorderLayout.SOUTH (default)


getCenterComponent

public javax.swing.JComponent getCenterComponent()

setCenterComponent

public void setCenterComponent(javax.swing.JComponent centerComponent)

clearWorkbench

public void clearWorkbench()