stella.jview
Class JOffLimit

java.lang.Object
  extended by util.PropertyContainer
      extended by mysql.AbstractSql
          extended by stella.sql.NightlyStatistic
              extended by stella.sql.OffLimitAlarm
                  extended by stella.sql.OffLimitVisual
                      extended by stella.jview.JOffLimit
All Implemented Interfaces:
ActionListener, Cloneable, EventListener, Displayable, ExitCleaning, Initializable, PropertyBearing, Refreshing
Direct Known Subclasses:
JOffLimit.Monitor, JOffLimit.Server, JOffTails.Server

public class JOffLimit
extends OffLimitVisual
implements Displayable, Refreshing, ActionListener, ExitCleaning

Uses an offset alert statistic to provide a one-look health display of the two telescopes plus environment conditions.


Nested Class Summary
static class JOffLimit.Client
          In this evocation, we act as a gesture client.
static class JOffLimit.Monitor
          In this evocation, we act as a gesture server.
static class JOffLimit.Server
          In this evocation, we act as a gesture server.
private static class JOffLimit.TenerifeMosaic
          In the event queue, there is no time for lengthy image transfers.
 
Nested classes/interfaces inherited from class stella.sql.OffLimitVisual
OffLimitVisual.Flavor, OffLimitVisual.Signal
 
Nested classes/interfaces inherited from class stella.sql.NightlyStatistic
NightlyStatistic.Duty, NightlyStatistic.Env, NightlyStatistic.Night
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private  JPanel body
          The panel holding the telescope displays with card-layout for env.
private  Map<String,JButton> buttons
          References to all buttons, telescope ones augmented like 'STELLA:'
private static String DEFDATEFIELD
          The default target name field in the database
private static String DEFDONETABLE
          The name of the field holding the object-id.
private static String DEFDURATIONFIELD
          The default target name field in the database
private static boolean DEFENABLEBUTTON
          Default enable telescope buttons.
private static String DEFHOSTS
          Default hosts=localhost.
private static String DEFLIGHTSWITCH
          Default rmi access to the bay switch.
private static String DEFMERITFIELD
          The default target name field in the database
private static String DEFPRINTFORMAT
          Default print format for signal values.
private static String DEFSUCCESSFIELD
          The default target name field in the database
private static String DEFTELMOSAIC
          Default propertizable of telescopes to labels.
private static String DEFTELRULE
          Default propertizable of telescopes to labels.
private static int DEFTILESHRINK
          The default tile shrink.
private static String DEFUNIQUENAME
          The default target name field in the database
private static String FIRST
          Stupid ruler for first card component.
private  Map<String,JTargetHistory> history
          Reference of login/logfile to logfield.
private  HistorySql hsql
          Connections to different tables.
static String KEY_ACCOUNTS
          The telescope-to-hosts name list.
static String KEY_DATEFIELD
          The key to the target name in the database.
static String KEY_DONETABLE
          The name of the field holding the object-id.
static String KEY_DURATIONFIELD
          The key to the target name in the database.
static String KEY_ENABLEBUTTON
          If false, we do not display the light-switch button
static String KEY_ENVCANVAS
          The pointer to the properties for the environment plot canvas.
static String KEY_ENVRULE
          If set, the value is propertized and merged into env canvas props.
static String KEY_HISTCANVAS
          The pointer to the properties for the history plot canvas.
static String KEY_HISTRULE
          If set, the value is propertized and merged into hist canvas props.
static String KEY_HOSTS
          The list of hosts that should be scanned to radiate pick events.
static String KEY_LIGHTSWITCH
          The rmi query for the bay lightswitch.
static String KEY_MERITFIELD
          The key to the target name in the database.
static String KEY_PRINTFORMAT
          The print format for signal values displayed at buttons.
static String KEY_SUCCESSFIELD
          The key to the target name in the database.
static String KEY_TELCANVAS
          The pointer to the properties for the telescope plot canvas.
static String KEY_TELMOSAIC
          The labels for the telescope mosaics.
static String KEY_TELRULE
          If set, the value is propertized and merged into tel canvas props.
static String KEY_TILESHRINK
          How much we should shrink the telescope tile sizes.
static String KEY_UNIQUENAME
          The key to the target name in the database.
private  Date lastdawn
          To avoid unnecessary update.
private  Date lastdusk
          To avoid unnecessary update.
private  JButton lastenv
          The last environment button pressed.
private  Map<String,JButton> lasttel
          The last telescope button pressed.
