Re: Ajaxifying existing application

2011-05-01 Thread meduolis
Why do you want to switch page using ajax? :D If you redownload all page
contents, do not use ajax :), it only complicates everything. Use ajax, when
you want to refresh only some of page components, like table, other
containers--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxifying-existing-application-tp3486615p3487445.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



Running Wicket under WebSphere

2011-05-01 Thread drf
We are using WebSphere 6.1, front ended by Apache (IBM HTTP Server)
Our Wicket application uses WicketFilter
When moving our war file from our Eclipse/Jetty environment to Websphere,
WebShpere is not finding the url of the project. However, if we put a static
resource, eg an html file, under the application context root, then
WebSphere WILL find it. If anyone has any ideas how to resolve the issue,
thanks very much.

Our web.xml is defined as follows:
?xml version=1.0 encoding=ISO-8859-1?
web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 version=2.4

display-namepki/display-name
listener

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

context-param
param-namecontextConfigLocation/param-name
param-valueclasspath:applicationContext.xml/param-value
/context-param
filter
filter-namewicket.pki/filter-name

filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param
param-nameapplicationClassName/param-name

param-valuecom.drf.hapoalim.gui.application.HapoalimApplication/param-value
/init-param
/filter
 filter-mapping
 filter-namewicket.pki/filter-name 
 url-pattern/*/url-pattern
 /filter-mapping
/web-app

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Running-Wicket-under-WebSphere-tp3487476p3487476.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: Wicket in Websphere 6.1

2011-05-01 Thread drf
This uses Spring 2 and ContextLoaderServlet

Does anyone have an example of a web.xml defined using Spring3 -
ContextLoaderListener - and Wicket
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-in-Websphere-6-1-tp1886967p3487523.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: Running Wicket under WebSphere

2011-05-01 Thread drf
I should add that we are using Spring 3, which uses ContextLoaderListener,
not ContextLoaderServlet
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Running-Wicket-under-WebSphere-tp3487476p3487531.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: wicket-tree checkboxes managing

2011-05-01 Thread massimo_pugni
Hi Sven,
I'm on back on it now.
To hidden the checkboxes for roots I've put the 'if' into the
'newContentComponent' method

something like this
public Component newContentComponent(String id, final AbstractTreeSkill
tree, IModelSkill model)
{
if (model.getObject().isRoot()) {
return new Label(id, model);
} else {
return new CheckedFolderSkill(id, tree, model)
{ ... }

What I'd like to do now is to reproduce 'check all/uncheck all' features I
was able to do using a linear/plain list view data structure (the original
structure I'd like to replace with a hierarchical one)

best
massimo
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-checkboxes-managing-tp3472967p3487626.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: wicket-tree checkboxes managing

2011-05-01 Thread massimo_pugni
Hi Sven,
I'm on back on it now.
To hidden the checkboxes for roots I've put the 'if' into the
'newContentComponent' method

something like this
public Component newContentComponent(String id, final AbstractTree tree,
IModel model)
{
if (model.getObject().isRoot()) {
return new Label(id, model);
} else {
return new CheckedFolder(id, tree, model)
{ ... }

What I'd like to do now is to reproduce 'check all/uncheck all' features I
was able to do using a linear/plain list view data structure (the original
structure I'd like to replace with a hierarchical one)

best
massimo
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-checkboxes-managing-tp3472967p3487627.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: Running Wicket under WebSphere

2011-05-01 Thread Clint Checketts
I heard that Webspere gets confused with a filter as the endpoint. Try
WicketServlet. I think there also is a patch for more recent Websphere
versions.

On Sunday, May 1, 2011, drf davidrfi...@gmail.com wrote:
 I should add that we are using Spring 3, which uses ContextLoaderListener,
 not ContextLoaderServlet
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Running-Wicket-under-WebSphere-tp3487476p3487531.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: Ajaxifying existing application

2011-05-01 Thread James Carman
I think he meant that rather than using a page-oriented design, that
they'd need to switch to more of a one page, switch panels design?

On Sun, May 1, 2011 at 4:09 AM, meduolis meduol...@gmail.com wrote:
 Why do you want to switch page using ajax? :D If you redownload all page
 contents, do not use ajax :), it only complicates everything. Use ajax, when
 you want to refresh only some of page components, like table, other
 containers--
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Ajaxifying-existing-application-tp3486615p3487445.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: Share data in TabbedPanel

2011-05-01 Thread jcgarciam
Lets say you have a property in your page that point to the dataobject you
are creating and manipulating on first tab.

The model of the tabs that should see this dataobject as well can be
reference as:

tp.setDefaultModel(new PropertyModel(this,mySharedObject));


Being mySharedObject the property on you page (this) that have the object
reference that you want to shared across tabs.

On Sun, May 1, 2011 at 5:06 AM, meduolis[via Apache Wicket] 
ml-node+3487440-18642877-65...@n4.nabble.com wrote:

 Maybe you can show a small example how to do this?

 You mean like this?

 TabbedPanel tp = new TabbedPanel();
 tp.setDefaultModel(new ModelSharedDTO());



 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3487440.html
  To start a new topic under Apache Wicket, email
 ml-node+1842946-398011874-65...@n4.nabble.com
 To unsubscribe from Apache Wicket, click 
 herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=.





-- 

JC
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3487759.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: wicket-tree checkboxes managing

2011-05-01 Thread Sven Meier

Hi,

you can utilize the usual Check/CheckGroup/CheckGroupSelector 
combination. I've added a convenience CheckContent implementation 
recently (now for Wicket 1.4 too):


  
http://code.google.com/p/wicket-tree/source/browse/branches/wicket-tree-0.4.x/wicket-tree/src/main/java/wickettree/content/CheckFolder.java


Hope this helps

Sven

On 05/01/2011 01:27 PM, massimo_pugni wrote:

Hi Sven,
I'm on back on it now.
To hidden the checkboxes for roots I've put the 'if' into the
'newContentComponent' method

something like this
public Component newContentComponent(String id, final AbstractTreeSkill
tree, IModelSkill  model)
{
if (model.getObject().isRoot()) {
return new Label(id, model);
} else {
return new CheckedFolderSkill(id, tree, model)
{ ... }

What I'd like to do now is to reproduce 'check all/uncheck all' features I
was able to do using a linear/plain list view data structure (the original
structure I'd like to replace with a hierarchical one)

best
massimo
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-tree-checkboxes-managing-tp3472967p3487626.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: Share data in TabbedPanel

2011-05-01 Thread meduolis
I think that your example would finish with ClassCastExeption in
TabbedPanel.java:382 line

return (Integer)getDefaultModelObject();
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3487936.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: wicket 1.5 AbstractDefaultAjaxBehavior bad url

2011-05-01 Thread Martin Grigorov
If you can create a quickstart that reproduces the problem then please
attach it to a ticket in Jira.

On Fri, Apr 29, 2011 at 10:52 PM, msj121 msj...@gmail.com wrote:
 I have noticed calling getCallbackUrl() on an AbstractDefaultAjaxBehavior
 results in a url sometimes in:

 ./wicket/page?0-1.IBehaviorListener

 and other parts of the same page have:

 ./wicket/page?1-2.IBehaviorListener


 I think that the bad urls cause the page to reload when the attempt to call:

 wicketAjaxGet('+click.getCallbackUrl()+x='+...+'y='+...+'');



 For some reason having these ajax calls reloads the page in Wicket 1.5 but
 not wicket 1.4. I am of course calling getCallbackUrl() after the behavior
 is added to the page not sure what is wrong.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-AbstractDefaultAjaxBehavior-bad-url-tp3484600p3484600.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: Ajaxifying existing application

2011-05-01 Thread Igor Vaynberg
if all your pages extend a base page then you can change the base page
to extend a panel instead.

than s/setResponsePage/setResponsePanel/

create a page that has the necessary infra to swap content panels and
wire in the new setResponsePanel to use that.

-igor

On Sat, Apr 30, 2011 at 2:36 PM, splitshade
martin.dil...@googlemail.com wrote:
 Hi,

 i have a general question,
 we have an exisiting application, that now needs to be ajaxified (no page
 reloads etc..).
 This has never been a requirement, so the application is not prepared at all
 for this.

 The biggest problem we see is that we have many different pages, but how
 shall we do page switches using ajax?

 I look forward to any hints on this.

 Thank you very much.--
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Ajaxifying-existing-application-tp3486615p3486615.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: Share data in TabbedPanel

2011-05-01 Thread jcgarciam
I didn't checked the API before posting the example was using the kind of
the same code you provide earlier, just to give u a quick start :)

But the idea is to pass a model to the underlying panel on each tab, that
points to the same object reference.


On Sun, May 1, 2011 at 12:52 PM, meduolis[via Apache Wicket] 
ml-node+3487936-2075405694-65...@n4.nabble.com wrote:

 I think that your example would finish with ClassCastExeption in
 TabbedPanel.java:382 line

 return (Integer)getDefaultModelObject();



 --
  If you reply to this email, your message will be added to the discussion
 below:

 http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3487936.html
  To start a new topic under Apache Wicket, email
 ml-node+1842946-398011874-65...@n4.nabble.com
 To unsubscribe from Apache Wicket, click 
 herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=.





-- 

JC
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3487998.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: Share data in TabbedPanel

2011-05-01 Thread meduolis
Thanks for help, I solved my problem by extending original TabbedPanel with
some additional properties.--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Share-data-in-TabbedPanel-tp3477328p3488031.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



Table repeater: repeat across row AND column

2011-05-01 Thread Alexandros Karypidis

Hello,

I am trying to create a web page that lists contact addresses in a table.  
My repeater can easily lay out one address per row, but I need to be able  
to list 2 addresses per row (actually, ideally I'd like to list N  
addresses per row). The problem is that ListView's operation  
[populateItem()] only provides you with one item to work with. So with  
this markup:


html xmlns:wicket
body
wicket:panel
table wicket:id=addressesTable style=width: 100%;
tr wicket:id=addresses
td wicket:id=address style=width: 
50%;/td
!--
I NEED ANOTHER CELL LIKE THE 
ONE ABOVE HERE
td wicket:id=address2 style=width: 
50%;/td
--
/tr
/table
/wicket:panel
/body
/html

If I uncomment the second cell above, I need to be able to access the  
next item, something like:


final ListViewAddress rowContainer = new ListViewAddress(
addresses, model) {
private static final long serialVersionUID = 1L;

@Override
protected void populateItem(ListItemAddress item) {
Address a = item.getModelObject();
AddressPanel ap = new AddressPanel(address,
new CompoundPropertyModelAddress(
new 
AddressLoadableDetachableModel(a.getId(;
item.add(ap);
/*
// DOES SUCH AN API EXIST?
//
if (item.hasNext()) {
item.next();
a = item.getModelObject();
AddressPanel ap2 = new AddressPanel(address2,
new CompoundPropertyModelAddress(
new 
AddressLoadableDetachableModel(a.getId(;
item.add(ap2);
}
*/
}
};

