com.mucommander.ui.main
Class MainFrame

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 com.mucommander.ui.main.MainFrame
All Implemented Interfaces:
LocationListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class MainFrame
extends javax.swing.JFrame
implements LocationListener

This is the main frame, which contains all other UI components visible on a mucommander window.

Author:
Maxence Bernard
See Also:
Serialized Form

Nested Class Summary
protected  class MainFrame.CustomFocusTraversalPolicy
          Manages focus for both FolderPanel and their subcomponents.
 
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.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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
 
Constructor Summary
MainFrame(AbstractFile leftInitialFolder, AbstractFile rightInitialFolder)
          Creates a new main frame set to the given initial folders.
 
Method Summary
 void addActivePanelListener(ActivePanelListener activePanelListener)
          Registers the given ActivePanelListener to receive events when the active table changes.
 void dispose()
          Overrides java.awt.Window#dispose to save last MainFrame's attributes in the preferences before disposing this MainFrame.
 FolderPanel getActivePanel()
          Returns the currently active panel.
 FileTable getActiveTable()
          Returns the currently active table.
 CommandBar getCommandBar()
          Returns the command bar, i.e.
 FolderPanel getInactivePanel()
          Returns the inactive panel, i.e.
 FileTable getInactiveTable()
          Returns the inactive table, i.e.
 FolderPanel getLeftPanel()
          Returns the FolderPanel instance corresponding to the left panel.
 boolean getNoEventsMode()
          Returns true if 'no events mode' is currently enabled.
 FolderPanel getRightPanel()
          Returns the FolderPanel instance corresponding to the right panel.
 ProportionalSplitPane getSplitPane()
          Returns the ProportionalSplitPane component that splits the two panels.
 boolean getSplitPaneOrientation()
          Returns how folder panels are currently split: if true is returned, panels are split vertically (default), horizontally otherwise.
 StatusBar getStatusBar()
          Returns the status bar, where information about selected files and volume are displayed.
 ToolBar getToolBar()
          Returns the toolbar where shortcut buttons (go back, go forward, ...) are.
 boolean isAncestorOfActiveWindow()
          Returns true if this MainFrame is active, or is an ancestor of a Window that is currently active.
 boolean isAutoSizeColumnsEnabled()
           
 boolean isForegroundActive()
          Returns true if this MainFrame is currently active in the foreground.
 void locationCancelled(LocationEvent e)
          This method is invoked when the current folder has been cancelled by the user.
 void locationChanged(LocationEvent e)
          This method is invoked when the current folder has changed.
 void locationChanging(LocationEvent e)
          This method is invoked when the current folder is being changed.
 void locationFailed(LocationEvent e)
          This method is invoked when the current folder could not be changed, as a result of the folder not existing or failing to list its contents.
 void removeActivePanelListener(ActivePanelListener activePanelListener)
          Unregisters the given ActivePanelListener so that it no longer receives events when the active table changes.
 void setAutoSizeColumnsEnabled(boolean b)
           
 void setNoEventsMode(boolean enabled)
          Enables/disables the 'no events mode' which prevents mouse and keyboard events from being received by the application (MainFrame, its subcomponents and the menu bar).
 void setSameFolder()
          Makes both folders the same, choosing the one which is currently active.
 void setSplitPaneOrientation(boolean vertical)
          Specifies how folder panels are split: if true is passed, the folder panels will be split vertically (default), horizontally otherwise.
 void swapFolders()
          Swaps the two FolderPanel instances: after a call to this method, the left FolderPanel will be the right one and vice-versa.
 void toFront()
          Overrides java.awt.Window#toFront to have the window return to a normal state if it is minimized.
 void tryRefreshCurrentFolders()
          Forces a refrehs of the frame's folder panel.
 void updateWindowTitle()
          Updates this window's title to show currently active folder and window number.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, 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, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack
 
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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, 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 java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

MainFrame

public MainFrame(AbstractFile leftInitialFolder,
                 AbstractFile rightInitialFolder)
Creates a new main frame set to the given initial folders.

Parameters:
leftInitialFolder - the initial folder to display in the left panel
rightInitialFolder - the initial folder to display in the right panel
Method Detail

addActivePanelListener

public void addActivePanelListener(ActivePanelListener activePanelListener)
Registers the given ActivePanelListener to receive events when the active table changes.

Parameters:
activePanelListener - the ActivePanelListener to add

removeActivePanelListener

public void removeActivePanelListener(ActivePanelListener activePanelListener)
Unregisters the given ActivePanelListener so that it no longer receives events when the active table changes.

Parameters:
activePanelListener - the ActivePanelListener to remove

getNoEventsMode

public boolean getNoEventsMode()
Returns true if 'no events mode' is currently enabled.

Returns:
true if 'no events mode' is currently enabled

setNoEventsMode

public void setNoEventsMode(boolean enabled)
Enables/disables the 'no events mode' which prevents mouse and keyboard events from being received by the application (MainFrame, its subcomponents and the menu bar).

Parameters:
enabled - true to enable 'no events mode', false to disable it

getToolBar

