Class TerminalPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

class TerminalPanel extends JPanel
Live terminal for either Emrick Designer's own log or a unit's serial port (9600 baud). Connecting to a receiver turns its debug output on for the session (and off again on disconnect). Text typed to a transmitter is checked first, because the transmitter treats every character as a command that is broadcast to every unit (e.g. 'e' puts them all to sleep).
  • Field Details

    • OWNER

      private static final String OWNER
      See Also:
    • APP_LOG

      private static final String APP_LOG
      See Also:
    • MAX_LINES

      private static final int MAX_LINES
      See Also:
    • TIME

      private static final SimpleDateFormat TIME
    • CONSOLE_BG

      private static final Color CONSOLE_BG
    • CONSOLE_FG

      private static final Color CONSOLE_FG
    • RISKY_TRANSMITTER_COMMANDS

      private static final Map<Character,String> RISKY_TRANSMITTER_COMMANDS
      Transmitter command characters that affect every unit and need confirmation.
    • host

      private final DevModeHost host
    • sourceBox

      private final JComboBox<String> sourceBox
    • connectButton

      private final JButton connectButton
    • resetButton

      private final JButton resetButton
    • debugBox

      private final JCheckBox debugBox
    • autoScrollBox

      private final JCheckBox autoScrollBox
    • timestampBox

      private final JCheckBox timestampBox
    • pauseBox

      private final JCheckBox pauseBox
    • output

      private final JTextArea output
    • input

      private final JTextField input
    • lineEndingBox

      private final JComboBox<String> lineEndingBox
    • sendButton

      private final JButton sendButton
    • statusPill

      private final DevUI.Pill statusPill
    • pausedLines

      private final List<String> pausedLines
    • port

      private com.fazecast.jSerialComm.SerialPort port
    • portName

      private String portName
    • unitType

      private String unitType
    • debugTurnedOn

      private boolean debugTurnedOn
    • readerThread

      private Thread readerThread
    • reading

      private volatile boolean reading
    • appLogListener

      private Consumer<AppLog.Entry> appLogListener
  • Constructor Details

  • Method Details

    • isConnected

      private boolean isConnected()
    • refreshSources

      private void refreshSources()
    • updateControls

      private void updateControls()
    • connect

      private void connect()
    • startReader

      private void startReader(com.fazecast.jSerialComm.SerialPort sp)
    • disconnect

      private void disconnect()
    • closePort

      private void closePort(boolean tidy)
      Parameters:
      tidy - turn the receiver's debug output back off before closing (skipped if the unit is gone)
    • shutdown

      void shutdown()
    • send

      private void send()
    • confirmTransmitterText

      private boolean confirmTransmitterText(String text)
      Transmitters read every character as a broadcast command, so warn before sending anything that would affect every unit. Units that couldn't be identified are treated the same way to be safe.
    • resetUnit

      private void resetUnit()
    • stamp

      private String stamp()
    • format

      private String format(AppLog.Entry entry)
    • appendLine

      private void appendLine(String text)
    • appendNow

      private void appendNow(String text)
    • saveLog

      private void saveLog()