stella.jview
Class JFrameParameter

java.lang.Object
  extended by util.PropertyContainer
      extended by stella.parameter.AbstractParameter
          extended by stella.parameter.AbstractRemoteParameter
              extended by stella.parameter.AbstractRemoteTrigger
                  extended by stella.parameter.AbstractRemoteSwitch
                      extended by stella.jview.JFrameParameter
All Implemented Interfaces:
ActionListener, Cloneable, Remote, EventListener, Parameter, AfterRegistering, ParameterDepending, RemoteParameter, RemoteSwitch, RemoteTrigger, Switch, Trigger, ConditionalRefreshing, ExitCleaning, Initializable, PropertyBearing, Refreshing, RmiCaster

public class JFrameParameter
extends AbstractRemoteSwitch
implements ActionListener, ParameterDepending, AfterRegistering, ConditionalRefreshing

A special parameter used as a dirty trick to get a parameter display. This parameter serves a top-level frame, where other parameters can register to using the registerParameter(stella.Parameter) method. If the added parameter implements the Displayable interface, its layout is queried with the appropriate method and it is added to the top level frame, using a slot defined by this parameters KEY_COMPONENTLIST property. Only Displayable parameters might be added.
As a parameter, this class delivers the number of registered parameters to it.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.PropertyContainer
PropertyContainer.URLResource
 
Field Summary
private  List added
          The list of parameters added successfully to this frame.
private  List all
          The list of parameters to add to this frame.
private static int DEFCOLUMN
          The default number of columns.
private static String DEFNAME
          The default name of the frame parameter.
private static long DEFREFRESH
          The default refresh rate.
private  TimerTask forcedoff
          This timer task is used to switch off after a certain time-out.
private  Trigger help
          Some properties are simple rayed to this instance.
static String KEY_COLUMN
          The key to the number of columns in the frame.
static String KEY_COMPONENTLIST
          The list of slot-positions where specific parameter should be shown.
static String KEY_REFRESH
          The key to the refresh intervall, in ms.
static String NONE
          The string toi display for undefined parameter values.
private  JFrame show
          The top-level display frame.
private  Map textfields
          The lookup-table matching parameter names to their textfields.
 
Fields inherited from class stella.parameter.AbstractRemoteParameter
DEFBIND, KEY_BIND
 
Fields inherited from class stella.parameter.AbstractParameter
KEY_FORMAT, KEY_NAME, KEY_PRESERVE, UNKNOWN
 
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
 
Fields inherited from interface stella.rmi.RemoteTrigger
NAMING_EXTENSION
 
Constructor Summary
JFrameParameter(Map info)
          Constructs a new frame parameter.
 
Method Summary
 void actionPerformed(ActionEvent ae)
          Handles updates in non-Displayable parameters.
 void afterAll()
          The second half of the display process.
 Object get()
          Returns the number of components that had been successfully added to the frame.
 long getElapsedToggleTime()
          Returns the toggle time of the internale helpter trigger.
 Date getLastToggleTime()
          Returns the toggle time of the internale helpter trigger.
 long getRefreshInterval()
          Returns the refresh interval.
 Boolean getTrigger()
          Returns true if we are showing and not null.
 void init()
          Initializes the frame and the parameter list.
 boolean isFixedRate()
          Returns false.
 boolean isRefreshNeeded()
          Returns true if the testfields are non-null.
 boolean isTrue()
          Returns true if we are showing and not null.
 void refresh()
          Scans through all non-Displayable parameters found in the frame's look-up table.
 void registerParameter(Parameter add)
          Adds an parameter to the frame for displaying.
 Object set(Object to)
          Setting the number of actual components is not allowed.
 Boolean setTrigger(Boolean to)
          Returns true if we are showing and not null.
 Boolean toggleTrigger()
          If frame is showing, hide it, if frame is hiding, show it.
 boolean turnOff()
          Turns the switch off.
 boolean turnOn(long timeout)
          Turning the switch on means (re)showing of the frame.
 
Methods inherited from class stella.parameter.AbstractRemoteSwitch
switchOff, switchOn
 
Methods inherited from class stella.parameter.AbstractRemoteTrigger
remoteGetTrigger, remoteIsTrue, remoteToggleTime
 
Methods inherited from class stella.parameter.AbstractRemoteParameter
addRmiListener, bindToRegistry, exit, isValid, remoteGet, removeRmiListener, rescanned, unbindFromRegistry
 
Methods inherited from class stella.parameter.AbstractParameter
createParameter, delivers, getFormatted, getFormatted, getName, getPreserveFile, getString, getString, register, setName, toString
 
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, setObject, setProperties, setProperty, stringProperties
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.Parameter
getFormatted, getName, getString
 
Methods inherited from interface util.PropertyBearing
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getLocalized, getProperties, getProperty, getResource, getResourceAsStream, getResources, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 
Methods inherited from interface stella.rmi.RemoteTrigger
remoteGetTrigger, remoteIsTrue, remoteToggleTime
 
Methods inherited from interface stella.rmi.RemoteParameter
addRmiListener, remoteGet, removeRmiListener
 
Methods inherited from interface util.rmi.RmiCaster
bindToRegistry, isValid, unbindFromRegistry
 

Field Detail

NONE

public static final String NONE
The string toi display for undefined parameter values.

See Also:
Constant Field Values

KEY_COMPONENTLIST

public static final String KEY_COMPONENTLIST
The list of slot-positions where specific parameter should be shown.

See Also:
Constant Field Values

KEY_COLUMN

public static final String KEY_COLUMN
The key to the number of columns in the frame.

See Also:
Constant Field Values

KEY_REFRESH

public static final String KEY_REFRESH
The key to the refresh intervall, in ms.

See Also:
Constant Field Values

DEFNAME

private static final String DEFNAME
The default name of the frame parameter.

See Also:
Constant Field Values

DEFCOLUMN

private static final int DEFCOLUMN
The default number of columns.

See Also:
Constant Field Values

DEFREFRESH

private static final long DEFREFRESH
The default refresh rate.

See Also:
Constant Field Values

all

private List all
The list of parameters to add to this frame.


added

private List added
The list of parameters added successfully to this frame.


textfields

private Map textfields
The lookup-table matching parameter names to their textfields.


show

private JFrame show
The top-level display frame. Displayed at parameter construction.


help

private Trigger help
Some properties are simple rayed to this instance.


forcedoff

private TimerTask forcedoff
This timer task is used to switch off after a certain time-out.

Constructor Detail

JFrameParameter

public JFrameParameter(Map info)
                throws RemoteException
Constructs a new frame parameter. During construction the top-level frame is generated. It is show when all parameters have been added with the registerParameter(stella.Parameter) method. The KEY_COMPONENTLIST determines the number of components to add.

Throws:
RemoteException
Method Detail

init

public void init()
Initializes the frame and the parameter list.

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

get

public Object get()
Returns the number of components that had been successfully added to the frame. Note that the frame will only be shown if the number of parameters added to it equals the number of parameters in its KEY_COMPONENTLIST.

Specified by:
get in interface Parameter
Returns:
An Integer object giving the numer of actual components.

set

public Object set(Object to)
Setting the number of actual components is not allowed. An UnsupportedOperationException will be thrown.

Specified by:
set in interface Parameter
Returns:
The previous value of this parameter.

getElapsedToggleTime

public long getElapsedToggleTime()
Returns the toggle time of the internale helpter trigger. Records the time from hiding/showing the frame.

Specified by:
getElapsedToggleTime in interface Trigger

getLastToggleTime

public Date getLastToggleTime()
Returns the toggle time of the internale helpter trigger. Records the time from hiding/showing the frame.

Specified by:
getLastToggleTime in interface Trigger

toggleTrigger

public Boolean toggleTrigger()
If frame is showing, hide it, if frame is hiding, show it.

Specified by:
toggleTrigger in interface Trigger

getTrigger

public Boolean getTrigger()
Returns true if we are showing and not null.

Specified by:
getTrigger in interface Trigger

isTrue

public boolean isTrue()
Returns true if we are showing and not null.

Specified by:
isTrue in interface Trigger

setTrigger

public Boolean setTrigger(Boolean to)
Returns true if we are showing and not null.

Specified by:
setTrigger in interface Trigger

turnOn

public boolean turnOn(long timeout)
Turning the switch on means (re)showing of the frame. If the frame is not ready for displaying, it is constructed from the registerd parameters.

Specified by:
turnOn in interface Switch
Parameters:
timeout - The maximum time the switch should be on (ms), zero for unlimited.
Returns:
True, if switch was successfully turned on.

turnOff

public boolean turnOff()
Turns the switch off. Diverts to the abstract method #off for actual switching. If a switch-off timer task was active, it is canceled.

Specified by:
turnOff in interface Switch
Returns:
True, if switch was successfully turned off.

registerParameter

public void registerParameter(Parameter add)
Adds an parameter to the frame for displaying. Various cases are important: Because the value of parameters may be changed without outer notice, a timer task is started that queries all non-Displayable parameters for their value at a regular time interval, given by KEY_REFRESH.
After the last parameter has been added to the frame, it is shown.

Specified by:
registerParameter in interface ParameterDepending

afterAll

public void afterAll()
The second half of the display process. Here, we can be sure that all parameters have been cross-initialized.

Specified by:
afterAll in interface AfterRegistering

actionPerformed

public void actionPerformed(ActionEvent ae)
Handles updates in non-Displayable parameters. In this case, the editable textfield associated with the parameter under question fires an action event as return is pressed. This method roams through its list of parameters using the firing textfield as the value to look for in the frame's lookup-table. If a parameter was found, the new value found in the textfield is set to this parameter.

Specified by:
actionPerformed in interface ActionListener

isRefreshNeeded

public boolean isRefreshNeeded()
Returns true if the testfields are non-null.

Specified by:
isRefreshNeeded in interface ConditionalRefreshing

getRefreshInterval

public long getRefreshInterval()
Returns the refresh interval.

Specified by:
getRefreshInterval in interface Refreshing

isFixedRate

public boolean isFixedRate()
Returns false.

Specified by:
isFixedRate in interface Refreshing
See Also:
Timer

refresh

public void refresh()
Scans through all non-Displayable parameters found in the frame's look-up table. The corresponding textfields (the values in the look-up table) are updated to the new values.

Specified by:
refresh in interface Refreshing