jmri.jmrit.symbolicprog.tabbedframe
Class PaneProgFrame

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 jmri.util.JmriJFrame
                          extended by jmri.jmrit.symbolicprog.tabbedframe.PaneProgFrame
All Implemented Interfaces:
ComponentListener, WindowListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, PaneContainer, ModifiedFlag
Direct Known Subclasses:
PaneOpsProgFrame, PaneServiceProgFrame

public abstract class PaneProgFrame
extends JmriJFrame
implements PropertyChangeListener, PaneContainer

Frame providing a command station programmer from decoder definition files.

Author:
Bob Jacobsen Copyright (C) 2001, 2004, 2005, 2008, D Miller Copyright 2003, 2005, Howard G. Penny Copyright (C) 2005
See Also:
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class jmri.util.JmriJFrame
reuseFrameSavedPosition, reuseFrameSavedSized
 
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
PaneProgFrame(DecoderFile pDecoderFile, RosterEntry pRosterEntry, String pFrameTitle, String pProgrammerFile, Programmer pProg, boolean opsMode)
          Initialization sequence: Ask the RosterEntry to read its contents If the decoder file is specified, open and load it, otherwise get the decoder filename from the RosterEntry and load that.
 
Method Summary
protected  boolean checkDirtyDecoder()
           
protected  boolean checkDirtyFile()
           
 void dispose()
          local dispose, which also invokes parent.
 void doPrintPanes(boolean preview)
           
 void enableButtons(boolean stat)
          Enable the read/write buttons.
 BusyGlassPane getBusyGlassPane()
           
 Dimension getMaximumSize()
          Provide a maximum frame size that is limited to what can fit on the screen after toolbars, etc are deducted.
protected abstract  JPanel getModePane()
          Abstract method to provide a JPanel setting the programming mode, if appropriate.
 List<JPanel> getPaneList()
           
 Dimension getPreferredSize()
          The preferred size must fit on the physical screen, so calculate the lesser of either the preferred size from the layout or the screen size.
 RosterEntry getRosterEntry()
           
static boolean getShowEmptyPanes()
           
protected  void handleDirtyFile()
           
protected  void installComponents()
           
 boolean isBusy()
           
protected  void loadDecoderFile(DecoderFile df, RosterEntry re)
           
protected  void loadDecoderFromLoco(RosterEntry r)
           
protected  void loadProgrammerFile(RosterEntry r)
           
protected  JPanel makeFunctionLabelPane(RosterEntry r)
           
protected  JPanel makeInfoPane(RosterEntry r)
           
protected  JPanel makeMediaPane(RosterEntry r)
           
 void newPane(String name, Element pane, Element modelElem, boolean enableEmpty)
           
 void paneFinished()
           
 void prepGlassPane(AbstractButton activeButton)
           
 void printInfoSection(HardcopyWriter w)
           
 void printPanes(boolean preview)
           
 void propertyChange(PropertyChangeEvent e)
          get notification of a variable property change in the pane, specifically "busy" going to false at the end of a programming operation
 boolean readAll()
          invoked by "Read All" button, this sets in motion a continuing sequence of "read all" operations on the panes.
 boolean readChanges()
          invoked by "Read Changes" button, this sets in motion a continuing sequence of "read changes" operations on the panes.
protected  void resetToDefaults()
          reset all CV values to defaults stored earlier.
protected  void saveDefaults()
          Save all CV values.
static void setShowEmptyPanes(boolean yes)
          Option to control appearance of empty panes
 boolean storeFile()
          Store the locomotives information in the roster (and a RosterEntry file).
 void windowClosing(WindowEvent e)
          Close box has been clicked; handle check for dirty with respect to decoder or file, then close.
 boolean writeAll()
          invoked by "Write All" button, this sets in motion a continuing sequence of "write all" operations on each pane.
 boolean writeChanges()
          invoked by "Write Changes" button, this sets in motion a continuing sequence of "write changes" operations on each pane.
 
Methods inherited from class jmri.util.JmriJFrame
addHelpMenu, addNotify, componentHidden, componentMoved, componentResized, componentShown, generateWindowRef, getFrame, getFrameList, getModifiedFlag, getSavePosition, getSaveSize, getWindowFrameRef, handleModified, initComponents, markWindowModified, pack, setModifiedFlag, setSavePosition, setSaveSize, setShutDownTask, storeValues, windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
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
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, 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, 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, getMinimumSize, getMousePosition, 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
 

Constructor Detail

PaneProgFrame

public PaneProgFrame(DecoderFile pDecoderFile,
                     RosterEntry pRosterEntry,
                     String pFrameTitle,
                     String pProgrammerFile,
                     Programmer pProg,
                     boolean opsMode)
Initialization sequence:

Parameters:
pDecoderFile - XML file defining the decoder contents
pRosterEntry - RosterEntry for information on this locomotive
pFrameTitle - Name/title for the frame
pProgrammerFile - Name of the programmer file to use
pProg - Programmer object to be used to access CVs
Method Detail

getModePane

