com.borland.primetime.ide
Class ProjectView

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--com.borland.primetime.ide.ProjectView
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ProjectView
extends javax.swing.JPanel

ProjectView displays a tree view of the currently 'active' project along with a toolbar which may be used to modify that project or switch to other open projects. It is created by the Browser and there is one instance per Browser. It adds itself as a ProjectListener and dynamically refreshes as files are added or removed. Certain static methods allow locating all open projects regardless of Browser.

See Also:
Browser, ProjectListener, Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static BrowserAction ACTION_ActivateNode
          An action which opens those currently selected node(s) having one or more registered NodeViewers in the Content Manager.
static BrowserAction ACTION_ContextMenu
          An action which displays the popup menu for the ProjectView.
static BrowserAction ACTION_FileAdd
          Displays a FileChooser dialog allowing the user to select a file to open.
static BrowserAction ACTION_NewFolder
          Action that creates a new Folder relative to the selected node based on a name supplied through a dialog.
static BrowserAction ACTION_ProjectCloseActive
          Closes the active Project, and saves it if it has been modified.
static BrowserAction ACTION_ProjectNodeDelete
          Deletes the selected files and removes Node from its Project.
static BrowserAction ACTION_ProjectNodeRemove
          Removes the selected Node from its Project.
static BrowserAction ACTION_ProjectNodeRename
          Action which renames the active selected node in the ProjectView to a new name.
static BrowserAction ACTION_ProjectRefresh
          An action which causes the ProjectView for the currently active project to be rebuilt.
static java.lang.String DEFAULT_PROJECT
           
 ActionGroup GROUP_OpenProjects
          Displays the open projects for the user to select one to activate.
 
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
 
Method Summary
 void addFile()
          The method called by the action ACTION_FileAdd which displays the dialog and adds the selected files to the project.
 void closeProject(Project project)
          Closes a Project (and all opened Nodes from the Project) from this ProjectView.
 void closeProjects(Project[] projects)
          Closes given Projects (and all opened Nodes within each Project) from this ProjectView.
 Project getActiveProject()
          Returns the 'active' Project of this ProjectView.
 Project getActiveUserProject()
          Returns the 'active' Project of this ProjectView if it is not the default project.
 java.awt.Dimension getMinimumSize()
          Overriden to ensure minimum size of 100x100.
static int getModifiedProjectCount()
          Returns the count of open *modified* projects.
static Project getOpenProject(int index)
          Returns the open project at the specified index.
static int getOpenProjectCount()
          Returns the count of open projects.
static Project[] getOpenProjects()
          Returns the list of open projects as an array.
 Node getSelectedNode()
          Returns the currently selected Node in this ProjectView.
 Node getSelectedNode(Project project)
          Returns the currently selected Node in this ProjectView.
 Node[] getSelectedNodes()
          Returns the currently selected Nodes in this ProjectView.
 Node[] getSelectedNodes(Project project)
          Returns the currently selected Nodes in this ProjectView from the specified project.
 boolean isVisible()
          Returns if ProjectView is visible.
 void refreshTree()
          This routine is used to force the ProjectView for the active project to be rebuilt.
 void refreshTree(Project project)
          This routine is used to force the ProjectView for the given open project to be rebuilt.
static void registerContextActionProvider(ContextActionProvider provider)
          OpenTools registration for an interface used to provide an Action to appear on the ProjectView popup menu.
 void setActiveProject(Project project)
          Sets the 'active' Project in this ProjectView.
 void setSelectedNode(Node node)
          If the given node is part of an opened project, it is made the selected node of that project causing its tree node to be expanded and scrolled into view if not already visible.
 void setSelectedNodes(Project project, Node[] nodes)
          All the given nodes must belong to the given project.
 void showNode(Node node)
          If the given node is part of an opened project, its tree node is expanded and scrolled into view if not already visible.
 void updateUI()
          Overridden to paint open projects.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString
 
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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PROJECT

