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

Variable Index

 o TYPE_DOUBLE
Constant for making a Double text field.
 o TYPE_FLOAT
Constant for making a Float text field.
 o TYPE_INTEGER
Constant for making an Integer text field.
 o TYPE_LONG
Constant for making a Long text field.
 o TYPE_STRING
Constant for making a String text field (default).
 o converter
This holds onto the print converter for this widget.
 o model
This holds onto the model for the widget.

Constructor Index

 o MVCTextField()
Default constructor
 o MVCTextField(int)
Constructs a new TextField initialized with the specified columns.

Method Index

 o action(Event, Object)
When the action occurs (the user accepts the value shown), then make sure to update the model.
 o converter()
Return the current print converter we are using, or null if we aren't using ones (just dealing with strings).
 o converter(PrintConverter)
Sets the current print converter to, or null if we just want to deal with strings.
 o converter(ObjectPrinter)
If this will be used as a read-only field, then you can use an ObjectPrinter instead of a PrintConverter.
 o getModel()
Retrieve the model, lazy initialize one if necessary.
 o getValue()
Return the appropriate object which the current widget contents represent.
 o lostFocus(Event, Object)
It would be great if this actually worked, but at least in Win32 I never get this event.
 o removeNotify()
Before we die, remove dependency on model.
 o setModel(ValueModel)
Give the widget a new model.
 o setType(int)
Set the type of the text field.
 o update(Observable, Object)
Called when observers in the observable list need to be updated.

Variables

 o TYPE_STRING
  public final static int TYPE_STRING
Constant for making a String text field (default).
 o TYPE_FLOAT
  public final static int TYPE_FLOAT
Constant for making a Float text field.
 o TYPE_DOUBLE
  public final static int TYPE_DOUBLE
Constant for making a Double text field.
 o TYPE_INTEGER
  public final static int TYPE_INTEGER
Constant for making an Integer text field.
 o TYPE_LONG
  public final static int TYPE_LONG
Constant for making a Long text field.
 o model
  protected ValueModel model
This holds onto the model for the widget.
 o converter
  protected PrintConverter converter
This holds onto the print converter for this widget.

Constructors

 o MVCTextField
  public MVCTextField()
Default constructor
 o MVCTextField
  public MVCTextField(int cols)
Constructs a new TextField initialized with the specified columns.
Parameters:
cols - the number of columns

Methods

 o getModel
  public synchronized ValueModel getModel()
Retrieve the model, lazy initialize one if necessary.
Returns:
the model the widget is using
 o 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
 o 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
 o 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
 o 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
 o 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.
 o 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
 o 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
 o 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
 o 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
 o 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