*/
public void bind(JComponent control, ValueModel valueModel)
{
// Respect the document that already exists on the control, if any
JTextComponent textControl = (JTextComponent)control;
MultiLineTextField textArea = null;
if (textControl instanceof MultiLineTextField) {
textArea = (MultiLineTextField)textControl;
// Text area is associated with valueModel so that the former can distinguish between
// user entered text and model supplied text. Cursor is to be placed at the beginning of model
// supplied text.
textArea.setValueModel(valueModel);
// Register the first PropertyChangeListener on valueModel BEFORE the DocumentAdapter has registered.
textArea.registerPropertyChangeHandler();
}
if (textControl.getDocument() != null) {
// TF:13/11/2009:LUM-48:Added the parameter to the TextDataToStringConverter to allow the use of identity comparisons when firing property change events
Bindings.bind((JTextComponent) control,new TextDataToStringConverter(valueModel, textArea != null), textControl.getDocument(), false);
}
else {
// TF:13/11/2009:LUM-48:Added the parameter to the TextDataToStringConverter to allow the use of identity comparisons when firing property change events
Bindings.bind((JTextComponent) control,new TextDataToStringConverter(valueModel, textArea != null),false);
}
if (textArea != null) {
// Register the second PropertyChangeListener on valueModel AFTER the DocumentAdapter has registered.
textArea.registerCaratPositionHandler();
}
}