Class com.bdnm.mvc.MVCTextField
All Packages Class Hierarchy This Package Previous Next Index
Class com.bdnm.mvc.MVCTextField
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.TextComponent
|
+----java.awt.TextField
|
+----com.bdnm.mvc.MVCTextField
- public class MVCTextField
- extends TextField
- implements Observer
-
TYPE_DOUBLE
- Constant for making a Double text field.
-
TYPE_FLOAT
- Constant for making a Float text field.
-
TYPE_INTEGER
- Constant for making an Integer text field.
-
TYPE_LONG
- Constant for making a Long text field.
-
TYPE_STRING
- Constant for making a String text field (default).
-
converter
- This holds onto the print converter for
this widget.
-
model
- This holds onto the model for the widget.
-
MVCTextField()
- Default constructor
-
MVCTextField(int)
- Constructs a new TextField initialized with the specified columns.
-
action(Event, Object)
- When the action occurs (the user accepts the
value shown), then make sure to update the
model.
-
converter()
- Return the current print converter we are using, or null
if we aren't using ones (just dealing with strings).
-
converter(PrintConverter)
- Sets the current print converter to, or null if we just want
to deal with strings.
-
converter(ObjectPrinter)
- If this will be used as a read-only field, then you
can use an ObjectPrinter instead of a PrintConverter.
-
getModel()
- Retrieve the model, lazy initialize one if
necessary.
-
getValue()
- Return the appropriate object which the current
widget contents represent.
-
lostFocus(Event, Object)
- It would be great if this actually worked, but at least
in Win32 I never get this event.
-
removeNotify()
- Before we die, remove dependency on model.
-
setModel(ValueModel)
- Give the widget a new model.
-
setType(int)
- Set the type of the text field.
-
update(Observable, Object)
- Called when observers in the observable list need to be
updated.
TYPE_STRING
public final static int TYPE_STRING
- Constant for making a String text field (default).
TYPE_FLOAT
public final static int TYPE_FLOAT
- Constant for making a Float text field.
TYPE_DOUBLE
public final static int TYPE_DOUBLE
- Constant for making a Double text field.
TYPE_INTEGER
public final static int TYPE_INTEGER
- Constant for making an Integer text field.
TYPE_LONG
public final static int TYPE_LONG
- Constant for making a Long text field.
model
protected ValueModel model
- This holds onto the model for the widget.
converter
protected PrintConverter converter
- This holds onto the print converter for
this widget.
MVCTextField
public MVCTextField()
- Default constructor
MVCTextField
public MVCTextField(int cols)
- Constructs a new TextField initialized with the specified columns.
- Parameters:
- cols - the number of columns
getModel
public synchronized ValueModel getModel()
- Retrieve the model, lazy initialize one if
necessary.
- Returns:
- the model the widget is using
getValue
protected Object getValue()
- Return the appropriate object which the current
widget contents represent. In general,
consumers should use ValueModel#getValue
on my model.
- Returns:
- the object representing the value
setModel
public synchronized void setModel(ValueModel newModel)
- Give the widget a new model. This will
also update the contents of the field.
- Parameters:
- newModel - the new model for the widget
converter
public PrintConverter converter()
- Return the current print converter we are using, or null
if we aren't using ones (just dealing with strings).
- Returns:
- the current print converter in use
converter
public void converter(PrintConverter newConverter)
- Sets the current print converter to, or null if we just want
to deal with strings.
- Parameters:
- newConverter - the new converter to use
converter
public void converter(ObjectPrinter aPrinter)
- If this will be used as a read-only field, then you
can use an ObjectPrinter instead of a PrintConverter.
An exception will be thrown if you attempt to read
from the text field.
update
public void update(Observable o,
Object arg)
- Called when observers in the observable list need to be
updated.
- Parameters:
- o - the observer sending the update
- arg - the new value
action
public boolean action(Event event,
Object what)
- When the action occurs (the user accepts the
value shown), then make sure to update the
model.
- Returns:
- whether the event was handled
- Overrides:
- action in class Component
lostFocus
public boolean lostFocus(Event event,
Object what)
- It would be great if this actually worked, but at least
in Win32 I never get this event. Bummer.
- Returns:
- whether the event was handled
- Overrides:
- lostFocus in class Component
setType
public void setType(int newType)
- Set the type of the text field. Right now,
this is a "write only" value, because we
don't hold onto the state.
- Parameters:
- newType - an int representing the type
removeNotify
public synchronized void removeNotify()
- Before we die, remove dependency on model.
- Overrides:
- removeNotify in class TextComponent
All Packages Class Hierarchy This Package Previous Next Index