apps
Class Apps

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by apps.Apps
All Implemented Interfaces:
WindowListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible
Direct Known Subclasses:
CornwallRR, DecoderPro, InstallTest, JMRIdemo, LocoTools, PacketPro, PacketScript, PanelPro

public class Apps
extends JPanel
implements PropertyChangeListener, WindowListener

Base class for Jmri applications.

Author:
Bob Jacobsen Copyright 2003, 2007, 2008, Dennis Miller Copyright 2005, Giorgio Terdina Copyright 2008
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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 static String configFilename
           
protected static boolean configOK
           
protected static String ignore
           
protected static boolean log4JSetUp
           
protected static AppConfigPanel prefs
           
protected static JmriJFrame prefsFrame
           
protected static ResourceBundle rb
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Apps(JFrame frame)
           
 
Method Summary
protected  void buildLine4(JPanel pane2)
           
protected  void buildLine5(JPanel pane2)
           
protected  void buildLine5a(JPanel pane2)
           
protected  void buildLine5b(JPanel pane2)
           
static JComponent buttonSpace()
          Provide access to a place where applications can expect the configurion code to build run-time buttons.
protected static void createFrame(Apps containedPane, JFrame frame)
           
protected  void createMenus(JMenuBar menuBar, JFrame frame)
          Create default menubar.
protected  void debugMenu(JMenuBar menuBar, JFrame frame)
           
protected  void developmentMenu(JMenuBar menuBar, JFrame frame)
           
protected  void doPreferences()
           
protected  void editMenu(JMenuBar menuBar, JFrame frame)
           
protected  void fileMenu(JMenuBar menuBar, JFrame frame)
           
static String getConnection1()
           
static String getConnection2()
           
static String getConnection3()
           
static String getConnection4()
           
static AppConfigPanel getPrefs()
           
static void handleQuit()
          The application decided to quit, handle that.
protected  void helpMenu(JMenuBar menuBar, JFrame frame)
           
protected static void initLog4J()
           
protected  String line1()
           
protected  String line2()
           
protected  String line3()
           
protected  String line6()
           
protected  String line7()
           
protected static void loadFile(String name)
           
protected  String logo()
           
protected  String mainWindowHelpID()
          Returns the ID for the main window's help, which is application specific
protected  void operationsMenu(JMenuBar menuBar, JFrame frame)
           
protected  void panelMenu(JMenuBar menuBar, JFrame frame)
           
 void propertyChange(PropertyChangeEvent ev)
           
protected  void rosterMenu(JMenuBar menuBar, JFrame frame)
           
protected  void scriptMenu(JMenuBar menuBar, JFrame frame)
           
protected  void setButtonSpace()
          Prepare the JPanel to contain buttons in the startup GUI.
protected static void setConfigFilename(String def, String[] args)
          Set up the configuration file name at startup.
protected  void setPrefsFrameHelp(JmriJFrame f, String l)
          Set the location of the window-specific help for the preferences pane.
protected  void setResourceBundle()
           
protected static void splash(boolean show)
           
static String startupInfo(String program)
           
protected  JPanel statusPanel()
          Fill in the logo and status panel
protected  void systemsMenu(JMenuBar menuBar, JFrame frame)
          Show only active systems in the menu bar.
protected  void toolsMenu(JMenuBar menuBar, JFrame frame)
           
protected  void updateLine4()
           
protected  void updateLine5()
           
protected  void updateLine5a()
           
protected  void updateLine5b()
           
 void windowActivated(WindowEvent e)
           
 void windowClosed(WindowEvent e)
           
 void windowClosing(WindowEvent e)
          Closing the main window is a shutdown request
 void windowDeactivated(WindowEvent e)
           
 void windowDeiconified(WindowEvent e)
           
 void windowIconified(WindowEvent e)
           
 void windowOpened(WindowEvent e)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
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, 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, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prefsFrame

protected static JmriJFrame prefsFrame

rb

protected static ResourceBundle rb

prefs

protected static AppConfigPanel prefs

log4JSetUp

protected static boolean log4JSetUp

configFilename

protected static String configFilename

configOK

protected static boolean configOK

ignore

protected static String ignore
Constructor Detail

Apps

public Apps(JFrame frame)
Method Detail

setButtonSpace

protected void setButtonSpace()
Prepare the JPanel to contain buttons in the startup GUI. Since it's possible to add buttons via the preferences, this space may have additional buttons appended to it later. The default implementation here just creates an empty space for these to be added to.