public static final java.lang.String DEFAULT_PROJECT

ACTION_ProjectRefresh

public static BrowserAction ACTION_ProjectRefresh
An action which causes the ProjectView for the currently active project to be rebuilt.

ACTION_ActivateNode

public static BrowserAction ACTION_ActivateNode
An action which opens those currently selected node(s) having one or more registered NodeViewers in the Content Manager.

ACTION_FileAdd

public static BrowserAction ACTION_FileAdd
Displays a FileChooser dialog allowing the user to select a file to open. If a file is selected, it is first tested to see if it is a Project. If it is a Project, the setActiveProject(...) method is called on this Browser's ProjectView. If the file is not a Project, a Node is created from the file using the 'active' Project, and the setActiveNode(...) method is called on this Browser.

ACTION_ContextMenu

public static BrowserAction ACTION_ContextMenu
An action which displays the popup menu for the ProjectView.

ACTION_ProjectNodeRemove

public static BrowserAction ACTION_ProjectNodeRemove
Removes the selected Node from its Project. If it has been modified, user will be prompted to save.

ACTION_ProjectNodeDelete

public static BrowserAction ACTION_ProjectNodeDelete
Deletes the selected files and removes Node from its Project.

ACTION_ProjectNodeRename

public static BrowserAction ACTION_ProjectNodeRename
Action which renames the active selected node in the ProjectView to a new name.

ACTION_ProjectCloseActive

public static BrowserAction ACTION_ProjectCloseActive
Closes the active Project, and saves it if it has been modified.

GROUP_OpenProjects

public ActionGroup GROUP_OpenProjects
Displays the open projects for the user to select one to activate.

ACTION_NewFolder

public static BrowserAction ACTION_NewFolder
Action that creates a new Folder relative to the selected node based on a name supplied through a dialog.
Method Detail

getOpenProjectCount

public static int getOpenProjectCount()
Returns the count of open projects.
Returns:
The number of open projects in all Browser instances.

getModifiedProjectCount

public static int getModifiedProjectCount()
Returns the count of open *modified* projects.
Returns:
The number of projects needing to be "saved" in all Browser instances.

getOpenProject

public static Project getOpenProject(int index)
Returns the open project at the specified index.
Parameters:
index - An index into the array returned by getOpenProjects().
Returns:
The open project corresponding to the given index.

getOpenProjects

public static Project[] getOpenProjects()
Returns the list of open projects as an array.
Returns:
The open projects in all Browser instances as an array.

setActiveProject

public void setActiveProject(Project project)
                      throws java.lang.Exception
Sets the 'active' Project in this ProjectView. If the passed Project is already open in this ProjectView, it is made the 'active' Project. If the passed Project is not already open in this ProjectView, it is first opened and then made the 'active' Project.

Note that if the passed Project is not already the active Project in this ProjectView, calling this method will trigger several Browser events:

  1. browserProjectChanging(...)
  2. browserNodeChanging(...)
  3. browserViewerChanging(...)
  4. browserProjectChanged(...)
  5. browserNodeChanged(...)
  6. browserViewerChanged(...)
Parameters:
project - The Project to activate in this ProjectView.
Throws:
java.lang.Exception - A myriad of different exceptions can be thrown when setting the active Project, including VetoException (if a BrowserListener doesn't want the Project, Node, or the viewer to change, or if a NodeViewer doesn't want the viewer to change). Any number of IOExceptions or Node exceptions can be thrown if the Project is being opened for the first time.

getActiveProject

public Project getActiveProject()
Returns the 'active' Project of this ProjectView. This value will be null if no Projects are opened.
Returns:
The 'active' Project of this ProjectView. MAY BE NULL!

getActiveUserProject

public Project getActiveUserProject()
Returns the 'active' Project of this ProjectView if it is not the default project.
Returns:
The 'active' non-default Project of this ProjectView. MAY BE NULL!

