org.argouml.ui
Class ProjectBrowser

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by org.argouml.ui.ProjectBrowser
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, TargetListener

public final class ProjectBrowser
extends javax.swing.JFrame
implements java.beans.PropertyChangeListener, TargetListener

The main window of the ArgoUML application.

See Also:
Serialized Form
Stereotype:
singleton

Nested Class Summary
static class ProjectBrowser.Position
          Position of pane in overall browser window.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int DEFAULT_COMPONENTHEIGHT
          Default height.
static int DEFAULT_COMPONENTWIDTH
          Default width.
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void addFileSaved(java.io.File file)
          Register a new file saved.
 void addPanel(java.awt.Component comp, ProjectBrowser.Position position)
          Add a panel to a split pane area.
 boolean askConfirmationAndSave()
          If the current project is dirty (needs saving) then this function will ask confirmation from the user.
 void buildTitleWithCurrentProjectName()
          Rebuild the title using the name of the current project.
 void clearDialogs()
          We should remove all open dialogs.
protected  void createPanels(SplashScreen splash, javax.swing.JPanel leftBottomPane)
          Creates the panels in the working area.
 void dispose()
           
 void exit()
          Exit the application saving the current user settings.
 java.lang.String getAppName()
           
 java.awt.Font getDefaultFont()
           
 javax.swing.JPanel getDetailsPane()
           
 MultiEditorPane getEditorPane()
           
 org.argouml.ui.NavigatorPane getExplorerPane()
           
static ProjectBrowser getInstance()
          Singleton retrieval method for the projectbrowser.
 javax.swing.JMenuBar getJMenuBar()
           
 java.util.Locale getLocale()
           
protected  java.io.File getNewFile()
           
 javax.swing.AbstractAction getRemoveFromDiagramAction()
          Get the action that removes selected figs from the diagram.
 javax.swing.AbstractAction getSaveAction()
          Get the action that can save the current project.
 StatusBar getStatusBar()
           
 AbstractArgoJPanel getTab(java.lang.Class tabClass)
          Deprecated. by for 0.25.5 by tfmorris. Tabs should register themselves with whoever they need to communicate with in a distributed fashion rather than relying on a central registry. Currently the only place this is used is to communicate between WizStep and TabToDo in the Cognitive subsystem.
 javax.swing.JPanel getTodoPane()
          Returns the todopane.
 boolean loadProject(java.io.File file, boolean showUI, ProgressMonitor pmw)
          Loads the project file and opens all kinds of error message windows if it doesn't work for some reason.
 void loadProjectWithProgressMonitor(java.io.File file, boolean showUI)
          Loads a project displaying a nice ProgressMonitor
static ProjectBrowser makeInstance(SplashScreen splash, boolean mainApplication, javax.swing.JPanel leftBottomPane)
          Creator method for the ProjectBrowser which optionally allows all components to be created without making a top level application window visible.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removePanel(java.awt.Component comp)
          Remove a panel from a split pane area.
 void setAppName(java.lang.String n)
           
 void setToDoItem(java.lang.Object o)
          Deprecated. for 0.25.5 by tfmorris. Send an event that the DetailsPane/TabToDo will be listening for.
 void setVisible(boolean b)
           
 void showSaveIndicator()
          Set the save indicator (the * after the title) to appear depending on the current save action enabled status.
 void targetAdded(TargetEvent e)
          Fired when a target is added to the list of targets.
 void targetRemoved(TargetEvent e)
          Fired when a target is removed from the list of targets
 void targetSet(TargetEvent e)
          Fired when a total new set of targets is set
 void tryExit()
          Exit the application if no save is required.
 void trySave(boolean overwrite)
          Try to save the project, possibly not creating a new file
 void trySave(boolean overwrite, boolean saveNewFile)
          Try to save the project.
 void trySave(boolean overwrite, boolean saveNewFile, boolean exitAfterSave)
          Try to save the project.
 boolean trySave(boolean overwrite, java.io.File file, ProgressMonitor pmw)
          Deprecated. in 0.29.1 by Bob Tarling use trySaveWithProgressMonitor
 void trySaveWithProgressMonitor(boolean overwrite, java.io.File file, boolean exit)
          Loads a project displaying a nice ProgressMonitor
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