setResourceBundle

protected void setResourceBundle()

createMenus

protected void createMenus(JMenuBar menuBar,
                           JFrame frame)
Create default menubar.

This does not include the development menu.

Parameters:
menuBar -
frame -

fileMenu

protected void fileMenu(JMenuBar menuBar,
                        JFrame frame)

doPreferences

protected void doPreferences()

setPrefsFrameHelp

protected void setPrefsFrameHelp(JmriJFrame f,
                                 String l)
Set the location of the window-specific help for the preferences pane. Made a separate method so if can be overridden for application specific preferences help


editMenu

protected void editMenu(JMenuBar menuBar,
                        JFrame frame)

toolsMenu

protected void toolsMenu(JMenuBar menuBar,
                         JFrame frame)

operationsMenu

protected void operationsMenu(JMenuBar menuBar,
                              JFrame frame)

rosterMenu

protected void rosterMenu(JMenuBar menuBar,
                          JFrame frame)

panelMenu

protected void panelMenu(JMenuBar menuBar,
                         JFrame frame)

systemsMenu

protected void systemsMenu(JMenuBar menuBar,
                           JFrame frame)
Show only active systems in the menu bar.

Alternately, you might want to do

    menuBar.add(new jmri.jmrix.SystemsMenu());
 

Parameters:
menuBar -
frame -

debugMenu

protected void debugMenu(JMenuBar menuBar,
                         JFrame frame)

scriptMenu

protected void scriptMenu(JMenuBar menuBar,
                          JFrame frame)

developmentMenu

protected void developmentMenu(JMenuBar menuBar,
                               JFrame frame)

helpMenu

protected void helpMenu(JMenuBar menuBar,
                        JFrame frame)

mainWindowHelpID

protected String mainWindowHelpID()
Returns the ID for the main window's help, which is application specific


line1

protected String line1()

line2

protected String line2()

line3

protected String line3()

buildLine4

protected void buildLine4(JPanel pane2)

updateLine4

protected void updateLine4()

buildLine5

protected void buildLine5(JPanel pane2)

updateLine5

protected void updateLine5()

buildLine5a

protected void buildLine5a(JPanel pane2)

updateLine5a

protected void updateLine5a()

buildLine5b

protected void buildLine5b(JPanel pane2)

updateLine5b

protected void updateLine5b()

line6

protected String line6()

line7

protected String line7()

logo

protected String logo()

statusPanel

protected JPanel statusPanel()
Fill in the logo and status panel

Returns:
Properly-filled out JPanel

windowClosing

public void windowClosing(WindowEvent e)
Closing the main window is a shutdown request

Specified by:
windowClosing in interface WindowListener

windowActivated

public void windowActivated(WindowEvent e)
Specified by:
windowActivated in interface WindowListener

windowClosed

public void windowClosed(WindowEvent e)
Specified by:
windowClosed in interface WindowListener

windowDeactivated

public void windowDeactivated(WindowEvent e)
Specified by:
windowDeactivated in interface WindowListener

windowDeiconified

public void windowDeiconified(WindowEvent e)
Specified by:
windowDeiconified in interface WindowListener

windowIconified

public void windowIconified(WindowEvent e)
Specified by:
windowIconified in interface WindowListener

windowOpened

public void windowOpened(WindowEvent e)
Specified by:
windowOpened in interface WindowListener

buttonSpace

public static JComponent buttonSpace()
Provide access to a place where applications can expect the configurion code to build run-time buttons.

Returns:
null if no such space exists
See Also:
CreateButtonPanel

getPrefs

public static AppConfigPanel getPrefs()

getConnection1

public static String getConnection1()

getConnection2

public static String getConnection2()

getConnection3

public static String getConnection3()

getConnection4

public static String getConnection4()

splash

protected static void splash(boolean show)

handleQuit

public static void handleQuit()
The application decided to quit, handle that.


initLog4J

protected static void initLog4J()

setConfigFilename

protected static void setConfigFilename(String def,
                                        String[] args)
Set up the configuration file name at startup.

The static configFilename variable holds the name used to load the configuration file during later startup processing. Applications invoke this method to handle the usual startup hierarchy:

This name will be used for reading and writing the preferences. It need not exist when the program first starts up.

Parameters:
def - Default value if no other is provided
args - Argument array from the main routine

createFrame

protected static void createFrame(Apps containedPane,
                                  JFrame frame)

loadFile

protected static void loadFile(String name)