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

public class Desktop
extends JFrame
implements URLEventListener, ViewEventListener, ViewGenerator

A container for various tools, particularly the BibleGenerator and the Tester. These tools are generally only of use to developers, and not to end users.

2 Things to think about, if you change the LaF when you have run some tests already, then the window can grow quite a lot. Also do we want to disable the Exit button if work is going on?

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: Desktop.java,v 1.38 2005/03/21 02:37:18 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com], Mark Goodwin [mark at thorubio dot org], DM Smith [dmsmith555 at yahoo dot com]
See Also:
Licence, Serialized Form

Nested Class Summary
 
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 static ImageIcon ICON_APP
          The application icon
protected static Logger log
          The log stream
private  ToolBar pnlTbar
           
private  DictionaryPane reference
           
private static long serialVersionUID
          Serialization ID
private static String SPLASH_PROPS
           
private  JSplitPane sptBooks
           
private  ViewManager views
           
 
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.
private  void createComponents()
          Call all the constructors
 Component createView()
          Constructs an application appropriate view for the desktop.
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.
protected  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.
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.
protected  void refreshBooks()
          Setup the book choices
 void setCloseEnabled(boolean enabled)
          Are the close buttons enabled?
static void setDefaultSize(Dimension newDefaultSize)
           
static void setMaxHeight(int maxHeight)
           
static void setMaxWidth(int maxWidth)
           
 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, 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 Config config
The configuration engine


defaultSize

private static Dimension defaultSize
The default dimension for this frame


log

protected static final Logger log
The log stream


actions

protected DesktopActions actions

ICON_APP

private static final ImageIcon ICON_APP
The application icon


views

private ViewManager views

corePanel

private JPanel corePanel

pnlTbar

private ToolBar pnlTbar

barStatus

private StatusBar barStatus

reference

private DictionaryPane reference

sptBooks

private JSplitPane sptBooks

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.


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

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

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


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

protected 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

Copyright ? 2003-2004