开发者

Slider bar in GWT

开发者 https://www.devze.com 2023-04-01 23:35 出处:网络
Does anyone know if there is a slider bar in gwt? I only开发者_如何学运维 found the one from GWT Incubator, which is unfortunately deprecated.Try this:

Does anyone know if there is a slider bar in gwt? I only开发者_如何学运维 found the one from GWT Incubator, which is unfortunately deprecated.


Try this:

http://code.google.com/p/gwt-slider-bar/

With help of this project it is possible create different slider bars.


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/)


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();
    }
});


You can use the slider from smartgwt. You only have to pay attention to the css definition. For the firefox it have to look like this:

#isc_4 td{
   font-size:0px;
}

The slider is not a html5 slider and not touchable, but it works.


It is being solved by writing a new lib which uses the jquery slider. The author will release the code when it's stable :)

0

精彩评论

暂无评论...
验证码 换一张
取 消