You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by odin568 <ma...@web.de> on 2011/11/10 19:51:16 UTC

Question regarding wiquery Rangeslider

Hi,

I want to implement Sliders into my Wicket Project. This works fine with the
example shown here:
http://wiquery-examples-1-1-x.appspot.com/?wicket:bookmarkablePage=wicket-1:org.odlabs.wiquery.examples.slider.SliderPage

Now I want to implement Range sliders. So i don't need only the Value of the
Slider, but the two values (min, max) of them.

Well, it works optically by adding

		SliderRange range = new SliderRange(true);
		slider.setRange(range);

But I don't get the example edited so that I get those two values :'-(

For help:

Cleaned example:
		slider = new Slider("slider", 0, 100);
		slider.setChangeEvent(
				new DefaultJsScopeUiEvent(
						"wicketAjaxGet('" + sliderBehavior.getCallbackUrl(true)
						+ "&sliderValue='+" + Slider.UI_VALUE
						+ ", null,null, function() {return true;})"));
		add(slider);



Can anybody give me a hint or prepare an example? 

Thank you a lot! 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4025737.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
I just added to head a method

public Slider setValues(Integer value1, Integer value2)

that simplifies things.

Ernesto


On Mon, Nov 14, 2011 at 1:03 PM, Ernesto Reinaldo Barreiro
<re...@gmail.com> wrote:
> yes you are right. I think what you need is
>
> public Slider setValues(ArrayItemOptions<IntegerItemOptions> values)
>        {
>                this.options.put("values", values);
>                return this;
>        }
>
> On Mon, Nov 14, 2011 at 12:57 PM, odin568 <ma...@web.de> wrote:
>> Hi,
>> no, this sets the complete range of the slider as in the constructor (in my
>> example 0 and 100).
>>
>> Thanks.
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039247.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
ArrayItemOptions is just an array list. Something like

ArrayItemOptions<IntegerItemOptions> options =
				new ArrayItemOptions<IntegerItemOptions>();
			options.add(new IntegerItemOptions(value1));
			options.add(new IntegerItemOptions(value2));

should do it.

Ernesto

On Mon, Nov 14, 2011 at 1:15 PM, odin568 <ma...@web.de> wrote:
> Ok thanks. But I have one problem implementing this:
>
> setValues needs parameter of type ArrayItemOptions<IntegerItemOptions>
>
> How do I put my int's into this type?? Don't know how to handle that :-S
> sorry
>
> Thanks!
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039287.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by odin568 <ma...@web.de>.
Ok thanks. But I have one problem implementing this:

setValues needs parameter of type ArrayItemOptions<IntegerItemOptions> 

How do I put my int's into this type?? Don't know how to handle that :-S
sorry

Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039287.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
yes you are right. I think what you need is

public Slider setValues(ArrayItemOptions<IntegerItemOptions> values)
	{
		this.options.put("values", values);
		return this;
	}

On Mon, Nov 14, 2011 at 12:57 PM, odin568 <ma...@web.de> wrote:
> Hi,
> no, this sets the complete range of the slider as in the constructor (in my
> example 0 and 100).
>
> Thanks.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039247.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by odin568 <ma...@web.de>.
Hi,
no, this sets the complete range of the slider as in the constructor (in my
example 0 and 100). 

Thanks.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039247.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Can´t  you just use the following methods?

/**
	 * Sets the maximum value of the slider.
	 *
	 * @param max
	 * @return instance of the current component
	 */
	public Slider setMax(Number max)
	{
		this.options.put("max", max.floatValue());
		return this;
	}


/**	 * Sets the minimum value of the slider.	 * 	 * @param min	 *
@return instance of the current component	 */	public Slider
setMin(Number min)	{		this.options.put("min",
min.floatValue());		return this;	}

Regards,

Ernesto
On Mon, Nov 14, 2011 at 12:45 PM, odin568 <ma...@web.de> wrote:
> Sorry, I think you missunderstood me:
> Yes, with this constructor, I set the min and max of the Slider.
>
> But I meant to set the values of the range manually.
>
> i.e. I create a range slider from 0 to 100. Then I want to set the two
> positions 10 and 90 as start for the Range.
>
> Thanks!
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039228.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by odin568 <ma...@web.de>.
Sorry, I think you missunderstood me:
Yes, with this constructor, I set the min and max of the Slider.

But I meant to set the values of the range manually.

i.e. I create a range slider from 0 to 100. Then I want to set the two
positions 10 and 90 as start for the Range.

Thanks!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4039228.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Ins´t there a constructor

public AjaxSlider(String id, Number min, Number max)

?

Regards,

Ernesto



On Mon, Nov 14, 2011 at 10:33 AM, odin568 <ma...@web.de> wrote:
> I finally found a solution. You were right - it's much easier by using
> AjaxSlider instead of normal slider.
>
> Here is the code:
>
>                                AjaxSlider slider = new AjaxSlider("slider", 0, 100);
>                                slider.setRange(new SliderRange(true));
>                                //TODO: Set Slider to position again!
>                                slider.setAjaxStopEvent(new AjaxSlider.ISliderAjaxEvent() {
>                                    private static final long serialVersionUID = 1L;
>                                    public void onEvent(AjaxRequestTarget target, AjaxSlider slider, int
> value, int[] values ) {
>                                        ........................................
>                                    }
>                                });
>                                item.add(slider);
>
>
>
>
> But I have one more problem: I want to initialize the Slider with a min and
> max-value. Until now, min and max start with 0. I don't understand the
> SliderRange constructor. I can give it beside a boolean a RangeEnum. How can
> I implement that? I don't understand...
>
> Thanks a lot!
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4038916.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by odin568 <ma...@web.de>.
I finally found a solution. You were right - it's much easier by using
AjaxSlider instead of normal slider.

Here is the code:

				AjaxSlider slider = new AjaxSlider("slider", 0, 100);
				slider.setRange(new SliderRange(true));
				//TODO: Set Slider to position again!
				slider.setAjaxStopEvent(new AjaxSlider.ISliderAjaxEvent() {
				    private static final long serialVersionUID = 1L;
				    public void onEvent(AjaxRequestTarget target, AjaxSlider slider, int
value, int[] values ) {
				        ........................................
				    }
				});
				item.add(slider);




But I have one more problem: I want to initialize the Slider with a min and
max-value. Until now, min and max start with 0. I don't understand the
SliderRange constructor. I can give it beside a boolean a RangeEnum. How can
I implement that? I don't understand...

Thanks a lot!

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4038916.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by odin568 <ma...@web.de>.
Thanks. The problem is - Only normal Sliders are described in the Wiki - no
SliderRange. I didn't find any Infos anywhere, that's why I post here hoping
someone could help me...

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4026495.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Question regarding wiquery Rangeslider

Posted by julien roche <ro...@gmail.com>.
hi,
I remenber about an AjaxSlider component with method to get the values.

I think you will find more hints on the wiquery wiki pages.

cheers

jul
Le 10 nov. 2011 19:51, "odin568" <ma...@web.de> a écrit :

> Hi,
>
> I want to implement Sliders into my Wicket Project. This works fine with
> the
> example shown here:
>
> http://wiquery-examples-1-1-x.appspot.com/?wicket:bookmarkablePage=wicket-1:org.odlabs.wiquery.examples.slider.SliderPage
>
> Now I want to implement Range sliders. So i don't need only the Value of
> the
> Slider, but the two values (min, max) of them.
>
> Well, it works optically by adding
>
>                SliderRange range = new SliderRange(true);
>                slider.setRange(range);
>
> But I don't get the example edited so that I get those two values :'-(
>
> For help:
>
> Cleaned example:
>                slider = new Slider("slider", 0, 100);
>                slider.setChangeEvent(
>                                new DefaultJsScopeUiEvent(
>                                                "wicketAjaxGet('" +
> sliderBehavior.getCallbackUrl(true)
>                                                + "&sliderValue='+" +
> Slider.UI_VALUE
>                                                + ", null,null, function()
> {return true;})"));
>                add(slider);
>
>
>
> Can anybody give me a hint or prepare an example?
>
> Thank you a lot!
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Question-regarding-wiquery-Rangeslider-tp4025737p4025737.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>