TreeTabel and file download

2010-12-30 Thread Anton Bessonov

Hello list,

I'm trying to implement small file browser and I use TreeTable. 
PropertyTreeColumn shows file names and I can get (newCell -> 
getTreeTable().getTreeState().isNodeSelected(node)) java.io.File. Now, 
I'm need force to download file after click on the file name. Any 
suggestions?


Thanks,

Anton

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



AjaxLazyLoadPanel and back button

2010-12-30 Thread flavius

I'm using the AjaxLazyLoadPanel to load images I'm generating from reports. 
When 
I'm on a page with the AjaxLazyLoadPanel, click a link to another page (like
a 
BookmarkablePageLink) and then click back, the image that was generated is
still in place.   

However, if I submit a form that's on the panel's page and then hit the back
button, 
it goes back to the page with the spinning busy indicator and it spins
forever, 
rather than displaying the already rendered image. 

Is this by design or should the generated image be rendered as it does when 
clicking a link?

I'm using wicket 1.4.15.



-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxLazyLoadPanel-and-back-button-tp3168379p3168379.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: radio group stated not updated via AJAX. Possible bug?

2010-12-30 Thread Igor Vaynberg
all components need that after they have been submitted once. how is
component to know that you have updated its model object? have you
called component.modelchanged()? clearinput() will do the same as
that.

-igor

On Thu, Dec 30, 2010 at 6:46 AM, Ernesto Reinaldo Barreiro
 wrote:
> Igor,
>
> Thanks for your answer. Yes, I thought about that possibility but
> somehow it seems weird to me that you have to call clearinput() to get
> the component update its state based on the model value: in particular
> because other form components do not need that trick to work properly.
>  Would the override
>
>  public boolean isInputNullable() {
>        return false;
>  }
>
> have any other (undesirable) side effects? This "solution" has the
> advantage that I can roll out my own AjaxUpdatebleRadioGroup and thus
> I do not have remember to call clearinput() over and over.
>
> Regards,
>
> Ernesto
>
> On Thu, Dec 30, 2010 at 3:29 PM, Igor Vaynberg  
> wrote:
>> call clearinput() on the radiogroup so it refreshes based on new model
>> value you set.
>>
>> -igor
>>
>> On Thu, Dec 30, 2010 at 4:57 AM, Ernesto Reinaldo Barreiro
>>  wrote:
>>> I forgot to mentions this is with wicket 1.4.x.
>>>
>>> Ernesto
>>>
>>> On Thu, Dec 30, 2010 at 1:53 PM, Ernesto Reinaldo Barreiro
>>>  wrote:
 Hi,

 Apologies for the somewhat lengthy e-mail.

 Consider the following situation

 1-I have a form with a RadioGroup, several Radio buttons, an AJAX
 submit button and some AJAX links that fetch "information" that can be
 used to repaint the form and the RadioGroup.

 In simplified code more or less this.

 public class RadioPage extends WebPage  {

        private static final long serialVersionUID = 1L;

        private WebMarkupContainer context;

        private Gender gender;

        private FeedbackPanel feedbackPanel;

        public RadioPage() {
              Form form = new Form("form");
              add(form);
              context = new WebMarkupContainer("context");
              context.setOutputMarkupId(true);
              form.add(context);


                RadioGroup gender = new RadioGroup("gender",
                                new PropertyModel(this,"gender"));

                gender.setRequired(true);
                context.add(gender);
                // hombre
                Radio sexoH = new Radio("male", new
 Model(Gender.MALE), gender);
                gender.add(sexoH);

                Radio sexoM = new Radio("female", new
 Model(Gender.FEMALE), gender);
                gender.add(sexoM);

                add(new AjaxLink("makeMale") {

                        private static final long serialVersionUID = 1L;

                       �...@override
                        public void onClick(AjaxRequestTarget target) {
                                RadioPage.this.gender = Gender.MALE;
                                if(target != null) {
                                        target.addComponent(context);
                                }
                        }
                });

                add(new AjaxLink("makeFemale") {

                        private static final long serialVersionUID = 1L;

                       �...@override
                        public void onClick(AjaxRequestTarget target) {
                                RadioPage.this.gender = Gender.FEMALE;
                                if(target != null) {
                                        target.addComponent(context);
                                }
                        }
                });

                form.add(new AjaxSubmitLink("submit") {

                        private static final long serialVersionUID = 1L;

                       �...@override
                        protected void onSubmit(AjaxRequestTarget target, 
 Form form) {
                                form.info("Gender was set to " + 
 RadioPage.this.gender);
                                target.addComponent(feedbackPanel);
                        }

                       �...@override
                        protected void onError(AjaxRequestTarget target, 
 Form form) {
                                target.addComponent(feedbackPanel);
                        }
                });

                feedbackPanel = new FeedbackPanel("feedback");
                feedbackPanel.setOutputMarkupId(true);
                add(feedbackPanel);
    }

        public Gender getGender() {
                return gender;
        }

        public void setGender(Gender gender) {
                this.gender = gender;
        }
 }

 ---

Re: radio group stated not updated via AJAX. Possible bug?

2010-12-30 Thread Ernesto Reinaldo Barreiro
Igor,

Thanks for your answer. Yes, I thought about that possibility but
somehow it seems weird to me that you have to call clearinput() to get
the component update its state based on the model value: in particular
because other form components do not need that trick to work properly.
 Would the override

 public boolean isInputNullable() {
return false;
 }

have any other (undesirable) side effects? This "solution" has the
advantage that I can roll out my own AjaxUpdatebleRadioGroup and thus
I do not have remember to call clearinput() over and over.

Regards,

Ernesto

On Thu, Dec 30, 2010 at 3:29 PM, Igor Vaynberg  wrote:
> call clearinput() on the radiogroup so it refreshes based on new model
> value you set.
>
> -igor
>
> On Thu, Dec 30, 2010 at 4:57 AM, Ernesto Reinaldo Barreiro
>  wrote:
>> I forgot to mentions this is with wicket 1.4.x.
>>
>> Ernesto
>>
>> On Thu, Dec 30, 2010 at 1:53 PM, Ernesto Reinaldo Barreiro
>>  wrote:
>>> Hi,
>>>
>>> Apologies for the somewhat lengthy e-mail.
>>>
>>> Consider the following situation
>>>
>>> 1-I have a form with a RadioGroup, several Radio buttons, an AJAX
>>> submit button and some AJAX links that fetch "information" that can be
>>> used to repaint the form and the RadioGroup.
>>>
>>> In simplified code more or less this.
>>>
>>> public class RadioPage extends WebPage  {
>>>
>>>        private static final long serialVersionUID = 1L;
>>>
>>>        private WebMarkupContainer context;
>>>
>>>        private Gender gender;
>>>
>>>        private FeedbackPanel feedbackPanel;
>>>
>>>        public RadioPage() {
>>>              Form form = new Form("form");
>>>              add(form);
>>>              context = new WebMarkupContainer("context");
>>>              context.setOutputMarkupId(true);
>>>              form.add(context);
>>>
>>>
>>>                RadioGroup gender = new RadioGroup("gender",
>>>                                new PropertyModel(this,"gender"));
>>>
>>>                gender.setRequired(true);
>>>                context.add(gender);
>>>                // hombre
>>>                Radio sexoH = new Radio("male", new
>>> Model(Gender.MALE), gender);
>>>                gender.add(sexoH);
>>>
>>>                Radio sexoM = new Radio("female", new
>>> Model(Gender.FEMALE), gender);
>>>                gender.add(sexoM);
>>>
>>>                add(new AjaxLink("makeMale") {
>>>
>>>                        private static final long serialVersionUID = 1L;
>>>
>>>                       �...@override
>>>                        public void onClick(AjaxRequestTarget target) {
>>>                                RadioPage.this.gender = Gender.MALE;
>>>                                if(target != null) {
>>>                                        target.addComponent(context);
>>>                                }
>>>                        }
>>>                });
>>>
>>>                add(new AjaxLink("makeFemale") {
>>>
>>>                        private static final long serialVersionUID = 1L;
>>>
>>>                       �...@override
>>>                        public void onClick(AjaxRequestTarget target) {
>>>                                RadioPage.this.gender = Gender.FEMALE;
>>>                                if(target != null) {
>>>                                        target.addComponent(context);
>>>                                }
>>>                        }
>>>                });
>>>
>>>                form.add(new AjaxSubmitLink("submit") {
>>>
>>>                        private static final long serialVersionUID = 1L;
>>>
>>>                       �...@override
>>>                        protected void onSubmit(AjaxRequestTarget target, 
>>> Form form) {
>>>                                form.info("Gender was set to " + 
>>> RadioPage.this.gender);
>>>                                target.addComponent(feedbackPanel);
>>>                        }
>>>
>>>                       �...@override
>>>                        protected void onError(AjaxRequestTarget target, 
>>> Form form) {
>>>                                target.addComponent(feedbackPanel);
>>>                        }
>>>                });
>>>
>>>                feedbackPanel = new FeedbackPanel("feedback");
>>>                feedbackPanel.setOutputMarkupId(true);
>>>                add(feedbackPanel);
>>>    }
>>>
>>>        public Gender getGender() {
>>>                return gender;
>>>        }
>>>
>>>        public void setGender(Gender gender) {
>>>                this.gender = gender;
>>>        }
>>> }
>>>
>>> -RadioPage.html--
>>>
>>> >> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
>>>    
>>>        Test
>>>    
>>>    
>>>        
>>>                
>>>                        
>>>                                        >> wicket:id="male"/>
>>>                                        Male
>>>                                        >> wicket:id="female"/>
>>>                              

