jas.util
Class Application
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jas.util.Application
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public abstract class Application
- extends JPanel
This class is meant to provide access from all packages to
certain general-purpose items of the application, such as
the UserProperties objects that the application
uses, and the JFrame that the application is in. It allows
classes from all packages to show help topics. However,
getting the actual topics themselves is the responsibility
of a class which subclasses Application.
- Author:
- Jonas Gifford, Peter Armstrong
- See Also:
UserProperties
,
JFrame
,
Serialized Form
Constructor Summary |
Application()
Creates an instance of the Application. |
Method Summary |
void |
addHelpLocation(Class base,
String s)
Add a Help location to the Vector of locations to look in for the helpset. |
void |
addHelpLocation(String s)
|
void |
addHelpLocation(URL url)
|
protected void |
doHelp()
Called to show user the syntax of the command, as a result of a syntax error
in the command line arguments, or in response to the --help option
Override to provide specialized instructions for your application |
void |
error(String s)
Parents an error box to the application's frame. |
void |
error(String s,
String helpTopic)
Parents an error box to the application's frame, and contains a button
that opens a given help page. |
void |
error(String s,
Throwable t)
Parents an error box to the application's frame and displays a Throwable
object's stack trace. |
void |
error(String s,
Throwable t,
String helpTopic)
Parents an error box to the application's frame, displays a Throwable
object's stace trace, and contains a button that opens a given help page. |
static Application |
getApplication()
Returns the application. |
CommandTargetManager |
getCommandManager()
|
JFrame |
getFrame()
Returns the parent JFrame. |
GetOptions |
getGetOptions()
Get the GetOptions object that will be used to parse the command line arguments |
UserProperties |
getUserProperties()
Returns the UserProperties object. |
protected int |
parseArgs(String[] argv)
Called to parse the command line arguments (after setting appropriate
options) |
protected void |
setDebugFlag(String flag)
Called once for each debug flag set in the command options. |
void |
showHelpContents()
Shows the table of contents for the help system. |
void |
showHelpIndex()
Shows the index for the help system. |
void |
showHelpSearch()
Opens a search window for the help system. |
void |
showHelpTopic(String helpTopicTarget)
|
void |
showHelpTopic(String helpTopicTarget,
Window owner)
Shows the specified JavaHelp topic with the TOC visible |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Application
public Application()
- Creates an instance of the Application. This constructor may
only be called once in an application.
parseArgs
protected int parseArgs(String[] argv)
- Called to parse the command line arguments (after setting appropriate
options)
- Parameters:
argv
- The command line arguments
- Returns:
- The number of parameters found
- See Also:
getGetOptions()
doHelp
protected void doHelp()
- Called to show user the syntax of the command, as a result of a syntax error
in the command line arguments, or in response to the --help option
Override to provide specialized instructions for your application
addHelpLocation
public void addHelpLocation(Class base,
String s)
- Add a Help location to the Vector of locations to look in for the helpset.
At the time of writing, this was a one-element Vector, but we're being flexible :-)
addHelpLocation
public void addHelpLocation(URL url)
addHelpLocation
public void addHelpLocation(String s)
setDebugFlag
protected void setDebugFlag(String flag)
- Called once for each debug flag set in the command options.
By default sets a system property of the form debugFlag where flag
is the flag specified (with its initial letter uppercased).
Override for application specific behaviour.
getApplication
public static final Application getApplication()
- Returns the application.
getUserProperties
public final UserProperties getUserProperties()
- Returns the UserProperties object.
getFrame
public final JFrame getFrame()
- Returns the parent JFrame.
- See Also:
JFrame
showHelpContents
public final void showHelpContents()
- Shows the table of contents for the help system.
showHelpIndex
public final void showHelpIndex()
- Shows the index for the help system.
showHelpSearch
public final void showHelpSearch()
- Opens a search window for the help system.
error
public final void error(String s,
Throwable t)
- Parents an error box to the application's frame and displays a Throwable
object's stack trace.
- Parameters:
s
- an error messaget
- the Exception or Error that caused the error- See Also:
ErrorBox
error
public final void error(String s)
- Parents an error box to the application's frame.
- Parameters:
s
- an error message- See Also:
ErrorBox
error
public final void error(String s,
Throwable t,
String helpTopic)
- Parents an error box to the application's frame, displays a Throwable
object's stace trace, and contains a button that opens a given help page.
- Parameters:
s
- an error messaget
- the Exception or Error that caused the errorhelpTopic
- the topic you want to link to- See Also:
ErrorBox
error
public final void error(String s,
String helpTopic)
- Parents an error box to the application's frame, and contains a button
that opens a given help page.
- Parameters:
s
- an error messagehelpTopic
- the topic you want to link to- See Also:
ErrorBox
showHelpTopic
public final void showHelpTopic(String helpTopicTarget)
showHelpTopic
public final void showHelpTopic(String helpTopicTarget,
Window owner)
- Shows the specified JavaHelp topic with the TOC visible
- Parameters:
helpTopicTarget
- the JavaHelp XML target name which maps to the .html page in the map file
getGetOptions
public GetOptions getGetOptions()
- Get the GetOptions object that will be used to parse the command line arguments
getCommandManager
public CommandTargetManager getCommandManager()
Copyright © 2000-2009 FreeHEP. All Rights Reserved.