My only solution currently is that I convert the list of addresses to a  
list of address tuples (pairs), so that I am able to repeat over pairs of  
addresses. In short, I am just wondering if there is a better way to do  
this rather than (pseudocode):


ListAddress addresses = myRepository.loadAddressList();
ListTupleAddress,Address addressPairs = convertToPairs(addresses);
// Make the above repeater iterate over ListTupleAddress,Address  
having access

// to two addresses per repetition

Any pointers on this? Thank you in advance.

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



Re: Table repeater: repeat across row AND column

2011-05-01 Thread Martin Grigorov
I like your current approach better than what you want to do.
Anyway here is how to do it:

int currIndex = item.getIndex();

ListItem nextItem = get(Integer.toString(currIndex + 1));
if (nextItem != null) {
...
}


On Sun, May 1, 2011 at 6:51 PM, Alexandros Karypidis akary...@yahoo.gr wrote:
 Hello,

 I am trying to create a web page that lists contact addresses in a table. My
 repeater can easily lay out one address per row, but I need to be able to
 list 2 addresses per row (actually, ideally I'd like to list N addresses per
 row). The problem is that ListView's operation [populateItem()] only
 provides you with one item to work with. So with this markup:

 html xmlns:wicket
        body
                wicket:panel
                        table wicket:id=addressesTable style=width:
 100%;
                                tr wicket:id=addresses
                                        td wicket:id=address style=width:
 50%;/td
                                        !--
                                                I NEED ANOTHER CELL LIKE THE
 ONE ABOVE HERE
                                        td wicket:id=address2
 style=width: 50%;/td
                                        --
                                /tr
                        /table
                /wicket:panel
        /body
 /html

 If I uncomment the second cell above, I need to be able to access the next
 item, something like:

 final ListViewAddress rowContainer = new ListViewAddress(
                addresses, model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItemAddress item) {
                Address a = item.getModelObject();
                AddressPanel ap = new AddressPanel(address,
                        new CompoundPropertyModelAddress(
                                        new
 AddressLoadableDetachableModel(a.getId(;
                item.add(ap);
 /*
 // DOES SUCH AN API EXIST?
 //
                if (item.hasNext()) {
                        item.next();
                        a = item.getModelObject();
                        AddressPanel ap2 = new AddressPanel(address2,
                                new CompoundPropertyModelAddress(
                                                new
 AddressLoadableDetachableModel(a.getId(;
                        item.add(ap2);
                }
 */
        }
 };

 My only solution currently is that I convert the list of addresses to a list
 of address tuples (pairs), so that I am able to repeat over pairs of
 addresses. In short, I am just wondering if there is a better way to do this
 rather than (pseudocode):

 ListAddress addresses = myRepository.loadAddressList();
 ListTupleAddress,Address addressPairs = convertToPairs(addresses);
 // Make the above repeater iterate over ListTupleAddress,Address
 having access
 // to two addresses per repetition

 Any pointers on this? Thank you in advance.

 -
 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


SubmitLink with confirmation dialog

2011-05-01 Thread scorpio2002
Hi there,
I have a SubmitLink and I'd like to add a very simple confirmation dialog to
it? Any way of doing so?

I've tried to add a SimpleAttributeModifier, but it overwrites the behaviour
in the onSubmit method of the submitlink. I think there must be an easy and
clean way of doing this.

Thank you.--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3487505.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: SubmitLink with confirmation dialog

2011-05-01 Thread Martin Grigorov
Hi,

On Sun, May 1, 2011 at 11:10 AM, scorpio2002 d.capite...@gmail.com wrote:
 Hi there,
 I have a SubmitLink and I'd like to add a very simple confirmation dialog to
 it? Any way of doing so?

 I've tried to add a SimpleAttributeModifier, but it overwrites the behaviour
 in the onSubmit method of the submitlink. I think there must be an easy and
 clean way of doing this.
SimpleAttributeModifier(onclick, yourJsHere) is the way if you want
to use JavaScript alert(). onSubmit() method is called at server side
only if onclick at the client side returned true.

 Thank you.--
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3487505.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: Ajaxifying existing application

2011-05-01 Thread splitshade
Hi James, yes, thats exaclty what I meant.

The Problem is, we have an existing infrastructure, that depends on pages.

The idea to change everything to a setResponsePanel-Method seems to be
very good, I think we could realize that very cheaply, thanks for the hint!

Would that be something that could be of interest for the framework itself?
Would it be possible/reasonable to integrate that into an
AbstractAjaxWebPage or something?

I did not try this out, but it seems to be a good idea that could be of
interest to many people?

Regards

Martin
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxifying-existing-application-tp3486615p3488304.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: SubmitLink with confirmation dialog

2011-05-01 Thread scorpio2002
Dear Martin,
thank you for answering. I tried something like this:

--
SubmitLink link = new SubmitLink(link) {
public void onSubmit() { /* my stuff */}
}

link.add(new SimpleAttributeModifier(onclick, return confirm('are you
sure?');));
--

However, weather I click 'Cancel' or 'OK', the code in the onSubmit() method
never gets executed.

I'm stuck, I can't believe such a framework does not support this basic
feature O_o I must be missing something obvious ^^
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3488329.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: Table repeater: repeat across row AND column

2011-05-01 Thread Igor Vaynberg
see GridView

-igor

On Sun, May 1, 2011 at 9:51 AM, Alexandros Karypidis akary...@yahoo.gr wrote:
 Hello,

 I am trying to create a web page that lists contact addresses in a table. My
 repeater can easily lay out one address per row, but I need to be able to
 list 2 addresses per row (actually, ideally I'd like to list N addresses per
 row). The problem is that ListView's operation [populateItem()] only
 provides you with one item to work with. So with this markup:

 html xmlns:wicket
        body
                wicket:panel
                        table wicket:id=addressesTable style=width:
 100%;
                                tr wicket:id=addresses
                                        td wicket:id=address style=width:
 50%;/td
                                        !--
                                                I NEED ANOTHER CELL LIKE THE
 ONE ABOVE HERE
                                        td wicket:id=address2
 style=width: 50%;/td
                                        --
                                /tr
                        /table
                /wicket:panel
        /body
 /html

 If I uncomment the second cell above, I need to be able to access the next
 item, something like:

 final ListViewAddress rowContainer = new ListViewAddress(
                addresses, model) {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItemAddress item) {
                Address a = item.getModelObject();
                AddressPanel ap = new AddressPanel(address,
                        new CompoundPropertyModelAddress(
                                        new
 AddressLoadableDetachableModel(a.getId(;
                item.add(ap);
 /*
 // DOES SUCH AN API EXIST?
 //
                if (item.hasNext()) {
                        item.next();
                        a = item.getModelObject();
                        AddressPanel ap2 = new AddressPanel(address2,
                                new CompoundPropertyModelAddress(
                                                new
 AddressLoadableDetachableModel(a.getId(;
                        item.add(ap2);
                }
 */
        }
 };

 My only solution currently is that I convert the list of addresses to a list
 of address tuples (pairs), so that I am able to repeat over pairs of
 addresses. In short, I am just wondering if there is a better way to do this
 rather than (pseudocode):

 ListAddress addresses = myRepository.loadAddressList();
 ListTupleAddress,Address addressPairs = convertToPairs(addresses);
 // Make the above repeater iterate over ListTupleAddress,Address
 having access
 // to two addresses per repetition

 Any pointers on this? Thank you in advance.

 -
 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: Ajaxifying existing application

2011-05-01 Thread meduolis
Use ajax with responsibility. To much ajax can make bad things :]. I can not
undestand, why you would like to change page to panel, and rerender it all,
just like setResponcePage does. Try to sit and decide, which parts of page
should be ajaxified and which should be left as it is.--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajaxifying-existing-application-tp3486615p3488474.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: SubmitLink with confirmation dialog

2011-05-01 Thread Pedro Santos
Hi, SubmitLink already write some JavaScript in the onclick handler, so you
need to prepend the confirmation JavaScript in order to maintain the default
behavior. e.g.

submitLink.add(new Behavior() {
onComponentTag() {
tag.put(onclick, if(!confirm('c')) return false; +
tag.getAttribute(onclick));
}
});

In Wicket 1.5 RC4 you can also use the AttributeAppender to prepend the
confirmation JavaScript.

On Sun, May 1, 2011 at 4:03 PM, scorpio2002 d.capite...@gmail.com wrote:

 Dear Martin,
 thank you for answering. I tried something like this:

 --
 SubmitLink link = new SubmitLink(link) {
public void onSubmit() { /* my stuff */}
 }

 link.add(new SimpleAttributeModifier(onclick, return confirm('are you
 sure?');));
 --

 However, weather I click 'Cancel' or 'OK', the code in the onSubmit()
 method
 never gets executed.

 I'm stuck, I can't believe such a framework does not support this basic
 feature O_o I must be missing something obvious ^^
 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/SubmitLink-with-confirmation-dialog-tp3487505p3488329.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




-- 
Pedro Henrique Oliveira dos Santos


Re: Wicket in Websphere 6.1

2011-05-01 Thread shetc
In your web.xml, something like:


listener
description/description
display-nameSpringContextLoaderListener/display-name

listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener

servlet
servlet-nameWicketServlet/servlet-name

servlet-classorg.apache.wicket.protocol.http.WicketServlet/servlet-class
init-param
param-nameapplicationFactoryClassName/param-name

param-valueorg.apache.wicket.spring.SpringWebApplicationFactory/param-value
/init-param
load-on-startup1/load-on-startup
/servlet

servlet-mapping
servlet-nameWicketServlet/servlet-name
url-pattern/app/*/url-pattern
/servlet-mapping
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-in-Websphere-6-1-tp1886967p3489035.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



How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Coleman, Chris
We have an app that allows people to add elements to a ListMultipleChoice by 
pressing on a button. We want the form to fail validation if the 
ListMultipleChoice contains no elements.

I've tried this:

  targettedSetsList.add(new IValidator()
  {
public void validate(IValidatable validatable) {
  // Always contains no items - strange
  Collection list = (Collection)validatable.getValue();

  if ( list.size() == 0 ) {
ValidationError ve = new ValidationError();
ve.setMessage(No sets have been specified for deployment);
validatable.error(ve);
  }
}
  });

but at validation the list.size() is always 0 even if the user has added 
elements. Am I doing it the right way? Is there a better way?



DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--



Re: Ajaxifying existing application

2011-05-01 Thread James Carman
On Sat, Apr 30, 2011 at 5:36 PM, splitshade
martin.dil...@googlemail.com wrote:
 Hi,

 i have a general question,
 we have an exisiting application, that now needs to be ajaxified (no page
 reloads etc..).
 This has never been a requirement, so the application is not prepared at all
 for this.


So, why is this a requirement now?  If it ain't broke, don't fix it.
Why does it *have* to be ajaxified?

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



Re: DataTable's view does not always update

2011-05-01 Thread D D
I tried the setting with true and false settings. It still doesn't work.

Here is Ajax Debug
INFO: Initiating Ajax GET request on
?wicket:interface=:0:dataForm:dataPanel:rxEntryTabs:panel:link::IBehaviorListener:0:-1random=0.6781234819490185
INFO: Invoking pre-call handler(s)...
ERROR: Received Ajax response with code: 404
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...
INFO: focus removed from link30


I also traced through debug the response sent to HttpResponse object
and it's what I'm expecting:

“?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
id=counter31 ![CDATA[span id=counter315/span]]/component
/ajax-response”

Not only it's written but the response object is properly closed too.
Not a single exception is thrown in Wicket's code.

The problem has to be somewhere inside WAS processing, right?

Any ideas where?

Dave

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



Re: DataTable's view does not always update

2011-05-01 Thread James Carman
You are using a servlet instead of a filter, right?  I don't see the
entire conversation in my gmail, here, so I hope I didn't miss
something.

On Sun, May 1, 2011 at 9:51 PM, D D dawi...@gmail.com wrote:
 I tried the setting with true and false settings. It still doesn't work.

 Here is Ajax Debug
 INFO: Initiating Ajax GET request on
 ?wicket:interface=:0:dataForm:dataPanel:rxEntryTabs:panel:link::IBehaviorListener:0:-1random=0.6781234819490185
 INFO: Invoking pre-call handler(s)...
 ERROR: Received Ajax response with code: 404
 INFO: Invoking post-call handler(s)...
 INFO: Invoking failure handler(s)...
 INFO: focus removed from link30


 I also traced through debug the response sent to HttpResponse object
 and it's what I'm expecting:

 “?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
 id=counter31 ![CDATA[span id=counter315/span]]/component
 /ajax-response”

 Not only it's written but the response object is properly closed too.
 Not a single exception is thrown in Wicket's code.

 The problem has to be somewhere inside WAS processing, right?

 Any ideas where?

 Dave

 -
 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: How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Clint Checketts
Lets see the code about 'adding elements by pressing on a button'.  The
'getValue()' method is returning the value from the list box's HTTP
submitted values, if the add button is submitting values via ajax or some
other means then it may need a different approach.

-Clint

On Sun, May 1, 2011 at 8:15 PM, Coleman, Chris 
chris.cole...@thalesgroup.com.au wrote:

 We have an app that allows people to add elements to a ListMultipleChoice
 by pressing on a button. We want the form to fail validation if the
 ListMultipleChoice contains no elements.

 I've tried this:

  targettedSetsList.add(new IValidator()
  {
public void validate(IValidatable validatable) {
  // Always contains no items - strange
  Collection list = (Collection)validatable.getValue();

  if ( list.size() == 0 ) {
ValidationError ve = new ValidationError();
ve.setMessage(No sets have been specified for deployment);
validatable.error(ve);
  }
}
  });

 but at validation the list.size() is always 0 even if the user has added
 elements. Am I doing it the right way? Is there a better way?




 DISCLAIMER:---
 This e-mail transmission and any documents, files and previous e-mail
 messages
 attached to it are private and confidential. They may contain proprietary
 or copyright
 material or information that is subject to legal professional privilege.
 They are for
 the use of the intended recipient only.  Any unauthorised viewing, use,
 disclosure,
 copying, alteration, storage or distribution of, or reliance on, this
 message is
 strictly prohibited. No part may be reproduced, adapted or transmitted
 without the
 written permission of the owner. If you have received this transmission in
 error, or
 are not an authorised recipient, please immediately notify the sender by
 return email,
 delete this message and all copies from your e-mail system, and destroy any
 printed
 copies. Receipt by anyone other than the intended recipient should not be
 deemed a
 waiver of any privilege or protection. Thales Australia does not warrant or
 represent
 that this e-mail or any documents, files and previous e-mail messages
 attached are
 error or virus free.

 --




Re: DataTable's view does not always update

2011-05-01 Thread D D
I have a filter in web.xml file - however I did not set it up. At the
same time I've started to question the setup because I tried to deploy
a clean test app (by clean I mean new ear file for the test app and
no extra ear files and configuration - just a strip down example from
wicket's website) and I'm getting 404 trying to bring the application
up.

So the original application with problem is having 404 on ajax calls
but it will start up. Test app will not start up - shows 404 all the
time.

Is it a WAS setup issue?

Thanks,
Dave


On Sun, May 1, 2011 at 8:57 PM, James Carman ja...@carmanconsulting.com wrote:
 You are using a servlet instead of a filter, right?  I don't see the
 entire conversation in my gmail, here, so I hope I didn't miss
 something.

 On Sun, May 1, 2011 at 9:51 PM, D D dawi...@gmail.com wrote:
 I tried the setting with true and false settings. It still doesn't work.

 Here is Ajax Debug
 INFO: Initiating Ajax GET request on
 ?wicket:interface=:0:dataForm:dataPanel:rxEntryTabs:panel:link::IBehaviorListener:0:-1random=0.6781234819490185
 INFO: Invoking pre-call handler(s)...
 ERROR: Received Ajax response with code: 404
 INFO: Invoking post-call handler(s)...
 INFO: Invoking failure handler(s)...
 INFO: focus removed from link30


 I also traced through debug the response sent to HttpResponse object
 and it's what I'm expecting:

 “?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
 id=counter31 ![CDATA[span id=counter315/span]]/component
 /ajax-response”

 Not only it's written but the response object is properly closed too.
 Not a single exception is thrown in Wicket's code.

 The problem has to be somewhere inside WAS processing, right?

 Any ideas where?

 Dave

 -
 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



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



RE: How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Coleman, Chris
Yes, it's all via AJAX.

In the last few minutes I've tried a different approach and it works ok but it 
introduces another problem:

  form.add(new AbstractFormValidator()
  {
public FormComponent[] getDependentFormComponents()
{
  return null;
}

public void validate(Form? form)
{
  List sets = targettedSetsList.getChoices();

  if ( sets.size() == 0 ) {
targettedSetsList.error((IValidationError)new 
ValidationError().addMessageKey(error.noSetSpecified));
  }  
}
  });

This accurately detects when nothing is in the list and displays an error 
message but once emptied we can not add new elements to the list because the 
validation is also executed when the 'add' button is pressed. The validation 
fails because the list is empty so the 'add' fails, making it impossible to add 
new elements when the list is empty.

I thought validation would only occur when the user submits the form but it 
appears to be fired off whenever the user presses the 'add' button. Is this to 
be expected?


-Original Message-
From: Clint Checketts [mailto:checke...@gmail.com] 
Sent: Monday, 2 May 2011 12:10 PM
To: users@wicket.apache.org
Subject: Re: How to fail validation if ListMultipleChoice is empty

Lets see the code about 'adding elements by pressing on a button'.  The
'getValue()' method is returning the value from the list box's HTTP
submitted values, if the add button is submitting values via ajax or some
other means then it may need a different approach.

-Clint

On Sun, May 1, 2011 at 8:15 PM, Coleman, Chris 
chris.cole...@thalesgroup.com.au wrote:

 We have an app that allows people to add elements to a ListMultipleChoice
 by pressing on a button. We want the form to fail validation if the
 ListMultipleChoice contains no elements.

 I've tried this:

  targettedSetsList.add(new IValidator()
  {
public void validate(IValidatable validatable) {
  // Always contains no items - strange
  Collection list = (Collection)validatable.getValue();

  if ( list.size() == 0 ) {
ValidationError ve = new ValidationError();
ve.setMessage(No sets have been specified for deployment);
validatable.error(ve);
  }
}
  });

 but at validation the list.size() is always 0 even if the user has added
 elements. Am I doing it the right way? Is there a better way?




 DISCLAIMER:---
 This e-mail transmission and any documents, files and previous e-mail
 messages
 attached to it are private and confidential. They may contain proprietary
 or copyright
 material or information that is subject to legal professional privilege.
 They are for
 the use of the intended recipient only.  Any unauthorised viewing, use,
 disclosure,
 copying, alteration, storage or distribution of, or reliance on, this
 message is
 strictly prohibited. No part may be reproduced, adapted or transmitted
 without the
 written permission of the owner. If you have received this transmission in
 error, or
 are not an authorised recipient, please immediately notify the sender by
 return email,
 delete this message and all copies from your e-mail system, and destroy any
 printed
 copies. Receipt by anyone other than the intended recipient should not be
 deemed a
 waiver of any privilege or protection. Thales Australia does not warrant or
 represent
 that this e-mail or any documents, files and previous e-mail messages
 attached are
 error or virus free.

 --





DISCLAIMER:---
This e-mail transmission and any documents, files and previous e-mail messages
attached to it are private and confidential. They may contain proprietary or 
copyright
material or information that is subject to legal professional privilege. They 
are for
the use of the intended recipient only.  Any unauthorised viewing, use, 
disclosure,
copying, alteration, storage or distribution of, or reliance on, this message is
strictly prohibited. No part may be reproduced, adapted or transmitted without 
the
written permission of the owner. If you have received this transmission in 
error, or
are not an authorised recipient, please immediately notify the sender by return 
email,
delete this message and all copies from your e-mail system, and destroy any 
printed
copies. Receipt by anyone other than the intended recipient should not be 
deemed a
waiver of any privilege or protection. Thales Australia does not warrant or 
represent
that this e-mail or any documents, files and previous e-mail messages attached 
are
error or virus free.
--


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

Re: How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Clint Checketts
You are correct that the Form's validation should only fire when submitting
the form. When an individual element is updated via ajax (as in an
AjaxFormComponentUpdatingBehavior) then just the processing and validations
steps are fired for the individual form component.

It makes me wonder if you are using an AjaxSubmitButton instead of just an
AjaxButton. (Or similarly an AjaxSubmitLink instead of an  AjaxLink) Mind
including your button's code?

Also, why are you calling getChoices() instead of getConvertedInput() in the
validator? Choices represent the possible selection options, the converted
input is the value of the selected choices.

-Clint

On Sun, May 1, 2011 at 9:25 PM, Coleman, Chris 
chris.cole...@thalesgroup.com.au wrote:

 Yes, it's all via AJAX.

 In the last few minutes I've tried a different approach and it works ok but
 it introduces another problem:

  form.add(new AbstractFormValidator()
  {
public FormComponent[] getDependentFormComponents()
{
  return null;
}

public void validate(Form? form)
{
  List sets = targettedSetsList.getChoices();

  if ( sets.size() == 0 ) {
targettedSetsList.error((IValidationError)new
 ValidationError().addMessageKey(error.noSetSpecified));
  }
}
  });

 This accurately detects when nothing is in the list and displays an error
 message but once emptied we can not add new elements to the list because the
 validation is also executed when the 'add' button is pressed. The validation
 fails because the list is empty so the 'add' fails, making it impossible to
 add new elements when the list is empty.

 I thought validation would only occur when the user submits the form but it
 appears to be fired off whenever the user presses the 'add' button. Is this
 to be expected?


 -Original Message-
 From: Clint Checketts [mailto:checke...@gmail.com]
 Sent: Monday, 2 May 2011 12:10 PM
 To: users@wicket.apache.org
 Subject: Re: How to fail validation if ListMultipleChoice is empty

 Lets see the code about 'adding elements by pressing on a button'.  The
 'getValue()' method is returning the value from the list box's HTTP
 submitted values, if the add button is submitting values via ajax or some
 other means then it may need a different approach.

 -Clint

 On Sun, May 1, 2011 at 8:15 PM, Coleman, Chris 
 chris.cole...@thalesgroup.com.au wrote:

  We have an app that allows people to add elements to a ListMultipleChoice
  by pressing on a button. We want the form to fail validation if the
  ListMultipleChoice contains no elements.
 
  I've tried this:
 
   targettedSetsList.add(new IValidator()
   {
 public void validate(IValidatable validatable) {
   // Always contains no items - strange
   Collection list = (Collection)validatable.getValue();
 
   if ( list.size() == 0 ) {
 ValidationError ve = new ValidationError();
 ve.setMessage(No sets have been specified for deployment);
 validatable.error(ve);
   }
 }
   });
 
  but at validation the list.size() is always 0 even if the user has added
  elements. Am I doing it the right way? Is there a better way?
 
 
 
 
 
 DISCLAIMER:---
  This e-mail transmission and any documents, files and previous e-mail
  messages
  attached to it are private and confidential. They may contain proprietary
  or copyright
  material or information that is subject to legal professional privilege.
  They are for
  the use of the intended recipient only.  Any unauthorised viewing, use,
  disclosure,
  copying, alteration, storage or distribution of, or reliance on, this
  message is
  strictly prohibited. No part may be reproduced, adapted or transmitted
  without the
  written permission of the owner. If you have received this transmission
 in
  error, or
  are not an authorised recipient, please immediately notify the sender by
  return email,
  delete this message and all copies from your e-mail system, and destroy
 any
  printed
  copies. Receipt by anyone other than the intended recipient should not be
  deemed a
  waiver of any privilege or protection. Thales Australia does not warrant
 or
  represent
  that this e-mail or any documents, files and previous e-mail messages
  attached are
  error or virus free.
 
 
 --
 
 




 DISCLAIMER:---
 This e-mail transmission and any documents, files and previous e-mail
 messages
 attached to it are private and confidential. They may contain proprietary
 or copyright
 material or information that is subject to legal professional privilege.
 They are for
 the use of the intended recipient only.  Any unauthorised viewing, use,
 disclosure,
 copying, alteration, storage or distribution of, or reliance on, this
 message is
 strictly prohibited. No part may be reproduced, 

Re: DataTable's view does not always update

2011-05-01 Thread Clint Checketts
Make sure that sendredirect.compatibility property is set to false or
deleted. It causes problems. You didn't say if it had originally be set or
not though, lets make sure it didn't get left on at some point.

Watch the URL, if you typed in http://localhost/myApp and it renders as
http://localhost/myApp/*myApp* (note the duplicate context root) you could
get 404s.

Also convert to using the WicketServlet, WAS had trouble pointing to a
filter as an endpoint (unless you have an empty index.htm file). Lets see if
that gets you back on track. I suspect that is why your clean app isn't
working, you have no index.htm file to trick WAS into working.

-Clint


On Sun, May 1, 2011 at 9:22 PM, D D dawi...@gmail.com wrote:

 I have a filter in web.xml file - however I did not set it up. At the
 same time I've started to question the setup because I tried to deploy
 a clean test app (by clean I mean new ear file for the test app and
 no extra ear files and configuration - just a strip down example from
 wicket's website) and I'm getting 404 trying to bring the application
 up.

 So the original application with problem is having 404 on ajax calls
 but it will start up. Test app will not start up - shows 404 all the
 time.

 Is it a WAS setup issue?

 Thanks,
 Dave


 On Sun, May 1, 2011 at 8:57 PM, James Carman ja...@carmanconsulting.com
 wrote:
  You are using a servlet instead of a filter, right?  I don't see the
  entire conversation in my gmail, here, so I hope I didn't miss
  something.
 
  On Sun, May 1, 2011 at 9:51 PM, D D dawi...@gmail.com wrote:
  I tried the setting with true and false settings. It still doesn't work.
 
  Here is Ajax Debug
  INFO: Initiating Ajax GET request on
 
 ?wicket:interface=:0:dataForm:dataPanel:rxEntryTabs:panel:link::IBehaviorListener:0:-1random=0.6781234819490185
  INFO: Invoking pre-call handler(s)...
  ERROR: Received Ajax response with code: 404
  INFO: Invoking post-call handler(s)...
  INFO: Invoking failure handler(s)...
  INFO: focus removed from link30
 
 
  I also traced through debug the response sent to HttpResponse object
  and it's what I'm expecting:
 
  “?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
  id=counter31 ![CDATA[span id=counter315/span]]/component
  /ajax-response”
 
  Not only it's written but the response object is properly closed too.
  Not a single exception is thrown in Wicket's code.
 
  The problem has to be somewhere inside WAS processing, right?
 
  Any ideas where?
 
  Dave
 
  -
  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
 
 

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




RE: How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Coleman, Chris
According to the doco the default form processing behavior is executed for 
AjaxButton and AjaxSubmitButton (in fact AjaxSubmitButton appears to be 
deprecated - behaves the same as AjaxButton anyway?).

I am using AjaxButton.

I actually don't care about the selections but rather, the entries that the 
user has added to the list (whether selected or not) which is why I call 
getChoices() rather than getConvertedInput()

The button code is:

  AjaxButton addBtn = new AjaxButton(add) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
  update(target, selectedAvailableSets, availableSetsList, 
targettedSetsList);
}

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

  addBtn.setOutputMarkupId(true);

  add(addBtn);


-Original Message-
From: Clint Checketts [mailto:checke...@gmail.com] 
Sent: Monday, 2 May 2011 2:28 PM
To: users@wicket.apache.org
Subject: Re: How to fail validation if ListMultipleChoice is empty

You are correct that the Form's validation should only fire when submitting
the form. When an individual element is updated via ajax (as in an
AjaxFormComponentUpdatingBehavior) then just the processing and validations
steps are fired for the individual form component.

It makes me wonder if you are using an AjaxSubmitButton instead of just an
AjaxButton. (Or similarly an AjaxSubmitLink instead of an  AjaxLink) Mind
including your button's code?

Also, why are you calling getChoices() instead of getConvertedInput() in the
validator? Choices represent the possible selection options, the converted
input is the value of the selected choices.

-Clint

On Sun, May 1, 2011 at 9:25 PM, Coleman, Chris 
chris.cole...@thalesgroup.com.au wrote:

 Yes, it's all via AJAX.

 In the last few minutes I've tried a different approach and it works ok but
 it introduces another problem:

  form.add(new AbstractFormValidator()
  {
public FormComponent[] getDependentFormComponents()
{
  return null;
}

public void validate(Form? form)
{
  List sets = targettedSetsList.getChoices();

  if ( sets.size() == 0 ) {
targettedSetsList.error((IValidationError)new
 ValidationError().addMessageKey(error.noSetSpecified));
  }
}
  });

 This accurately detects when nothing is in the list and displays an error
 message but once emptied we can not add new elements to the list because the
 validation is also executed when the 'add' button is pressed. The validation
 fails because the list is empty so the 'add' fails, making it impossible to
 add new elements when the list is empty.

 I thought validation would only occur when the user submits the form but it
 appears to be fired off whenever the user presses the 'add' button. Is this
 to be expected?


 -Original Message-
 From: Clint Checketts [mailto:checke...@gmail.com]
 Sent: Monday, 2 May 2011 12:10 PM
 To: users@wicket.apache.org
 Subject: Re: How to fail validation if ListMultipleChoice is empty

 Lets see the code about 'adding elements by pressing on a button'.  The
 'getValue()' method is returning the value from the list box's HTTP
 submitted values, if the add button is submitting values via ajax or some
 other means then it may need a different approach.

 -Clint

 On Sun, May 1, 2011 at 8:15 PM, Coleman, Chris 
 chris.cole...@thalesgroup.com.au wrote:

  We have an app that allows people to add elements to a ListMultipleChoice
  by pressing on a button. We want the form to fail validation if the
  ListMultipleChoice contains no elements.
 
  I've tried this:
 
   targettedSetsList.add(new IValidator()
   {
 public void validate(IValidatable validatable) {
   // Always contains no items - strange
   Collection list = (Collection)validatable.getValue();
 
   if ( list.size() == 0 ) {
 ValidationError ve = new ValidationError();
 ve.setMessage(No sets have been specified for deployment);
 validatable.error(ve);
   }
 }
   });
 
  but at validation the list.size() is always 0 even if the user has added
  elements. Am I doing it the right way? Is there a better way?
 
 
 
 
 
 DISCLAIMER:---
  This e-mail transmission and any documents, files and previous e-mail
  messages
  attached to it are private and confidential. They may contain proprietary
  or copyright
  material or information that is subject to legal professional privilege.
  They are for
  the use of the intended recipient only.  Any unauthorised viewing, use,
  disclosure,
  copying, alteration, storage or distribution of, or reliance on, this
  message is
  strictly prohibited. No part may be reproduced, adapted or transmitted
  without the
  written permission of the owner. If you have received this transmission
 in
  error, or
  are not an authorised recipient, please immediately notify the sender by
  return email,
  delete this message and all 

Re: How to fail validation if ListMultipleChoice is empty

2011-05-01 Thread Clint Checketts
Good catch on AjaxSubmitButton being deprecated, I guess an IDe would have
made that obvious ;)

I do have to say using the getChoices over a proper model may give you more
work than needed in updating the underlying model objects (maybe consider
overriding the getConvertedInput to return getChoices)

It sounds like you have different buttons for adding and submitting. Correct
me if this is too hackish, but you could change the validator to check if
the addBtn is the submitting button, and ignore the validation in that case:

  form.add(new AbstractFormValidator()
  {
public FormComponent[] getDependentFormComponents()
{
  return null;
}

public void validate(Form? form)
{
  List sets = targettedSetsList.getChoices();

  if ((*!addBtn.equals(form.findSubmittingButton()) * sets.size() == 0
) {
targettedSetsList.error((IValidationError)new
  ValidationError().addMessageKey(error.noSetSpecified));
  }
}
  });


-Clint

On Mon, May 2, 2011 at 12:27 AM, Coleman, Chris 
chris.cole...@thalesgroup.com.au wrote:

 According to the doco the default form processing behavior is executed for
 AjaxButton and AjaxSubmitButton (in fact AjaxSubmitButton appears to be
 deprecated - behaves the same as AjaxButton anyway?).

 I am using AjaxButton.

 I actually don't care about the selections but rather, the entries that the
 user has added to the list (whether selected or not) which is why I call
 getChoices() rather than getConvertedInput()

 The button code is:

  AjaxButton addBtn = new AjaxButton(add) {
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
  update(target, selectedAvailableSets, availableSetsList,
 targettedSetsList);
}

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

  addBtn.setOutputMarkupId(true);

  add(addBtn);


 -Original Message-
 From: Clint Checketts [mailto:checke...@gmail.com]
 Sent: Monday, 2 May 2011 2:28 PM
 To: users@wicket.apache.org
 Subject: Re: How to fail validation if ListMultipleChoice is empty

 You are correct that the Form's validation should only fire when submitting
 the form. When an individual element is updated via ajax (as in an
 AjaxFormComponentUpdatingBehavior) then just the processing and validations
 steps are fired for the individual form component.

 It makes me wonder if you are using an AjaxSubmitButton instead of just an
 AjaxButton. (Or similarly an AjaxSubmitLink instead of an  AjaxLink) Mind
 including your button's code?

 Also, why are you calling getChoices() instead of getConvertedInput() in
 the
 validator? Choices represent the possible selection options, the converted
 input is the value of the selected choices.

 -Clint

 On Sun, May 1, 2011 at 9:25 PM, Coleman, Chris 
 chris.cole...@thalesgroup.com.au wrote:

  Yes, it's all via AJAX.
 
  In the last few minutes I've tried a different approach and it works ok
 but
  it introduces another problem:
 
   form.add(new AbstractFormValidator()
   {
 public FormComponent[] getDependentFormComponents()
 {
   return null;
 }
 
 public void validate(Form? form)
 {
   List sets = targettedSetsList.getChoices();
 
   if ( sets.size() == 0 ) {
 targettedSetsList.error((IValidationError)new
  ValidationError().addMessageKey(error.noSetSpecified));
   }
 }
   });
 
  This accurately detects when nothing is in the list and displays an error
  message but once emptied we can not add new elements to the list because
 the
  validation is also executed when the 'add' button is pressed. The
 validation
  fails because the list is empty so the 'add' fails, making it impossible
 to
  add new elements when the list is empty.
 
  I thought validation would only occur when the user submits the form but
 it
  appears to be fired off whenever the user presses the 'add' button. Is
 this
  to be expected?
 
 
  -Original Message-
  From: Clint Checketts [mailto:checke...@gmail.com]
  Sent: Monday, 2 May 2011 12:10 PM
  To: users@wicket.apache.org
  Subject: Re: How to fail validation if ListMultipleChoice is empty
 
  Lets see the code about 'adding elements by pressing on a button'.  The
  'getValue()' method is returning the value from the list box's HTTP
  submitted values, if the add button is submitting values via ajax or some
  other means then it may need a different approach.
 
  -Clint
 
  On Sun, May 1, 2011 at 8:15 PM, Coleman, Chris 
  chris.cole...@thalesgroup.com.au wrote:
 
   We have an app that allows people to add elements to a
 ListMultipleChoice
   by pressing on a button. We want the form to fail validation if the
   ListMultipleChoice contains no elements.
  
   I've tried this:
  
targettedSetsList.add(new IValidator()
{
  public void validate(IValidatable validatable) {
// Always contains no items - strange
Collection list = (Collection)validatable.getValue();
  
if ( list.size() == 

Re: wicket 1.5 AbstractDefaultAjaxBehavior bad url

2011-05-01 Thread msj121
SOLVED:

After some debugging I noticed the following:

In the constructor the url generated is:
./wicket/page?54-0.IBehaviorListener.0

In onBeforeRender and onAfterRender the url is
./wicket/page?54-1.IBehaviorListener.0

I was pretty much getting the url as a string and passing it to WiQuery (ie:
another object). When the url is finally updated after the constructor (ie:
later in the request cycle) the string was obviously not altered though the
url was no longer good.

Furthermore, reloading the page doesn't always seem to call the constructor
leaving a further off url. Meaning the string stored was for a previous
version number so it might be 52-0 instead of the intended 53-1 etc


This may be obvious to someone who understood the url changes even after the
constructor of the page was called. I suppose it boggled me as this is only
an issue now in Wicket 1.5 somehow.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-1-5-AbstractDefaultAjaxBehavior-bad-url-tp3484600p3489362.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