ilog.views.appframe.swing
Class IlvTreeView

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 ilog.views.appframe.swing.IlvPanelView
                      extended by ilog.views.appframe.swing.IlvTreeView
All Implemented Interfaces:
IlvDocumentView, ActionHandler, MessageListener, IlvPropertyManager, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
IlvExplorerView

public class IlvTreeView
extends IlvPanelView

Defines a document view associated with Swing JTree.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static String DEFAULT_SETTINGS_NAME
          Default attribute name for selecting the settings element that provides the settings of the tree view.
static String DEFAULT_SETTINGS_TYPE
          Type of settings element providing the settings for the tree views.
 
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 ilog.views.appframe.docview.IlvDocumentView
ACTIVE_PROPERTY, ACTIVE_VIEW_NAME, APPLICATION_PROPERTY, CLOSABLE_PROPERTY, CLOSING_VIEW_MSG, DOCUMENT_PROPERTY, SETTINGS_ELEMENT_PROPERTY, STATIC_VIEW_PROPERTY, VIEW_CONTAINER_PROPERTY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
  IlvTreeView()
          Constructs an IlvTreeView component.
protected IlvTreeView(String settingsType, String defaultSettingsName)
          Constructs a tree view that reads its settings from a settings element with the specified settingsType.
 
Method Summary
protected  void addTree(JTree tree)
          Invoked after the tree associated with this view has been created, for adding it to the panel view.
protected  JTree createTree()
          Factory method invoked to create a JTree to add to the panel view.
protected  TreeCellRenderer createTreeCellRenderer(JTree tree)
          Factory method that creates a tree renderer for the specified tree.
 Object getProperty(String key)
          Returns the client property of the tree with the specified key.
 JTree getTree()
          Returns the JTree instance associated with this view.
protected  void initializeTree(JTree tree)
          Invoked by the initializeView(ilog.views.appframe.docview.IlvDocument) method after the createTree() method has been called, for initializing the newly created tree.
 void initializeView(IlvDocument document)
          Initializes the tree view with the specified document.
protected  void nodeDoubleClicked(MouseEvent e, TreeNode treeNode, Object userData)
          Invoked when a tree node has been double-clicked in the tree view.
protected  void nodeRightClicked(MouseEvent e, TreeNode treeNode, Object userData)
          Invoked when a tree node has been right-clicked in the tree view.
 Object setProperty(String key, Object value)
          Sets one of the client properties of this tree, using the associated key.
 void setTree(JTree tree)
          Associates the specified tree with this tree view.
 void viewClosed()
          Invoked after the view has been closed.
 void viewClosing()
          Invoked before the view closes.
 
Methods inherited from class ilog.views.appframe.swing.IlvPanelView
actionPerformed, addActionHandler, close, getApplication, getDocument, getSettings, getSettingsElement, getSettingsName, getSettingsQuery, getSettingsType, getViewContainer, isProcessingAction, isStaticView, readSettings, receiveMessage, registerMappings, removeActionHandler, setApplication, setDocument, setSettings, setSettingsElement, setSettingsName, setSettingsQuery, setViewContainer, updateAction, writeSettings
 
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, 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, 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
 
Methods inherited from interface ilog.views.appframe.util.IlvPropertyManager
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

DEFAULT_SETTINGS_TYPE

public static final String DEFAULT_SETTINGS_TYPE
Type of settings element providing the settings for the tree views.

See Also:
Constant Field Values

DEFAULT_SETTINGS_NAME

public static final String DEFAULT_SETTINGS_NAME
Default attribute name for selecting the settings element that provides the settings of the tree view.

See Also:
Constant Field Values
Constructor Detail

IlvTreeView

protected IlvTreeView(String settingsType,
                      String defaultSettingsName)
Constructs a tree view that reads its settings from a settings element with the specified settingsType.

Parameters:
settingsType - The type of the settings element that provides the settings for the tree view.
defaultSettingsName - The default name used to select the settings element that provides the settings for this tree view.
See Also:
IlvPanelView.getSettingsType(), IlvPanelView.getSettingsName()

IlvTreeView

public IlvTreeView()
Constructs an IlvTreeView component.

Method Detail

initializeView

public void initializeView(IlvDocument document)
Initializes the tree view with the specified document. Before the method is called, the specified document is associated with the view by setting the DOCUMENT_PROPERTY of the view.

By default, this method makes sure that a JTree instance has been created for the view. If not, the factory createTree() method will be called.

Specified by:
initializeView in interface IlvDocumentView
Overrides:
initializeView in class IlvPanelView
Parameters:
document - The document to initialize the content of the tree view from.

createTree

