Remove Text listen "verify" from protocol, use "Modify" only
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/protocol/adapter/TextAdapter.js b/bundles/org.eclipse.rap.rwt/js/rwt/protocol/adapter/TextAdapter.js
index 36fc1de..89c87e3 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/protocol/adapter/TextAdapter.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/protocol/adapter/TextAdapter.js
@@ -63,8 +63,7 @@
listeners : rwt.protocol.AdapterUtil.extendControlListeners( [
"DefaultSelection",
- "Modify",
- "verify"
+ "Modify"
] ),
listenerHandler : rwt.protocol.AdapterUtil.extendControlListenerHandler( {} ),
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Text.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Text.js
index 092e30b..46e7081 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Text.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Text.js
@@ -27,7 +27,6 @@
}
this._hasDefaultSelectionListener = false;
this._hasModifyListener = false;
- this._hasVerifyListener = false;
this._modifyScheduled = false;
this._message = null;
this._messageElement = null;
@@ -107,14 +106,6 @@
return this._hasModifyListener;
},
- setHasVerifyListener : function( value ) {
- this._hasVerifyListener = value;
- },
-
- hasVerifyListener : function() {
- return this._hasVerifyListener;
- },
-
////////////////
// event handler
@@ -169,7 +160,7 @@
_handleModification : function() {
var server = rwt.remote.Server.getInstance();
- if( !this._modifyScheduled && ( this.hasModifyListener() || this.hasVerifyListener() ) ) {
+ if( !this._modifyScheduled && this.hasModifyListener() ) {
this._modifyScheduled = true;
server.sendDelayed( 500 );
server.onNextSend( this._onSend, this );
diff --git a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
index 3618cf2..1927b25 100644
--- a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
+++ b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/textkit/TextLCAUtil.java
@@ -65,7 +65,6 @@
static final String PROP_ECHO_CHAR = "echoChar";
static final String PROP_MESSAGE = "message";
static final String PROP_MODIFY_LISTENER = "Modify";
- static final String PROP_VERIFY_LISTENER = "verify";
static final String PROP_DEFAULT_SELECTION_LISTENER = "DefaultSelection";
private static final Point ZERO_SELECTION = new Point( 0, 0 );
@@ -83,8 +82,7 @@
preserveProperty( text, PROP_EDITABLE, text.getEditable() );
preserveProperty( text, PROP_ECHO_CHAR, getEchoChar( text ) );
preserveProperty( text, PROP_MESSAGE, text.getMessage() );
- preserveListener( text, PROP_MODIFY_LISTENER, text.isListening( SWT.Modify ) );
- preserveListener( text, PROP_VERIFY_LISTENER, text.isListening( SWT.Verify ) );
+ preserveListener( text, PROP_MODIFY_LISTENER, hasModifyListener( text ) );
preserveListener( text,
PROP_DEFAULT_SELECTION_LISTENER,
text.isListening( SWT.DefaultSelection ) );
@@ -106,8 +104,7 @@
renderProperty( text, PROP_TEXT_LIMIT, getTextLimit( text ), null );
renderProperty( text, PROP_ECHO_CHAR, getEchoChar( text ), null );
renderProperty( text, PROP_MESSAGE, text.getMessage(), "" );
- renderListener( text, PROP_MODIFY_LISTENER, text.isListening( SWT.Modify ), false );
- renderListener( text, PROP_VERIFY_LISTENER, text.isListening( SWT.Verify ), false );
+ renderListener( text, PROP_MODIFY_LISTENER, hasModifyListener( text ), false );
renderListener( text,
PROP_DEFAULT_SELECTION_LISTENER,
text.isListening( SWT.DefaultSelection ),
@@ -196,4 +193,10 @@
private static String getEchoChar( Text text ) {
return text.getEchoChar() == 0 ? null : String.valueOf( text.getEchoChar() );
}
+
+ private static boolean hasModifyListener( Text text ) {
+ // NOTE : Client does not support Verify, it is created server-side from Modify
+ return text.isListening( SWT.Modify ) || text.isListening( SWT.Verify );
+ }
+
}
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TextTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TextTest.js
index 9ea5916..d15376f 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TextTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/TextTest.js
@@ -357,21 +357,6 @@
assertTrue( text.hasModifyListener() );
},
- testSetHasVerifyListenerByProtocol : function() {
- Processor.processOperation( {
- "target" : "w3",
- "action" : "create",
- "type" : "rwt.widgets.Text",
- "properties" : {
- "style" : [ "SINGLE" ],
- "parent" : "w2"
- }
- } );
- TestUtil.protocolListen( "w3", { "verify" : true } );
- text = ObjectManager.getObject( "w3" );
- assertTrue( text.hasVerifyListener() );
- },
-
testSetTextByProtocol : function() {
Processor.processOperation( {
"target" : "w3",
@@ -806,16 +791,6 @@
assertNotNull( TestUtil.getMessageObject().findNotifyOperation( "w3", "Modify" ) );
},
- testSendTextModifyEventWithVerifyListener : function() {
- createText();
- text.setHasVerifyListener( true );
-
- text.setValue( "foobar" );
- TestUtil.forceInterval( Server.getInstance()._delayTimer );
-
- assertNotNull( TestUtil.getMessageObject().findNotifyOperation( "w3", "Modify" ) );
- },
-
testSendNoModifyEvent : function() {
createText();
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
index 952f6b3..8815347 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/internal/widgets/textkit/TextLCA_Test.java
@@ -695,31 +695,25 @@
Fixture.markInitialized( text );
Fixture.preserveWidgets();
- text.addVerifyListener( new VerifyListener() {
- public void verifyText( VerifyEvent event ) {
- }
- } );
+ text.addListener( SWT.Verify, mock( Listener.class ) );
lca.renderChanges( text );
Message message = Fixture.getProtocolMessage();
- assertEquals( Boolean.TRUE, message.findListenProperty( text, "verify" ) );
+ assertEquals( Boolean.TRUE, message.findListenProperty( text, "Modify" ) );
}
- public void testRenderRemoveVerifyListener() throws Exception {
- VerifyListener listener = new VerifyListener() {
- public void verifyText( VerifyEvent event ) {
- }
- };
- text.addVerifyListener( listener );
+ public void testRenderVerifyModifyListener() throws Exception {
+ Listener listener = mock( Listener.class );
+ text.addListener( SWT.Verify, listener );
Fixture.markInitialized( display );
Fixture.markInitialized( text );
Fixture.preserveWidgets();
- text.removeVerifyListener( listener );
+ text.removeListener( SWT.Verify, listener );
lca.renderChanges( text );
Message message = Fixture.getProtocolMessage();
- assertEquals( Boolean.FALSE, message.findListenProperty( text, "verify" ) );
+ assertEquals( Boolean.FALSE, message.findListenProperty( text, "Modify" ) );
}
public void testRenderVerifyListenerUnchanged() throws Exception {
@@ -727,15 +721,12 @@
Fixture.markInitialized( text );
Fixture.preserveWidgets();
- text.addVerifyListener( new VerifyListener() {
- public void verifyText( VerifyEvent event ) {
- }
- } );
+ text.addListener( SWT.Verify, mock( Listener.class ) );
Fixture.preserveWidgets();
lca.renderChanges( text );
Message message = Fixture.getProtocolMessage();
- assertNull( message.findListenOperation( text, "verify" ) );
+ assertNull( message.findListenOperation( text, "Modify" ) );
}
public void testRenderInitialText() throws IOException {