Package jmri.jmrix
Class AbstractMonPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- jmri.util.swing.JmriPanel
-
- jmri.jmrix.AbstractMonPane
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
- Direct Known Subclasses:
BiDiBMonPane
,Dcc4PcMonPane
,EcosMonPane
,IEEE802154MonPane
,JMRIClientMonPane
,LocoMonPane
,MarklinMonPane
,MonitorPane
,MonitorPane
,MrcMonPanel
,Mx1MonPanel
,NceMonPanel
,NcePacketMonitorPanel
,SerialMonPane
,SerialMonPane
,SRCPMonPane
,TamsMonPane
,XNetMonPane
,XpaMonPane
,Z21MonPane
public abstract class AbstractMonPane extends JmriPanel
Abstract base class for JPanels displaying communications monitor information.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.String
alwaysOnTopCheck
protected javax.swing.JCheckBox
alwaysOnTopCheckBox
(package private) java.lang.String
autoScrollCheck
protected javax.swing.JCheckBox
autoScrollCheckBox
protected javax.swing.JButton
clearButton
protected javax.swing.JButton
copyToClipBoardButton
protected javax.swing.JButton
enterButton
protected javax.swing.JTextField
entryField
protected javax.swing.JTextField
filterField
(package private) java.lang.String
filterFieldCheck
protected javax.swing.JLabel
filterLabel
protected javax.swing.JToggleButton
freezeButton
protected javax.swing.JScrollPane
jScrollPane1
protected java.lang.StringBuffer
linesBuffer
(package private) javax.swing.JFileChooser
logFileChooser
protected TextAreaFIFO
monTextPane
protected javax.swing.JButton
openFileChooserButton
protected javax.swing.JCheckBox
rawCheckBox
(package private) java.lang.String
rawDataCheck
protected javax.swing.JToggleButton
startLogButton
protected javax.swing.JButton
stopLogButton
protected javax.swing.JCheckBox
timeCheckBox
(package private) java.lang.String
timeStampCheck
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description AbstractMonPane()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addCustomControlPanes(javax.swing.JPanel parent)
Expand the display with additional options specific to the hardware.protected void
addDataPanes()
Put data pane(s) in the GUI.void
clearButtonActionPerformed(java.awt.event.ActionEvent e)
protected void
configureDataPane(TextAreaFIFO textPane)
Do default configuration of a data pane.void
copyToClipBoardButtonActionPerformed(java.awt.event.ActionEvent e)
protected void
createDataPanes()
By default, create just one place (one data pane) to put trace data.void
dispose()
void
enterButtonActionPerformed(java.awt.event.ActionEvent e)
java.lang.String
getFilePathAndName()
java.lang.String
getFilterText()
java.lang.String
getFrameText()
java.lang.String
getHelpTarget()
Provide a help target string which an enclosing frame can provide as a help reference.protected int
getInitialPreferredLineCount()
Provide initial number of lines to display Used to size the initial GUI.protected int
getInitialPreferredLineLength()
Provide initial preferred line length.protected java.lang.String
getOpCodeForFilter(java.lang.String raw)
Get hex opcode for filtering.javax.swing.JTextArea
getTextArea()
Get access to the main text area.abstract java.lang.String
getTitle()
Provide a recommended title for an enclosing frame.protected abstract void
init()
Initialize the data source.void
initComponents()
2nd stage of initialization, invoked after the constructor is complete.protected boolean
isFiltered(java.lang.String raw)
Default filtering implementation, more of an example than anything else, not clear it really works for any system.void
logMessage(java.lang.String messagePrefix, java.lang.String rawPrefix, Message message)
Log an Message derived message with a prefixed label.void
logMessage(java.lang.String messagePrefix, Message message)
Log an Message derived message.void
logMessage(Message message)
Log an Message derived message.void
nextLine(java.lang.String line, java.lang.String raw)
void
nextLineWithTime(java.util.Date timestamp, java.lang.String line, java.lang.String raw)
Handle display of traffic.void
openFileChooserButtonActionPerformed(java.awt.event.ActionEvent e)
void
setFilterText(java.lang.String text)
void
setFixedWidthFont()
Set the display window to fixed width font, so that e.g. columns line up.void
startLogButtonActionPerformed(java.awt.event.ActionEvent e)
void
stopLogButtonActionPerformed(java.awt.event.ActionEvent e)
-
Methods inherited from class jmri.util.swing.JmriPanel
getMenus, getMinimumDimension, getWindowInterface, initContext, isMultipleInstances, setWindowInterface
-
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, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
copyToClipBoardButton
protected javax.swing.JButton copyToClipBoardButton
-
clearButton
protected javax.swing.JButton clearButton
-
freezeButton
protected javax.swing.JToggleButton freezeButton
-
jScrollPane1
protected javax.swing.JScrollPane jScrollPane1
-
monTextPane
protected TextAreaFIFO monTextPane
-
startLogButton
protected javax.swing.JToggleButton startLogButton
-
stopLogButton
protected javax.swing.JButton stopLogButton
-
rawCheckBox
protected javax.swing.JCheckBox rawCheckBox
-
timeCheckBox
protected javax.swing.JCheckBox timeCheckBox
-
alwaysOnTopCheckBox
protected javax.swing.JCheckBox alwaysOnTopCheckBox
-
autoScrollCheckBox
protected javax.swing.JCheckBox autoScrollCheckBox
-
filterField
protected javax.swing.JTextField filterField
-
filterLabel
protected javax.swing.JLabel filterLabel
-
openFileChooserButton
protected javax.swing.JButton openFileChooserButton
-
entryField
protected javax.swing.JTextField entryField
-
enterButton
protected javax.swing.JButton enterButton
-
rawDataCheck
java.lang.String rawDataCheck
-
timeStampCheck
java.lang.String timeStampCheck
-
alwaysOnTopCheck
java.lang.String alwaysOnTopCheck
-
autoScrollCheck
java.lang.String autoScrollCheck
-
filterFieldCheck
java.lang.String filterFieldCheck
-
logFileChooser
final javax.swing.JFileChooser logFileChooser
-
linesBuffer
protected java.lang.StringBuffer linesBuffer
-
-
Constructor Detail
-
AbstractMonPane
public AbstractMonPane()
-
-
Method Detail
-
getTitle
public abstract java.lang.String getTitle()
Provide a recommended title for an enclosing frame.
-
init
protected abstract void init()
Initialize the data source.This is invoked at the end of the GUI initialization phase. Subclass implementations should connect to their data source here.
-
createDataPanes
protected void createDataPanes()
By default, create just one place (one data pane) to put trace data.
-
configureDataPane
protected void configureDataPane(TextAreaFIFO textPane)
Do default configuration of a data pane.- Parameters:
textPane
- a TextAreaFIFO into which the data pane will be placed
-
getInitialPreferredLineLength
protected int getInitialPreferredLineLength()
Provide initial preferred line length. Used to size the initial GUI.- Returns:
- preferred initial number of columns
-
getInitialPreferredLineCount
protected int getInitialPreferredLineCount()
Provide initial number of lines to display Used to size the initial GUI.- Returns:
- preferred initial number of rows
-
addDataPanes
protected void addDataPanes()
Put data pane(s) in the GUI.
-
initComponents
public void initComponents()
2nd stage of initialization, invoked after the constructor is complete.- Overrides:
initComponents
in classJmriPanel
-
addCustomControlPanes
protected void addCustomControlPanes(javax.swing.JPanel parent)
Expand the display with additional options specific to the hardware.- Parameters:
parent
- a Panel (with vertical BoxLayout); overrides should add a new Panel with horizontal BoxLayout to hold the additional options.
-
setFixedWidthFont
public void setFixedWidthFont()
Set the display window to fixed width font, so that e.g. columns line up.
-
getHelpTarget
public java.lang.String getHelpTarget()
Provide a help target string which an enclosing frame can provide as a help reference.This automatically provides a reference to the usual place for JMRI window-specific help pages that are named for the implementing class, but note this is a Pane class, not a Frame class.
- Overrides:
getHelpTarget
in classJmriPanel
- Returns:
- the target String
-
logMessage
public void logMessage(Message message)
Log an Message derived message.- Parameters:
message
- message object to log.
-
logMessage
public void logMessage(java.lang.String messagePrefix, Message message)
Log an Message derived message.- Parameters:
messagePrefix
- text to prefix the message with.message
- message object to log.
-
logMessage
public void logMessage(java.lang.String messagePrefix, java.lang.String rawPrefix, Message message)
Log an Message derived message with a prefixed label.- Parameters:
messagePrefix
- text to prefix the message with.rawPrefix
- label to add to the start of the message.message
- message object to log.
-
nextLine
public void nextLine(java.lang.String line, java.lang.String raw)
-
nextLineWithTime
public void nextLineWithTime(java.util.Date timestamp, java.lang.String line, java.lang.String raw)
Handle display of traffic.- Parameters:
timestamp
- timestamp to be pre-pended to the output line (if timestamping is enabled)line
- The traffic in normal parsed form, ending with \nraw
- The traffic in raw form, ending with \n
-
isFiltered
protected boolean isFiltered(java.lang.String raw)
Default filtering implementation, more of an example than anything else, not clear it really works for any system. Override this in system-specific subclasses to do something useful.- Parameters:
raw
- A string containing the raw message hex information, in ASCII encoding, with some "header" information pre-pended.- Returns:
- True if the opcode in the raw message matches one of the "filter" opcodes. False if the opcode does not match any of the "filter" opcodes.
-
getOpCodeForFilter
protected java.lang.String getOpCodeForFilter(java.lang.String raw)
Get hex opcode for filtering.Reports the "opcode" byte from the string containing the ASCII string representation of the message. Assumes that there is a generic header on string, like "Tx - ", and ignores it.
- Parameters:
raw
- a String containing the generic raw hex information, with pre-pended header.- Returns:
- a two character String containing only the hex representation of the opcode from the raw message.
-
clearButtonActionPerformed
public void clearButtonActionPerformed(java.awt.event.ActionEvent e)
-
copyToClipBoardButtonActionPerformed
public void copyToClipBoardButtonActionPerformed(java.awt.event.ActionEvent e)
-
getFilePathAndName
public java.lang.String getFilePathAndName()
-
startLogButtonActionPerformed
public void startLogButtonActionPerformed(java.awt.event.ActionEvent e)
-
stopLogButtonActionPerformed
public void stopLogButtonActionPerformed(java.awt.event.ActionEvent e)
-
openFileChooserButtonActionPerformed
public void openFileChooserButtonActionPerformed(java.awt.event.ActionEvent e)
-
enterButtonActionPerformed
public void enterButtonActionPerformed(java.awt.event.ActionEvent e)
-
getFrameText
public java.lang.String getFrameText()
-
getTextArea
public final javax.swing.JTextArea getTextArea()
Get access to the main text area. This is intended for use in e.g. scripting to extend the behavior of the window.- Returns:
- the main text area
-
getFilterText
public java.lang.String getFilterText()
-
setFilterText
public void setFilterText(java.lang.String text)
-
-