Class PaneProgFrame

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  PaneProgFrame.SearchPair  
      • Nested classes/interfaces inherited from class javax.swing.JFrame

        javax.swing.JFrame.AccessibleJFrame
      • Nested classes/interfaces inherited from class java.awt.Frame

        java.awt.Frame.AccessibleAWTFrame
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Constructor Summary

      Constructors 
      Constructor Description
      PaneProgFrame​(DecoderFile pDecoderFile, RosterEntry pRosterEntry, java.lang.String pFrameEntryId, java.lang.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

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void addHelp()  
      protected boolean checkDirtyDecoder()  
      protected boolean checkDirtyFile()  
      void dispose()
      Local dispose, which also invokes parent.
      (package private) boolean doRead()  
      (package private) boolean doWrite()  
      void enableButtons​(boolean stat)
      Enable the read/write buttons.
      (package private) void enableReadButtons()
      Enable the [Read all] and [Read changes] buttons if possible.
      BusyGlassPane getBusyGlassPane()  
      static boolean getCanCacheDefault()  
      static boolean getDoConfirmRead()  
      FunctionLabelPane getFnLabelPane()  
      java.awt.Dimension getMaximumSize()
      Provide a maximum frame size that is limited to what can fit on the screen after toolbars, etc are deducted.
      protected abstract javax.swing.JPanel getModePane()
      Abstract method to provide a JPanel setting the programming mode, if appropriate.
      java.util.List<javax.swing.JPanel> getPaneList()  
      java.awt.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()  
      RosterEntryPane getRosterPane()  
      static boolean getShowCvNumbers()  
      static boolean getShowEmptyPanes()
      Get value of Preference option to show empty panes.
      protected void handleDirtyFile()  
      protected void installComponents()  
      boolean isBusy()  
      static boolean isIncludedFE​(org.jdom2.Element e, org.jdom2.Element aModelElement, RosterEntry aRosterEntry, java.lang.String extraIncludes, java.lang.String extraExcludes)
      Front end to DecoderFile.isIncluded() Retrieves "productID" and "model attributes from the "model" element and "family" attribute from the roster entry.
      protected void loadDecoderFile​(DecoderFile df, RosterEntry re)  
      protected void loadDecoderFromLoco​(RosterEntry r)  
      protected void loadJPanel​(java.awt.Component c, javax.swing.JPanel tab)  
      protected void loadProgrammerFile​(RosterEntry r)  
      protected void loadSearchTargets()  
      protected javax.swing.JPanel makeFunctionLabelPane​(RosterEntry r)  
      protected javax.swing.JPanel makeInfoPane​(RosterEntry r)  
      protected javax.swing.JPanel makeMediaPane​(RosterEntry r)  
      void newPane​(java.lang.String name, org.jdom2.Element pane, org.jdom2.Element modelElem, boolean enableEmpty, boolean programmerPane)  
      void paneFinished()  
      protected void pickProgrammerMode​(org.jdom2.Element programming)  
      void prepGlassPane​(javax.swing.AbstractButton activeButton)
      Create a BusyGlassPane transparent layer over the panel blocking any other interaction, excluding a supplied button.
      void printPanes​(boolean preview)
      Prepare a roster entry to be printed, and display a selection list.
      protected void processModifierElements​(org.jdom2.Element e, PaneProgPane pane, VariableTableModel model, javax.swing.JTabbedPane tabPane, int index)
      If there are any modifier elements, process them.
      void propertyChange​(java.beans.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 the "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.
      (package private) void readConfig​(org.jdom2.Element root, RosterEntry r)  
      protected void resetToDefaults()
      Reset all CV values to defaults stored earlier.
      protected void saveDefaults()
      Save all CV values.
      protected void searchDidNotFind()  
      protected void searchGoesTo​(PaneProgFrame.SearchPair result)  
      static void setCanCacheDefault​(boolean yes)  
      static void setDoConfirmRead​(boolean yes)  
      (package private) void setProgrammingGui​(javax.swing.JPanel bottom)  
      (package private) void setSearchGui​(javax.swing.JPanel bottom)  
      static void setShowCvNumbers​(boolean yes)
      Option to control appearance of CV numbers in tool tips.
      static void setShowEmptyPanes​(boolean yes)
      Set value of Preference option to show empty panes.
      boolean storeFile()
      Store the locomotives information in the roster (and a RosterEntry file).
      (package private) void updateDccAddress()  
      void windowClosing​(java.awt.event.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 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, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, 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,
                             @Nonnull
                             RosterEntry pRosterEntry,
                             java.lang.String pFrameEntryId,
                             java.lang.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. Note that we're assuming the roster entry has the right decoder, at least w.r.t. the loco file.
        • Fill CV values from the roster entry
        • Create the programmer panes
        Parameters:
        pDecoderFile - XML file defining the decoder contents; if null, the decoder definition is found from the RosterEntry
        pRosterEntry - RosterEntry for information on this locomotive
        pFrameEntryId - Roster ID (entry) loaded into the frame
        pProgrammerFile - Name of the programmer file to use
        pProg - Programmer object to be used to access CVs
        opsMode - true for opsMode, else false.
    • Method Detail

      • getModePane

        protected abstract javax.swing.JPanel getModePane()
        Abstract method to provide a JPanel setting the programming mode, if appropriate.

        A null value is ignored (?)

        Returns:
        new mode panel for inclusion in the GUI
      • setSearchGui

        void setSearchGui​(javax.swing.JPanel bottom)
      • loadJPanel

        protected void loadJPanel​(java.awt.Component c,
                                  javax.swing.JPanel tab)
      • getPaneList

        public java.util.List<javax.swing.JPanel> getPaneList()
      • getPreferredSize

        public java.awt.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
        Returns:
        the preferred size or the maximum size, whichever is smaller
      • getMaximumSize

        public java.awt.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
        Returns:
        the maximum window size
      • enableReadButtons

        void enableReadButtons()
        Enable the [Read all] and [Read changes] buttons if possible. This checks to make sure this is appropriate, given the attached programmer's capability.
      • isIncludedFE

        public static boolean isIncludedFE​(org.jdom2.Element e,
                                           org.jdom2.Element aModelElement,
                                           RosterEntry aRosterEntry,
                                           java.lang.String extraIncludes,
                                           java.lang.String extraExcludes)
        Front end to DecoderFile.isIncluded()
        • Retrieves "productID" and "model attributes from the "model" element and "family" attribute from the roster entry.
        • Then invokes DecoderFile.isIncluded() with the retrieved values.
        • Deals gracefully with null or missing elements and attributes.
        Parameters:
        e - XML element with possible "include" and "exclude" attributes to be checked
        aModelElement - "model" element from the Decoder Index, used to get "model" and "productID".
        aRosterEntry - The current roster entry, used to get "family".
        extraIncludes - additional "include" terms
        extraExcludes - additional "exclude" terms.
        Returns:
        true if front ended included, else false.
      • checkDirtyDecoder

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

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

        public void windowClosing​(java.awt.event.WindowEvent e)
        Close box has been clicked; handle check for dirty with respect to decoder or file, then close.
        Specified by:
        windowClosing in interface java.awt.event.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 {link #resetToDefaults()}

      • newPane

        public void newPane​(java.lang.String name,
                            org.jdom2.Element pane,
                            org.jdom2.Element modelElem,
                            boolean enableEmpty,
                            boolean programmerPane)
      • processModifierElements

        protected void processModifierElements​(org.jdom2.Element e,
                                               PaneProgPane pane,
                                               VariableTableModel model,
                                               javax.swing.JTabbedPane tabPane,
                                               int index)
        If there are any modifier elements, process them.
        Parameters:
        e - Process the contents of this element
        pane - Destination of any visible items
        model - Used to locate any needed variables
        tabPane - For overall GUI navigation
        index - Which pane in the overall window
      • prepGlassPane

        public void prepGlassPane​(javax.swing.AbstractButton activeButton)
        Create a BusyGlassPane transparent layer over the panel blocking any other interaction, excluding a supplied button.
        Specified by:
        prepGlassPane in interface PaneContainer
        Parameters:
        activeButton - a button to put on top of the pane
      • enableButtons

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

        In addition, if a programming mode pane is present, its "set" button is enabled.

        Specified by:
        enableButtons in interface PaneContainer
        Parameters:
        stat - Are reads possible? If false, so not enable the read buttons.
      • 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 the "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
      • printPanes

        public void printPanes​(boolean preview)
        Prepare a roster entry to be printed, and display a selection list.
        Parameters:
        preview - true if output should go to a Preview pane on screen, false to output to a printer (dialog)
        See Also:
        PrintRosterEntry.doPrintPanes(boolean)
      • propertyChange

        public void propertyChange​(java.beans.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 java.beans.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.
        Specified by:
        dispose in interface WindowInterface
        Overrides:
        dispose in class JmriJFrame
      • setShowEmptyPanes

        public static void setShowEmptyPanes​(boolean yes)
        Set value of Preference option to show empty panes.
        Parameters:
        yes - true if empty panes should be shown
      • getShowEmptyPanes

        public static boolean getShowEmptyPanes()
        Get value of Preference option to show empty panes.
        Returns:
        value from programmer config. manager, else true.
      • setShowCvNumbers

        public static void setShowCvNumbers​(boolean yes)
        Option to control appearance of CV numbers in tool tips.
        Parameters:
        yes - true is CV numbers should be shown