Module hw06

Class MainFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class MainFrame extends JFrame
Example view class that has the ability to add a LoggerPanel.
Author:
swong
See Also:
Serialized Form
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For serialization
      See Also:
      Constant Field Values
    • leFormatter

      private ILogEntryFormatter leFormatter
      The log entry formatter used by the local view logger. Notice how indexed positional arguments ("%X$") are used to control where the various log entry values are placed in the output string.d
    • viewOnlyLogger

      private ILogger viewOnlyLogger
      The local view logger that uses a custom (lambda expression implemented) ILogEntryProcessor which shows a formatted log entry on a pop-up dialog window.
    • v2mAdpt

      private IView2ModelAdapter v2mAdpt
      The adapter to the model
    • contentPane

      private JPanel contentPane
      The frame's content pane
    • pnlControl

      private final JPanel pnlControl
      The panel holding the control components at the top of the frame
    • btnMakeError

      private final JButton btnMakeError
      The button to make an error log entry in the model
    • btnMakeDebug

      private final JButton btnMakeDebug
      The button to make a debug log entry in the model
    • cbxSetLogLevel

      private final JComboBox<LogLevel> cbxSetLogLevel
      The drop list that sets the system logger's minimum log level
    • pnlLogControl

      private final JPanel pnlLogControl
      The panel that holds the controls for the system logger.
    • pnlCreateLog

      private final JPanel pnlCreateLog
      The panel to hold the controls to ask the model to make a log entry
    • tfLogMsg

      private final JTextField tfLogMsg
      The text field to enter a log message for the model
    • btnMakeCritical

      private final JButton btnMakeCritical
      The button to make a critical log entry in the model
    • btnMakeInfo

      private final JButton btnMakeInfo
      The button to make an info log entry in the model
    • lblMsgDisplay

      private final JLabel lblMsgDisplay
      The label used to display messages on the view
    • btnMakeViewLogMsg

      private final JButton btnMakeViewLogMsg
      The button to make a log entry using the local view logger
    • pnlViewOnly

      private final JPanel pnlViewOnly
      The panel that holds the controls for the local view logger
    • tfViewOnlyMsg

      private final JTextField tfViewOnlyMsg
      The text field to enter a message for a local view log entry.
  • Constructor Details

    • MainFrame

      public MainFrame(IView2ModelAdapter v2mAdpt)
      Create the frame. The system-wide logger is deliberately not being passed in here as it is for the model to illustrate how the view can directly access the global, singleton logger (which is the same logger as the system logger here) through ILoggerControl.
      Parameters:
      v2mAdpt - The adapter to the model
  • Method Details

    • initGUI

      private void initGUI()
      Initialize the GUI
    • start

      public void start()
      Start the view. This includes adding the global singleton logger to the local view logger chain (viewOnlyLogger).
    • addCenterPanel

      public void addCenterPanel(JPanel pnlCenter)
      Add a panel to the center of the view. The logger panel will be put here.
      Parameters:
      pnlCenter - The panel to add to the center of the view
    • displayMsg

      public void displayMsg(String msg)
      Display the given string on the display label
      Parameters:
      msg - The message to display