setSelectedNode

public void setSelectedNode(Node node)
If the given node is part of an opened project, it is made the selected node of that project causing its tree node to be expanded and scrolled into view if not already visible.
Parameters:
node - The Node whose tree node is to be selected.

showNode

public void showNode(Node node)
If the given node is part of an opened project, its tree node is expanded and scrolled into view if not already visible.
Parameters:
node - The Node whose tree node is to be shown.

setSelectedNodes

public void setSelectedNodes(Project project,
                             Node[] nodes)
All the given nodes must belong to the given project. If the project is open, then each of the given nodes are selected without expanding their tree nodes or scrolling.
Parameters:
project - Project to which the given nodes belong.
nodes - An array identifying the Nodes to be selected.

getSelectedNode

public Node getSelectedNode()
Returns the currently selected Node in this ProjectView. This value will be null if no Nodes are selected.
Returns:
The selected Node in this ProjectView. MAY BE NULL!

getSelectedNode

public Node getSelectedNode(Project project)
Returns the currently selected Node in this ProjectView. This value will be null if no Nodes are selected.
Parameters:
project - The project to return the selected node from
Returns:
The selected Node in this ProjectView. MAY BE NULL!

getSelectedNodes

public Node[] getSelectedNodes()
Returns the currently selected Nodes in this ProjectView.
Returns:
The selected Nodes in this ProjectView.

getSelectedNodes

public Node[] getSelectedNodes(Project project)
Returns the currently selected Nodes in this ProjectView from the specified project.
Parameters:
project - The project to retrieve the selected nodes from
Returns:
The selected Nodes in this ProjectView.

refreshTree

public void refreshTree()
This routine is used to force the ProjectView for the active project to be rebuilt. It should be used if some external program has altered the file system being displayed.

refreshTree

public void refreshTree(Project project)
This routine is used to force the ProjectView for the given open project to be rebuilt. It should be used if some external program has altered the file system being displayed.
Parameters:
project - The open project whose ProjectView is to be rebuilt.

closeProject

public void closeProject(Project project)
                  throws java.lang.Exception
Closes a Project (and all opened Nodes from the Project) from this ProjectView.
Parameters:
project - The Project to close
Throws:
java.lang.Exception - A myriad of different exceptions can be thrown when closing a Project, including VetoException (if a BrowserListener doesn't want the Project, Node, or the viewer to change, or if a NodeViewer doesn't want the viewer to change). Any number of IOExceptions or Node exceptions can be thrown during the Node save/close process.

closeProjects

public void closeProjects(Project[] projects)
                   throws java.lang.Exception
Closes given Projects (and all opened Nodes within each Project) from this ProjectView. If any of the projects or files in one of those projects have been modified, then a dialog will be presented to select which to save. This dialog may also be used to cancel the entire close process.
Parameters:
projects - An array of open Projects to close
Throws:
java.lang.Exception - A myriad of different exceptions can be thrown when closing a Project, including VetoException (if a BrowserListener doesn't want the Project, Node, or the viewer to change, or if a NodeViewer doesn't want the viewer to change). Any number of IOExceptions or Node exceptions can be thrown during the Node save/close process.

addFile

public void addFile()
The method called by the action ACTION_FileAdd which displays the dialog and adds the selected files to the project.

registerContextActionProvider

public static void registerContextActionProvider(ContextActionProvider provider)
OpenTools registration for an interface used to provide an Action to appear on the ProjectView popup menu.
Parameters:
provider - An interface which can provide the popup menu Action.

isVisible

public boolean isVisible()
Returns if ProjectView is visible.
Overrides:
isVisible in class java.awt.Component
Returns:
True if ProjectView has not been hidden.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overriden to ensure minimum size of 100x100.
Overrides:
getMinimumSize in class javax.swing.JComponent

updateUI

public void updateUI()
Overridden to paint open projects.
Overrides:
updateUI in class javax.swing.JPanel