protected JTree createTree()
Factory method invoked to create a JTree to add to the panel view. By default, a JTree instance is returned.

Returns:
The newly created JTree instance.
See Also:
initializeView(ilog.views.appframe.docview.IlvDocument), initializeTree(javax.swing.JTree)

initializeTree

protected void initializeTree(JTree tree)
Invoked by the initializeView(ilog.views.appframe.docview.IlvDocument) method after the createTree() method has been called, for initializing the newly created tree. By default, a mouse listener is added to the tree for linking the double-click and right-click events to the methods nodeDoubleClicked(java.awt.event.MouseEvent, javax.swing.tree.TreeNode, java.lang.Object) and nodeRightClicked(java.awt.event.MouseEvent, javax.swing.tree.TreeNode, java.lang.Object) respectively.

This method is invoked once after a new tree has been created. The initialization of the tree content according to the data of the document of this view should be performed when overriding the initializeView(ilog.views.appframe.docview.IlvDocument) method.

Parameters:
tree - The tree to initialize.

addTree

protected void addTree(JTree tree)
Invoked after the tree associated with this view has been created, for adding it to the panel view. By default, a BorderLayout is set to the panel view and the tree is added to the panel with the BorderLayout.CENTER constraint.

Parameters:
tree - The tree to add to the panel view.
See Also:
initializeView(ilog.views.appframe.docview.IlvDocument), createTree()

getTree

public JTree getTree()
Returns the JTree instance associated with this view.

See Also:
setTree(javax.swing.JTree)

setTree

public void setTree(JTree tree)
Associates the specified tree with this tree view. The previous tree of the view is removed from the panel. Then, the methods initializeTree(javax.swing.JTree) and addTree(javax.swing.JTree) are called respectively for associating the specified tree with the view.

Parameters:
tree - The new tree of the tree view.
See Also:
getTree(), initializeTree(javax.swing.JTree), addTree(javax.swing.JTree)

viewClosing

public void viewClosing()
Invoked before the view closes. Does nothing by default.

Specified by:
viewClosing in interface IlvDocumentView
Overrides:
viewClosing in class IlvPanelView
See Also:
viewClosed()

viewClosed

public void viewClosed()
Invoked after the view has been closed. Does nothing by default.

Specified by:
viewClosed in interface IlvDocumentView
Overrides:
viewClosed in class IlvPanelView
See Also:
viewClosing()

createTreeCellRenderer

protected TreeCellRenderer createTreeCellRenderer(JTree tree)
Factory method that creates a tree renderer for the specified tree. This method is called after the method createTree() has been called for setting a tree cell renderer to the new tree. The newly created tree renderer must not be set to the tree, since this is done automatically.

Returns:
The newly created tree renderer.
See Also:
createTree()

setProperty

public Object setProperty(String key,
                          Object value)
Sets one of the client properties of this tree, using the associated key. If the value has changed, a PropertyChangeEvent will be sent to property change listeners.

Specified by:
setProperty in interface IlvPropertyManager
Overrides:
setProperty in class IlvPanelView
Parameters:
key - The non-null property key.
value - An Object value. If it is equal to null, the property with the specified key will be removed.
Returns:
The previous value of the property.
See Also:
getProperty(java.lang.String), JComponent.putClientProperty(java.lang.Object, java.lang.Object)

getProperty

public Object getProperty(String key)
Returns the client property of the tree with the specified key.

Specified by:
getProperty in interface IlvPropertyManager
Overrides:
getProperty in class IlvPanelView
Parameters:
key - The non-null property key.
Returns:
The value of the specified property. It returns null if the specified property was not found.
See Also:
setProperty(java.lang.String, java.lang.Object), JComponent.getClientProperty(java.lang.Object)

nodeDoubleClicked

protected void nodeDoubleClicked(MouseEvent e,
                                 TreeNode treeNode,
                                 Object userData)
Invoked when a tree node has been double-clicked in the tree view. By default, this method is empty. It is overridden by the explorer view for opening a document corresponding to the user data node.

Parameters:
e - The mouse event that originated the call to this method.
treeNode - The tree node.
userData - The user data associated with this node or null.
See Also:
initializeTree(javax.swing.JTree)

nodeRightClicked

protected void nodeRightClicked(MouseEvent e,
                                TreeNode treeNode,
                                Object userData)
Invoked when a tree node has been right-clicked in the tree view. By default, this method is empty. It is overridden by the explorer view for displaying a menu corresponding to the specified userData.

Parameters:
e - The mouse event that originated the call to this method. Parameters of this event can be used for displaying a pop-up menu.
treeNode - The tree node.
userData - The user data associated with this node or null.
See Also:
initializeTree(javax.swing.JTree)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.