|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
jmri.util.swing.JmriPanel
jmri.jmrix.loconet.swing.LnPanel
jmri.jmrix.loconet.AbstractBoardProgPanel
public abstract class AbstractBoardProgPanel
Display and modify an Digitrax board configuration.
Supports boards which can be read and write using LocoNet opcode OPC_MULTI_SENSE, such as PM4x, DS64, SE8c, BDL16x.
The read and write require a sequence of operations, which we handle with a state variable.
Each read or write OpSw access requires a response from the addressed board. If a response is not received within a fixed time, then the process will repeat the read or write OpSw access up to MAX_OPSW_ACCESS_RETRIES additional times to try to get a response from the addressed board. If the board does not respond, the access sequence is aborted and a failure message is populated in the "status" variable.
Programming of the board is done via configuration messages, so the board should not be put into programming mode via the built-in pushbutton while this tool is in use.
Throughout, the terminology is "closed" == true, "thrown" == false. Variables are named for their closed state.
Some of the message formats used in this class are Copyright Digitrax, Inc. and used with permission as part of the JMRI project. That permission does not extend to uses in other software products. If you wish to use this code, algorithm or these message formats outside of JMRI, please contact Digitrax Inc for separate permission.
| 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
(package private) int |
address
|
JTextField |
addrField
|
(package private) boolean |
awaitingReply
|
(package private) JPanel |
contents
|
(package private) org.slf4j.Logger |
log
|
boolean |
onlyOneOperation
|
protected boolean[] |
opsw
True is "closed", false is "thrown". |
Timer |
pacingTimer
|
(package private) ResourceBundle |
rb
|
boolean |
read
|
JToggleButton |
readAllButton
|
(package private) boolean |
readOnInit
|
(package private) int |
replyTryCount
|
Timer |
responseTimer
|
int |
state
|
(package private) JLabel |
status
|
(package private) int |
typeWord
|
JToggleButton |
writeAllButton
|
| Fields inherited from class jmri.jmrix.loconet.swing.LnPanel |
|---|
memo |
| 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 | |
|---|---|
protected |
AbstractBoardProgPanel()
Constructor which assumes the board ID number is 1 |
protected |
AbstractBoardProgPanel(boolean readOnInit)
|
protected |
AbstractBoardProgPanel(int boardNum)
Constructor which allows the caller to pass in the board ID number |
protected |
AbstractBoardProgPanel(int boardNum,
boolean readOnInit)
|
| Method Summary | |
|---|---|
protected void |
appendLine(JComponent c)
Handle GUI layout details during construction. |
protected abstract void |
copyToOpsw()
Copy from the GUI to the opsw array. |
void |
dispose()
|
void |
doTheNextThing()
Helps continue sequences of OpSw accesses. |
Integer |
getBoardIdValue()
|
void |
initComponents()
2nd stage of initialization, invoked after the constuctor is complete. |
void |
initComponents(LocoNetSystemConnectionMemo memo)
2nd stage of initialization, invoked after the constuctor is complete. |
void |
message(LocoNetMessage m)
Processes incoming LocoNet message m for OpSw responses to read and write operation messages, and automatically advances to the next OpSw operation as directed by nextState(). |
protected abstract int |
nextState(int state)
Specify which OpSws (and which sequence) need to be read/written |
protected JPanel |
provideAddressing(String type)
Provide GUI elements for read and write buttons and address entry field |
protected JComponent |
provideStatusLine()
creates the status line for the GUI |
void |
readAll()
Provides a mechanism to read several OpSw values in a sequence. |
(package private) void |
setAddress(int maxValid)
Converts the GUI text field containing the address into a valid integer address, and handles user-input errors as needed. |
void |
setBoardIdValue(Integer boardId)
Set the Board ID number (also known as board address number) |
protected void |
setStatus(String msg)
updates the status line |
protected void |
setTypeWord(int type)
Configure the type word in the LocoNet messages. |
protected abstract void |
updateDisplay()
Update the GUI based on the contents of opsw[]. |
void |
writeAll()
Provides a mechanism to write several OpSw values in a sequence. |
void |
writeOne(int opswIndex)
writeOne() is intended to provide a mechanism to write a single OpSw value (specified by opswIndex), rather than a sequence of OpSws as done by writeAll(). |
| Methods inherited from class jmri.jmrix.loconet.swing.LnPanel |
|---|
getTitle, initContext |
| Methods inherited from class jmri.util.swing.JmriPanel |
|---|
getHelpTarget, getMenus, getTitle, getWindowInterface, isMultipleInstances, setWindowInterface |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
JPanel contents
ResourceBundle rb
public JToggleButton readAllButton
public JToggleButton writeAllButton
public JTextField addrField
JLabel status
public boolean read
public int state
boolean awaitingReply
int replyTryCount
public Timer responseTimer
public Timer pacingTimer
public boolean onlyOneOperation
int address
int typeWord
boolean readOnInit
protected boolean[] opsw
org.slf4j.Logger log
| Constructor Detail |
|---|
protected AbstractBoardProgPanel()
protected AbstractBoardProgPanel(boolean readOnInit)
protected AbstractBoardProgPanel(int boardNum,
boolean readOnInit)
protected AbstractBoardProgPanel(int boardNum)
boardNum - | Method Detail |
|---|
public void initComponents(LocoNetSystemConnectionMemo memo)
LnPanelInterfaceThis needs to be connected to the initContext() method in implementing classes.
initComponents in interface LnPanelInterfaceinitComponents in class LnPanelpublic void initComponents()
JmriPanel
initComponents in class JmriPanelpublic void setBoardIdValue(Integer boardId)
boardId - public Integer getBoardIdValue()
protected JPanel provideAddressing(String type)
protected JComponent provideStatusLine()
protected void setStatus(String msg)
msg - protected void appendLine(JComponent c)
c - component to put on a single linepublic void readAll()
protected void setTypeWord(int type)
Known values:
void setAddress(int maxValid)
throws Exception
Exceptionprotected abstract void copyToOpsw()
Used before a write operation is started.
protected abstract void updateDisplay()
This method is executed after completion of a read operation sequence.
protected abstract int nextState(int state)
public void writeAll()
public void writeOne(int opswIndex)
opswIndex - writeAll()public void message(LocoNetMessage m)
message in interface LocoNetListenerm - public void doTheNextThing()
Handles aborting a sequence of reads or writes when the GUI Read button or the GUI Write button (as appropriate for the current operation) is de-selected.
public void dispose()
dispose in class JmriPanel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||