stella.jview
Class JMasterDisplay

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by jview.JExitFrame
                          extended by jview.JConfirmExitFrame
                              extended by jview.JBorderFrame
                                  extended by jview.JOpenFrame
                                      extended by jview.JClientFrame
                                          extended by stella.jview.JMasterDisplay
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Remote, EventListener, Accessible, RootPaneContainer, WindowConstants, BorderLabels, ClientLabels, Displayable, PickListener, ClientObject, ExitCleaning, Initializable, PropertyComposed, Refreshing
Direct Known Subclasses:
JAcquireDisplay, JAdapterDisplay, JAllskyDisplay, JDatabaseDisplay, JEnvironmentDisplay, JFitsDisplay, JOffsetDisplay

public abstract class JMasterDisplay
extends JClientFrame
implements PickListener, Refreshing

A generic class that allows display of information from periheral devices of STELLA. A JEnvironment may display the status of the roof and some senor data, a JTelescope displays status information of the telescope etc. This class provides a generic frame that might be populated with a single additional component provided by the subclass. It also acts as a PickListener, meaning that it is able to receive single HistoryAware.Pick events to update its display. The connect/disconnect action binds/unbinds this listening ability to the registry using the KEY_BINDNAME property. This reversal allows publisher of pick events to scan entire registries and funnel picks to all listeners found.

See Also:
Serialized Form

Nested Class Summary
static class JMasterDisplay.Show
          Class to create the frame and display it.
 
Nested classes/interfaces inherited from class jview.JClientFrame
JClientFrame.ClientListener
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static long DEFREFRESH
          Default refresh interval.
static String KEY_BINDNAME
          The command caster name we listener to, if any
static String KEY_REFRESH
          The refresh intervall in ms.
static String KEY_SWITCHMONITOR
          The command to switch the monitor.
private static String OFF
          Python-script for on.
private static String ON
          Python-script for on.
private  long switched
          Last time monitor was switched.
 
Fields inherited from class jview.JClientFrame
CONNECTACTION, DISCONNECTACTION, KEY_CONNECTONINIT, KEY_ICONCONNECT, KEY_ICONDISCONNECT
 
Fields inherited from class jview.JOpenFrame
EMPTYACTION, EXITACTION, KEY_FILEACTIONS, KEY_FILEHOME, OPENACTION, PRINTACTION, SAVEACTION
 
Fields inherited from class jview.JBorderFrame
DATACLEANSE, KEY_ABOUTURL, KEY_ACTIONCLASS, KEY_AIPLOGO, KEY_BIGGERSTRUT, KEY_DATAANALYSER, KEY_EASTALIGNMENT, KEY_FITTERS, KEY_HELPSIZE, KEY_LESSERSTRUT, KEY_NORTHALIGNMENT, KEY_SOUTHALIGNMENT, KEY_WESTALIGNMENT, MODELFITTER
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface jview.ClientLabels
KEY_CONNECTERROR, KEY_CONNECTTITLE, KEY_DISCONNECTERROR
 
Fields inherited from interface jview.BorderLabels
KEY_ABOUT, KEY_ABOUTACC, KEY_FILEACCS, KEY_FILEITEMS, KEY_FILEMENU, KEY_FILEMNEMONIC, KEY_HELPMENU, KEY_HELPMNEMONIC, KEY_HELPTITLE, KEY_NOHELP, KEY_NOURLACCESS, KEY_TITLE
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
protected JMasterDisplay(Map<String,String> prop)
          Constructs a generic peripheral from a property container.
protected JMasterDisplay(PropertyBearing prop)
          Constructs a generic peripheral from a property container.
 
Method Summary
 boolean connect()
          Called when connection to the registry is required.
 boolean disconnect()
          Called when deregistering from the casters is required.
protected  boolean execute(String command)
          Subclasses that need a system process to be executed can use this method.
protected  boolean execute(String command, boolean waitfor)
          Subclasses that need a system process to be executed can use this method.
 Icon getIcon()
          Might return an icon, if one was stated in the properties
 long getRefreshInterval()
          The refresh intervall.
 void init()
          We set our default close operation to nothing, allowing confirmed exit.
 boolean isFixedRate()
          True.
protected  void openFile(File f)
          Per default, we cannot open a file.
protected abstract  boolean processExternally(HistoryAware.Pick pick)
          If data was not available on the local resources, but should be retrieved using external storage, processLocally(stella.HistoryAware.Pick) should return false, in which turn we end up here.
protected abstract  boolean processLocally(HistoryAware.Pick pick)
          This method is called firstly when a pick event is received.
 boolean processPick(HistoryAware.Pick pick)
          We receive a pick event here.
 void refresh()
          Refresh only if NEC, plasma is on and the last toggle time is big.
 void setComposedProperties(PropertyBearing info)
          Defaults the display.
private  boolean tryLocalAndRemote(HistoryAware.Pick pick)
          Method the pick event is relayed to.
 
Methods inherited from class jview.JClientFrame
abolishConnection, actionPerformed, createConnect, establishConnection, exit, getBottomItems
 
Methods inherited from class jview.JOpenFrame
createCheckBoxMenuItem, createLocalizedCheckBoxMenuItem, getHelpActions, getMenus, getOpenFilter, getPrintRepresentation, getSaveFilter, getSaveRepresentation, populateMenu, printCenter, saveFile
 
