Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-03-20 09:57:06 +0000
committerIvan Furnadjiev2017-03-20 11:25:49 +0000
commit6790e87fed7345d452e086f022dca522f9ed156e (patch)
tree01d72f826bfbbaa8d24d0d760a194c80c79190e0
parent508e1e02a73829973bddfd009cef14cccaae9754 (diff)
downloadorg.eclipse.rap-6790e87fed7345d452e086f022dca522f9ed156e.tar.gz
org.eclipse.rap-6790e87fed7345d452e086f022dca522f9ed156e.tar.xz
org.eclipse.rap-6790e87fed7345d452e086f022dca522f9ed156e.zip
Implement get/setOrigin() Client-API for ScrolledComposite
Change-Id: I0d7f4785fc432ea42a62d7a82095b10b04606663 Signed-off-by: Clemens Eisserer <linuxhippy@gmail.com>
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ScrolledCompositeHandler.js14
-rw-r--r--tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrolledCompositeTest.js27
2 files changed, 37 insertions, 4 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ScrolledCompositeHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ScrolledCompositeHandler.js
index 83290c6972..b29db1eb30 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ScrolledCompositeHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/ScrolledCompositeHandler.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2014 EclipseSource and others.
+ * Copyright (c) 2011, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,6 +53,16 @@ rwt.remote.HandlerRegistry.add( "rwt.widgets.ScrolledComposite", {
listeners : rwt.remote.HandlerUtil.extendControlListeners( [] ),
- listenerHandler : rwt.remote.HandlerUtil.extendControlListenerHandler( {} )
+ listenerHandler : rwt.remote.HandlerUtil.extendControlListenerHandler( {} ),
+
+ scriptingMethods : rwt.remote.HandlerUtil.extendControlScriptingMethods( {
+ setOrigin : function(x, y) {
+ this.setHBarSelection( x );
+ this.setVBarSelection( y );
+ },
+ getOrigin : function() {
+ return [ this.getHorizontalBar().getValue(), this.getVerticalBar().getValue()];
+ }
+ } )
} );
diff --git a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrolledCompositeTest.js b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrolledCompositeTest.js
index c683a4a73a..6f0ca36be3 100644
--- a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrolledCompositeTest.js
+++ b/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/ScrolledCompositeTest.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 EclipseSource and others.
+ * Copyright (c) 2010, 2017 EclipseSource and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -138,6 +138,29 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.ScrolledCompositeTest", {
var widget = ObjectRegistry.getObject( "w3" );
assertEquals( 1, widget._horzScrollBar.getValue() );
assertEquals( 2, widget._vertScrollBar.getValue() );
+ assertEquals( [ 1, 2, ], rap.getObject( "w3" ).getOrigin() );
+ shell.destroy();
+ widget.destroy();
+ },
+
+ testSetOriginByClientAPI : function() {
+ var shell = TestUtil.createShellByProtocol( "w2" );
+ MessageProcessor.processOperation( {
+ "target" : "w3",
+ "action" : "create",
+ "type" : "rwt.widgets.ScrolledComposite",
+ "properties" : {
+ "style" : [],
+ "parent" : "w2"
+ }
+ } );
+
+ rap.getObject( "w3" ).setOrigin( 1, 2 );
+
+ var widget = ObjectRegistry.getObject( "w3" );
+ assertEquals( 1, widget._horzScrollBar.getValue() );
+ assertEquals( 2, widget._vertScrollBar.getValue() );
+ assertEquals( [ 1, 2, ], rap.getObject( "w3" ).getOrigin() );
shell.destroy();
widget.destroy();
},
@@ -673,7 +696,7 @@ rwt.qx.Class.define( "org.eclipse.rwt.test.tests.ScrolledCompositeTest", {
_getScrollPosition : function( composite ) {
var client = composite._clientArea;
- return [ client.getScrollLeft(), client.getScrollTop() ];
+ return [ Math.round( client.getScrollLeft() ), Math.round( client.getScrollTop() ) ];
},
_setScrollDimension : function( composite, width, height, noflush ) {

Back to the top