public ToolBar getToolBar()
Returns the toolbar where shortcut buttons (go back, go forward, ...) are. Note that a non-null instance of ToolBar is returned even if it is currently hidden.

Returns:
the toolbar component

getCommandBar

public CommandBar getCommandBar()
Returns the command bar, i.e. the component that contains shortcuts to certains actions such as View, Edit, Copy, Move, etc... Note that a non-null instance of CommandBar is returned even if it is currently hidden.

Returns:
the command bar component

getStatusBar

public StatusBar getStatusBar()
Returns the status bar, where information about selected files and volume are displayed.

Returns:
the status bar

getActiveTable

public FileTable getActiveTable()
Returns the currently active table.

The returned table doesn't necessarily have focus, the focus can be in some other component of the active FolderPanel, or nowhere in the MainFrame if it is currently not in the foreground.

Use Component.hasFocus() to test if the table currently has focus.

Returns:
the currently active table
See Also:
FileTable.isActiveTable()

getActivePanel

public FolderPanel getActivePanel()
Returns the currently active panel.

The returned panel doesn't necessarily have focus, for example if the MainFrame is currently not in the foreground.

Returns:
the currently active panel

getInactiveTable

public FileTable getInactiveTable()
Returns the inactive table, i.e. the complement of getActiveTable().

Returns:
the inactive table

getInactivePanel

public FolderPanel getInactivePanel()
Returns the inactive panel, i.e. the complement of getActivePanel().

Returns:
the inactive panel

getLeftPanel

public FolderPanel getLeftPanel()
Returns the FolderPanel instance corresponding to the left panel.

Returns:
the FolderPanel instance corresponding to the left panel

getRightPanel

public FolderPanel getRightPanel()
Returns the FolderPanel instance corresponding to the right panel.

Returns:
the FolderPanel instance corresponding to the right panel

getSplitPane

public ProportionalSplitPane getSplitPane()
Returns the ProportionalSplitPane component that splits the two panels.

Returns:
the ProportionalSplitPane component that splits the two panels

setSplitPaneOrientation

public void setSplitPaneOrientation(boolean vertical)
Specifies how folder panels are split: if true is passed, the folder panels will be split vertically (default), horizontally otherwise.

Parameters:
vertical - if true, the folder panels will be split horizontally (default), vertically otherwise.

getSplitPaneOrientation

public boolean getSplitPaneOrientation()
Returns how folder panels are currently split: if true is returned, panels are split vertically (default), horizontally otherwise.

Returns:
true if folder panels are split vertically

swapFolders

public void swapFolders()
Swaps the two FolderPanel instances: after a call to this method, the left FolderPanel will be the right one and vice-versa.


setSameFolder

public void setSameFolder()
Makes both folders the same, choosing the one which is currently active.


isForegroundActive

public boolean isForegroundActive()
Returns true if this MainFrame is currently active in the foreground.

Returns:
true if this MainFrame is currently active in the foreground

tryRefreshCurrentFolders

public void tryRefreshCurrentFolders()
Forces a refrehs of the frame's folder panel.


isAncestorOfActiveWindow

public boolean isAncestorOfActiveWindow()
Returns true if this MainFrame is active, or is an ancestor of a Window that is currently active.

Returns:
true if this MainFrame is active, or is an ancestor of a Window that is currently active

updateWindowTitle

public void updateWindowTitle()
Updates this window's title to show currently active folder and window number. This method is called by this class and WindowManager.


locationChanged

public void locationChanged(LocationEvent e)
Description copied from interface: LocationListener
This method is invoked when the current folder has changed.

Specified by:
locationChanged in interface LocationListener
Parameters:
e - describes the location change event

locationChanging

public void locationChanging(LocationEvent e)
Description copied from interface: LocationListener
This method is invoked when the current folder is being changed.

A call to either LocationListener.locationChanged(LocationEvent), LocationListener.locationCancelled(LocationEvent) or LocationListener.locationFailed(LocationEvent) will always follow to indicate the outcome of the folder change.

Specified by:
locationChanging in interface LocationListener
Parameters:
e - describes the location change event

locationCancelled

public void locationCancelled(LocationEvent e)
Description copied from interface: LocationListener
This method is invoked when the current folder has been cancelled by the user.

Specified by:
locationCancelled in interface LocationListener
Parameters:
e - describes the location change event

locationFailed

public void locationFailed(LocationEvent e)
Description copied from interface: LocationListener
This method is invoked when the current folder could not be changed, as a result of the folder not existing or failing to list its contents.

Specified by:
locationFailed in interface LocationListener
Parameters:
e - describes the location change event

dispose

public void dispose()
Overrides java.awt.Window#dispose to save last MainFrame's attributes in the preferences before disposing this MainFrame.

Overrides:
dispose in class java.awt.Window

toFront

public void toFront()
Overrides java.awt.Window#toFront to have the window return to a normal state if it is minimized.

Overrides:
toFront in class java.awt.Window

isAutoSizeColumnsEnabled

public boolean isAutoSizeColumnsEnabled()

setAutoSizeColumnsEnabled

public void setAutoSizeColumnsEnabled(boolean b)


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard