|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter
de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDSwingComponent
de.unihalle.informatik.Alida.dataio.provider.swing.components.ALDSwingComponentTextField
public class ALDSwingComponentTextField
Alida-specific Swing component linked to a JTextField
.
This component reports events on changes of the text entry. In addition it features a value checking. It verifies if the current text entry can be converted to an object of the class initially specified on contruction of the object. If not, a warning message is displayed.
Important note for programmers using this component:
this checking mechanism does only properly work if the text in the
component is never changed directly. Changes should exclusively be done by
using the setText(String t) method of this class.
Field Summary | |
---|---|
protected javax.swing.JTextField |
compTextField
Associated Swing component. |
protected java.lang.Class<?> |
objCl
Class of objects to be read through this text field. |
protected java.lang.String |
value
Current value of the text field. |
Fields inherited from class de.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter |
---|
listenerList |
Constructor Summary | |
---|---|
ALDSwingComponentTextField(java.lang.Class<?> cl,
int columns)
Default constructor. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
protected boolean |
checkValue()
Method that handles events triggered by the text field. |
void |
disableComponent()
Method to disable the component, i.e. all graphical elements, to prohibit parameter changes. |
void |
enableComponent()
Method to enable the component with all graphical elements again. |
void |
focusGained(java.awt.event.FocusEvent e)
|
void |
focusLost(java.awt.event.FocusEvent e)
|
javax.swing.JTextField |
getJComponent()
Method to request the provider's GUI element. |
java.lang.String |
getText()
Returns text of text field. |
void |
setText(java.lang.String t)
Set text of associated text field. |
Methods inherited from class de.unihalle.informatik.Alida.dataio.provider.swing.events.ALDSwingValueChangeReporter |
---|
addValueChangeEventListener, fireALDSwingValueChangeEvent, removeValueChangeEventListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected javax.swing.JTextField compTextField
protected java.lang.Class<?> objCl
protected java.lang.String value
Constructor Detail |
---|
public ALDSwingComponentTextField(java.lang.Class<?> cl, int columns)
The class parameter allows to specify a class which is used to check the validity of text field entries. If the class parameter is null, validation is disabled.
cl
- Class of objects to be read via text field.columns
- Width of text field.Method Detail |
---|
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
protected boolean checkValue()
The method at first checks if the value of the text field has changed.
If so, it subsequently validates if the new value is valid with regard
to the class linked to this GUI element. If both checks are passed
a ALDSwingValueChangeEvent
is triggered. If the new value is
invalid, a warning is displayed to the user.
public void disableComponent()
ALDSwingComponent
disableComponent
in class ALDSwingComponent
public void enableComponent()
ALDSwingComponent
enableComponent
in class ALDSwingComponent
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 javax.swing.JTextField getJComponent()
ALDSwingComponent
getJComponent
in class ALDSwingComponent
public java.lang.String getText()
public void setText(java.lang.String t)
t
- New text to be displayed.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |