Re: Feedback panel don't show messages of child component

2011-08-23 Thread Florian B.
Hi,

you're right I found the following message:

/WARN  - WebSession - Component-targetted feedback message
was left unrendered. This could be because you are missing a FeedbackPanel
on the page.  Message: [FeedbackMessage message =
StringResourceModel[key:form.error.storeDoesntExist,default:null,params:[]],
reporter = remove, level = ERROR]/

I'm wondering why it says it couldn't find a FeedbackPanel, as I'm pretty
sure there's a FeedbackPanel on the page. As I could display messages there
from the panel that contains the FeedbackPanel. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Feedback-panel-don-t-show-messages-of-child-component-tp3759993p3762065.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: Feedback panel don't show messages of child component

2011-08-23 Thread nino martinez wael
You are not doing any ajax are you?

2011/8/23 Florian B. florian.bernst...@gmail.com:
 Hi,

 you're right I found the following message:

 /WARN  - WebSession                 - Component-targetted feedback message
 was left unrendered. This could be because you are missing a FeedbackPanel
 on the page.  Message: [FeedbackMessage message =
 StringResourceModel[key:form.error.storeDoesntExist,default:null,params:[]],
 reporter = remove, level = ERROR]/

 I'm wondering why it says it couldn't find a FeedbackPanel, as I'm pretty
 sure there's a FeedbackPanel on the page. As I could display messages there
 from the panel that contains the FeedbackPanel.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Feedback-panel-don-t-show-messages-of-child-component-tp3759993p3762065.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



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



Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Alexandros Karypidis

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be re-rendered 
using the newly selected locale. This does NOT happen. Instead, only the 
select input box seems to be refreshed to use the new locale, 
whereas the rest of the page content is still rendered using the 
previously selected locale. However, the locale has been changed in the 
Session which can be seen when the user navigates to another page (e.g. 
by clicking on a link), as the new page is rendered using the 
newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

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



Wizard step - adding multiple addresses to one client

2011-08-23 Thread nebojsa.nedic
Hello all,

In second wizard step I would like to have an option to add several
addresses for one client (that is created in the first wizard step). I have
tried several options but none work out.

The best one that I currently have is that I have added additional add
button to the wizard step which is used to add address to the client. That
works OK, but if user fills in all address fields and then clicks Next
instead of add, form will be validated but no address is added (because
add button adds the address to the client). Then I have added additional
form validation (new AbstractFormValidator()) and checked whether at least
one address is added. Because no address is added at the beginning, I always
get an error - good idea .

Now I am thinking to create a component that will have a model [SetAddress
clientAddresses] but I don't know is this a good approach (and even am I
good enough to create this kind of component)? Also, I don't know how to
create component in a way that when I put component.setRequired(true) that
component checks whether there is at least one address added into the model?

Any ideas how to solve this kind of use case?

Thank you very much.

Regards,
Nebojsa

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wizard-step-adding-multiple-addresses-to-one-client-tp3763189p3763189.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: StatelessForm on BookmarkablePage and its action url

2011-08-23 Thread Doug Leeper
Urgghhh.  It does work.  Just have to pass the PageParameters to the super
class in the constructor.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/StatelessForm-on-BookmarkablePage-and-its-action-url-tp3761160p3763192.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



Attach multiple javascript file to a page

2011-08-23 Thread m.ugues
Hallo all.
I'm new to this mailing list.

I'm joking with wicket 1.4.18.
I have this simple problem: I'm trying to attach 2 js files on my page in
this way:

