org.crosswire.bibledesktop.desktop
Class Desktop

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.crosswire.bibledesktop.desktop.Desktop
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, DisplaySelectListener, URLEventListener, ViewEventListener, ViewGenerator

public class Desktop
extends JFrame
implements URLEventListener, ViewEventListener, DisplaySelectListener, ViewGenerator

The Desktop is the user's view of BibleDesktop.

Author:
Joe Walker [joe at eireneh dot com], Mark Goodwin [mark at thorubio dot org], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors., Serialized Form

Nested Class Summary
private static class Desktop.DesktopRunner
          Helper class to actually display the application at the right time.
private static class Desktop.DesktopThread
          Helper class to run the application in a thread group and capture errors.
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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
protected  DesktopActions actions
           
private  StatusBar barStatus
           
private static String BIBLE_PROTOCOL
           
private static String COMMENTARY_PROTOCOL
           
private  Config config
          The configuration engine
private static String CONFIG_KEY
           
private static String CONV_KEY
           
private  JPanel corePanel
           
private static String CSWING_KEY
           
private static Dimension defaultSize
          The default dimension for this frame
private static String DESKTOP_KEY
           
private static String DICTIONARY_PROTOCOL
           
private static String EMPTY_STRING
           
private static String GREEK_DEF_PROTOCOL
           
private static String GREEK_MORPH_PROTOCOL
           
private  boolean hasRefBooks
           
private static String HEBREW_DEF_PROTOCOL
           
private static String HEBREW_MORPH_PROTOCOL
           
private  History history
           
private static ImageIcon ICON_APP
          The application icon
protected static Logger log
          The log stream
private  JPanel mainPanel
           
private  DictionaryPane reference
           
private static boolean reuseBibleView
          Whether to current BibleView should be used for links
private static long serialVersionUID
          Serialization ID
private static boolean sidebarShowing
          Whether to show the Key Sidebar at startup
private  JCheckBoxMenuItem sidebarToggle
           
private static String SPLASH_PROPS
           
private  JSplitPane sptBlog
           
private  JSplitPane sptBooks
           
private  ViewManager views
           
private static boolean webJournalShowing
          Whether to show the web journal at startup
 
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
Desktop()
          Construct a Desktop.
 
Method Summary
 void activateURL(URLEvent ev)
          This method is called to indicate that an URL can be processed.
 void bookChosen(DisplaySelectEvent ev)
          This method is called to indicate that a command has been made.
 void checkForBooks()
           
private  void createComponents()
          Call all the constructors
private  JMenu createEditMenu()
           
private  JMenu createFileMenu()
          Create the file menu
private  JMenu createGoMenu()
           
private  JMenu createHelpMenu()
           
private  JMenuBar createMenuBar(ToolBar toolbar)
          Cause the Journal to reset itself to preferred size
private  JPopupMenu createPopupMenu()
           
private  ToolBar createToolBar()
           
private  JMenu createToolsMenu()
           
 Component createView()
          Constructs an application appropriate view for the desktop.
private  JMenu createViewMenu(ToolBar toolbar)
          Create the view menu.
private  void debug()
          Sometimes we need to make some changes to debug the GUI.
 void enterURL(URLEvent ev)
          This method is called to indicate that the mouse has entered the URL.
 void establishPreferredSize()
          Get the size of the content panel and make that the preferred size.
(package private)  void fillChoiceFactory()
          Setup the choices so that the options dialog knows what there is to select from.
 void generateConfig()
          Load the config.xml file
 Config getConfig()
           
static Dimension getDefaultSize()
           
static int getMaxHeight()
           
static int getMaxWidth()
           
 ViewManager getViews()
           
private  void init()
          Initialize the GUI, and display it.
static boolean isBibleViewReused()
           
static boolean isSidebarShowing()
           
static boolean isWebJournalShowing()
           
private  void jump(Book book, String data)
          Open the requested book and go to the requested key.
 void leaveURL(URLEvent ev)
          This method is called to indicate that the mouse has left the URL.
static void main(String[] args)
          Central start point.
 void passageSelected(DisplaySelectEvent ev)
          This method is called to indicate that a command has been made.
private  void readObject(ObjectInputStream is)
          Serialization support.
protected  void refreshBooks()
          Setup the book choices
 void selectHistory(int i)
           
static void setBibleViewReused(boolean reuse)
           
 void setCloseEnabled(boolean enabled)
          Are the close buttons enabled?
static void setDefaultSize(Dimension newDefaultSize)
           
static void setMaxHeight(int maxHeight)
           
static void setMaxWidth(int maxWidth)
           
static void setSidebarShowing(boolean show)
           
static void setWebJournalShowing(boolean show)
           
 void showStatusBar(boolean show)
          Show or hide the status bar.
 void showWebJournal(boolean show)
          Show or hide the web journal.
 void viewRemoved(ViewEvent event)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, 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, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, 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, setVisible, 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

hasRefBooks

private boolean hasRefBooks

SPLASH_PROPS

private static final String SPLASH_PROPS
See Also:
Constant Field Values

BIBLE_PROTOCOL

private static final String BIBLE_PROTOCOL
See Also:
Constant Field Values

DICTIONARY_PROTOCOL

private static final String DICTIONARY_PROTOCOL
See Also:
Constant Field Values

GREEK_DEF_PROTOCOL

private static final String GREEK_DEF_PROTOCOL
See Also:
Constant Field Values

HEBREW_DEF_PROTOCOL

private static final String HEBREW_DEF_PROTOCOL
See Also:
Constant Field Values

GREEK_MORPH_PROTOCOL

private static final String GREEK_MORPH_PROTOCOL
See Also:
Constant Field Values

HEBREW_MORPH_PROTOCOL

private static final String HEBREW_MORPH_PROTOCOL
See Also:
Constant Field Values

COMMENTARY_PROTOCOL

private static final String COMMENTARY_PROTOCOL
See Also:
Constant Field Values

EMPTY_STRING

private static final String EMPTY_STRING
See Also:
Constant Field Values

CONFIG_KEY

private static final String CONFIG_KEY
See Also:
Constant Field Values

DESKTOP_KEY

private static final String DESKTOP_KEY
See Also:
Constant Field Values

CONV_KEY

private static final String CONV_KEY
See Also:
Constant Field Values

CSWING_KEY

private static final String CSWING_KEY
See Also:
Constant Field Values

config

private transient Config config
The configuration engine


sidebarShowing

private static boolean sidebarShowing
Whether to show the Key Sidebar at startup


webJournalShowing

private static boolean webJournalShowing
Whether to show the web journal at startup


reuseBibleView

private static boolean reuseBibleView
Whether to current BibleView should be used for links


defaultSize

private static Dimension defaultSize
The default dimension for this frame


log

protected static final Logger log
The log stream


actions

protected transient DesktopActions actions

ICON_APP

private static final ImageIcon ICON_APP
The application icon


views

private transient ViewManager views

corePanel

private JPanel corePanel

sptBlog

private JSplitPane sptBlog

sidebarToggle

private JCheckBoxMenuItem sidebarToggle

barStatus

private StatusBar barStatus

reference

private DictionaryPane reference

sptBooks

private JSplitPane sptBooks

mainPanel

private JPanel mainPanel

history

private transient History history

serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values
Constructor Detail

Desktop

public Desktop()
Construct a Desktop.

Method Detail

main

public static void main(String[] args)
Central start point.

Parameters:
args - The command line arguments

debug

private void debug()
Sometimes we need to make some changes to debug the GUI.


createComponents

private void createComponents()
Call all the constructors


init

private void init()
Initialize the GUI, and display it.


createMenuBar

private JMenuBar createMenuBar(ToolBar toolbar)
Cause the Journal to reset itself to preferred size


createPopupMenu

private JPopupMenu createPopupMenu()

createToolBar

private ToolBar createToolBar()

createFileMenu

private JMenu createFileMenu()
Create the file menu

Returns:
the file menu

createEditMenu

private JMenu createEditMenu()

createGoMenu

private JMenu createGoMenu()

createViewMenu

private JMenu createViewMenu(ToolBar toolbar)
Create the view menu.

Returns:
the view menu.

createToolsMenu

private JMenu createToolsMenu()

createHelpMenu

private JMenu createHelpMenu()

establishPreferredSize

