comparison src/econnect/wp3_3/client/slider/JsSlider.java @ 3:cf06b77a8bbd

Committed branch of the e4D repos sti-gwt branch 16384. git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b>
date Tue, 17 Jul 2012 13:34:40 +0000
parents
children
comparison
equal deleted inserted replaced
2:2897af43ccc6 3:cf06b77a8bbd
1 package econnect.wp3_3.client.slider;
2
3 import com.google.gwt.core.client.JavaScriptObject;
4 import com.google.gwt.dom.client.DivElement;
5 import com.google.gwt.dom.client.Document;
6
7 /**
8 * Implementation of the wrapper for the Slider class of the WebFX JavaScript source
9 */
10 public class JsSlider extends JavaScriptObject {
11
12 protected JsSlider(){
13 }
14
15 /**
16 * Initializes a WebFX Slider element
17 *
18 * @param slider div element for the slider range
19 * @param input div element for the slider adjuster
20 * @param orientation if the slider should be vertical or horizontal
21 * @return a WebFX Slider object
22 */
23 public static native JsSlider createSlider( DivElement slider, DivElement input, String orientation ) /*-{
24 return new $wnd.Slider( slider, input, orientation );
25 }-*/;
26
27 /**
28 * Setter for the maximum possible value of the slider
29 *
30 * @param max maximum of the slider
31 */
32 public final native void setMaximum( int max ) /*-{
33 this.setMaximum(max);
34 }-*/;
35
36 /**
37 * Setter for the new value of the slider
38 *
39 * @param value the new value of the slider
40 */
41 public final native void setValue( int value ) /*-{
42 this.setValue(value);
43 }-*/;
44
45 /**
46 * Getter for the actual value of the slider
47 *
48 * @return the actual value of the slider
49 */
50 public final native int getValue() /*-{
51 return this.getValue();
52 }-*/;
53
54 /**
55 * Adds a change listener to the javascript slider object
56 */
57 public final native void addChangeListener( JavaScriptObject jso, Document document, boolean direct ) /*-{
58 var slider = this;
59 this.handle.onmousedown = function(){
60 var oldValue = slider.getValue();
61 document.onmouseup = function(){
62 if( direct && !jso.zoom( slider.getValue() / slider.getMaximum() ) ||
63 !direct && !jso.zoom( slider.getValue() - oldValue ) ){
64 slider.setValue(oldValue);
65 }
66 document.onmouseup = null;
67 }
68 }
69 }-*/;
70
71 }