class MyPage extends WebPage {
add(new StyleSheetReference(ui-lightness, getClass(),
css/ui-lightness/jquery-ui-1.8.16.custom.css));

add(new JavaScriptReference(indexController1, getClass(),
js/indexController1.js));
add(new JavaScriptReference(indexController, getClass(),
js/indexController.js));

An the relative html

head

link wicket:id=ui-lightness/
script wicket:id=indexController1/
script wicket:id=indexController/

The javascript file contain 2 alert:

indexController -- alert(Cippa);
indexController1 -- alert(Cippa1);

When I execute this page the problem is that the html seems to be rendered
correctly as you can see:
head

link wicket:id=ui-lightness rel=stylesheet type=text/css
href=resources/com.example.app.MyPage/css/ui-lightness/jquery-ui-1.8.16.custom.css/
  

script wicket:id=indexController1 type=text/javascript
src=resources/com.example.app.MyPage/js/indexController1.js/
script wicket:id=indexController type=text/javascript
src=resources/com.example.app.MyPage/js/indexController.js/

But the behaviour is strange: it's executed only the first javascript, ever.
If I change the order same problem.

Where am I wrong?

Kind regards
Massimo

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Attach-multiple-javascript-file-to-a-page-tp3763258p3763258.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



Cannot render slider inside modal window

2011-08-23 Thread Rodrigo Heffner
Hi all,

I have a modal window and I want to add a jqwicket slider to it. The slider
works normally if it's added directly to my page, but not inside the modal
window (I can inspect the html and see that my WebMarkupContainer is
rendered, but the slider isn't shown). Here's the code:

add(new WebMarkupContainer(slider).add(new SliderBehavior(new
SliderOptions().min(10).max(100).value(20;

div wicket:id=slider/div

I've read this thread
http://apache-wicket.1842946.n4.nabble.com/How-to-access-div-on-wicket-modal-dialog-td2310678.htmlbut
I couldn't work out a solution to my problem yet.

I've also tried using jqwicket's AjaxSlider class, still no luck:

public abstract class AjaxSlider extends WebMarkupContainer {

private static final long serialVersionUID = 1L;

public AjaxSlider(String id) {
super(id);
super.setOutputMarkupId(true);
}

public abstract void onValueChanged(AjaxRequestTarget target,
int newValue);

@Override
protected void onInitialize() {
super.onInitialize();
AbstractDefaultAjaxBehavior ajaxBehavior = new
AbstractDefaultAjaxBehavior() {

private static final long serialVersionUID = 1L;

@Override
protected void respond(AjaxRequestTarget target) {
String sliderValue =
RequestCycle.get().getRequest().getParameter(sv);
if (Utils.isNotBlank(sliderValue)) {
onValueChanged(target, Integer.valueOf(sliderValue));
}
}

//@Override
//public void renderHead(IHeaderResponse response) {
//super.renderHead(response);
//response.renderOnDomReadyJavascript();
//}
};
super.add(ajaxBehavior);
super.add(new SliderBehavior(new
SliderOptions().changeEvent(wicketAjaxGet(
ajaxBehavior,
new MapBuilderString, Object().add(sv,
js(ui.value)).build();
}
}

Thanks in advance,

-- 
Rodrigo H M Bezerra


Sorting Feedback Messages

2011-08-23 Thread Christian Huber

Hi,

I was wondering if there is a way to have feedback messages show up in 
certain order. Like, when you have multiple messages for the user you 
might want to have the most general one (e.g. success/failure) at the 
top and other detail messages shown below.


From what I have seen so far it looks like this is not possible (at 
least not with 1.4.18)


As a default messages are rendered in the order they have been provided, 
so usually you can just collect the messages you want to display and 
then add them at the end of your request in the desired order. But there 
can be circumstances where this is not feasible or at least pretty anoying.


I have seen that a FeedbackPanel can be given a comparator to sort the 
messages but the feedback messages only provide a level field to 
distinguish between info, debug, errror etc. To impose a proper priority 
order one would need a metric orthogonal to message levels preferrably 
represented by a primitive (double would give the biggest freedom here).


The Component class could be extended to provide additional methods like 
Component#info(String message, double priority) and messages which do 
not have a priority get assigned a default value specified in the 
Application class (could be 0 in the standard implementation).


Would this be a useful/sensible addition? Is such a thing planned for 
future releases or maybe already available and I just did not see it?


One workaround/hack to implement this with the current version could be 
to prefix all messages with a numeric string and use a Comparator to 
parse this string and sort accordingly.


Cheers, Chris

--
The Sanity Resort http://sanityresort.blogspot.com/


Re: Sorting Feedback Messages

2011-08-23 Thread Martin Grigorov
I think 
org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(ComparatorFeedbackMessage)
is for that

On Tue, Aug 23, 2011 at 8:10 PM, Christian Huber hub...@butterbrot.org wrote:
 Hi,

 I was wondering if there is a way to have feedback messages show up in
 certain order. Like, when you have multiple messages for the user you might
 want to have the most general one (e.g. success/failure) at the top and
 other detail messages shown below.

 From what I have seen so far it looks like this is not possible (at least
 not with 1.4.18)

 As a default messages are rendered in the order they have been provided, so
 usually you can just collect the messages you want to display and then add
 them at the end of your request in the desired order. But there can be
 circumstances where this is not feasible or at least pretty anoying.

 I have seen that a FeedbackPanel can be given a comparator to sort the
 messages but the feedback messages only provide a level field to distinguish
 between info, debug, errror etc. To impose a proper priority order one would
 need a metric orthogonal to message levels preferrably represented by a
 primitive (double would give the biggest freedom here).

 The Component class could be extended to provide additional methods like
 Component#info(String message, double priority) and messages which do not
 have a priority get assigned a default value specified in the Application
 class (could be 0 in the standard implementation).

 Would this be a useful/sensible addition? Is such a thing planned for future
 releases or maybe already available and I just did not see it?

 One workaround/hack to implement this with the current version could be to
 prefix all messages with a numeric string and use a Comparator to parse this
 string and sort accordingly.

 Cheers, Chris

 --
 The Sanity Resort http://sanityresort.blogspot.com/




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: Attach multiple javascript file to a page

2011-08-23 Thread Martin Grigorov
Try with console.log() instead of alert()

On Tue, Aug 23, 2011 at 7:25 PM, m.ugues m.ug...@gmail.com wrote:
 Hallo all.
 I'm new to this mailing list.

 I'm joking with wicket 1.4.18.
 I have this simple problem: I'm trying to attach 2 js files on my page in
 this way:

 class MyPage extends WebPage {
        add(new StyleSheetReference(ui-lightness, getClass(),
 css/ui-lightness/jquery-ui-1.8.16.custom.css));

        add(new JavaScriptReference(indexController1, getClass(),
 js/indexController1.js));
        add(new JavaScriptReference(indexController, getClass(),
 js/indexController.js));

 An the relative html

 head

                link wicket:id=ui-lightness/
                script wicket:id=indexController1/
                script wicket:id=indexController/

 The javascript file contain 2 alert:

 indexController -- alert(Cippa);
 indexController1 -- alert(Cippa1);

 When I execute this page the problem is that the html seems to be rendered
 correctly as you can see:
 head

                link wicket:id=ui-lightness rel=stylesheet type=text/css
 href=resources/com.example.app.MyPage/css/ui-lightness/jquery-ui-1.8.16.custom.css/

                script wicket:id=indexController1 type=text/javascript
 src=resources/com.example.app.MyPage/js/indexController1.js/
                script wicket:id=indexController type=text/javascript
 src=resources/com.example.app.MyPage/js/indexController.js/

 But the behaviour is strange: it's executed only the first javascript, ever.
 If I change the order same problem.

 Where am I wrong?

 Kind regards
 Massimo

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Attach-multiple-javascript-file-to-a-page-tp3763258p3763258.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





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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



Re: AJAXDownload Example Doesn't Support Content-Disposition (Save As)

2011-08-23 Thread Igor Racic
Hi,

I am not able to get save dialog.

Here is the code:

final AJAXDownload download = new AJAXDownload()
{
@Override
protected IResourceStream getResourceStream()
{
return new StringResourceStream(info.srcString, text/plain);
}
 @Override
protected String getFileName() {
return info.proposedFileName;
}
 };
add(download);

add(new AjaxLinkVoid(download) {
@Override
public void onClick(AjaxRequestTarget target)
{
// do whatever with the target, e.g. refresh components
//target.addComponent(...);

// finally initiate the download
download.initiate(target);
}
});

Any hint to troubleshoot the problem ? (Clicking on link goes directly to
download)
Version is 1.4.17


Thank you and regards,
Igor




2011/8/22 eugenebalt eugeneb...@yahoo.com

 Thanks I fixed it. This example explains how to do it.

 https://cwiki.apache.org/WICKET/best-practices-and-gotchas.html



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AJAXDownload-Example-Doesn-t-Support-Content-Disposition-Save-As-tp3760342p3760552.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: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Gregor Kaczor
I have exactly the same problem, though i use an xml file for the 
translations. Any help out there?


On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be 
re-rendered using the newly selected locale. This does NOT happen. 
Instead, only the select input box seems to be refreshed to use 
the new locale, whereas the rest of the page content is still rendered 
using the previously selected locale. However, the locale has been 
changed in the Session which can be seen when the user navigates to 
another page (e.g. by clicking on a link), as the new page is rendered 
using the newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

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




--
How to find files on the Internet? FindFiles.net http://findfiles.net!


[CVE-2011-2712] Apache Wicket XSS vulnerability

2011-08-23 Thread Martin Grigorov
Severity: Important

Vendor:
The Apache Software Foundation

Versions Affected:
Apache Wicket 1.4.x

Apache Wicket 1.3.x and 1.5-RCx are not affected

Description:
With multi window support application configuration and special query
parameters it
is possible to execute any kind of JavaScript on a site running with the
affected versions.

Mitigation:
Either disable multi window support with
org.apache.wicket.settings.IPageSettings.setAutomaticMultiWindowSupport(false)
or upgrade to Apache Wicket 1.4.18 or 1.5-RC5.1.

Credit:
This issue was discovered by Sven Krewitt of TÜV Rheinland i-sec GmbH.


Apache Wicket Team

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



Re: Sorting Feedback Messages

2011-08-23 Thread Christian Huber
Yes, as i wrote this would be the way to impose a custom sorting on 
messages but at the moment the FilterMessage class does not provide 
dedicated fields that could be used for a sorting metric. So i was 
wondering if there are plans to provide such a thing or if we will be 
bound to incooperate this kind of information into the messages themselves.


The Sanity Resort http://sanityresort.blogspot.com/

Am 23.08.2011 19:21, schrieb Martin Grigorov:

I think 
org.apache.wicket.markup.html.panel.FeedbackPanel.setSortingComparator(ComparatorFeedbackMessage)
is for that

On Tue, Aug 23, 2011 at 8:10 PM, Christian Huberhub...@butterbrot.org  wrote:

Hi,

I was wondering if there is a way to have feedback messages show up in
certain order. Like, when you have multiple messages for the user you might
want to have the most general one (e.g. success/failure) at the top and
other detail messages shown below.

 From what I have seen so far it looks like this is not possible (at least
not with 1.4.18)

As a default messages are rendered in the order they have been provided, so
usually you can just collect the messages you want to display and then add
them at the end of your request in the desired order. But there can be
circumstances where this is not feasible or at least pretty anoying.

I have seen that a FeedbackPanel can be given a comparator to sort the
messages but the feedback messages only provide a level field to distinguish
between info, debug, errror etc. To impose a proper priority order one would
need a metric orthogonal to message levels preferrably represented by a
primitive (double would give the biggest freedom here).

The Component class could be extended to provide additional methods like
Component#info(String message, double priority) and messages which do not
have a priority get assigned a default value specified in the Application
class (could be 0 in the standard implementation).

Would this be a useful/sensible addition? Is such a thing planned for future
releases or maybe already available and I just did not see it?

One workaround/hack to implement this with the current version could be to
prefix all messages with a numeric string and use a Comparator to parse this
string and sort accordingly.

Cheers, Chris

--
The Sanity Resorthttp://sanityresort.blogspot.com/






Re: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Alexandros Karypidis

Hi Gregor,

I've found a way to do this by manipulating the request cycle. However, 
it will only work if you don't mind losing any page state, as it 
generates a new page rendering. I do this by overriding 
onSelectionChanged(...) of the DropDownChoiceLocale as follows:


@Override
protected void onSelectionChanged(Locale newSelection) {
super.onSelectionChanged(newSelection);
// the following tells wicket to instantiate a new page using 
the current page's class

getRequestCycle().setResponsePage(getPage().getClass());
}

Maybe a more knowledgeable user could suggest a better alternative?

On 23/8/2011 9:13 μμ, Gregor Kaczor wrote:
I have exactly the same problem, though i use an xml file for the 
translations. Any help out there?


On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

Hello,

I have written a locale selector by extending DropDownChoice (you can 
see the essential stuff of the implementation below). The problem is 
that when the user changes the locale, the page needs to be 
re-rendered using the newly selected locale. This does NOT happen. 
Instead, only the select input box seems to be refreshed to use 
the new locale, whereas the rest of the page content is still 
rendered using the previously selected locale. However, the locale 
has been changed in the Session which can be seen when the user 
navigates to another page (e.g. by clicking on a link), as the new 
page is rendered using the newly-selected locale.


So, how can I force the current page to be re-rendered?

Implementation of my locale selector is as follows:

Markup: select wicket:id=localeSelection/select
Component code:
public class LocaleDropDown extends DropDownChoiceLocale {
//...
public LocaleDropDown(final String id, final ListLocale choices) {
// ...
setModel(new IModelLocale() {
public Locale getObject() {
return getSession().getLocale();
}
@Override
public void setObject(Locale locale) {
getSession().setLocale(locale);
// need something here to tell wicket to refresh the 
entire page?

}
});
// ...
}

@Override
protected boolean wantOnSelectionChangedNotifications() {
// post an event when user changes the selected value in the 
drop-down box

return true;
}
}

-- Kind regards, Alex

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







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



Re: Basic l10n / i18n question: must page be re-rendered?

2011-08-23 Thread Igor Vaynberg
the pub and form input examples works correctly, take a look at those.

-igor


On Tue, Aug 23, 2011 at 11:13 AM, Gregor Kaczor gkac...@gmx.de wrote:
 I have exactly the same problem, though i use an xml file for the
 translations. Any help out there?

 On 08/23/2011 02:09 PM, Alexandros Karypidis wrote:

 Hello,

 I have written a locale selector by extending DropDownChoice (you can see
 the essential stuff of the implementation below). The problem is that when
 the user changes the locale, the page needs to be re-rendered using the
 newly selected locale. This does NOT happen. Instead, only the select
 input box seems to be refreshed to use the new locale, whereas the rest of
 the page content is still rendered using the previously selected locale.
 However, the locale has been changed in the Session which can be seen when
 the user navigates to another page (e.g. by clicking on a link), as the new
 page is rendered using the newly-selected locale.

 So, how can I force the current page to be re-rendered?

 Implementation of my locale selector is as follows:

 Markup: select wicket:id=localeSelection/select
 Component code:
 public class LocaleDropDown extends DropDownChoiceLocale {
 //...
    public LocaleDropDown(final String id, final ListLocale choices) {
    // ...
        setModel(new IModelLocale() {
            public Locale getObject() {
                return getSession().getLocale();
            }
            @Override
            public void setObject(Locale locale) {
                getSession().setLocale(locale);
                // need something here to tell wicket to refresh the entire
 page?
            }
        });
    // ...
    }

    @Override
    protected boolean wantOnSelectionChangedNotifications() {
        // post an event when user changes the selected value in the
 drop-down box
        return true;
    }
 }

 -- Kind regards, Alex

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



 --
 How to find files on the Internet? FindFiles.net http://findfiles.net!


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



Re: AJAXDownload Example Doesn't Support Content-Disposition (Save As)

2011-08-23 Thread eugenebalt
Igor,

Don't use the AJAXDownload class. There's another way to do it via Ajax, and
get the Save As dialog.

Click this page:
https://cwiki.apache.org/WICKET/best-practices-and-gotchas.html

Go down to the example that starts with or do it like this: (the 2nd
example in the section Starting download after form submission (Wicket
1.2))

This example is using the WebResource.

[ WebResource export = new WebResource() { ... etc. ]

Use this WebResource example. Then, add a ResourceLink backed by this
WebResource.

I followed it directly and it works. I get the Save As... dialog box and the
file bytes are constructed at the time the link is clicked.

CODE:
--

// Export to Spreadsheet Link

// 1. Construct a WebResource from Excel bytes
WebResource export = new WebResource() 
{
@Override
public IResourceStream getResourceStream() {
ByteArrayResource bar = new 
ByteArrayResource(application/vnd.ms-excel,
createExcelBytes());
return bar.getResourceStream();
}

@Override
protected void setHeaders(WebResponse response) {
super.setHeaders(response);
response.setAttachmentHeader(report.xls);
}
};
export.setCacheable(false);

// 2. Add a ResourceLink based on the WebResource
ResourceLink exportLink = new ResourceLink(exportLink, export);   

add(exportLink);
--


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AJAXDownload-Example-Doesn-t-Support-Content-Disposition-Save-As-tp3760342p3763726.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: AJAXDownload Example Doesn't Support Content-Disposition (Save As)

2011-08-23 Thread Sven Meier
Hi,

are you sure proposedFileName is non-null?

Sven

On 08/23/2011 07:29 PM, Igor Racic wrote:
 Hi,
 
 I am not able to get save dialog.
 
 Here is the code:
 
 final AJAXDownload download = new AJAXDownload()
 {
 @Override
 protected IResourceStream getResourceStream()
 {
 return new StringResourceStream(info.srcString, text/plain);
 }
  @Override
 protected String getFileName() {
 return info.proposedFileName;
 }
  };
 add(download);
 
 add(new AjaxLinkVoid(download) {
 @Override
 public void onClick(AjaxRequestTarget target)
 {
 // do whatever with the target, e.g. refresh components
 //target.addComponent(...);
 
 // finally initiate the download
 download.initiate(target);
 }
 });
 
 Any hint to troubleshoot the problem ? (Clicking on link goes directly to
 download)
 Version is 1.4.17
 
 
 Thank you and regards,
 Igor
 
 
 
 
 2011/8/22 eugenebalt eugeneb...@yahoo.com
 
 Thanks I fixed it. This example explains how to do it.

 https://cwiki.apache.org/WICKET/best-practices-and-gotchas.html



 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AJAXDownload-Example-Doesn-t-Support-Content-Disposition-Save-As-tp3760342p3760552.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


 


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



Re: Wizard step - adding multiple addresses to one client

2011-08-23 Thread Sven Meier
 Now I am thinking to create a component ... but I don't know is this
 a good approach

Sure, a panel allowing to manage addresses, sounds good.

 when I put component.setRequired(true) that component checks whether
 there is at least one address added into the model?

You could use WizardStep#add(IFormValidator) for a validator checking
the count of addresses.

Hope this helps
Sven

On 08/23/2011 06:02 PM, nebojsa.nedic wrote:
 Hello all,
 
 In second wizard step I would like to have an option to add several
 addresses for one client (that is created in the first wizard step). I have
 tried several options but none work out.
 
 The best one that I currently have is that I have added additional add
 button to the wizard step which is used to add address to the client. That
 works OK, but if user fills in all address fields and then clicks Next
 instead of add, form will be validated but no address is added (because
 add button adds the address to the client). Then I have added additional
 form validation (new AbstractFormValidator()) and checked whether at least
 one address is added. Because no address is added at the beginning, I always
 get an error - good idea .
 
 Now I am thinking to create a component that will have a model [SetAddress
 clientAddresses] but I don't know is this a good approach (and even am I
 good enough to create this kind of component)? Also, I don't know how to
 create component in a way that when I put component.setRequired(true) that
 component checks whether there is at least one address added into the model?
 
 Any ideas how to solve this kind of use case?
 
 Thank you very much.
 
 Regards,
 Nebojsa
 
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wizard-step-adding-multiple-addresses-to-one-client-tp3763189p3763189.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
 


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



Re: AJAXDownload Example Doesn't Support Content-Disposition (Save As)

2011-08-23 Thread Igor Racic
Yes, it initialized.

Thank you,
Igor


2011/8/23 Sven Meier s...@meiers.net

 Hi,

 are you sure proposedFileName is non-null?

 Sven

 On 08/23/2011 07:29 PM, Igor Racic wrote:
  Hi,
 
  I am not able to get save dialog.
 
  Here is the code:
 
  final AJAXDownload download = new AJAXDownload()
  {
  @Override
  protected IResourceStream getResourceStream()
  {
  return new StringResourceStream(info.srcString, text/plain);
  }
   @Override
  protected String getFileName() {
  return info.proposedFileName;
  }
   };
  add(download);
 
  add(new AjaxLinkVoid(download) {
  @Override
  public void onClick(AjaxRequestTarget target)
  {
  // do whatever with the target, e.g. refresh components
  //target.addComponent(...);
 
  // finally initiate the download
  download.initiate(target);
  }
  });
 
  Any hint to troubleshoot the problem ? (Clicking on link goes directly to
  download)
  Version is 1.4.17
 
 
  Thank you and regards,
  Igor
 
 
 
 
  2011/8/22 eugenebalt eugeneb...@yahoo.com
 
  Thanks I fixed it. This example explains how to do it.
 
  https://cwiki.apache.org/WICKET/best-practices-and-gotchas.html
 
 
 
  --
  View this message in context:
 
 http://apache-wicket.1842946.n4.nabble.com/AJAXDownload-Example-Doesn-t-Support-Content-Disposition-Save-As-tp3760342p3760552.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
 
 
 


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




ConcurrentModificationException since Update to 1.4.18

2011-08-23 Thread Johannes Schneider
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi guys,

I tried to upgrade to the latest Wicket version (security issues...).
But now I suddently get that exception:

Any hints? I didn't change anything knowingly. So I have no idea where
to search for the solution...


Thanks a lot,

Johannes


HELLO ERROR [main] org.apache.wicket.markup.html.WebPage -
^
HELLO ERROR [main] org.apache.wicket.RequestCycle - Error attaching this
container for rendering: [MarkupContainer [Component id = navigationUl]]
org.apache.wicket.WicketRuntimeException: Error attaching this container
for rendering: [MarkupContainer [Component id = navigationUl]]
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1789)
at org.apache.wicket.Component.onBeforeRender(Component.java:4000)
at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
at org.apache.wicket.Component.beforeRender(Component.java:1103)
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1777)
at org.apache.wicket.Component.onBeforeRender(Component.java:4000)
at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
at org.apache.wicket.Component.beforeRender(Component.java:1103)
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1777)
at org.apache.wicket.Component.onBeforeRender(Component.java:4000)
at org.apache.wicket.Page.onBeforeRender(Page.java:1550)
at org.apache.wicket.Component.internalBeforeRender(Component.java:1069)
at org.apache.wicket.Component.beforeRender(Component.java:1103)
at org.apache.wicket.Component.prepareForRender(Component.java:2295)
at org.apache.wicket.Page.prepareForRender(Page.java:1540)
at org.apache.wicket.Component.prepareForRender(Component.java:2332)
at org.apache.wicket.Page.renderPage(Page.java:911)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:261)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:105)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1260)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:595)
at
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:502)
at
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:414)
at
org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:302)
at com.cedarsoft.page.CedarsoftTest.testIt(CedarsoftTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at
com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java:139)
at junit.textui.TestRunner.doRun(TestRunner.java:109)
at
com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaTestRunner.java:52)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:199)
at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.util.ConcurrentModificationException
at 
java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
at 

Re: CSS Change not being picked up when using TextTemplateResourceReference

2011-08-23 Thread Doug Leeper
I have just encountered this issue and have tried overriding the newResource
but in 1.4.18 the variables textTemplate, and variablesModel are private.

Any suggestion how I might be rectify this w/o creating my own
TextTemplateResourceReference?

BTW...Can't move to 1.5

Thanks in advance
- Doug

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/CSS-Change-not-being-picked-up-when-using-TextTemplateResourceReference-tp3613064p3764050.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: JavaScriptReference with TextTemplate only returns the first retrieved value

2011-08-23 Thread Doug Leeper
I have encountered this issue as well...and I believe I know the reason for
this behavior.

The TextTemplateResourceReference eventually is bound to the Application
shared resources.  It never gets reset.  So the
TextTemplateResourceReference will always use the first variables used  to
substitute in the template.

I believe the correct way to do achieve this behavior is to couple the text
template substitution with a dynamic web resource.

Am I correct on this?

Has anyone done this before?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/JavaScriptReference-with-TextTemplate-only-returns-the-first-retrieved-value-tp1877334p3764346.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