DEFAULT_COMPONENTWIDTH

public static final int DEFAULT_COMPONENTWIDTH
Default width.

See Also:
Constant Field Values

DEFAULT_COMPONENTHEIGHT

public static final int DEFAULT_COMPONENTHEIGHT
Default height.

See Also:
Constant Field Values
Method Detail

getInstance

public static ProjectBrowser getInstance()
Singleton retrieval method for the projectbrowser. Do not use this before makeInstance is called!

Returns:
the singleton instance of the projectbrowser

makeInstance

public static ProjectBrowser makeInstance(SplashScreen splash,
                                          boolean mainApplication,
                                          javax.swing.JPanel leftBottomPane)
Creator method for the ProjectBrowser which optionally allows all components to be created without making a top level application window visible.

Parameters:
splash - true if we are allowed to show a splash screen
mainApplication - true to create a top level application, false if integrated with something else.
leftBottomPane - panel to place in the bottom left corner of the GUI
Returns:
the singleton instance of the projectbrowser

getLocale

public java.util.Locale getLocale()
Overrides:
getLocale in class java.awt.Window

createPanels

protected void createPanels(SplashScreen splash,
                            javax.swing.JPanel leftBottomPane)
Creates the panels in the working area.

Parameters:
splash - true if we show the splashscreen during startup
leftBottomPane - panel to be placed in the bottom left (southwest) corner of the UI.

addPanel

public void addPanel(java.awt.Component comp,
                     ProjectBrowser.Position position)
Add a panel to a split pane area.

Parameters:
comp - the panel to add
position - the position where the panel should be added

removePanel

public void removePanel(java.awt.Component comp)
Remove a panel from a split pane area.

Parameters:
comp - the panel to remove

showSaveIndicator

public void showSaveIndicator()
Set the save indicator (the * after the title) to appear depending on the current save action enabled status.


getAppName

public java.lang.String getAppName()
Returns:
the application name ("ArgoUML") as shown in the titlebar

setAppName

public void setAppName(java.lang.String n)
Parameters:
n - the application name ("ArgoUML") as shown in the titlebar

setToDoItem

@Deprecated
public void setToDoItem(java.lang.Object o)
Deprecated. for 0.25.5 by tfmorris. Send an event that the DetailsPane/TabToDo will be listening for.

Select the tab page containing the todo item.

Parameters:
o - the todo item to select

getTab

@Deprecated
public AbstractArgoJPanel getTab(java.lang.Class tabClass)
Deprecated. by for 0.25.5 by tfmorris. Tabs should register themselves with whoever they need to communicate with in a distributed fashion rather than relying on a central registry. Currently the only place this is used is to communicate between WizStep and TabToDo in the Cognitive subsystem.

Get the tab page instance of the given class.

Parameters:
tabClass - the given class
Returns:
the tabpage

getStatusBar

public StatusBar getStatusBar()
Returns:
the status bar

getJMenuBar

public javax.swing.JMenuBar getJMenuBar()
Overrides:
getJMenuBar in class javax.swing.JFrame

getEditorPane

public MultiEditorPane getEditorPane()
Returns:
the editor pane

getExplorerPane

public org.argouml.ui.NavigatorPane getExplorerPane()
Returns:
the explorer pane

getDetailsPane

public javax.swing.JPanel getDetailsPane()
Returns:
the details pane

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class java.awt.Component

tryExit

public void tryExit()
Exit the application if no save is required. If a save is required then prompt the user if they wish to, save and exit, exit without saving or cancel the exit operation.


exit

public void exit()
Exit the application saving the current user settings.


dispose

public void dispose()
Overrides:
dispose in class java.awt.Window

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

targetAdded