protected abstract JPanel getModePane()
Abstract method to provide a JPanel setting the programming mode, if appropriate. A null value is ignored.


installComponents

protected void installComponents()

getPaneList

public List<JPanel> getPaneList()

getPreferredSize

public Dimension getPreferredSize()
Description copied from class: JmriJFrame
The preferred size must fit on the physical screen, so calculate the lesser of either the preferred size from the layout or the screen size.

Overrides:
getPreferredSize in class JmriJFrame

getMaximumSize

public Dimension getMaximumSize()
Description copied from class: JmriJFrame
Provide a maximum frame size that is limited to what can fit on the screen after toolbars, etc are deducted.

Some of the methods used here return null pointers on some Java implementations, however, so this will return the superclasses's maximum size if the algorithm used here fails.

Overrides:
getMaximumSize in class JmriJFrame

loadDecoderFromLoco

protected void loadDecoderFromLoco(RosterEntry r)

loadDecoderFile

protected void loadDecoderFile(DecoderFile df,
                               RosterEntry re)

loadProgrammerFile

protected void loadProgrammerFile(RosterEntry r)

checkDirtyDecoder

protected boolean checkDirtyDecoder()
Returns:
true if decoder needs to be written

checkDirtyFile

protected boolean checkDirtyFile()
Returns:
true if file needs to be written

handleDirtyFile

protected void handleDirtyFile()

windowClosing

public void windowClosing(WindowEvent e)
Close box has been clicked; handle check for dirty with respect to decoder or file, then close.

Specified by:
windowClosing in interface WindowListener
Overrides:
windowClosing in class JmriJFrame
Parameters:
e - Not used

resetToDefaults

protected void resetToDefaults()
reset all CV values to defaults stored earlier. This will in turn update the variables


saveDefaults

protected void saveDefaults()
Save all CV values. These stored values are used by resetToDefaults


makeInfoPane

protected JPanel makeInfoPane(RosterEntry r)

makeFunctionLabelPane

protected JPanel makeFunctionLabelPane(RosterEntry r)

makeMediaPane

protected JPanel makeMediaPane(RosterEntry r)

newPane

public void newPane(String name,
                    Element pane,
                    Element modelElem,
                    boolean enableEmpty)

getBusyGlassPane

public BusyGlassPane getBusyGlassPane()
Specified by:
getBusyGlassPane in interface PaneContainer

prepGlassPane

public void prepGlassPane(AbstractButton activeButton)
Specified by:
prepGlassPane in interface PaneContainer

paneFinished

public void paneFinished()
Specified by:
paneFinished in interface PaneContainer

enableButtons

public void enableButtons(boolean stat)
Enable the read/write buttons.

In addition, if a programming mode pane is present, it's "set" button is enabled.

Specified by:
enableButtons in interface PaneContainer
Parameters:
stat - Are reads possible? If false, so not enable the read buttons.

isBusy

public boolean isBusy()
Specified by:
isBusy in interface PaneContainer

readChanges

public boolean readChanges()
invoked by "Read Changes" button, this sets in motion a continuing sequence of "read changes" operations on the panes. Each invocation of this method reads one pane; completion of that request will cause it to happen again, reading the next pane, until there's nothing left to read.

Returns:
true if a read has been started, false if the operation is complete.

readAll

public boolean readAll()
invoked by "Read All" button, this sets in motion a continuing sequence of "read all" operations on the panes. Each invocation of this method reads one pane; completion of that request will cause it to happen again, reading the next pane, until there's nothing left to read.

Returns:
true if a read has been started, false if the operation is complete.

writeAll

public boolean writeAll()
invoked by "Write All" button, this sets in motion a continuing sequence of "write all" operations on each pane. Each invocation of this method writes one pane; completion of that request will cause it to happen again, writing the next pane, until there's nothing left to write.

Returns:
true if a write has been started, false if the operation is complete.

writeChanges

public boolean writeChanges()
invoked by "Write Changes" button, this sets in motion a continuing sequence of "write changes" operations on each pane. Each invocation of this method writes one pane; completion of that request will cause it to happen again, writing the next pane, until there's nothing left to write.

Returns:
true if a write has been started, false if the operation is complete.

doPrintPanes

public void doPrintPanes(boolean preview)

printPanes

public void printPanes(boolean preview)

printInfoSection

public void printInfoSection(HardcopyWriter w)

propertyChange

public void propertyChange(PropertyChangeEvent e)
get notification of a variable property change in the pane, specifically "busy" going to false at the end of a programming operation

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - Event, used to find source

storeFile

public boolean storeFile()
Store the locomotives information in the roster (and a RosterEntry file).

Returns:
false if store failed

dispose

public void dispose()
local dispose, which also invokes parent. Note that we remove the components (removeAll) before taking those apart.

Overrides:
dispose in class JmriJFrame

setShowEmptyPanes

public static void setShowEmptyPanes(boolean yes)
Option to control appearance of empty panes


getShowEmptyPanes

public static boolean getShowEmptyPanes()

getRosterEntry

public RosterEntry getRosterEntry()


Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads