You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2011/08/27 04:40:54 UTC
Opening modal window at file upload completion
Is it possible to open a modal window after file upload completion.
Even though I'm using the AJAX file upload which shows the progress bar
the submit handler doesn't contain a 'target' parameter required to
bring up a modal.
protected void onSubmit()
{
final FileUpload upload = fileUploadField.getFileUpload();
if (upload != null)
{
// Create a new file
.....
}
The reason is that I do some processing of the file after uploading and
I want to display to the user the results of that processing. Any ideas?
Re: 1.5: Content cannot be added below Body inside Border?
Posted by bh...@actrix.gen.nz.
Thanks Martin, it works.
On Sun, 28 Aug 2011 14:35:02 +0300, you wrote:
>Border.add() delegates to .addToBodyContainer().
>Use .addToBorder() to add something that is ot of the body.
>It is in the migration guide
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: 1.5: Content cannot be added below Body inside Border?
Posted by Martin Grigorov <mg...@apache.org>.
Border.add() delegates to .addToBodyContainer().
Use .addToBorder() to add something that is ot of the body.
It is in the migration guide
On Sun, Aug 28, 2011 at 2:29 PM, <bh...@actrix.gen.nz> wrote:
>
>
> public class FormFeedbackBelowBorder extends Border implements
> IFeedback {
>
> private static final long serialVersionUID = 1L;
> private String inputStyleClassNormal;
> private String inputStyleClassFeedback;
> private MyFeedbackLabel feedbackLabel;
> // feedbackContainer: So we can make it invisible.
> private WebMarkupContainer feedbackContainer;
> // component: Required for filters
> private Component component;
>
> public FormFeedbackBelowBorder(final String id, Component
> component,
> final String inputStyleClassNormal, final String
> inputStyleClassFeedback) {
> super(id);
> this.component = component;
> this.inputStyleClassNormal = inputStyleClassNormal;
> this.inputStyleClassFeedback = inputStyleClassFeedback;
> // Insert component into <wicket:body/> of this container:
> this.getBodyContainer().add(component);
> // MarkupContainer is required so that the <br/> can be hidden
> if no
> // feedback is shown
> this.feedbackContainer =
> new WebMarkupContainer("feedbackContainer");
> this.feedbackLabel = new MyFeedbackLabel("feedbackLabel",
> component);
> this.feedbackContainer.add(this.feedbackLabel);
> add(this.feedbackContainer);
> }
>
> Regards,
>
> Bernard
>
>
>
>
> On Sun, 28 Aug 2011 14:18:34 +0300, you wrote:
>
>>it should be possible
>>show the java code
>>
>>On Sun, Aug 28, 2011 at 2:19 PM, <bh...@actrix.gen.nz> wrote:
>>> Hi,
>>>
>>> The following markup is used to stuff a form component inside the body
>>> of a border where validation feedback is displayed below the form
>>> component:
>>>
>>> <wicket:border>
>>> <wicket:body>Form Component</wicket:body>
>>> <!-- feedbackContainer because of the <br/> tag that has to be
>>> removed
>>> if feedbackLabel is empty -->
>>> <span wicket:id = "feedbackContainer"><br/>
>>> <span wicket:id="feedbackLabel">Feedback here</span>
>>> </span>
>>> </wicket:border>
>>>
>>> In 1.4, this works as expected.
>>>
>>> In 1.5, I get an error:
>>>
>>> Unable to find component with id 'feedbackContainer' in
>>> [FormFeedbackBelowBorder [Component id = emailFeedback]]
>>> Expected:
>>> 'formPanel:registerForm:emailFeedback.feedbackContainer'.
>>> Found with similar names:
>>> 'formPanel:registerForm:emailFeedback:emailFeedback_body:feedbackContainer'
>>>
>>> It looks like Wicket thinks that the feedbackContainer is inside the
>>> bodyContainer which it obviously isn't.
>>>
>>> Is it no longer possible in 1.5 to add wicket tags inside
>>> <wicket:border> but outside its <wicket:body>?
>>>
>>> Thanks,
>>>
>>> Bernard
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: 1.5: Content cannot be added below Body inside Border?
Posted by bh...@actrix.gen.nz.
public class FormFeedbackBelowBorder extends Border implements
IFeedback {
private static final long serialVersionUID = 1L;
private String inputStyleClassNormal;
private String inputStyleClassFeedback;
private MyFeedbackLabel feedbackLabel;
// feedbackContainer: So we can make it invisible.
private WebMarkupContainer feedbackContainer;
// component: Required for filters
private Component component;
public FormFeedbackBelowBorder(final String id, Component
component,
final String inputStyleClassNormal, final String
inputStyleClassFeedback) {
super(id);
this.component = component;
this.inputStyleClassNormal = inputStyleClassNormal;
this.inputStyleClassFeedback = inputStyleClassFeedback;
// Insert component into <wicket:body/> of this container:
this.getBodyContainer().add(component);
// MarkupContainer is required so that the <br/> can be hidden
if no
// feedback is shown
this.feedbackContainer =
new WebMarkupContainer("feedbackContainer");
this.feedbackLabel = new MyFeedbackLabel("feedbackLabel",
component);
this.feedbackContainer.add(this.feedbackLabel);
add(this.feedbackContainer);
}
Regards,
Bernard
On Sun, 28 Aug 2011 14:18:34 +0300, you wrote:
>it should be possible
>show the java code
>
>On Sun, Aug 28, 2011 at 2:19 PM, <bh...@actrix.gen.nz> wrote:
>> Hi,
>>
>> The following markup is used to stuff a form component inside the body
>> of a border where validation feedback is displayed below the form
>> component:
>>
>> <wicket:border>
>> <wicket:body>Form Component</wicket:body>
>> <!-- feedbackContainer because of the <br/> tag that has to be
>> removed
>> if feedbackLabel is empty -->
>> <span wicket:id = "feedbackContainer"><br/>
>> <span wicket:id="feedbackLabel">Feedback here</span>
>> </span>
>> </wicket:border>
>>
>> In 1.4, this works as expected.
>>
>> In 1.5, I get an error:
>>
>> Unable to find component with id 'feedbackContainer' in
>> [FormFeedbackBelowBorder [Component id = emailFeedback]]
>> Expected:
>> 'formPanel:registerForm:emailFeedback.feedbackContainer'.
>> Found with similar names:
>> 'formPanel:registerForm:emailFeedback:emailFeedback_body:feedbackContainer'
>>
>> It looks like Wicket thinks that the feedbackContainer is inside the
>> bodyContainer which it obviously isn't.
>>
>> Is it no longer possible in 1.5 to add wicket tags inside
>> <wicket:border> but outside its <wicket:body>?
>>
>> Thanks,
>>
>> Bernard
>>
>> ---------------------------------------------------------------------
>> 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: 1.5: Content cannot be added below Body inside Border?
Posted by Martin Grigorov <mg...@apache.org>.
it should be possible
show the java code
On Sun, Aug 28, 2011 at 2:19 PM, <bh...@actrix.gen.nz> wrote:
> Hi,
>
> The following markup is used to stuff a form component inside the body
> of a border where validation feedback is displayed below the form
> component:
>
> <wicket:border>
> <wicket:body>Form Component</wicket:body>
> <!-- feedbackContainer because of the <br/> tag that has to be
> removed
> if feedbackLabel is empty -->
> <span wicket:id = "feedbackContainer"><br/>
> <span wicket:id="feedbackLabel">Feedback here</span>
> </span>
> </wicket:border>
>
> In 1.4, this works as expected.
>
> In 1.5, I get an error:
>
> Unable to find component with id 'feedbackContainer' in
> [FormFeedbackBelowBorder [Component id = emailFeedback]]
> Expected:
> 'formPanel:registerForm:emailFeedback.feedbackContainer'.
> Found with similar names:
> 'formPanel:registerForm:emailFeedback:emailFeedback_body:feedbackContainer'
>
> It looks like Wicket thinks that the feedbackContainer is inside the
> bodyContainer which it obviously isn't.
>
> Is it no longer possible in 1.5 to add wicket tags inside
> <wicket:border> but outside its <wicket:body>?
>
> Thanks,
>
> Bernard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
1.5: Content cannot be added below Body inside Border?
Posted by bh...@actrix.gen.nz.
Hi,
The following markup is used to stuff a form component inside the body
of a border where validation feedback is displayed below the form
component:
<wicket:border>
<wicket:body>Form Component</wicket:body>
<!-- feedbackContainer because of the <br/> tag that has to be
removed
if feedbackLabel is empty -->
<span wicket:id = "feedbackContainer"><br/>
<span wicket:id="feedbackLabel">Feedback here</span>
</span>
</wicket:border>
In 1.4, this works as expected.
In 1.5, I get an error:
Unable to find component with id 'feedbackContainer' in
[FormFeedbackBelowBorder [Component id = emailFeedback]]
Expected:
'formPanel:registerForm:emailFeedback.feedbackContainer'.
Found with similar names:
'formPanel:registerForm:emailFeedback:emailFeedback_body:feedbackContainer'
It looks like Wicket thinks that the feedbackContainer is inside the
bodyContainer which it obviously isn't.
Is it no longer possible in 1.5 to add wicket tags inside
<wicket:border> but outside its <wicket:body>?
Thanks,
Bernard
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Opening modal window at file upload completion
Posted by Janos Cserep <cs...@metaprime.hu>.
You can try using Uploadify from code.google.com/p/jqwicket/, which lets you
put event handlers on successful completion. You need to write a separate
servlet to handle upload though, but it's quite straightforward. One small
trick is overriding getEventHandler() so you can pass the javascript
generated to call the behaviour from other javascript components. The
example below uses a uuid to communicate between the upload form and the
servlet.
// ajax behaviour added to parent as bogus "onNever" event
handler
OnComplete onComplete = new OnComplete("onNever", ip, uuid);
wmc.add(onComplete);
wmc.add(new UploadifyWebMarkupContainer("upload", new
UploadifyOptions().auto(true).multi(false).scriptAccess("always").
script(getRequest().getRelativePathPrefixToContextRoot()
+ "upload?uuid=" + uuid).onCompleteEvent(onComplete.getEventHandler())));
...
/**
* AJAX behaviour fired when upload is ready
*/
public class OnComplete extends AjaxEventBehavior {
Picture picture;
String uuid;
public OnComplete(String event, Picture picture, String uuid) {
super(event);
this.picture = picture;
this.uuid = uuid;
}
public String getUuid() {
return uuid;
}
@Override
protected void onEvent(AjaxRequestTarget target) {
// servlet stores uploaded image
byte[] bytes = UploadifyServlet.getAndRemoveBytes(uuid);
if (bytes != null) {
PhotoUtil.handleImageUpload(bytes, picture);
}
target.addComponent(getComponent().getParent().getParent());
}
// need to be public
@Override
public CharSequence getEventHandler() {
return super.getEventHandler();
}
}
On Sat, Aug 27, 2011 at 4:40 AM, Chris Colman
<ch...@stepaheadsoftware.com>wrote:
> Is it possible to open a modal window after file upload completion.
>
> Even though I'm using the AJAX file upload which shows the progress bar
> the submit handler doesn't contain a 'target' parameter required to
> bring up a modal.
>
> protected void onSubmit()
> {
> final FileUpload upload = fileUploadField.getFileUpload();
> if (upload != null)
> {
> // Create a new file
> .....
> }
>
> The reason is that I do some processing of the file after uploading and
> I want to display to the user the results of that processing. Any ideas?
>
>