public void targetAdded(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is added to the list of targets.

Specified by:
targetAdded in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_ADDED

targetRemoved

public void targetRemoved(TargetEvent e)
Description copied from interface: TargetListener
Fired when a target is removed from the list of targets

Specified by:
targetRemoved in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_REMOVED

targetSet

public void targetSet(TargetEvent e)
Description copied from interface: TargetListener
Fired when a total new set of targets is set

Specified by:
targetSet in interface TargetListener
Parameters:
e - The targetevent, name will be TARGET_SET

getTodoPane

public javax.swing.JPanel getTodoPane()
Returns the todopane.

Returns:
ToDoPane

getDefaultFont

public java.awt.Font getDefaultFont()
Returns:
Returns the defaultFont.

trySave

public void trySave(boolean overwrite)
Try to save the project, possibly not creating a new file

Parameters:
overwrite - if true, then we overwrite without asking

trySave

public void trySave(boolean overwrite,
                    boolean saveNewFile)
Try to save the project.

Parameters:
overwrite - if true, then we overwrite without asking
saveNewFile - if true, we'll ask for a new file even if the current project already had one

trySave

public void trySave(boolean overwrite,
                    boolean saveNewFile,
                    boolean exitAfterSave)
Try to save the project.

Parameters:
overwrite - if true, then we overwrite without asking
saveNewFile - if true, we'll ask for a new file even if the current project already had one
exitAfterSave - The application will exit when the save has completed successfully

trySaveWithProgressMonitor

public void trySaveWithProgressMonitor(boolean overwrite,
                                       java.io.File file,
                                       boolean exit)
Loads a project displaying a nice ProgressMonitor

Parameters:
overwrite - if true, the file is going to be overwritten
file - the target file TODO: Separate this into a Swing specific class - tfm

buildTitleWithCurrentProjectName

public void buildTitleWithCurrentProjectName()
Rebuild the title using the name of the current project.


trySave

@Deprecated
public boolean trySave(boolean overwrite,
                                  java.io.File file,
                                  ProgressMonitor pmw)
Deprecated. in 0.29.1 by Bob Tarling use trySaveWithProgressMonitor

Try to save the project.

Parameters:
overwrite - if true, then we overwrite without asking
file - the File to save to
pmw - the ProgressMonitor to be updated;
Returns:
true if successful TODO: Separate this into a Swing specific class - tfm

addFileSaved

public void addFileSaved(java.io.File file)
                  throws java.io.IOException
Register a new file saved.

Parameters:
file - The file.
Throws:
java.io.IOException - if we cannot get the file name from the file.

askConfirmationAndSave

public boolean askConfirmationAndSave()
If the current project is dirty (needs saving) then this function will ask confirmation from the user. If the user indicates that saving is needed, then saving is attempted. See ActionExit.actionPerformed() for a very similar procedure!

Returns:
true if we can continue with opening

loadProjectWithProgressMonitor

public void loadProjectWithProgressMonitor(java.io.File file,
                                           boolean showUI)
Loads a project displaying a nice ProgressMonitor

Parameters:
file - the project to be opened
showUI - whether to show the GUI or not TODO: This needs to be refactored to be GUI independent - tfm

loadProject

public boolean loadProject(java.io.File file,
                           boolean showUI,
                           ProgressMonitor pmw)
Loads the project file and opens all kinds of error message windows if it doesn't work for some reason. In those cases it preserves the old project.

Parameters:
file - the file to open.
showUI - true if an error message may be shown to the user, false if run in commandline mode
pmw - the ProgressMonitor to be updated; if not needed, use null
Returns:
true if the file was successfully opened TODO: Separate this into a Swing specific class - tfm

clearDialogs

public void clearDialogs()
We should remove all open dialogs. They have as parent the ProjectBrowser. This is needed for the non-modal dialogs such as Find and Goto.


getSaveAction

public javax.swing.AbstractAction getSaveAction()
Get the action that can save the current project.

Returns:
the save action.

getRemoveFromDiagramAction

public javax.swing.AbstractAction getRemoveFromDiagramAction()
Get the action that removes selected figs from the diagram.

Returns:
the remove from diagram action.

getNewFile

protected java.io.File getNewFile()
Returns:
the File to save to


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook