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, URIEventListener, ViewEventListener, ViewGenerator

public class Desktop
extends JFrame
implements URIEventListener, 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ActionFactory actions
          The factory for actions that this class works with
private  StatusBar barStatus
           
static String BIBLE_PROTOCOL
           
private  PropertyChangeSupport changeSupport
           
static String COMMENTARY_PROTOCOL
           
private  boolean compareShowing
          Whether to show differences between versions of the Bible
private  org.crosswire.common.config.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 String DESKTOP_KEY
           
protected  DesktopActions desktopActions
          The DesktopActions is the holder for the actions, merely to keep the size of this file smaller.
static String DICTIONARY_PROTOCOL
           
private static String EMPTY_STRING
           
static String GREEK_DEF_PROTOCOL
           
static String GREEK_MORPH_PROTOCOL
           
private  boolean hasRefBooks
           
static String HEBREW_DEF_PROTOCOL
           
static String HEBREW_MORPH_PROTOCOL
           
private  org.crosswire.common.history.History history
           
private static ImageIcon ICON_APP
          The application icon
protected static org.slf4j.Logger log
          The log stream
private  JPanel mainPanel
           
private static org.crosswire.common.util.CWProject PROJECT
           
protected  MultiBookPane 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 sptBooks
           
private  ViewManager views
           
private static boolean viewSourceShowing
          Whether to show the view source in the menu 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 activateURI(URIEvent ev)
          This method is called to indicate that an URI can be processed.
 void bookChosen(DisplaySelectEvent ev)
          This method is called to indicate that a command has been made.
private  void buildActionMap()
           
 void checkForBooks()
           
private  JCheckBoxMenuItem createCheckbox(XSLTProperty prop)
           
private  void createComponents()
          Call all the constructors
private  JMenu createEditMenu()
           
private  JMenu createFileMenu()
          Create the file menu
private  JMenu createHelpMenu()
           
private  void createLayout()
          Initialize the GUI, and display it.
private  JMenuBar createMenuBar(ToolBar toolbar)
           
private  JMenu createNavigateMenu()
           
private  JPopupMenu createPopupMenu()
           
private  JRadioButtonMenuItem createRadioButton(ButtonGroup group, XSLTProperty prop)
           
private  ToolBar createToolBar()
           
private  JMenu createToolsMenu()
           
private  JMenu createVerseMenu()
           
 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 enterURI(URIEvent ev)
          This method is called to indicate that the mouse has entered the URI.
 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
 org.crosswire.common.config.Config getConfig()
           
static String getCSSOverride()
           
private  ActionFactory getViewActions(ViewManager viewMgr)
           
 ViewManager getViews()
           
static boolean isBibleViewReused()
           
 boolean isCompareShowing()
           
static boolean isSidebarShowing()
           
static boolean isViewSourceShowing()
           
private  void jump(org.crosswire.jsword.book.Book book, String data)
          Open the requested book and go to the requested key.
 void leaveURI(URIEvent ev)
          This method is called to indicate that the mouse has left the URI.
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?
 void setCompareShowing(boolean show)
           
static void setCSSOverride(String override)
           
static void setSidebarShowing(boolean show)
           
static void setViewSourceShowing(boolean show)
           
 void showStatusBar(boolean show)
          Show or hide the status bar.
 void viewRemoved(ViewEvent event)
           
 
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, dispose, 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, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, 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, 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
 

Field Detail

PROJECT

private static final org.crosswire.common.util.CWProject PROJECT

hasRefBooks

private boolean hasRefBooks

SPLASH_PROPS

private static final String SPLASH_PROPS
See Also:
Constant Field Values

BIBLE_PROTOCOL

public static final String BIBLE_PROTOCOL
See Also:
Constant Field Values

DICTIONARY_PROTOCOL

public static final String DICTIONARY_PROTOCOL
See Also:
Constant Field Values

GREEK_DEF_PROTOCOL

public static final String GREEK_DEF_PROTOCOL
See Also:
Constant Field Values

HEBREW_DEF_PROTOCOL

public static final String HEBREW_DEF_PROTOCOL
See Also:
Constant Field Values

GREEK_MORPH_PROTOCOL

public static final String GREEK_MORPH_PROTOCOL
See Also:
Constant Field Values

HEBREW_MORPH_PROTOCOL

public static final String HEBREW_MORPH_PROTOCOL
See Also:
Constant Field Values

COMMENTARY_PROTOCOL

public 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 org.crosswire.common.config.Config config
The configuration engine


sidebarShowing

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


viewSourceShowing

private static boolean viewSourceShowing
Whether to show the view source in the menu at startup


compareShowing

private boolean compareShowing
Whether to show differences between versions of the Bible


reuseBibleView

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


actions

protected transient volatile ActionFactory actions
The factory for actions that this class works with


desktopActions

protected transient DesktopActions desktopActions
The DesktopActions is the holder for the actions, merely to keep the size of this file smaller.


ICON_APP

private static final ImageIcon ICON_APP
The application icon


views

private transient ViewManager views

corePanel

private JPanel corePanel

sidebarToggle

private JCheckBoxMenuItem sidebarToggle

barStatus

private StatusBar barStatus

reference

protected MultiBookPane reference

sptBooks

private JSplitPane sptBooks

mainPanel

private JPanel mainPanel

history

private transient org.crosswire.common.history.History history

changeSupport

private PropertyChangeSupport changeSupport

log

protected static final org.slf4j.Logger log
The log stream


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


getViewActions

private ActionFactory getViewActions(ViewManager viewMgr)

createLayout

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


createMenuBar

private JMenuBar createMenuBar(ToolBar toolbar)

buildActionMap

private void buildActionMap()

createFileMenu

private JMenu createFileMenu()
Create the file menu

Returns:
the file menu

createEditMenu

private JMenu createEditMenu()

createNavigateMenu

private JMenu createNavigateMenu()

createRadioButton

private JRadioButtonMenuItem createRadioButton(ButtonGroup group,
                                               XSLTProperty prop)

createCheckbox

private JCheckBoxMenuItem createCheckbox(XSLTProperty prop)

createVerseMenu

private JMenu createVerseMenu()

createViewMenu

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

Returns:
the view menu.

createToolsMenu

private JMenu createToolsMenu()

createHelpMenu

private JMenu createHelpMenu()

createPopupMenu

private JPopupMenu createPopupMenu()

createToolBar

private ToolBar createToolBar()

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)

activateURI

public void activateURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that an URI can be processed.

Specified by:
activateURI in interface URIEventListener
Parameters:
ev - Describes the URI

jump

private void jump(org.crosswire.jsword.book.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

enterURI

public void enterURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that the mouse has entered the URI.

Specified by:
enterURI in interface URIEventListener
Parameters:
ev - Describes the URI

leaveURI

public void leaveURI(URIEvent ev)
Description copied from interface: URIEventListener
This method is called to indicate that the mouse has left the URI.

Specified by:
leaveURI in interface URIEventListener
Parameters:
ev - Describes the URI

showStatusBar

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

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.

setViewSourceShowing

public static void setViewSourceShowing(boolean show)
Parameters:
show - Whether to show the view source in menu at start up.

isViewSourceShowing

public static boolean isViewSourceShowing()
Returns:
Whether to show the view source in menu at start up.

setCompareShowing

public void setCompareShowing(boolean show)
Parameters:
show - Whether to show differences between versions of the Bible

isCompareShowing

public boolean isCompareShowing()
Returns:
Whether to show differences between versions of the Bible

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.

setCSSOverride

public static void setCSSOverride(String override)
Parameters:
override - The path to the CSS that should be used to override.

getCSSOverride

public static String getCSSOverride()
Returns:
the current override

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 org.crosswire.common.config.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-2013