stella.jview
Class JEnvironment

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.JMasterFrame
                                              extended by stella.jview.JEnvironment
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, Remote, EventListener, Accessible, RootPaneContainer, WindowConstants, BorderLabels, ClientLabels, Displayable, RmiAcknowledgeListener, RmiCommandListener, RmiDataCollecting, RmiDataListener, RmiDoneListener, RmiErrorListener, RmiWeatherListener, ClientObject, ExitCleaning, Initializable, PropertyAware, PropertyComposed, RmiEventListener, RmiListener

public class JEnvironment
extends JMasterFrame

The last class in the GUI-building control hierarchy. This GUI combines the capabilities of sending commands to a RoofReceiver (from JLaunchBox) with a display of the current roof position from JRoofView and a display of current weather data (from JSensorTable. Additionally it provides methods to put the EnvironmentMaster into manual mode, without the need for direct registration to the roof receiver at startup.

The current web-cam image is 'http://webcam.tt.iac.es/fullsize.jpg?axislogo=off&clock=on'

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class stella.jview.JMasterFrame
JMasterFrame.Show, JMasterFrame.Signal
 
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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static Color DEFBADBORDER
          The default good-weather color.
private static int DEFBORDER
          The default border size.
private static String DEFFILEACTIONS
          The action commands used for identfiying file menu actions.
private static Color DEFGOODBORDER
          The default good-weather color.
private static String DEFRESOURCEBUNDLES
          The resource bundles for localized labels and text.
private static int DEFROOFNUMBER
          The default number of roofs.
private  boolean haveall
          Gets true if we have collected information on all roofs present.
private  JPanel jenv
          My display panel for changing the border color.
static String KEY_BADBORDER
          The color of the bad-weather border.
static String KEY_BORDER
          The key to the size of the panel border.
static String KEY_GOODBORDER
          The color of the good-weather border.
static String KEY_ROOFNUMBER
          The key pointing to the properties file of the roof view panel.
static String KEY_SENSORCANVAS
          The key pointing to the property files of the sensor tabels.
static String KEY_SENSORTABS
          The key pointing to the tags on the tabbed sensor pane.
private  RoofInfo[] roof
          The information on the roof switches used to derive the roof state.
private  JTabbedPane sensors
          The pane displaying the sensor values.
private  JRoofView view
          The display of the current roof state.
private  List weathercanvi
          The list of successfully initialized weather canvases.
 
Fields inherited from class stella.jview.JMasterFrame
KEY_ACKNOWLEDGECASTER, KEY_COMMANDCASTER, KEY_DATACASTER, KEY_DONECASTER, KEY_ERRORCASTER, KEY_INTERVAL, KEY_REPOSITORY, KEY_WEATHERCASTER
 
Fields inherited from class jview.JClientFrame
CONNECTACTION, DISCONNECTACTION, KEY_CONNECTONINIT, KEY_ICONCONNECT, KEY_ICONDISCONNECT
 
Fields inherited from class jview.JOpenFrame
EMPTYACTION, EXITACTION, EXPORTACTION, 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_FITTERTIPS, KEY_HELPSIZE, KEY_LESSERSTRUT, KEY_NOLOGO, 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
JEnvironment(Map<String,String> prop)
          Constructs a generic peripheral from a property container.
JEnvironment(PropertyBearing env)
          Constructs a new environment-GUI.
 
Method Summary
 Component getRepresentation()
          Returns the entire environment in a single panel.
 void init()
          Initializes the environment display.
static void main(String[] arg)
          Launches a roof control program.
protected  boolean openFile(File in)
          Called if a file should be open.
 void rmiErrorOccured(ErrorEvent ee)
          The receiving edge of the error listener.
 void rmiProcessData(Map readings, boolean weather)
          This method passes only the data in the mapping to all its registered JWeatherCanvases.
 void rmiWeatherChanged(WeatherEvent we)
          Receive wether changed events.
protected  boolean saveFile(File out)
          Overrides saving of component with saving of weather data.
 void setComposedProperties(PropertyBearing prop)
          Sets a PropertyBearing object as a composite of the canvas.
 
Methods inherited from class stella.jview.JMasterFrame
accepts, connect, createStatus, disconnect, disconnect, getListenerName, isConnected, rmiCommand, rmiDataAvailable, rmiGetInterval, rmiGotAcknowledge, rmiGotDone
 
Methods inherited from class jview.JClientFrame
abolishConnection, actionPerformed, createConnect, establishConnection, exit, getBottomItems
 
Methods inherited from class jview.JOpenFrame
createCheckBoxMenuItem, createLocalizedCheckBoxMenuItem, exportCenter, getExportRepresentation, getHelpActions, getMenus, getOpenFilter, getPrintRepresentation, getSaveFilter, getSaveRepresentation, populateMenu, printCenter
 
Methods inherited from class jview.JBorderFrame
analyserListenTo, createButton, createCheckBox, createDataAnalysers, createFitters, createHelp, createLabel, createLocalizedButton, createLocalizedCheckBox, createLocalizedHelp, createLocalizedLabel, getAboutAction, getActiveFit, getBiggerStrut, getComposedProperties, getDataAnalysers, getFitterButtonGroup, getFitterComboBox, getIcon, getLeftItems, getLesserStrut, getModelFittings, 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, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, 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, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, 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, 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, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface util.PropertyComposed
getComposedProperties
 
Methods inherited from interface jview.Displayable
getIcon
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

KEY_SENSORCANVAS

public static final String KEY_SENSORCANVAS
The key pointing to the property files of the sensor tabels.

See Also:
Constant Field Values

KEY_SENSORTABS

public static final String KEY_SENSORTABS
The key pointing to the tags on the tabbed sensor pane.

See Also:
Constant Field Values

KEY_ROOFNUMBER

public static final String KEY_ROOFNUMBER
The key pointing to the properties file of the roof view panel.

See Also:
Constant Field Values

KEY_BORDER

public static final String KEY_BORDER
The key to the size of the panel border.

See Also:
Constant Field Values

KEY_GOODBORDER

public static final String KEY_GOODBORDER
The color of the good-weather border.

See Also:
Constant Field Values

KEY_BADBORDER

public static final String KEY_BADBORDER
The color of the bad-weather border.

See Also:
Constant Field Values

DEFROOFNUMBER

private static final int DEFROOFNUMBER
The default number of roofs.

See Also:
Constant Field Values

DEFBORDER

private static final int DEFBORDER
The default border size.

See Also:
Constant Field Values

DEFGOODBORDER

private static final Color DEFGOODBORDER
The default good-weather color.


DEFBADBORDER

private static final Color DEFBADBORDER
The default good-weather color.


DEFRESOURCEBUNDLES

private static final String DEFRESOURCEBUNDLES
The resource bundles for localized labels and text.

See Also:
Constant Field Values

DEFFILEACTIONS

private static final String DEFFILEACTIONS
The action commands used for identfiying file menu actions.

See Also:
Constant Field Values

jenv

private JPanel jenv
My display panel for changing the border color.


haveall

private boolean haveall
Gets true if we have collected information on all roofs present.


roof

private RoofInfo[] roof
The information on the roof switches used to derive the roof state.


view

private JRoofView view
The display of the current roof state.


sensors

private JTabbedPane sensors
The pane displaying the sensor values.


weathercanvi

private List weathercanvi
The list of successfully initialized weather canvases.

Constructor Detail

JEnvironment

public JEnvironment(PropertyBearing env)
             throws RemoteException
Constructs a new environment-GUI. Additionally to normal construct, the #KEY_HOSTS host-list is searched for a registry-bound environment master. This property may default to #DEFHOSTS.

Throws:
RemoteException

JEnvironment

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

Throws:
RemoteException
Method Detail

setComposedProperties

public void setComposedProperties(PropertyBearing prop)
Sets a PropertyBearing object as a composite of the canvas. Defaults the necessary parameter.

Specified by:
setComposedProperties in interface PropertyAware
Overrides:
setComposedProperties in class JMasterFrame

init

public void init()
Initializes the environment display. In this section, the registry of the stated hosts is scanned for a proper binding of an environment master. Additionally, if the sensor-panel properties are given, the sensor details are constructed. Note that the sensor-details representation may only be retrieved after they have been notified by the stella.sensor.ShortAverageRepository. This class will in almost all cases work with a late-comming data collecting to the repository.

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

getRepresentation

public Component getRepresentation()
Returns the entire environment in a single panel. Calling this method requires the command server to be up and running (i.e. the roof receiver). The command server is queried for a status environment that is readily parsed into the roof info objects. Note that update of the roof view happens in the error-receiving edge of the roof control.

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

rmiErrorOccured

public void rmiErrorOccured(ErrorEvent ee)
                     throws RemoteException
The receiving edge of the error listener. Passes the error/status message received to the status field's error channel. Additionally, if the received error event is a RoofPosition, a new RoofInfo object, addressed at the roof index carried within the RoofPosition is parsed out of the roof state. If enough, i.e. two, roof info objects are present, the roof view is updated.

Specified by:
rmiErrorOccured in interface RmiErrorListener
Overrides:
rmiErrorOccured in class JMasterFrame
Throws:
RemoteException

rmiWeatherChanged

public void rmiWeatherChanged(WeatherEvent we)
                       throws RemoteException
Receive wether changed events. If we have our central component ready, we change the border to a mate border of the KEY_GOODBORDER or KEY_BADBORDER color.

Specified by:
rmiWeatherChanged in interface RmiWeatherListener
Overrides:
rmiWeatherChanged in class JMasterFrame
Throws:
RemoteException

rmiProcessData

public void rmiProcessData(Map readings,
                           boolean weather)
                    throws RemoteException
This method passes only the data in the mapping to all its registered JWeatherCanvases.

Specified by:
rmiProcessData in interface RmiDataCollecting
Overrides:
rmiProcessData in class JMasterFrame
Throws:
RemoteException

openFile

protected boolean openFile(File in)
Called if a file should be open. We try to serialize the user data from our weather canvi.

Overrides:
openFile in class JMasterFrame

saveFile

protected boolean saveFile(File out)
Overrides saving of component with saving of weather data.

Overrides:
saveFile in class JOpenFrame

main

public static void main(String[] arg)
                 throws RemoteException
Launches a roof control program. Additionally to the buttons provided by the launch box parent class, a graphical representation of the roof state is provided.

Throws:
RemoteException