How to bookmark an form with file upload input

2009-01-27 Thread Trevor Campbell
I have a wicket application that has a simple form with a file upload 
capability.  I would now like to allow to extend the application by 
allowing an application on a device to send me the form and the 
application to return some XML.


I have easily built a page to return the XML and if I invoke with a 
simple URL (GET) using parameters, but to get a fileupload I need (I 
think I need) a multipart mime form.


The input form would be a simple as:
html 
body
 form wicket:id=analyzeForm action=app/getxml method=post
 input wicket:id=fileUpload id=fileUpload type=file/
 input type=submit value=Analyze/
 /form
/body
/html

I mount the bookmarkable page, e.g . mountBookmarkablePage(/getxml, 
GetAnalysisXML.class);  but when I submit the form, wicket renders a new 
version of the page (i.e. the real wicket page), rather than processing 
the POST message.





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



Resource download - How to forward to resource?

2009-01-11 Thread Trevor Campbell
I am having trouble working out how to download a dynamically generated 
file.


I have a simple form that captures and number of pieces of information 
and then generates a piece of text that I want to send to the user as a 
text file download.


The form is a standard Form in a page extending WebPage.

Following the Upload/Download page in the wiki, I have created a resouce 
extending DynamicWebResource, but cannot see how to redirect to it.


I would normally just do a setResponsePage(new MyPage(dshs)) but that 
doesn't work as the resource is not a Page.


How do I redirect to send My resource?  (I don't want to store the file 
and make the user click a link and all that stuff)


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



Re: Resource download - How to forward to resource? Solved

2009-01-11 Thread Trevor Campbell

Trevor Campbell wrote:
I am having trouble working out how to download a dynamically 
generated file.


I have a simple form that captures and number of pieces of information 
and then generates a piece of text that I want to send to the user as 
a text file download.


The form is a standard Form in a page extending WebPage.

Following the Upload/Download page in the wiki, I have created a 
resouce extending DynamicWebResource, but cannot see how to redirect 
to it.


I would normally just do a setResponsePage(new MyPage(dshs)) but 
that doesn't work as the resource is not a Page.


How do I redirect to send My resource?  (I don't want to store the 
file and make the user click a link and all that stuff)


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


I was able to solve my issue by ignoring all the stuff in the wiki about 
upload/download and just doing the following


   setRedirect(false);
   WebResponse response = (WebResponse) getResponse();
   response.setAttachmentHeader(nyFile.txt);
   response.setContentLength(myText.length());
   response.setLastModifiedTime(Time.now());
   response.setContentType(text/plain);
   response.write(myText);
   response.close();


I am not sure if it is the most elegant but it works for me.


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



Need help with GridView and checkboxes.

2008-03-18 Thread Trevor Campbell

I have a form containing a GridView with a PagingNavigator.
Within each cell I have an image and a CheckBox.  When a user submits 
the form I collect all the image refs from the selected cells and 
process them.


My problem is I would like to do this across multiple pages.  So the user
scenario is:
A user goes through the pages using the navigator and selects, using the 
checkboxes, what images they like and then presses a select button.


Unfortunately the selections are not preserved when I use a 
PagingNavigator on the form.  A paging navigator renders links rather 
than a submit, so any selections are lost.


Any ideas how to get around this??


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need help with GridView and checkboxes.

2008-03-18 Thread Trevor Campbell




Thanks Maurice,

I was able to get this to work by copying PagingNavigator,
PagingNavigation, PagingNavigationLink and
PagingNavigationIncrementLink.

The only substantial changes I made were to make PagingNavigationLink
and PagingNavigationIncrementLink extend SubmitLink and then in the
onsubit to do some horrible stuff to update the models.

 public void onSubmit()
 {
 pageable.setCurrentPage(getPageNumber());
 FormComponent.IVisitor visitor = new
FormComponent.IVisitor(){
 @Override
 public Object formComponent(IFormVisitorParticipant
formComponent)
 {
 if (formComponent instanceof FormComponent)
 {
 ((FormComponent) formComponent).validate();
 ((FormComponent)
formComponent).updateModel();
 }
 if (formComponent.processChildren())
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL;
 }
 else
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
 }
 }
 };
 getForm().visitFormComponents(visitor);
 }

I still haven't got the autoEnable and linksTo functionality working,
but it is just some cosmetics.

Trev

Maurice Marrink wrote:

  That is a known issue, unfortunately you will need to create your own
version of a submittingpagingnavigator. The api for those classes is
however not very extendable friendly so you probably end up
copy-pasting large portions of code.
I believe Martijn is planning on refactoring that component, just not
for wicket 1.3.x.

As an alternative you might be able to use ajaxcheckboxes?

Maurice

On Tue, Mar 18, 2008 at 12:30 PM, Trevor Campbell [EMAIL PROTECTED] wrote:
  
  
I have a form containing a GridView with a PagingNavigator.
 Within each cell I have an image and a CheckBox.  When a user submits
 the form I collect all the image refs from the selected cells and
 process them.

 My problem is I would like to do this across multiple pages.  So the user
 scenario is:
 A user goes through the pages using the navigator and selects, using the
 checkboxes, what images they like and then presses a select button.

 Unfortunately the selections are not preserved when I use a
 PagingNavigator on the form.  A paging navigator renders links rather
 than a submit, so any selections are lost.

 Any ideas how to get around this??


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need help with GridView and checkboxes.

2008-03-18 Thread Trevor Campbell




I should have added, I needed to setDefaultFormProcessing(false)
because I don't want to process the form while just paging forward and
without the DefaultFormProcessing, the model wasn't updating.

Is this wrong? or am I missing something else.

Igor Vaynberg wrote:

  you shouldnt have to do any of that form updating yourself...it should
