Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-04-07 09:10:59 +0000
committerIvan Furnadjiev2017-04-07 09:10:59 +0000
commit7291e3e363abfca494e264682ae056de95fc723f (patch)
tree3f93db0d9e26dd41920521c21d79041b84e9b620 /bundles
parentf971da8620dc9a93cbd4668930e4de9dfe565d3c (diff)
downloadorg.eclipse.rap-7291e3e363abfca494e264682ae056de95fc723f.tar.gz
org.eclipse.rap-7291e3e363abfca494e264682ae056de95fc723f.tar.xz
org.eclipse.rap-7291e3e363abfca494e264682ae056de95fc723f.zip
Extend Slider client scripting capabilities
Ad support for Selection client listener. Expose scripting getSelection/getMinimum/getMaximum methods in SliderHandler.js. 512382: Client-side Selection listener is not invoked for Slider widget https://bugs.eclipse.org/bugs/show_bug.cgi?id=512382 Change-Id: Icb8f99b0e8c2c7ce989283de25b4d2c8de077249
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/SliderHandler.js41
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/scripting/EventBinding.js12
-rw-r--r--bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/AbstractSlider.js3
-rw-r--r--bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java11
4 files changed, 59 insertions, 8 deletions
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/SliderHandler.js b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/SliderHandler.js
index 2663c3790f..5476b5c578 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/SliderHandler.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/remote/handler/SliderHandler.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
@@ -39,6 +39,43 @@ rwt.remote.HandlerRegistry.add( "rwt.widgets.Slider", {
listeners : rwt.remote.HandlerUtil.extendControlListeners( [] ),
- listenerHandler : rwt.remote.HandlerUtil.extendControlListenerHandler( {} )
+ listenerHandler : rwt.remote.HandlerUtil.extendControlListenerHandler( {} ),
+
+ methods: [ "addListener", "removeListener" ],
+
+ methodHandler : rwt.remote.HandlerUtil.extendListenerMethodHandler( {} ),
+
+ /**
+ * @class RWT Scripting analoge to org.eclipse.swt.widgets.Slider
+ * @name Slider
+ * @extends Control
+ * @description The constructor is not public.
+ * @since 3.2
+ */
+ scriptingMethods : rwt.remote.HandlerUtil.extendControlScriptingMethods(
+ /** @lends Slider.prototype */
+ {
+ /**
+ * @description Returns the 'selection', which is the receiver's position.
+ * @return {int} the selection
+ */
+ getSelection : function() {
+ return this._selection;
+ },
+ /**
+ * @description Returns the maximum value which the receiver will allow.
+ * @return {int} the maximum
+ */
+ getMaximum : function() {
+ return this._maximum;
+ },
+ /**
+ * @description Returns the minimum value which the receiver will allow.
+ * @return {int} the minimum
+ */
+ getMinimum : function() {
+ return this._minimum;
+ }
+ } )
} );
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/scripting/EventBinding.js b/bundles/org.eclipse.rap.rwt/js/rwt/scripting/EventBinding.js
index 4e32be008f..616f2bb52c 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/scripting/EventBinding.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/scripting/EventBinding.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2015 EclipseSource and others.
+ * Copyright (c) 2012, 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
@@ -234,6 +234,16 @@ rwt.scripting.EventBinding = {
*/
"Selection" : "selectionChanged"
},
+ "rwt.widgets.Slider" : {
+ /**
+ * @event
+ * @description Sent when the widget selection is changed
+ * @name Slider#Selection
+ * @param {Event} event
+ * @see SWT.Selection
+ */
+ "Selection" : "selectionChanged"
+ },
"rwt.widgets.Composite" : {
/**
* @event
diff --git a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/AbstractSlider.js b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/AbstractSlider.js
index d7987b32e2..1853aa9059 100644
--- a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/AbstractSlider.js
+++ b/bundles/org.eclipse.rap.rwt/js/rwt/widgets/base/AbstractSlider.js
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2008, 2017 Innoopract Informationssysteme GmbH 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
@@ -152,6 +152,7 @@ rwt.qx.Class.define( "rwt.widgets.base.AbstractSlider", {
if( this._autoRepeat !== "" && !this._repeatTimer.isEnabled() ) {
this._delayTimer.start();
}
+ this.dispatchSimpleEvent( "selectionChanged" );
},
_onChangeSize : function() {
diff --git a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java
index 5e79a0fb56..ae52267f02 100644
--- a/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java
+++ b/bundles/org.eclipse.rap.rwt/widgetkits/org/eclipse/swt/internal/widgets/sliderkit/SliderLCA.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2008, 2017 Innoopract Informationssysteme GmbH 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
@@ -11,17 +11,19 @@
******************************************************************************/
package org.eclipse.swt.internal.widgets.sliderkit;
-import static org.eclipse.rap.rwt.internal.protocol.JsonUtil.createJsonArray;
-import static org.eclipse.rap.rwt.internal.protocol.RemoteObjectFactory.createRemoteObject;
import static org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.getStyles;
import static org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.preserveProperty;
+import static org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.renderClientListeners;
import static org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.renderListenSelection;
import static org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil.renderProperty;
import static org.eclipse.rap.rwt.internal.lifecycle.WidgetUtil.getId;
+import static org.eclipse.rap.rwt.internal.protocol.JsonUtil.createJsonArray;
+import static org.eclipse.rap.rwt.internal.protocol.RemoteObjectFactory.createRemoteObject;
+
import java.io.IOException;
-import org.eclipse.rap.rwt.internal.lifecycle.WidgetLCA;
import org.eclipse.rap.rwt.internal.lifecycle.ControlLCAUtil;
+import org.eclipse.rap.rwt.internal.lifecycle.WidgetLCA;
import org.eclipse.rap.rwt.internal.lifecycle.WidgetLCAUtil;
import org.eclipse.rap.rwt.remote.RemoteObject;
import org.eclipse.swt.widgets.Slider;
@@ -81,6 +83,7 @@ public class SliderLCA extends WidgetLCA<Slider> {
renderProperty( slider, PROP_PAGE_INCREMENT, slider.getPageIncrement(), DEFAULT_PINCREMENT );
renderProperty( slider, PROP_THUMB, slider.getThumb(), DEFAULT_THUMB );
renderListenSelection( slider );
+ renderClientListeners( slider );
}
private SliderLCA() {

Back to the top