private  Map<String,JPanel> mosaic
          References to all telescope baycam mosaics.
private  ObserveSql osql
          Connections to different tables.
private  List<Registry> registries
          A list of registries on hosts that might contain pick event listeners.
private static String SECOND
          Stupid ruler for second card component.
private  Map<String,List<String>> telurl
          References from all telescopes to their labels.
 
Fields inherited from class stella.sql.OffLimitVisual
KEY_REDAVENV, KEY_REDAVTEL, KEY_REDMINMAXENV, KEY_REDMINMAXTEL, KEY_REDSIGMAENV, KEY_YELLOWAVENV, KEY_YELLOWAVTEL, KEY_YELLOWMINMAXENV, KEY_YELLOWMINMAXTEL, KEY_YELLOWSIGMAENV
 
Fields inherited from class stella.sql.OffLimitAlarm
KEY_DONELIST, KEY_DONENAMES, KEY_DONEWHERE, KEY_ENVLIST, KEY_ENVNAMES, KEY_JOINTLIST, KEY_JOINTNAMES, KEY_JOINTWHERE, KEY_OBSLIST, KEY_OBSNAMES, KEY_OBSWHERE, KEY_SCILIST, KEY_SCINAMES, KEY_SCIWHERE, KEY_TELESCOPE, NULL, TELESCOPESEPARATOR
 
Fields inherited from class stella.sql.NightlyStatistic
DEFPASSWORD, DEFUSERNAME, KEY_RISETWILIGHT, KEY_SETTWILIGHT
 
Fields inherited from class mysql.AbstractSql
KEY_PASSWORD, KEY_TABLE, KEY_USERNAME
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR, KEY_NOINITONCREATE, KEY_RESOURCEBUNDLES
 
Fields inherited from interface util.PropertyBearing
CONFIG, KEY_CLASS, KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Constructor Summary
JOffLimit(Map<String,String> prop)
          Constructs a new JOffLimit object that is updated at regular intervals.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Deal with the button events.
private  boolean displayAndShow(JPanel card, double[] x, double[] y, List<Object> keys, String label)
          The panel deliverd has a card layout, with a jdatacanvas as the second component.
 void exit()
          This method is called whenever a clean-up before a shutdown is necessarry.
private  Map<String,String> getDataCanvasProperties(String urlkey, String overrulekey)
          From the two keys, we construct the data canvas properties by first using either the default or the canvas resource (if latter is non-null), then, if an overrule is present, we augment these properties with the additional mappings.
private  Map<String,String> getDefaultDataCanvasProperties()
          This provides a default canvas property collection.
private  Map<String,String> getDefaultHistoryCanvasProperties()
          This provides a default canvas property collection.
private  Map<String,String> getHistoryCanvasProperties(String urlkey, String overrulekey)
          From the two keys, we construct the data canvas properties by first using either the default or the canvas resource (if latter is non-null), then, if an overrule is present, we augment these properties with the additional mappings.
 Icon getIcon()
          If we have an icon in the properties.
 long getRefreshInterval()
          Update every quarter hour.
 Component getRepresentation()
          Returns a JPanel like
 void init()
          If we are not the default user of the database, try to add ourself here.
 boolean isFixedRate()
          Fixed delay.
static void main(String[] arg)
          We create a master frame, where we enter the offlimit panel.
 void refresh()
          On refresh, we update the signal lists.
private  void treatPick(HistoryAware.Pick click)
          This pick is selected.
private  void treatUnique(Object unique)
          This method is called if a object was selected in a telescope plot.
private  void updateButtonLabel(OffLimitVisual.Signal sign, JButton on)
          We update the button layout according to the signal.
private  void updateLabels(Date now)
          We update the labels on all buttons.
 
Methods inherited from class stella.sql.OffLimitVisual
gather, getEnvironmentSignals, getTelescopeSignals
 
Methods inherited from class stella.sql.OffLimitAlarm
addDone, addEnvironment, addJoint, addObs, clearStats, convertToStatistic, extractUnique, getAverageEnvOffs, getAverageTelOffs, getEnvStatistic, getEnvTimes, getMinMaxEnvOffs, getMinMaxTelOffs, getSigmaEnvOffs, getSigmaTelOffs, getSpanEnvOffs, getSpanTelOffs, getTelescopeKeys, getTelescopes, getTelescopeStatistic, getTelescopeTimes, telescopeDoubleMapping, telescopeVectorMapping, vectorMapping
 
Methods inherited from class stella.sql.NightlyStatistic
duskToDawn, duskToDawn, getDone, getDone, getDone, getEnvironment, getEnvironment, getEnvironment, getExposureTimeSum, getJoint, getJoint, getJoint, getNightCount, getObs, getObs, getObs, getRoofOpenCount, getScienceTimeSum
 
Methods inherited from class mysql.AbstractSql
getPassword, getTable, getUserName, isEntry
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, clone, createFrom, createFrom, createFrom, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getLocalClassLoader, getLocalized, getLocalized, getLocalizedString, getLocalizedString, getProperties, getPropertiesToKey, getPropertiesToKey, getProperty, getResource, getResourceAsStream, getResourceFromKey, getResources, has, isNew, keyCreate, keyCreate, parseObject, reload, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_LIGHTSWITCH

public static final String KEY_LIGHTSWITCH
The rmi query for the bay lightswitch.

See Also:
Constant Field Values

KEY_PRINTFORMAT

public static final String KEY_PRINTFORMAT
The print format for signal values displayed at buttons.

See Also:
Constant Field Values

KEY_ENVCANVAS

public static final String KEY_ENVCANVAS
The pointer to the properties for the environment plot canvas.

See Also:
Constant Field Values

KEY_ENVRULE

public static final String KEY_ENVRULE
If set, the value is propertized and merged into env canvas props.

See Also:
Constant Field Values

KEY_TELCANVAS

public static final String KEY_TELCANVAS
The pointer to the properties for the telescope plot canvas.

See Also:
Constant Field Values

KEY_TELRULE

public static final String KEY_TELRULE
If set, the value is propertized and merged into tel canvas props.

See Also:
Constant Field Values

KEY_HISTCANVAS

public static final String KEY_HISTCANVAS
The pointer to the properties for the history plot canvas.

See Also:
Constant Field Values

KEY_HISTRULE

public static final String KEY_HISTRULE
If set, the value is propertized and merged into hist canvas props.

See Also:
Constant Field Values

KEY_TELMOSAIC

public static final String KEY_TELMOSAIC
The labels for the telescope mosaics.

See Also:
Constant Field Values

KEY_DONETABLE

public static final String KEY_DONETABLE
The name of the field holding the object-id.

See Also:
Constant Field Values

KEY_UNIQUENAME

public static final String KEY_UNIQUENAME
The key to the target name in the database.

See Also:
Constant Field Values

KEY_DATEFIELD

public static final String KEY_DATEFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_DURATIONFIELD

public static final String KEY_DURATIONFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_SUCCESSFIELD

public static final String KEY_SUCCESSFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_MERITFIELD

public static final String KEY_MERITFIELD
The key to the target name in the database.

See Also:
Constant Field Values

KEY_HOSTS

public static final String KEY_HOSTS
The list of hosts that should be scanned to radiate pick events.

See Also:
Constant Field Values

KEY_ACCOUNTS

public static final String KEY_ACCOUNTS
The telescope-to-hosts name list.

See Also:
Constant Field Values

KEY_TILESHRINK

public static final String KEY_TILESHRINK
How much we should shrink the telescope tile sizes.

See Also:
Constant Field Values

KEY_ENABLEBUTTON

public static final String KEY_ENABLEBUTTON
If false, we do not display the light-switch button

See Also:
Constant Field Values

FIRST

private static final String FIRST
Stupid ruler for first card component.

See Also:
Constant Field Values

SECOND

private static final String SECOND
Stupid ruler for second card component.

See Also:
Constant Field Values

DEFLIGHTSWITCH

private static final String DEFLIGHTSWITCH
Default rmi access to the bay switch.

See Also:
Constant Field Values

DEFPRINTFORMAT

private static final String DEFPRINTFORMAT
Default print format for signal values.

See Also:
Constant Field Values

DEFTELMOSAIC

private static final String DEFTELMOSAIC
Default propertizable of telescopes to labels.

See Also:
Constant Field Values

DEFTELRULE

private static final String DEFTELRULE
Default propertizable of telescopes to labels.

See Also:
Constant Field Values

DEFDONETABLE

private static final String DEFDONETABLE
The name of the field holding the object-id.

See Also:
Constant Field Values

DEFUNIQUENAME

private static final String DEFUNIQUENAME
The default target name field in the database

See Also:
Constant Field Values

DEFDATEFIELD

private static final String DEFDATEFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFDURATIONFIELD

private static final String DEFDURATIONFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFSUCCESSFIELD

private static final String DEFSUCCESSFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFMERITFIELD

private static final String DEFMERITFIELD
The default target name field in the database

See Also:
Constant Field Values

DEFHOSTS

private static final String DEFHOSTS
Default hosts=localhost.

See Also:
Constant Field Values

DEFTILESHRINK

private static final int DEFTILESHRINK
The default tile shrink.

See Also:
Constant Field Values

DEFENABLEBUTTON

private static final boolean DEFENABLEBUTTON
Default enable telescope buttons.

See Also:
Constant Field Values

registries

private List<Registry> registries
A list of registries on hosts that might contain pick event listeners.


buttons

private Map<String,JButton> buttons
References to all buttons, telescope ones augmented like 'STELLA:'


lastenv

private JButton lastenv
The last environment button pressed.


lasttel

private Map<String,JButton> lasttel
The last telescope button pressed.


telurl

private Map<String,List<String>> telurl
References from all telescopes to their labels.


mosaic

private Map<String,JPanel> mosaic
References to all telescope baycam mosaics.


history

private Map<String,JTargetHistory> history
Reference of login/logfile to logfield.


body

private JPanel body
The panel holding the telescope displays with card-layout for env.


hsql

private HistorySql hsql
Connections to different tables.


osql

private ObserveSql osql
Connections to different tables.


lastdusk

private Date lastdusk
To avoid unnecessary update.


lastdawn

private Date lastdawn
To avoid unnecessary update.

Constructor Detail

JOffLimit

public JOffLimit(Map<String,String> prop)
Constructs a new JOffLimit object that is updated at regular intervals.

Method Detail

getIcon

public Icon getIcon()
If we have an icon in the properties.

Specified by:
getIcon in interface Displayable

init

public void init()
Description copied from class: AbstractSql
If we are not the default user of the database, try to add ourself here.

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

getRepresentation

public Component getRepresentation()
Returns a JPanel like

Specified by:
getRepresentation in interface Displayable

treatUnique

private void treatUnique(Object unique)
This method is called if a object was selected in a telescope plot.


treatPick

private void treatPick(HistoryAware.Pick click)
This pick is selected.


getDataCanvasProperties

private Map<String,String> getDataCanvasProperties(String urlkey,
                                                   String overrulekey)
From the two keys, we construct the data canvas properties by first using either the default or the canvas resource (if latter is non-null), then, if an overrule is present, we augment these properties with the additional mappings.


getHistoryCanvasProperties

private Map<String,String> getHistoryCanvasProperties(String urlkey,
                                                      String overrulekey)
From the two keys, we construct the data canvas properties by first using either the default or the canvas resource (if latter is non-null), then, if an overrule is present, we augment these properties with the additional mappings.


getDefaultHistoryCanvasProperties

private Map<String,String> getDefaultHistoryCanvasProperties()
This provides a default canvas property collection.


getDefaultDataCanvasProperties

private Map<String,String> getDefaultDataCanvasProperties()
This provides a default canvas property collection.


exit

public void exit()
Description copied from interface: ExitCleaning
This method is called whenever a clean-up before a shutdown is necessarry. The shutdown (or any comparable process) blocks until this method returns.

Specified by:
exit in interface ExitCleaning

actionPerformed

public void actionPerformed(ActionEvent ae)
Deal with the button events.

Specified by:
actionPerformed in interface ActionListener

displayAndShow

private boolean displayAndShow(JPanel card,
                               double[] x,
                               double[] y,
                               List<Object> keys,
                               String label)
The panel deliverd has a card layout, with a jdatacanvas as the second component. We grab this datacanvas, show the new data on it and make sure that it is visible. On success, we return true;


refresh

public void refresh()
On refresh, we update the signal lists.

Specified by:
refresh in interface Refreshing

isFixedRate

public boolean isFixedRate()
Fixed delay.

Specified by:
isFixedRate in interface Refreshing
See Also:
Timer

getRefreshInterval

public long getRefreshInterval()
Update every quarter hour.

Specified by:
getRefreshInterval in interface Refreshing

updateLabels

private void updateLabels(Date now)
We update the labels on all buttons.


updateButtonLabel

private void updateButtonLabel(OffLimitVisual.Signal sign,
                               JButton on)
We update the button layout according to the signal. The color defines the background of the button, the label is the flavour plus the value.


main

public static void main(String[] arg)
We create a master frame, where we enter the offlimit panel.