all be done before your link's onsubmit is called, there is a reason
why its called a submitlink

-igor


On Tue, Mar 18, 2008 at 7:47 PM, Trevor Campbell [EMAIL PROTECTED] wrote:
  
  
 Thanks Maurice,

 I was able to get this to work by copying PagingNavigator,
PagingNavigation, PagingNavigationLink and PagingNavigationIncrementLink.

 The only substantial changes I made were to make PagingNavigationLink and
PagingNavigationIncrementLink extend SubmitLink and then in the onsubit to
do some horrible stuff to update the models.

 public void onSubmit()
 {
 pageable.setCurrentPage(getPageNumber());
 FormComponent.IVisitor visitor = new
FormComponent.IVisitor(){
 @Override
 public Object formComponent(IFormVisitorParticipant
formComponent)
 {
 if (formComponent instanceof FormComponent)
 {
 ((FormComponent) formComponent).validate();
 ((FormComponent) formComponent).updateModel();
 }
 if (formComponent.processChildren())
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL;
 }
 else
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
 }
 }
 };
 getForm().visitFormComponents(visitor);
 }

 I still haven't got the autoEnable and linksTo functionality working,  but
it is just some cosmetics.

 Trev

 Maurice Marrink wrote:

 That is a known issue, unfortunately you will need to create your own
version of a submittingpagingnavigator. The api for those classes is
however not very extendable friendly so you probably end up
copy-pasting large portions of code.
I believe Martijn is planning on refactoring that component, just not
for wicket 1.3.x.

As an alternative you might be able to use ajaxcheckboxes?

Maurice

On Tue, Mar 18, 2008 at 12:30 PM, Trevor Campbell [EMAIL PROTECTED]
wrote:


 I have a form containing a GridView with a PagingNavigator.
 Within each cell I have an image and a CheckBox. When a user submits
 the form I collect all the image refs from the selected cells and
 process them.

 My problem is I would like to do this across multiple pages. So the user
 scenario is:
 A user goes through the pages using the navigator and selects, using the
 checkboxes, what images they like and then presses a select button.

 Unfortunately the selections are not preserved when I use a
 PagingNavigator on the form. A paging navigator renders links rather
 than a submit, so any selections are lost.

 Any ideas how to get around this??


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



 - To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]

  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Need help with GridView and checkboxes.

2008-03-18 Thread Trevor Campbell




I am not really doing the normal form processing in the navigation.
The form has a navigator, just for showing more parts of the GridView,
it also has a submit button to process the users request after they
have selected items on one or more pages, So when they use the
navigator, all I do is update the component models, when they press the
submit button, I validate and process the whole form,

But I see your point. I suppose I could pull the code from the form
submit and process that in the onSubmit method of the default form
submit button. I will give that a try. But that might be a little
obscure if someone else were to use my components.



Igor Vaynberg wrote:

  so you call setdefaultformprocessing(false) and yet update the form
yourself? that is the same as leaving setdefaultformprocessing(true)

-igor


On Tue, Mar 18, 2008 at 8:00 PM, Trevor Campbell [EMAIL PROTECTED] wrote:
  
  
 I should have added, I needed to setDefaultFormProcessing(false) because I
don't want to process the form while just paging forward and without the
DefaultFormProcessing, the model wasn't updating.

 Is this wrong? or am I missing something else.



 Igor Vaynberg wrote:
 you shouldnt have to do any of that form updating yourself...it should
all be done before your link's onsubmit is called, there is a reason
why its called a submitlink

-igor


On Tue, Mar 18, 2008 at 7:47 PM, Trevor Campbell [EMAIL PROTECTED]
wrote:


 Thanks Maurice,

 I was able to get this to work by copying PagingNavigator,
PagingNavigation, PagingNavigationLink and PagingNavigationIncrementLink.

 The only substantial changes I made were to make PagingNavigationLink and
PagingNavigationIncrementLink extend SubmitLink and then in the onsubit to
do some horrible stuff to update the models.

 public void onSubmit()
 {
 pageable.setCurrentPage(getPageNumber());
 FormComponent.IVisitor visitor = new
FormComponent.IVisitor(){
 @Override
 public Object formComponent(IFormVisitorParticipant
formComponent)
 {
 if (formComponent instanceof FormComponent)
 {
 ((FormComponent) formComponent).validate();
 ((FormComponent) formComponent).updateModel();
 }
 if (formComponent.processChildren())
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL;
 }
 else
 {
 return
Component.IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
 }
 }
 };
 getForm().visitFormComponents(visitor);
 }

 I still haven't got the autoEnable and linksTo functionality working, but
it is just some cosmetics.

 Trev

 Maurice Marrink wrote:

 That is a known issue, unfortunately you will need to create your own
version of a submittingpagingnavigator. The api for those classes is
however not very extendable friendly so you probably end up
copy-pasting large portions of code.
I believe Martijn is planning on refactoring that component, just not
for wicket 1.3.x.

As an alternative you might be able to use ajaxcheckboxes?

Maurice

On Tue, Mar 18, 2008 at 12:30 PM, Trevor Campbell [EMAIL PROTECTED]
wrote:


 I have a form containing a GridView with a PagingNavigator.
 Within each cell I have an image and a CheckBox. When a user submits
 the form I collect all the image refs from the selected cells and
 process them.

 My problem is I would like to do this across multiple pages. So the user
 scenario is:
 A user goes through the pages using the navigator and selects, using the
 checkboxes, what images they like and then presses a select button.

 Unfortunately the selections are not preserved when I use a
 PagingNavigator on the form. A paging navigator renders links rather
 than a submit, so any selections are lost.

 Any ideas how to get around this??


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



 - To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]

 -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





 - To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]

  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]