Slider bar in GWT
Solution 1
It is being solved by writing a new lib which uses the jquery slider. The author will release the code when it's stable :)
Solution 2
Try this:
http://code.google.com/p/gwt-slider-bar/
With help of this project it is possible create different slider bars.
Solution 3
There is no slide bar in the standard GWT library. But an alternative to the GWT incubator is in the sample project listwidget by David Chandler (he's on the Google GWT team). For this sample project he also needed a Slide bar. He took the sources from the GWT incubator and updated them.
What you can do is take these sources and put them in your own project (it has an apache licence). It's maybe not optimal but it worked for me. Here is a link to the sources http://code.google.com/p/listwidget/source/browse/#svn%2Ftrunk%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgwt%2Fgen2%2Fclient (and for convenience here a link to the project: http://code.google.com/p/listwidget/)
Solution 4
You can now just use an HTML5 slider, like this:
<input ui:field="sliderInput" type="range" />
@UiField InputElement sliderInput;
sliderInput.setAttribute("min", "1");
sliderInput.setAttribute("max", "100");
sliderInput.setAttribute("step", "10");
Event.sinkEvents(sliderInput, Event.ONCHANGE);
Event.setEventListener(sliderInput, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
// sliderInput.getValue();
}
});
Related videos on Youtube
mkn
Updated on June 04, 2022Comments
-
mkn almost 2 years
Does anyone know if there is a slider bar in gwt? I only found the one from GWT Incubator, which is unfortunately deprecated.
-
mkn over 12 yearsI need a touchable slider (for ipad). The slider with jquery right now is not touchable but there seems to be workarounds
-
tombo_189 over 6 yearscould you please also provide an example which generates the
sliderInput
programmatically, without the use of UIBinder, and adds it to some container widget later? -
Craigo over 6 years@tombo_189 Have a look in the GWT DOMImpl class at the createInputElement method. Copy that, and change it to have the type of "range".
-
Magallo almost 6 yearsIf I specify ui:field="sliderInput" to the <input> the GWT compilter return an error: [ERROR] Template Page.ui.xml has no ui:field attribute for Page#sliderInput
-
Craigo almost 6 years@Magallo That's odd. You should be able to add ui:field to any element in the ui.xml. That's the way to access them in Java. You might like to check the docs gwtproject.org/doc/latest/DevGuideUiBinder.html
-
Gautam over 4 yearsAn exported copy is available on github - github.com/jbarop/gwt-slider-bar