Re: radio group stated not updated via AJAX. Possible bug?

2010-12-30 Thread Igor Vaynberg
call clearinput() on the radiogroup so it refreshes based on new model
value you set.

-igor

On Thu, Dec 30, 2010 at 4:57 AM, Ernesto Reinaldo Barreiro
 wrote:
> I forgot to mentions this is with wicket 1.4.x.
>
> Ernesto
>
> On Thu, Dec 30, 2010 at 1:53 PM, Ernesto Reinaldo Barreiro
>  wrote:
>> Hi,
>>
>> Apologies for the somewhat lengthy e-mail.
>>
>> Consider the following situation
>>
>> 1-I have a form with a RadioGroup, several Radio buttons, an AJAX
>> submit button and some AJAX links that fetch "information" that can be
>> used to repaint the form and the RadioGroup.
>>
>> In simplified code more or less this.
>>
>> public class RadioPage extends WebPage  {
>>
>>        private static final long serialVersionUID = 1L;
>>
>>        private WebMarkupContainer context;
>>
>>        private Gender gender;
>>
>>        private FeedbackPanel feedbackPanel;
>>
>>        public RadioPage() {
>>              Form form = new Form("form");
>>              add(form);
>>              context = new WebMarkupContainer("context");
>>              context.setOutputMarkupId(true);
>>              form.add(context);
>>
>>
>>                RadioGroup gender = new RadioGroup("gender",
>>                                new PropertyModel(this,"gender"));
>>
>>                gender.setRequired(true);
>>                context.add(gender);
>>                // hombre
>>                Radio sexoH = new Radio("male", new
>> Model(Gender.MALE), gender);
>>                gender.add(sexoH);
>>
>>                Radio sexoM = new Radio("female", new
>> Model(Gender.FEMALE), gender);
>>                gender.add(sexoM);
>>
>>                add(new AjaxLink("makeMale") {
>>
>>                        private static final long serialVersionUID = 1L;
>>
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                RadioPage.this.gender = Gender.MALE;
>>                                if(target != null) {
>>                                        target.addComponent(context);
>>                                }
>>                        }
>>                });
>>
>>                add(new AjaxLink("makeFemale") {
>>
>>                        private static final long serialVersionUID = 1L;
>>
>>                       �...@override
>>                        public void onClick(AjaxRequestTarget target) {
>>                                RadioPage.this.gender = Gender.FEMALE;
>>                                if(target != null) {
>>                                        target.addComponent(context);
>>                                }
>>                        }
>>                });
>>
>>                form.add(new AjaxSubmitLink("submit") {
>>
>>                        private static final long serialVersionUID = 1L;
>>
>>                       �...@override
>>                        protected void onSubmit(AjaxRequestTarget target, 
>> Form form) {
>>                                form.info("Gender was set to " + 
>> RadioPage.this.gender);
>>                                target.addComponent(feedbackPanel);
>>                        }
>>
>>                       �...@override
>>                        protected void onError(AjaxRequestTarget target, 
>> Form form) {
>>                                target.addComponent(feedbackPanel);
>>                        }
>>                });
>>
>>                feedbackPanel = new FeedbackPanel("feedback");
>>                feedbackPanel.setOutputMarkupId(true);
>>                add(feedbackPanel);
>>    }
>>
>>        public Gender getGender() {
>>                return gender;
>>        }
>>
>>        public void setGender(Gender gender) {
>>                this.gender = gender;
>>        }
>> }
>>
>> -RadioPage.html--
>>
>> > xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
>>    
>>        Test
>>    
>>    
>>        
>>                
>>                        
>>                                        
>>                                        Male
>>                                        > wicket:id="female"/>
>>                                        Female
>>                                
>>                        
>>                        
>>                
>>                
>>                
>>                        Updating RadioGroup via AJAX does not work:
>>                        Make male and > wicket:id="makeFemale">Make female.
>>                
>>    
>> 
>>
>> and
>>
>> public enum Gender {
>>        FEMALE,
>>        MALE;
>> }
>>
>>
>> 2-You click on the AJAX submit button without selecting any of the
>> radio buttons. This seems to set the rawinput of  RadioGroup to null.
>> 3-You click now on one of the AJAX links (Make male or Make female in
>> the example) in order to fetch the "information"  and repaint the form
>> via AJAX. But radios checked condition is not updated:-(
>>
>> This seems to be be

Re: radio group stated not updated via AJAX. Possible bug?

2010-12-30 Thread Ernesto Reinaldo Barreiro
I forgot to mentions this is with wicket 1.4.x.

Ernesto

On Thu, Dec 30, 2010 at 1:53 PM, Ernesto Reinaldo Barreiro
 wrote:
> Hi,
>
> Apologies for the somewhat lengthy e-mail.
>
> Consider the following situation
>
> 1-I have a form with a RadioGroup, several Radio buttons, an AJAX
> submit button and some AJAX links that fetch "information" that can be
> used to repaint the form and the RadioGroup.
>
> In simplified code more or less this.
>
> public class RadioPage extends WebPage  {
>
>        private static final long serialVersionUID = 1L;
>
>        private WebMarkupContainer context;
>
>        private Gender gender;
>
>        private FeedbackPanel feedbackPanel;
>
>        public RadioPage() {
>              Form form = new Form("form");
>              add(form);
>              context = new WebMarkupContainer("context");
>              context.setOutputMarkupId(true);
>              form.add(context);
>
>
>                RadioGroup gender = new RadioGroup("gender",
>                                new PropertyModel(this,"gender"));
>
>                gender.setRequired(true);
>                context.add(gender);
>                // hombre
>                Radio sexoH = new Radio("male", new
> Model(Gender.MALE), gender);
>                gender.add(sexoH);
>
>                Radio sexoM = new Radio("female", new
> Model(Gender.FEMALE), gender);
>                gender.add(sexoM);
>
>                add(new AjaxLink("makeMale") {
>
>                        private static final long serialVersionUID = 1L;
>
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                RadioPage.this.gender = Gender.MALE;
>                                if(target != null) {
>                                        target.addComponent(context);
>                                }
>                        }
>                });
>
>                add(new AjaxLink("makeFemale") {
>
>                        private static final long serialVersionUID = 1L;
>
>                       �...@override
>                        public void onClick(AjaxRequestTarget target) {
>                                RadioPage.this.gender = Gender.FEMALE;
>                                if(target != null) {
>                                        target.addComponent(context);
>                                }
>                        }
>                });
>
>                form.add(new AjaxSubmitLink("submit") {
>
>                        private static final long serialVersionUID = 1L;
>
>                       �...@override
>                        protected void onSubmit(AjaxRequestTarget target, 
> Form form) {
>                                form.info("Gender was set to " + 
> RadioPage.this.gender);
>                                target.addComponent(feedbackPanel);
>                        }
>
>                       �...@override
>                        protected void onError(AjaxRequestTarget target, 
> Form form) {
>                                target.addComponent(feedbackPanel);
>                        }
>                });
>
>                feedbackPanel = new FeedbackPanel("feedback");
>                feedbackPanel.setOutputMarkupId(true);
>                add(feedbackPanel);
>    }
>
>        public Gender getGender() {
>                return gender;
>        }
>
>        public void setGender(Gender gender) {
>                this.gender = gender;
>        }
> }
>
> -RadioPage.html--
>
>  xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>
>    
>        Test
>    
>    
>        
>                
>                        
>                                        
>                                        Male
>                                         wicket:id="female"/>
>                                        Female
>                                
>                        
>                        
>                
>                
>                
>                        Updating RadioGroup via AJAX does not work:
>                        Make male and  wicket:id="makeFemale">Make female.
>                
>    
> 
>
> and
>
> public enum Gender {
>        FEMALE,
>        MALE;
> }
>
>
> 2-You click on the AJAX submit button without selecting any of the
> radio buttons. This seems to set the rawinput of  RadioGroup to null.
> 3-You click now on one of the AJAX links (Make male or Make female in
> the example) in order to fetch the "information"  and repaint the form
> via AJAX. But radios checked condition is not updated:-(
>
> This seems to be because of following code on Radio.onComponentTag():
>
>                // compare the model objects of the group and self, if
> the same add the
>                // checked attribute, first check if there was a raw input on 
> the group.
>                if (group.hasRawInput())
>                {
>                   

radio group stated not updated via AJAX. Possible bug?

2010-12-30 Thread Ernesto Reinaldo Barreiro
Hi,

Apologies for the somewhat lengthy e-mail.

Consider the following situation

1-I have a form with a RadioGroup, several Radio buttons, an AJAX
submit button and some AJAX links that fetch "information" that can be
used to repaint the form and the RadioGroup.

In simplified code more or less this.

public class RadioPage extends WebPage  {

private static final long serialVersionUID = 1L;

private WebMarkupContainer context;

private Gender gender;

private FeedbackPanel feedbackPanel;

public RadioPage() {
  Form form = new Form("form");
  add(form);
  context = new WebMarkupContainer("context");
  context.setOutputMarkupId(true);
  form.add(context);


RadioGroup gender = new RadioGroup("gender",
new PropertyModel(this,"gender"));

gender.setRequired(true);
context.add(gender);
// hombre
Radio sexoH = new Radio("male", new
Model(Gender.MALE), gender);
gender.add(sexoH);

Radio sexoM = new Radio("female", new
Model(Gender.FEMALE), gender);
gender.add(sexoM);

add(new AjaxLink("makeMale") {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
RadioPage.this.gender = Gender.MALE;
if(target != null) {
target.addComponent(context);
}
}
});

add(new AjaxLink("makeFemale") {

private static final long serialVersionUID = 1L;

@Override
public void onClick(AjaxRequestTarget target) {
RadioPage.this.gender = Gender.FEMALE;
if(target != null) {
target.addComponent(context);
}
}
});

form.add(new AjaxSubmitLink("submit") {

private static final long serialVersionUID = 1L;

@Override
protected void onSubmit(AjaxRequestTarget target, 
Form form) {
form.info("Gender was set to " + 
RadioPage.this.gender);
target.addComponent(feedbackPanel);
}

@Override
protected void onError(AjaxRequestTarget target, 
Form form) {
target.addComponent(feedbackPanel);
}
});

feedbackPanel = new FeedbackPanel("feedback");
feedbackPanel.setOutputMarkupId(true);
add(feedbackPanel);
}

public Gender getGender() {
return gender;
}

public void setGender(Gender gender) {
this.gender = gender;
}
}

-RadioPage.html--

http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd";>

Test






Male

Female


   



Updating RadioGroup via AJAX does not work:
Make male and Make female.




and

public enum Gender {
FEMALE,
MALE;   
}


2-You click on the AJAX submit button without selecting any of the
radio buttons. This seems to set the rawinput of  RadioGroup to null.
3-You click now on one of the AJAX links (Make male or Make female in
the example) in order to fetch the "information"  and repaint the form
via AJAX. But radios checked condition is not updated:-(

This seems to be because of following code on Radio.onComponentTag():

// compare the model objects of the group and self, if
the same add the
// checked attribute, first check if there was a raw input on 
the group.
if (group.hasRawInput())
{
String rawInput = group.getRawInput();
if (rawInput != null && rawInput.eq