Modelers

org.topcased.modeler.editor.properties
Class TextChangeHelper

java.lang.Object
  extended by org.topcased.modeler.editor.properties.TextChangeHelper
All Implemented Interfaces:
org.eclipse.swt.widgets.Listener

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

TextChangeHelper notifies the listner of text lifecycle events on behalf of the widget(s) it listens to.


Constructor Summary
TextChangeHelper()
           
 
Method Summary
 void finishNonUserChange()
          Clients who call startNonUserChange() should call finishNonUserChange() as soon as possible after the change is done.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextChangeHelper

public TextChangeHelper()
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.

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.

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.