public void establishPreferredSize()
Get the size of the content panel and make that the preferred size.


getViews

public ViewManager getViews()
Returns:
Returns the views.

createView

public Component createView()
Description copied from interface: ViewGenerator
Constructs an application appropriate view for the desktop.

Specified by:
createView in interface ViewGenerator
Returns:
a view that can be used as a "window"

viewRemoved

public void viewRemoved(ViewEvent event)
Specified by:
viewRemoved in interface ViewEventListener

bookChosen

public void bookChosen(DisplaySelectEvent ev)
Description copied from interface: DisplaySelectListener
This method is called to indicate that a command has been made.

Specified by:
bookChosen in interface DisplaySelectListener
Parameters:
ev - Describes the change

passageSelected

public void passageSelected(DisplaySelectEvent ev)
Description copied from interface: DisplaySelectListener
This method is called to indicate that a command has been made.

Specified by:
passageSelected in interface DisplaySelectListener
Parameters:
ev - Describes the change

selectHistory

public void selectHistory(int i)

activateURL

public void activateURL(URLEvent ev)
Description copied from interface: URLEventListener
This method is called to indicate that an URL can be processed.

Specified by:
activateURL in interface URLEventListener
Parameters:
ev - Describes the URL

jump

private void jump(Book book,
                  String data)
Open the requested book and go to the requested key.

Parameters:
book - The book to use
data - The key to find

enterURL

public void enterURL(URLEvent ev)
Description copied from interface: URLEventListener
This method is called to indicate that the mouse has entered the URL.

Specified by:
enterURL in interface URLEventListener
Parameters:
ev - Describes the URL

leaveURL

public void leaveURL(URLEvent ev)
Description copied from interface: URLEventListener
This method is called to indicate that the mouse has left the URL.

Specified by:
leaveURL in interface URLEventListener
Parameters:
ev - Describes the URL

showStatusBar

public void showStatusBar(boolean show)
Show or hide the status bar.

Parameters:
show - boolean

showWebJournal

public void showWebJournal(boolean show)
Show or hide the web journal.

Parameters:
show - boolean

setCloseEnabled

public void setCloseEnabled(boolean enabled)
Are the close buttons enabled?

Parameters:
enabled - The enabled state

generateConfig

public final void generateConfig()
Load the config.xml file


checkForBooks

public void checkForBooks()

setSidebarShowing

public static void setSidebarShowing(boolean show)
Parameters:
show - Whether to show the KeySidebar at start up.

isSidebarShowing

public static boolean isSidebarShowing()
Returns:
Whether to show the KeySidebar at start up.

setWebJournalShowing

public static void setWebJournalShowing(boolean show)
Parameters:
show - Whether to show the web journal at start up.

isWebJournalShowing

public static boolean isWebJournalShowing()
Returns:
Whether to show the web journal at start up.

setBibleViewReused

public static void setBibleViewReused(boolean reuse)
Parameters:
reuse - Whether reuse the current BibleView.

isBibleViewReused

public static boolean isBibleViewReused()
Returns:
Whether links use the current BibleView.

setMaxHeight

public static void setMaxHeight(int maxHeight)
Parameters:
maxHeight - The maxHeight to set.

getMaxHeight

public static int getMaxHeight()
Returns:
Returns the maxHeight.

getMaxWidth

public static int getMaxWidth()
Returns:
Returns the maxWidth.

setMaxWidth

public static void setMaxWidth(int maxWidth)
Parameters:
maxWidth - The maxWidth to set.

getDefaultSize

public static Dimension getDefaultSize()
Returns:
Returns the defaultSize.

setDefaultSize

public static void setDefaultSize(Dimension newDefaultSize)
Parameters:
newDefaultSize - The defaultSize to set.

fillChoiceFactory

final void fillChoiceFactory()
Setup the choices so that the options dialog knows what there is to select from.


refreshBooks

protected final void refreshBooks()
Setup the book choices


getConfig

public Config getConfig()
Returns:
The config set that this application uses to configure itself

readObject

private void readObject(ObjectInputStream is)
                 throws IOException,
                        ClassNotFoundException
Serialization support.

Parameters:
is -
Throws:
IOException
ClassNotFoundException

Copyright ยจ 2003-2006