Mercurial > hg > STI-GWT
view src/econnect/wp3_3/client/slider/JsSlider.java @ 39:ba7d401c2750 CellTable
Fix for missing JS file, why did this even work?
author | Sebastian Kruse <skruse@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 06 Dec 2012 18:05:16 +0100 |
parents | cf06b77a8bbd |
children |
line wrap: on
line source
package econnect.wp3_3.client.slider; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; /** * Implementation of the wrapper for the Slider class of the WebFX JavaScript source */ public class JsSlider extends JavaScriptObject { protected JsSlider(){ } /** * Initializes a WebFX Slider element * * @param slider div element for the slider range * @param input div element for the slider adjuster * @param orientation if the slider should be vertical or horizontal * @return a WebFX Slider object */ public static native JsSlider createSlider( DivElement slider, DivElement input, String orientation ) /*-{ return new $wnd.Slider( slider, input, orientation ); }-*/; /** * Setter for the maximum possible value of the slider * * @param max maximum of the slider */ public final native void setMaximum( int max ) /*-{ this.setMaximum(max); }-*/; /** * Setter for the new value of the slider * * @param value the new value of the slider */ public final native void setValue( int value ) /*-{ this.setValue(value); }-*/; /** * Getter for the actual value of the slider * * @return the actual value of the slider */ public final native int getValue() /*-{ return this.getValue(); }-*/; /** * Adds a change listener to the javascript slider object */ public final native void addChangeListener( JavaScriptObject jso, Document document, boolean direct ) /*-{ var slider = this; this.handle.onmousedown = function(){ var oldValue = slider.getValue(); document.onmouseup = function(){ if( direct && !jso.zoom( slider.getValue() / slider.getMaximum() ) || !direct && !jso.zoom( slider.getValue() - oldValue ) ){ slider.setValue(oldValue); } document.onmouseup = null; } } }-*/; }