|
|||||||||
| Home >> All >> org >> scopemvc >> view >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.scopemvc.view.swing
Class STextField

java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextField
org.scopemvc.view.swing.STextField
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.event.FocusListener, java.awt.image.ImageObserver, java.awt.MenuContainer, org.scopemvc.view.util.ModelBindable, org.scopemvc.core.PropertyView, Refreshable, javax.swing.Scrollable, java.io.Serializable, javax.swing.SwingConstants, org.scopemvc.core.View
- Direct Known Subclasses:
- SLabel
- public class STextField
- extends javax.swing.JTextField
- implements org.scopemvc.core.PropertyView, java.awt.event.FocusListener, java.awt.event.ActionListener, org.scopemvc.view.util.ModelBindable, Refreshable
- extends javax.swing.JTextField
A JTextField linked to a property of a bound model object. The property must have a StringConvertor to handle conversion to and from a String representation that will be edited in the textfield. Updates to the textfield result in changes to the model property when focus is lost.
STextField responds to the bound model or the particular bound property becoming read-only by disabling itself. An STextField is also disabled if it has no bound model or property.
STextField can issue a Control when the user hits the Enter key.
Null properties are handled in one of two ways:
- The field is disabled to prevent editing.
- The field is populated with an empty String. In this case, the bound property will contain an empty String not a null, if the textfield is populated with an empty string.
setDisableOnNull(boolean) 55 .
- Version:
- $Revision: 1.9 $ $Date: 2002/02/09 15:57:36 $
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JTextField |
javax.swing.JTextField.AccessibleJTextField |
| Nested classes inherited from class javax.swing.text.JTextComponent |
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
private SwingBoundModel |
boundModel
Helper to manage model to view binding. |
private java.lang.String |
controlID
ID of the Control issued when user hits Enter in the STextField. |
private boolean |
disableOnNull
Does this textfield disable itself if the model property it is bound to becomes null? |
private org.scopemvc.util.convertor.StringConvertor |
forcedStringConvertor
If this is set, use it instead of finding a convertor to match the datatype being edited. |
private static org.apache.commons.logging.Log |
LOG
|
private org.scopemvc.util.convertor.StringConvertor |
stringConvertor
The StringConvertor used to convert the model property to and from the String representation that the user edits in the textfield. |
private ValidationHelper |
validationHelper
Helper to manage validation state. |
private boolean |
valueIsNull
STextField can "hold" a null when bound to a property that happens to be null. |
| Fields inherited from class javax.swing.JTextField |
notifyAction |
| Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
STextField()
|
|
STextField(int columns)
|
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Sync model object to View and issue a Control if ControlID set. |
javax.swing.JToolTip |
createToolTip()
Return the toolTip property of this component, creating it and
setting it if it is currently null. |
void |
focusGained(java.awt.event.FocusEvent inEvent)
This method is called when a component gains the keyboard focus. |
void |
focusLost(java.awt.event.FocusEvent inEvent)
This method is invoked when a component loses the keyboard focus. |
java.lang.Object |
getBoundModel()
|
org.scopemvc.core.Controller |
getController()
Don't assign a Controller to STextField, instead delegate to the containing SwingView that has a parent Controller. |
org.scopemvc.core.Selector |
getSelector()
|
java.lang.Object |
getViewValue()
Get the current value (what would be set as a property of the bound model object) being presented on the View. |
boolean |
isDisableOnNull()
|
void |
issueControl(org.scopemvc.core.Control inControl)
Don't assign a Controller to STextField, instead delegate to the containing SwingView that has a parent Controller. |
void |
refresh()
Update the widget with the current state of the bound model. |
void |
setBoundModel(java.lang.Object inModel)
|
void |
setControlID(java.lang.String inControlID)
Set the ID of the Control that will be issued when Enter key is pressed in this STextField. |
void |
setController(org.scopemvc.core.Controller inController)
Don't assign a Controller to STextField, instead delegate to the containing SwingView that has a parent Controller. |
void |
setDisableOnNull(boolean inDisable)
Set this to true if the textfield should be disabled when it edits a null property value. |
void |
setSelector(org.scopemvc.core.Selector inSelector)
|
void |
setSelectorString(java.lang.String inSelectorString)
|
void |
setStringConvertor(org.scopemvc.util.convertor.StringConvertor inConvertor)
Force use of this StringConvertor instead of automatically finding one to match the datatype being edited. |
void |
setText(java.lang.String t)
Override to call super.setText() only if new value not equals() old value. |
protected void |
setupStringConvertor()
|
void |
updateFromProperty(java.lang.Object inValue,
boolean inReadOnly)
Converts the incoming value to a String via appropriate org.scopemvc.util.convertor.StringConvertor. |
void |
validationFailed(java.lang.Exception inException)
Validation failed while getting a value from View into the bound model object. |
void |
validationSuccess()
Clear previous validation failure. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
LOG
private static final org.apache.commons.logging.Log LOG
boundModel
private SwingBoundModel boundModel
- Helper to manage model to view binding.
validationHelper
private ValidationHelper validationHelper
- Helper to manage validation state.
controlID
private java.lang.String controlID
- ID of the Control issued when user hits Enter in the STextField.
valueIsNull
private boolean valueIsNull
- STextField can "hold" a null when bound to a
property that happens to be null.
disableOnNull
private boolean disableOnNull
- Does this textfield disable itself if the model property
it is bound to becomes null?
stringConvertor
private org.scopemvc.util.convertor.StringConvertor stringConvertor
- The StringConvertor used to convert the model
property to and from the String representation
that the user edits in the textfield.
forcedStringConvertor
private org.scopemvc.util.convertor.StringConvertor forcedStringConvertor
- If this is set, use it instead of finding a convertor
to match the datatype being edited.
| Constructor Detail |
STextField
public STextField()
STextField
public STextField(int columns)
| Method Detail |
setDisableOnNull
public final void setDisableOnNull(boolean inDisable)
- Set this to true if the textfield should be disabled when
it edits a null property value. Otherwise, a null property is treated
as an empty String.
isDisableOnNull
public final boolean isDisableOnNull()
getBoundModel
public final java.lang.Object getBoundModel()
- Specified by:
getBoundModelin interfaceorg.scopemvc.core.View
setBoundModel
public final void setBoundModel(java.lang.Object inModel)
- Specified by:
setBoundModelin interfaceorg.scopemvc.core.View
getSelector
public final org.scopemvc.core.Selector getSelector()
- Specified by:
getSelectorin interfaceorg.scopemvc.core.PropertyView
setSelector
public final void setSelector(org.scopemvc.core.Selector inSelector)
- Specified by:
setSelectorin interfaceorg.scopemvc.core.PropertyView
setSelectorString
public final void setSelectorString(java.lang.String inSelectorString)
setStringConvertor
public void setStringConvertor(org.scopemvc.util.convertor.StringConvertor inConvertor)
- Force use of this StringConvertor instead of automatically finding
one to match the datatype being edited.
setupStringConvertor
protected void setupStringConvertor()
updateFromProperty
public void updateFromProperty(java.lang.Object inValue, boolean inReadOnly)
- Converts the incoming value to a String via
appropriate org.scopemvc.util.convertor.StringConvertor.
For incoming null either disable field or set text
to empty String.
- Specified by:
updateFromPropertyin interfaceorg.scopemvc.view.util.ModelBindable
setText
public void setText(java.lang.String t)
- Override to call super.setText() only
if new value not equals() old value.
getViewValue
public java.lang.Object getViewValue() throws java.lang.IllegalArgumentException
- Description copied from interface:
org.scopemvc.view.util.ModelBindable - Get the current value (what would be set
as a property of the bound model object)
being presented on the View.
- Specified by:
getViewValuein interfaceorg.scopemvc.view.util.ModelBindable
validationFailed
public void validationFailed(java.lang.Exception inException)
- Description copied from interface:
org.scopemvc.view.util.ModelBindable - Validation failed while getting a value from View into
the bound model object. Use this to indicate to the user that the
value being edited is invalid.
- Specified by:
validationFailedin interfaceorg.scopemvc.view.util.ModelBindable
validationSuccess
public void validationSuccess()
- Description copied from interface:
org.scopemvc.view.util.ModelBindable - Clear previous validation failure.
- Specified by:
validationSuccessin interfaceorg.scopemvc.view.util.ModelBindable
createToolTip
public javax.swing.JToolTip createToolTip()
- Description copied from class:
javax.swing.JComponent - Return the
toolTipproperty of this component, creating it and setting it if it is currentlynull. This method can be overridden in subclasses which wish to control the exact form of tooltip created.
focusLost
public void focusLost(java.awt.event.FocusEvent inEvent)
- Description copied from interface:
java.awt.event.FocusListener - This method is invoked when a component loses the keyboard focus.
- Specified by:
focusLostin interfacejava.awt.event.FocusListener
focusGained
public void focusGained(java.awt.event.FocusEvent inEvent)
- Description copied from interface:
java.awt.event.FocusListener - This method is called when a component gains the keyboard focus.
- Specified by:
focusGainedin interfacejava.awt.event.FocusListener
setControlID
public final void setControlID(java.lang.String inControlID)
- Set the ID of the Control that will be issued when
Enter key is pressed in this STextField. If null no Control will be issued.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Sync model object to View and issue a Control if ControlID set.
- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
setController
public void setController(org.scopemvc.core.Controller inController)
- Don't assign a Controller to STextField, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
setControllerin interfaceorg.scopemvc.core.View
getController
public org.scopemvc.core.Controller getController()
- Don't assign a Controller to STextField, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
getControllerin interfaceorg.scopemvc.core.View
issueControl
public void issueControl(org.scopemvc.core.Control inControl)
- Don't assign a Controller to STextField, instead delegate
to the containing SwingView that has a parent Controller.
- Specified by:
issueControlin interfaceorg.scopemvc.core.View
refresh
public void refresh()
- Description copied from interface:
Refreshable - Update the widget with the current state of the bound model.
Probably something like this:
Object propertyValue = boundModel.getPropertyValue(); boolean propertyReadOnly = boundModel.getPropertyReadOnly(); updateFromProperty(propertyValue, propertyReadOnly);- Specified by:
refreshin interfaceRefreshable
|
|||||||||
| Home >> All >> org >> scopemvc >> view >> [ swing overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC