|
LiveGraph data visualisation and analysis framework |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.LiveGraph.gui.RealNumFieldValueChangeAdaptor
public abstract class RealNumFieldValueChangeAdaptor
This validating adaptor listens to focusLost
-messages of a
JTextField
. If at that moment the field contains a valid
double
value (as a string), the valueChanged(JTextField, double)
-method is
called. That method must be overridden by subclasses to take some appropriate
action. If, however, the field does not contain a valid double
value,
the valueChanged(JTextField, double)
-method is not called and a tooltip with an error
message is displayed near the text fiels. The last known "good" value is then
restored.
This product includes software developed by the
LiveGraph project and its contributors.
(http://www.live-graph.org)
Copyright (c) 2007 G. Paperin.
All rights reserved.
File: RealNumFieldValueChangeAdaptor.java
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:
1. Redistributions of source code must retain the above
acknowledgement of the LiveGraph project and its web-site, the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the
LiveGraph project and its web-site, the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with
the distribution.
3. All advertising materials mentioning features or use of this software or any derived
software must display the following acknowledgement:
This product includes software developed by the LiveGraph project and its
contributors.
(http://www.live-graph.org)
4. All advertising materials distributed in form of HTML pages or any other technology
permitting active hyper-links that mention features or use of this software or any
derived software must display the acknowledgment specified in condition 3 of this
agreement, and in addition, include a visible and working hyper-link to the LiveGraph
homepage (http://www.live-graph.org).
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Field Summary | |
---|---|
private double |
defaultValue
|
private java.util.HashMap<javax.swing.JTextField,java.lang.Double> |
lastLegalvaluesCache
|
static long |
TOOLTIP_DISPLAY_LEN
Display length for the error messgae tooltip in milliseconds. |
Constructor Summary | |
---|---|
RealNumFieldValueChangeAdaptor(double defaultValue)
Constructor. |
Method Summary | |
---|---|
void |
focusGained(java.awt.event.FocusEvent e)
Does nothing. |
void |
focusLost(java.awt.event.FocusEvent e)
Catches the focus lost event and performs field validation. |
void |
handleEvent(javax.swing.JTextField field)
Performs the validation and handles appropriately. |
void |
keyPressed(java.awt.event.KeyEvent e)
Catches the enter pressed event and performs field validation. |
void |
keyReleased(java.awt.event.KeyEvent e)
Does nothing. |
void |
keyTyped(java.awt.event.KeyEvent e)
Does nothing. |
abstract double |
valueChanged(javax.swing.JTextField field,
double newValue)
Subclasses must override that in order to take the appropriate action when the field contains a valid double value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long TOOLTIP_DISPLAY_LEN
private double defaultValue
private java.util.HashMap<javax.swing.JTextField,java.lang.Double> lastLegalvaluesCache
Constructor Detail |
---|
public RealNumFieldValueChangeAdaptor(double defaultValue)
defaultValue
- Default "good" value.Method Detail |
---|
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void handleEvent(javax.swing.JTextField field)
field
- The text field that generated the event.public abstract double valueChanged(javax.swing.JTextField field, double newValue)
double
value.
field
- The text field containing the value.newValue
- The double
value in the field.
|
LiveGraph data visualisation and analysis framework |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |