Hi all
I have a ULCTextField that I have created an extension to its client
couterpart, the UITextField.
My UITextfield extends the standard one because I need three extra events. A
mouse double click and a value from and value to null event.
The double click listener is working just fine but I am having problems with my
valueFromNullEvent and the valueToNullEvent. The events themselves work just
fine, the only problem is, is that when I send my event to the server, it also
invokes the ValueChangedEvent. The ValueChangedEvent normally only gets fired
once focus leaves the field. I have not left the field and I have no server
code that would force a focus changed.
my client code is as follows:
protected void postInitializeState()
{
super.postInitializeState();
_borderManager = new BorderManager(this);
getBasicTextField().addKeyListener(new KeyListener()
{
public void keyTyped(KeyEvent e)
{
if (Character.isLetterOrDigit(e.getKeyChar()))
{
if (getBasicTextField().getText() == null ||
getBasicTextField().getText().trim().length() == 0)
{
fireEventULC(SPRINT_VALUE_CHANGED_FROM_NULL_EVENT,
SPRINT_VALUE_CHANGED_FROM_NULL_EVENT, new Object[] {});
}
}
}
public void keyReleased(KeyEvent e)
{
if (getBasicTextField().getText() == null ||
getBasicTextField().getText().length() == 0)
{
fireEventULC(SPRINT_VALUE_CHANGED_TO_NULL_EVENT,
SPRINT_VALUE_CHANGED_TO_NULL_EVENT, new Object[] {});
}
}
public void keyPressed(KeyEvent e)
{
}
});
getBasicTextField().addMouseListener(new MouseListener()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
fireEventULC(SPRINT_DOUBLE_CLICK_EVENT, "doubleClicked",
new Object[] {});
}
}
....
....
....
It seems to me that the KexEvents are logged by ULC to be able to know if a
value has changed. Because I have my own key listener which fires its own
event, it seems to get in the way of the valuechanged event. I tried printing
out the isValueChangedEventPending() value but it is false.
Could you please tell me if I am doing something wrong or if this is standard
behaviour. If it is standard behaviour then the Java Doc of the
ValueChangedEvent is incorrect and I would be very grateful for a workaround.
Kins regards
Paul Harrison