ilog.views.appframe.swing
Class IlvExplorerView

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

public class IlvExplorerView
extends IlvTreeView

Explorer view for visualizing and editing data container documents.

See Also:
IlvDataContainerDocument, 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 explorer view.
static String DEFAULT_SETTINGS_TYPE
          Type of settings element providing the settings for the tree views.
static String INSERT_FILE_CMD
          Action command key for the action that inserts a new file.
static String INSERT_FOLDER_CMD
          Action command key for the action that inserts a new folder.
static String INSERT_PROJECT_CMD
          Action command key for the action that inserts a new project.
static String OPEN_PROJECT_NODE_CMD
          Action command key for the action that opens the selected data container nodes.
static String REMOVE_NODE_CMD
          Action command key for the action that removes a node from the data container visualized by the explorer view.
 
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
  IlvExplorerView()
          Constructs a new IlvExplorerView.
protected IlvExplorerView(String settingsType, String defaultSettingsName)
          Constructs an explorer view that reads its settings from a settings element with the specified settingsType.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invoked when an action occurs.
protected  boolean canOpenNodes(Object[] nodes)
          Determines whether the selected nodes of the data container associated with this explorer view can be opened.
protected  boolean canRemoveDataContainerNode(Object parent, Object node)
          Determines whether the specified data container node can be removed.
protected  boolean canRemoveNodes(Object[] nodes)
          Determines whether the specified data container nodes can be removed from their data container.
protected  boolean canRemoveTreeNode(TreeNode treeNode)
          Determines whether the specified treeNode can be removed from this explorer view.
protected  TreeCellRenderer createTreeCellRenderer(JTree tree)
          Creates a tree cell renderer for the explorer view.
 IlvDataContainer getDataContainer()
          Returns the data container associated with this explorer view.
protected  Object getDataContainerNode(Object treeNode)
          Returns the data container node associated with the specified treeNode or null.
protected  String getNewFolderName(Object parent)
          Gets a name for a new folder to be created.
protected  Icon getNodeIcon(Object node, boolean expanded)
          Returns an icon for the tree node associated with the specified data container node.
protected  String getNodeText(Object node)
          Gets the text for the tree node associated with the specified data container node.
protected  void initializeTree(JTree tree)
          Invoked by the initializeView(ilog.views.appframe.docview.IlvDocument) method after the IlvTreeView.createTree() method has been called, for initializing the newly created tree.
protected  void initializeView(IlvDataContainer dataContainer)
          Initializes the explorer view with the specified data container.
 void initializeView(IlvDocument document)
          Initializes the tree view with the specified document.
protected  Object[] insertNewFiles(Object parent)
          Inserts a new file reference into the specified data container parent node.
protected  Object insertNewFolder(Object parent)
          Inserts a new folder into the specified data container parent node.
protected  Object[] insertNewProject(Object parent)
          Inserts a new project reference into the specified data container parent node.
 boolean isProcessingAction(String command)
          Determines whether the explorer view is able to perform the action with the specified command key in its actionPerformed(java.awt.event.ActionEvent) method.
protected  void nodeDoubleClicked(MouseEvent e, TreeNode treeNode, Object userData)
          Invoked when a tree node has been double-clicked in the explorer view.
protected  void nodeRightClicked(MouseEvent e, TreeNode treeNode, Object node)
          Invoked when a tree node has been right-clicked in the explorer view.
protected  boolean openNodes(Object[] nodes)
          Opens the selected nodes of the data container associated with this explorer view.
protected  void readSettings(IlvSettingsElement settingsElement)
          Reads the settings of the tree view.
protected  boolean removeNodes(Object[] nodes)
          Removes the selected data container nodes from the data container associated with this explorer view.
 boolean updateAction(Action action)
          Invoked by the application for updating the state of the specified action.
protected  void writeSettings(IlvSettingsElement settingsElement)
          Writes the settings of the tree view.
 
Methods inherited from class ilog.views.appframe.swing.IlvTreeView
addTree, createTree, getProperty, getTree, setProperty, setTree, viewClosed, viewClosing
 
Methods inherited from class ilog.views.appframe.swing.IlvPanelView
addActionHandler, close, getApplication, getDocument, getSettings, getSettingsElement, getSettingsName, getSettingsQuery, getSettingsType, getViewContainer, isStaticView, receiveMessage, registerMappings, removeActionHandler, setApplication, setDocument, setSettings, setSettingsElement, setSettingsName, setSettingsQuery, setViewContainer
 
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 explorer view.

See Also:
Constant Field Values

INSERT_FOLDER_CMD

public static final String INSERT_FOLDER_CMD
Action command key for the action that inserts a new folder.

See Also:
Constant Field Values

INSERT_FILE_CMD

public static final String INSERT_FILE_CMD
Action command key for the action that inserts a new file.

See Also:
Constant Field Values

INSERT_PROJECT_CMD

public static final String INSERT_PROJECT_CMD
Action command key for the action that inserts a new project.

See Also:
Constant Field Values

REMOVE_NODE_CMD

public static final String REMOVE_NODE_CMD
Action command key for the action that removes a node from the data container visualized by the explorer view.

See Also:
Constant Field Values

OPEN_PROJECT_NODE_CMD

public static final String OPEN_PROJECT_NODE_CMD
Action command key for the action that opens the selected data container nodes.

See Also:
Constant Field Values
Constructor Detail

IlvExplorerView

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

Parameters:
settingsType - The type of the settings element providing 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()

IlvExplorerView

public IlvExplorerView()
Constructs a new IlvExplorerView.

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.

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

initializeView

protected void initializeView(IlvDataContainer dataContainer)
Initializes the explorer view with the specified data container.

Parameters:
dataContainer - The data container to initialize the explorer view from.

initializeTree

protected void initializeTree(JTree tree)
Invoked by the initializeView(ilog.views.appframe.docview.IlvDocument) method after the IlvTreeView.createTree() method has been called, for initializing the newly created tree. A new selection listener is added to the specified tree.

Overrides:
initializeTree in class IlvTreeView
Parameters:
tree - The tree to initialize.

getDataContainer

public IlvDataContainer getDataContainer()
Returns the data container associated with this explorer view. This data container comes from the document of this view, if this document implements the IlvDataContainerProvider interface.

Returns:
The associated data container or null if the document of the view does not implement the IlvDataContainerProvider interface.
See Also:
IlvDataContainerProvider, IlvDataContainerDocument

getNodeIcon

protected Icon getNodeIcon(Object node,
                           boolean expanded)
Returns an icon for the tree node associated with the specified data container node.

Parameters:
node - The data container node to associate an icon with.
expanded - The expanded state to get the icon for. If true, the icon for the expanded state is required; if false, the icon for the collapsed state is required.
Returns:
The icon or null.

getNodeText

protected String getNodeText(Object node)
Gets the text for the tree node associated with the specified data container node.

Returns:
The text for the specified data container node.

createTreeCellRenderer

protected TreeCellRenderer createTreeCellRenderer(JTree tree)
Creates a tree cell renderer for the explorer view.

Overrides:
createTreeCellRenderer in class IlvTreeView
Returns:
The newly created tree cell renderer.
See Also:
IlvTreeView.createTree()

readSettings

protected void readSettings(IlvSettingsElement settingsElement)
Reads the settings of the tree view.

Overrides:
readSettings in class IlvPanelView
Parameters:
settingsElement - The root settings element that contains the settings for this tree view.

writeSettings

protected void writeSettings(IlvSettingsElement settingsElement)
Writes the settings of the tree view.

Overrides:
writeSettings in class IlvPanelView
Parameters:
settingsElement - The root settings element to write the settings to.

nodeDoubleClicked

protected void nodeDoubleClicked(MouseEvent e,
                                 TreeNode treeNode,
                                 Object userData)
Invoked when a tree node has been double-clicked in the explorer view. Tries to open a document associated with the specified userData.

Overrides:
nodeDoubleClicked in class IlvTreeView
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:
IlvTreeView.initializeTree(javax.swing.JTree)

nodeRightClicked

protected void nodeRightClicked(MouseEvent e,
                                TreeNode treeNode,
                                Object node)
Invoked when a tree node has been right-clicked in the explorer view. A pop-up menu is displayed, corresponding to the category of the specified node.

Overrides:
nodeRightClicked in class IlvTreeView
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.
node - The node of the associated data container that corresponds to the specified treeNode.
See Also:
IlvDataContainer.getCategory(java.lang.Object)

isProcessingAction

public boolean isProcessingAction(String command)
Determines whether the explorer view is able to perform the action with the specified command key in its actionPerformed(java.awt.event.ActionEvent) method.

Specified by:
isProcessingAction in interface ActionHandler
Overrides:
isProcessingAction in class IlvPanelView
Parameters:
command - The command key of the action.
Returns:
true if the tree view performs the specified action; false otherwise.

updateAction

public boolean updateAction(Action action)
Invoked by the application for updating the state of the specified action.

Specified by:
updateAction in interface ActionHandler
Overrides:
updateAction in class IlvPanelView
Parameters:
action - The action to update.
Returns:
true if the listener has updated the state of the action; false otherwise.

actionPerformed

public void actionPerformed(ActionEvent e)
Invoked when an action occurs.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class IlvPanelView
Parameters:
e - The action event.

insertNewFolder

protected Object insertNewFolder(Object parent)
Inserts a new folder into the specified data container parent node. This method is invoked when processing the action with the command key INSERT