Methods inherited from class jview.JBorderFrame
analyserListenTo, createBox, createButton, createCheckBox, createDataAnalysers, createFitters, createHelp, createLabel, createLocalizedButton, createLocalizedCheckBox, createLocalizedHelp, createLocalizedLabel, createStatus, getAboutAction, getActiveFit, getBiggerStrut, getBoxAt, getComposedProperties, getDataAnalysers, getLeftItems, getLesserStrut, getModelFittings, getRepresentation, getRightItems, getStatusField, getTopItems, hasFired, printAlignment, setAlignment, setFired
 
Methods inherited from class jview.JConfirmExitFrame
disposeAndExit
 
Methods inherited from class jview.JExitFrame
setVisible
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.PropertyComposed
getComposedProperties
 
Methods inherited from interface jview.Displayable
getRepresentation
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

KEY_BINDNAME

public static final String KEY_BINDNAME
The command caster name we listener to, if any

See Also:
Constant Field Values

KEY_SWITCHMONITOR

public static final String KEY_SWITCHMONITOR
The command to switch the monitor. For NEC monitors.

See Also:
Constant Field Values

KEY_REFRESH

public static final String KEY_REFRESH
The refresh intervall in ms.

See Also:
Constant Field Values

DEFREFRESH

private static final long DEFREFRESH
Default refresh interval. In default mode only used for screen-save.

See Also:
Constant Field Values

ON

private static final String ON
Python-script for on.

See Also:
Constant Field Values

OFF

private static final String OFF
Python-script for on.

See Also:
Constant Field Values

switched

private long switched
Last time monitor was switched.

Constructor Detail

JMasterDisplay

protected JMasterDisplay(Map<String,String> prop)
                  throws RemoteException
Constructs a generic peripheral from a property container.

Throws:
RemoteException

JMasterDisplay

protected JMasterDisplay(PropertyBearing prop)
                  throws RemoteException
Constructs a generic peripheral from a property container.

Throws:
RemoteException
Method Detail

setComposedProperties

public void setComposedProperties(PropertyBearing info)
Defaults the display.

Specified by:
setComposedProperties in interface PropertyComposed
Overrides:
setComposedProperties in class JClientFrame

init

public void init()
We set our default close operation to nothing, allowing confirmed exit.

Specified by:
init in interface Initializable
Overrides:
init in class JOpenFrame

getIcon

public Icon getIcon()
Might return an icon, if one was stated in the properties

Specified by:
getIcon in interface Displayable
Overrides:
getIcon in class JBorderFrame

getRefreshInterval

public long getRefreshInterval()
The refresh intervall.

Specified by:
getRefreshInterval in interface Refreshing

isFixedRate

public boolean isFixedRate()
True.

Specified by:
isFixedRate in interface Refreshing
See Also:
Timer

refresh

public void refresh()
Refresh only if NEC, plasma is on and the last toggle time is big. Than set to off.

Specified by:
refresh in interface Refreshing

connect

public boolean connect()
Called when connection to the registry is required. We enlist ourself at the KEY_BINDNAME property.

Specified by:
connect in interface ClientObject
Overrides:
connect in class JClientFrame

disconnect

public boolean disconnect()
Called when deregistering from the casters is required.

Specified by:
disconnect in interface ClientObject
Overrides:
disconnect in class JClientFrame

execute

protected boolean execute(String command)
Subclasses that need a system process to be executed can use this method.


execute

protected boolean execute(String command,
                          boolean waitfor)
Subclasses that need a system process to be executed can use this method.


openFile

protected void openFile(File f)
Per default, we cannot open a file.

Specified by:
openFile in class JOpenFrame

processPick

public boolean processPick(HistoryAware.Pick pick)
                    throws RemoteException
We receive a pick event here. Generally, a master display first checks if the data is needed is available locally. If this is not the case, a call to remote data gathering is initiated. We implement this by first calling processLocally(stella.HistoryAware.Pick). If this method returns false, we issue an info message on the status bar and call processExternally(stella.HistoryAware.Pick). If this method also returns false, we issue a warning to the status bar and return.
The actual method calls are done from an individual thread to fulfill the requirement of fast-returning event listeners

Specified by:
processPick in interface PickListener
Returns:
True, if the pick can be processed.
Throws:
RemoteException

tryLocalAndRemote

private boolean tryLocalAndRemote(HistoryAware.Pick pick)
Method the pick event is relayed to.


processLocally

protected abstract boolean processLocally(HistoryAware.Pick pick)
This method is called firstly when a pick event is received. If the data needed is available locally, the implementing class should process and display it and return true. If the data is not available locally and is for sure not available externally, the implementing class may issue a warning, but should nevertheless return true here. If the data may be available externally, the implementing class should return false here, in which turn processExternally(stella.HistoryAware.Pick) will be called.


processExternally

protected abstract boolean processExternally(HistoryAware.Pick pick)
If data was not available on the local resources, but should be retrieved using external storage, processLocally(stella.HistoryAware.Pick) should return false, in which turn we end up here. The implemnting class should retrieve the external data, display it and eventually place a copy into the local resources for later retrieval.