WIDAR Classes

edu.nrao.widar.gui.widget
Class LogPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.nrao.widar.gui.widget.BlankPanel
                      extended by edu.nrao.widar.gui.widget.LogPane
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class LogPane
extends BlankPanel
implements java.awt.event.ActionListener, java.awt.event.WindowListener

LogPane.
LogPane is a small JTextArea in a JScrollPane that can be added to a GUI to facilitate reading and writing a server resident log. It's intended use is to facilitate communication between GUI users in the case where more than one user is connected to the same device.

Every device in the WIDAR correlator that is served by the REST-based interface system contains an online log that is memory resident (it gets reset when the server is restarted). This includes each of the Station and Baseline Boards CMIBs as well as the CPCC and MCCC and likely the CBE computers. Each log is for a single device.
LogPane automatically makes a server log entry when a GUI connects to it or disconnects from it so that it is not dependent on a human having to remember to do so. A user may also enter additional information into the log that others will see when they connect.
Finally, the pane preovides a drop down choice field to allow a user to set a lock state on the device. This is not a working lock but meant to let others know, at a glance, what the useable state of the board is without having to search through log text.
Programmers note 1:
LogPane knows when its parent window is opened and closed by listening to WindowEvents. The events are dispatched by the 'system' for all cases except when a program explicitly calls System.exit(). This is normally the case when the default close operation is set to EXIT_ON_CLOSE and the user selected 'Quit' from a menu. (Clicking the 'X' (or red button for OS-X) on the window frame causes proper event dispatching). So, in order for proper operation of LogPane when quitting the GUI application using the System.exit() method, the program must first explicitly dispatch a WINDOW_CLOSING event using the following method:

   dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
before calling System.exit().
Programmers note 2:
It's a good idea to refresh LogPane whenever the GUI iteslf is refreshed. This can be done in one of two ways:
  • 1) Add LogPane to the GUI's RefreshPanel (or ServerPanel) ActionListener list so that it will automatically be notified with an ActionEvent:
    refreshPanel.addActionListener(logPane);
  • 2) Explicitly call LogPane's public refresh method everytime the GUI itself is refreshed.

  • Since:
    1.5
    Author:
    KJRyan
    See Also:
    Serialized Form
    Created:
    2008.08.29
     

    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
     
    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
     
    Field Summary
    static java.awt.Color LOCK_DONT_USE
               
    static java.awt.Color LOCK_IN_USE
               
    static java.awt.Color LOCK_OKAY_TO_USE
               
     java.lang.Runnable scrollDown
               
     
    Fields inherited from class edu.nrao.widar.gui.widget.BlankPanel
    bigLabelFont, defaultFont, fieldFont, LABEL_POS_BOTTOM, LABEL_POS_LEFT, LABEL_POS_RIGHT, LABEL_POS_TOP
     
    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
    LogPane(int w, int h, javax.swing.JTextField ipField)
              Create a LogPane of a specified size with a specified JTextField supplying the IP address of the server.
    LogPane(int w, int h, java.lang.String ipString)
              Create a LogPane of a specified size with a specified String supplying the IP address of the server.
     
    Method Summary
     void actionPerformed(java.awt.event.ActionEvent e)
               
     void addMessage(java.lang.String message)
               
     void addNotify()
               
     void paintComponent(java.awt.Graphics g)
               
     void refresh()
              Refresh.
     void removeNotify()
               
     void windowActivated(java.awt.event.WindowEvent e)
               
     void windowClosed(java.awt.event.WindowEvent e)
               
     void windowClosing(java.awt.event.WindowEvent e)
               
     void windowDeactivated(java.awt.event.WindowEvent e)
               
     void windowDeiconified(java.awt.event.WindowEvent e)
               
     void windowIconified(java.awt.event.WindowEvent e)
               
     void windowOpened(java.awt.event.WindowEvent e)
               
     
    Methods inherited from class edu.nrao.widar.gui.widget.BlankPanel
    add, add, add, add, add, add, add, add, add, add, add, add, add, add, addButton, addComponent, addComponent, addComponent, addComponent, addComponent, addComponent, addLabel, addPanel, drawGrid, drawGrid, fixMarginsAndGetDimension, getComponent, getField, getFieldText, getValue, setAndAlarm, setField
     
    Methods inherited from class javax.swing.JPanel
    getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
     
    Methods inherited from class javax.swing.JComponent
    addAncestorListener, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    LOCK_IN_USE

    public static final java.awt.Color LOCK_IN_USE

    LOCK_DONT_USE

    public static final java.awt.Color LOCK_DONT_USE

    LOCK_OKAY_TO_USE

    public static final java.awt.Color LOCK_OKAY_TO_USE

    scrollDown

    public java.lang.Runnable scrollDown
    Constructor Detail

    LogPane

    public LogPane(int w,
                   int h,
                   java.lang.String ipString)
    Create a LogPane of a specified size with a specified String supplying the IP address of the server. The same IP address is used for the remainder of the life of this LogPane.

    Parameters:
    w - width, in pixels, of the GUI pane
    h - height, in pixels, of the GUI pane
    ipString - IP address String of the server that the GUI is connected to

    LogPane

    public LogPane(int w,
                   int h,
                   javax.swing.JTextField ipField)
    Create a LogPane of a specified size with a specified JTextField supplying the IP address of the server. The JTextField is read before each get/set of the server to facilitate GUIs that can dynamically change the servers to which they are attached.

    Parameters:
    w - width, in pixels, of the GUI pane
    h - height, in pixels, of the GUI pane
    ipField - JTextField containing the IP address of the server that the GUI is connected to. When this constructor is used, LogPane will fetch the IP from the field before each server access so that, if the GUI changes servers, LogPane will access the correct one.
    Method Detail

    paintComponent

    public void paintComponent(java.awt.Graphics g)
    Overrides:
    paintComponent in class javax.swing.JComponent

    addMessage

    public void addMessage(java.lang.String message)

    refresh

    public void refresh()
    Refresh. This is the public method used to refresh the log pane. If LogPane is not added to the RefreshPanel or ServerPanel list of ActionListeners, then this method should be called explicitly whenever the GUI itelf is being refreshed.


    windowActivated

    public void windowActivated(java.awt.event.WindowEvent e)
    Specified by:
    windowActivated in interface java.awt.event.WindowListener

    windowClosed

    public void windowClosed(java.awt.event.WindowEvent e)
    Specified by:
    windowClosed in interface java.awt.event.WindowListener

    windowClosing

    public void windowClosing(java.awt.event.WindowEvent e)
    Specified by:
    windowClosing in interface java.awt.event.WindowListener

    windowDeactivated

    public void windowDeactivated(java.awt.event.WindowEvent e)
    Specified by:
    windowDeactivated in interface java.awt.event.WindowListener

    windowDeiconified

    public void windowDeiconified(java.awt.event.WindowEvent e)
    Specified by:
    windowDeiconified in interface java.awt.event.WindowListener

    windowIconified

    public void windowIconified(java.awt.event.WindowEvent e)
    Specified by:
    windowIconified in interface java.awt.event.WindowListener

    windowOpened

    public void windowOpened(java.awt.event.WindowEvent e)
    Specified by:
    windowOpened in interface java.awt.event.WindowListener

    addNotify

    public void addNotify()
    Overrides:
    addNotify in class javax.swing.JComponent

    removeNotify

    public void removeNotify()
    Overrides:
    removeNotify in class javax.swing.JComponent

    actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)
    Specified by:
    actionPerformed in interface java.awt.event.ActionListener

    NRAO/DRAO

    National Radio Astronomy Observatory