org.eclipse.emf.ecoretools.tabbedproperties.utils
Class TextChangeListener

java.lang.Object
  extended by org.eclipse.emf.ecoretools.tabbedproperties.utils.TextChangeListener
All Implemented Interfaces:
org.eclipse.swt.widgets.Listener

public abstract class TextChangeListener
extends java.lang.Object
implements org.eclipse.swt.widgets.Listener

This is a copy of the TextChangeHelper available in GMF with addition to listener on FocusIn and FocusOut events. We only want to avoid a dependency to the GMF component TextChangeListener notifies the listener of text lifecycle events on behalf of the widget(s) it listens to.


Constructor Summary
TextChangeListener()
           
 
Method Summary
 void finishNonUserChange()
          Clients who call startNonUserChange() should call finishNonUserChange() as soon as possible after the change is done.
 void focusIn(org.eclipse.swt.widgets.Control control)
          This method is method notified when the focus is gained Client may override this method if he desire some particular behavior
 void focusOut(org.eclipse.swt.widgets.Control control)
          This method is notified when the focus is lost Client may override this method if he desire some particular behavior
 void handleEvent(org.eclipse.swt.widgets.Event event)
           
 boolean isNonUserChange()
          Determine if a programmatic change is in progress.
 void startListeningForEnter(org.eclipse.swt.widgets.Control control)
          Registers this helper with the given control to listen for the Enter key.
 void startListeningTo(org.eclipse.swt.widgets.Control control)
          Registers this helper with the given control to listen for events which indicate that a change is in progress (or done).
 void startNonUserChange()
          Marks the start of a programmatic change to the widget contents.
 void stopListeningTo(org.eclipse.swt.widgets.Control control)
          Unregisters this helper from a control previously passed to startListeningTo() and/or startListeningForEnter().
abstract  void textChanged(org.eclipse.swt.widgets.Control control)
          Abstract method notified when a text field has been changed.
 void verifyText(org.eclipse.swt.widgets.Control control)
          This method is notified when text is been modified Client may override this method if he desire some particular behavior
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextChangeListener

public TextChangeListener()
Method Detail

startNonUserChange

public void startNonUserChange()
Marks the start of a programmatic change to the widget contents. Clients must call startNonUserChange() before directly setting the widget contents to avoid unwanted lifecycle events.

Throws:
java.lang.IllegalArgumentException - if a programmatic change is already in progress.

finishNonUserChange

public void finishNonUserChange()
Clients who call startNonUserChange() should call finishNonUserChange() as soon as possible after the change is done.

Throws:
java.lang.IllegalArgumentException - if no change is in progress.

isNonUserChange

public boolean isNonUserChange()
Determine if a programmatic change is in progress.

Returns:
true if a programmatic change is in progress.

handleEvent

public void handleEvent(org.eclipse.swt.widgets.Event event)
Specified by:
handleEvent in interface org.eclipse.swt.widgets.Listener
See Also:
Listener.handleEvent(org.eclipse.swt.widgets.Event)

textChanged

public abstract void textChanged(org.eclipse.swt.widgets.Control control)
Abstract method notified when a text field has been changed.

Parameters:
control - the given control.

focusIn

public void focusIn(org.eclipse.swt.widgets.Control control)
This method is method notified when the focus is gained Client may override this method if he desire some particular behavior

Parameters:
control - the given control.

focusOut

public void focusOut(org.eclipse.swt.widgets.Control control)
This method is notified when the focus is lost Client may override this method if he desire some particular behavior

Parameters:
control - the given control.

verifyText

public void verifyText(org.eclipse.swt.widgets.Control control)
This method is notified when text is been modified Client may override this method if he desire some particular behavior

Parameters:
control - the given control.

startListeningTo

public void startListeningTo(org.eclipse.swt.widgets.Control control)
Registers this helper with the given control to listen for events which indicate that a change is in progress (or done).

Parameters:
control - the given control.

startListeningForEnter

public void startListeningForEnter(org.eclipse.swt.widgets.Control control)
Registers this helper with the given control to listen for the Enter key. When Enter is pressed, the change is considered done (this is only appropriate for single-line Text widgets).

Parameters:
control - the given control.

stopListeningTo

public void stopListeningTo(org.eclipse.swt.widgets.Control control)
Unregisters this helper from a control previously passed to startListeningTo() and/or startListeningForEnter().

Parameters:
control - the given control.

Copyright 2007 Anyware Technologies.
All Rights Reserved.