You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eyal Golan <eg...@gmail.com> on 2008/03/12 13:18:42 UTC

Ajax CheckGroup problem exception: java.lang.IllegalStateException: No Page found for component

Hi,
I made a select-all check box inside a table.
I used the example from
http://javathoughts.capesugarbird.com/2007/09/ajax-select-all-checkbox-for-wicket.html
It works well in most cases.

Here's some code:

Adding the checkgroup to the panel:
    private void addCheckGroup() {
        checkGroup = new MyAjaxCheckBox("allChecked", new
PropertyModel(this, "allChecked")) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                final boolean isSelected = isChecked();
                if (isSelected) {
                    checkGroupModel.addAll(entitiesList);
                } else {
                    checkGroupModel.clear();
                }
                for (MyAjaxCheckBox check : checkboxes) {
                    check.setOutputMarkupId(true);
                    target.addComponent(check);
                }
                for (EntityWrapper entity : entitiesList) {
                    entity.setSelect(isSelected);
                }
//                target.addComponent(EntitiesPanel.this);
                EntitiesPanel.this.onUpdate(target);
            }
            @Override
            public boolean isVisible() {
                return (withSelect && entitiesList != null &&
entitiesList.size() > 0);
            }
        };
        checkGroup.setOutputMarkupId(true);
//        checkGroup.setVisible(false);
        add(checkGroup);
    }

The Checkbox column inside the table, and the fragment it uses:
    private AbstractColumn createCheckboxColumn() {
        AbstractColumn p = new AbstractColumn(new Model()) {
            private static final long serialVersionUID = 1L;

            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                EntityWrapper confEntity = (EntityWrapper)
rowModel.getObject();
                Fragment frag = new CheckboxEntityFrag(componentId,
"checkboxFrag",
                        EntitiesPanel.this, confEntity);
                cellItem.add(frag);
            }
        };
        return p;
    }

        private CheckboxEntityFrag(String id, String markupId,
MarkupContainer markupProvider,
                final EntityWrapper value) {
            super(id, markupId, markupProvider);
            checkbox = new MyAjaxCheckBox("entityCheckbox", new
PropertyModel(value, "select")) {
                private static final long serialVersionUID = 1L;

                @Override
                protected void onUpdate(AjaxRequestTarget target) {
                    if (isChecked()) {
                        if (!checkGroupModel.contains(value))
                            checkGroupModel.add(value);
                    } else {
                        checkGroupModel.remove(value);
                    }
                    setAllChecked(checkGroupModel.size() ==
entitiesList.size());
                    checkGroup.setOutputMarkupId(true);
                    target.addComponent(checkGroup);
                    EntitiesPanel.this.onUpdate(target);
                }
            };
            add(checkbox);
            checkboxes.add(checkbox);
        }
    }

The problem:
someone else uses my panel for his purposes.
He has a page (search page) that has my panel (with the table and the
checkboxes).
His page has a navigation button - NEXT that uses setResponsePage.
The next page has a PREV button to go back.
Going back is also with setResponsePage WITH THE ORIGINAL one.

The scenario:
Open the search page (with my panel) - the 'select-all' work fine.
Press next.
Press back.

Press the 'select-all' again.
I get an exception: java.lang.IllegalStateException: No Page found for
component [MarkupContainer [Component id = entityCheckbox, page = <No Page>,
path = 1:cells:1:cell:entityCheckbox.EntitiesPanel$CheckboxEntityFrag$1]]

Is there something in a page's component's life cycle that I'm missing?

Hope it's clear.

(I'll be away for a few days so bare with me if I'm not answering)

Thanks
-- 
Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/

RE: File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
Never mind - found it, but it's PHP. Well, might help to structure
things properly.

Thanks,

Michael

-----Original Message-----
From: Michael Mehrle [mailto:michael.mehrle@ask.com] 
Sent: Monday, March 24, 2008 2:24 PM
To: users@wicket.apache.org
Subject: RE: File upload field inside of a modal?

What a tease! No source code from what I can tell...

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Monday, March 24, 2008 2:14 PM
To: users@wicket.apache.org
Subject: Re: File upload field inside of a modal?

take a look here for a starting point:

http://www.phpletter.com/Demo/AjaxFileUpload-Demo/

we cannot use jquery in wicket core projects directly because it is
not properly namespaced...

-igor


On Mon, Mar 24, 2008 at 2:12 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Right - the old fashioned way. Igor strikes again - I'll give that a
>  shot - let you know if it pans out :-)
>
>
>  Michael
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>
>
> Sent: Monday, March 24, 2008 2:10 PM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  via javascript: form.submit();
>
>  -igor
>
>
>  On Mon, Mar 24, 2008 at 2:03 PM, Michael Mehrle
<mi...@ask.com>
>  wrote:
>  > That sounds worthwhile exploring. How do I trigger a POST request
in
>  an
>  >  iFrame from within a Wicket modal window?
>  >
>  >  Thanks again for your input.
>  >
>  >  Michael
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>  >  Sent: Monday, March 24, 2008 1:41 PM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: File upload field inside of a modal?
>  >
>  >  usually it is done with a hidden iframe which does the POST
>  >
>  >  -igor
>  >
>  >
>  >  On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
>  >  <mi...@ask.com> wrote:
>  >  > No, I don't have an example - looking for a way to make it
work...
>  >  >
>  >  >  Michael
>  >  >
>  >  >
>  >  >
>  >  >  -----Original Message-----
>  >  >  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  >  >  Sent: Monday, March 24, 2008 11:30 AM
>  >  >  To: users@wicket.apache.org
>  >  >  Subject: Re: File upload field inside of a modal?
>  >  >
>  >  >  dont think so.. ajax file upload is not possible i think.
>  >  >  Or do you have examples where they do that?
>  >  >
>  >  >  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
>  >  <mi...@ask.com>
>  >  >  wrote:
>  >  >
>  >  >  > According to this old threat, the use of a file upload field
>  inside
>  >  a
>  >  >  > wicket Ajax modal was not possible:
>  >  >  >
>  >  >  > http://tinyurl.com/3e4z35
>  >  >  >
>  >  >  > Has anyone found a work-around to this (besides placing the
>  field
>  >  into
>  >  >  a
>  >  >  > regular page ;-) ?
>  >  >  >
>  >  >  > Thanks!
>  >  >  >
>  >  >  > Michael
>  >  >  >
>  >  >  >
>  >
---------------------------------------------------------------------
>  >  >  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  > For additional commands, e-mail: users-help@wicket.apache.org
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >  >
>  >  >
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


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


RE: File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
What a tease! No source code from what I can tell...

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Monday, March 24, 2008 2:14 PM
To: users@wicket.apache.org
Subject: Re: File upload field inside of a modal?

take a look here for a starting point:

http://www.phpletter.com/Demo/AjaxFileUpload-Demo/

we cannot use jquery in wicket core projects directly because it is
not properly namespaced...

-igor


On Mon, Mar 24, 2008 at 2:12 PM, Michael Mehrle <mi...@ask.com>
wrote:
> Right - the old fashioned way. Igor strikes again - I'll give that a
>  shot - let you know if it pans out :-)
>
>
>  Michael
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>
>
> Sent: Monday, March 24, 2008 2:10 PM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  via javascript: form.submit();
>
>  -igor
>
>
>  On Mon, Mar 24, 2008 at 2:03 PM, Michael Mehrle
<mi...@ask.com>
>  wrote:
>  > That sounds worthwhile exploring. How do I trigger a POST request
in
>  an
>  >  iFrame from within a Wicket modal window?
>  >
>  >  Thanks again for your input.
>  >
>  >  Michael
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>  >  Sent: Monday, March 24, 2008 1:41 PM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: File upload field inside of a modal?
>  >
>  >  usually it is done with a hidden iframe which does the POST
>  >
>  >  -igor
>  >
>  >
>  >  On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
>  >  <mi...@ask.com> wrote:
>  >  > No, I don't have an example - looking for a way to make it
work...
>  >  >
>  >  >  Michael
>  >  >
>  >  >
>  >  >
>  >  >  -----Original Message-----
>  >  >  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  >  >  Sent: Monday, March 24, 2008 11:30 AM
>  >  >  To: users@wicket.apache.org
>  >  >  Subject: Re: File upload field inside of a modal?
>  >  >
>  >  >  dont think so.. ajax file upload is not possible i think.
>  >  >  Or do you have examples where they do that?
>  >  >
>  >  >  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
>  >  <mi...@ask.com>
>  >  >  wrote:
>  >  >
>  >  >  > According to this old threat, the use of a file upload field
>  inside
>  >  a
>  >  >  > wicket Ajax modal was not possible:
>  >  >  >
>  >  >  > http://tinyurl.com/3e4z35
>  >  >  >
>  >  >  > Has anyone found a work-around to this (besides placing the
>  field
>  >  into
>  >  >  a
>  >  >  > regular page ;-) ?
>  >  >  >
>  >  >  > Thanks!
>  >  >  >
>  >  >  > Michael
>  >  >  >
>  >  >  >
>  >
---------------------------------------------------------------------
>  >  >  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  > For additional commands, e-mail: users-help@wicket.apache.org
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >  >
>  >  >
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


Re: File upload field inside of a modal?

Posted by Igor Vaynberg <ig...@gmail.com>.
take a look here for a starting point:

http://www.phpletter.com/Demo/AjaxFileUpload-Demo/

we cannot use jquery in wicket core projects directly because it is
not properly namespaced...

-igor


On Mon, Mar 24, 2008 at 2:12 PM, Michael Mehrle <mi...@ask.com> wrote:
> Right - the old fashioned way. Igor strikes again - I'll give that a
>  shot - let you know if it pans out :-)
>
>
>  Michael
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>
>
> Sent: Monday, March 24, 2008 2:10 PM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  via javascript: form.submit();
>
>  -igor
>
>
>  On Mon, Mar 24, 2008 at 2:03 PM, Michael Mehrle <mi...@ask.com>
>  wrote:
>  > That sounds worthwhile exploring. How do I trigger a POST request in
>  an
>  >  iFrame from within a Wicket modal window?
>  >
>  >  Thanks again for your input.
>  >
>  >  Michael
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>  >  Sent: Monday, March 24, 2008 1:41 PM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: File upload field inside of a modal?
>  >
>  >  usually it is done with a hidden iframe which does the POST
>  >
>  >  -igor
>  >
>  >
>  >  On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
>  >  <mi...@ask.com> wrote:
>  >  > No, I don't have an example - looking for a way to make it work...
>  >  >
>  >  >  Michael
>  >  >
>  >  >
>  >  >
>  >  >  -----Original Message-----
>  >  >  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  >  >  Sent: Monday, March 24, 2008 11:30 AM
>  >  >  To: users@wicket.apache.org
>  >  >  Subject: Re: File upload field inside of a modal?
>  >  >
>  >  >  dont think so.. ajax file upload is not possible i think.
>  >  >  Or do you have examples where they do that?
>  >  >
>  >  >  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
>  >  <mi...@ask.com>
>  >  >  wrote:
>  >  >
>  >  >  > According to this old threat, the use of a file upload field
>  inside
>  >  a
>  >  >  > wicket Ajax modal was not possible:
>  >  >  >
>  >  >  > http://tinyurl.com/3e4z35
>  >  >  >
>  >  >  > Has anyone found a work-around to this (besides placing the
>  field
>  >  into
>  >  >  a
>  >  >  > regular page ;-) ?
>  >  >  >
>  >  >  > Thanks!
>  >  >  >
>  >  >  > Michael
>  >  >  >
>  >  >  >
>  >  ---------------------------------------------------------------------
>  >  >  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  > For additional commands, e-mail: users-help@wicket.apache.org
>  >  >  >
>  >  >  >
>  >  >
>  >  >
>  ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


RE: File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
Right - the old fashioned way. Igor strikes again - I'll give that a
shot - let you know if it pans out :-)

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Monday, March 24, 2008 2:10 PM
To: users@wicket.apache.org
Subject: Re: File upload field inside of a modal?

via javascript: form.submit();

-igor


On Mon, Mar 24, 2008 at 2:03 PM, Michael Mehrle <mi...@ask.com>
wrote:
> That sounds worthwhile exploring. How do I trigger a POST request in
an
>  iFrame from within a Wicket modal window?
>
>  Thanks again for your input.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>  Sent: Monday, March 24, 2008 1:41 PM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  usually it is done with a hidden iframe which does the POST
>
>  -igor
>
>
>  On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
>  <mi...@ask.com> wrote:
>  > No, I don't have an example - looking for a way to make it work...
>  >
>  >  Michael
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  >  Sent: Monday, March 24, 2008 11:30 AM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: File upload field inside of a modal?
>  >
>  >  dont think so.. ajax file upload is not possible i think.
>  >  Or do you have examples where they do that?
>  >
>  >  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
>  <mi...@ask.com>
>  >  wrote:
>  >
>  >  > According to this old threat, the use of a file upload field
inside
>  a
>  >  > wicket Ajax modal was not possible:
>  >  >
>  >  > http://tinyurl.com/3e4z35
>  >  >
>  >  > Has anyone found a work-around to this (besides placing the
field
>  into
>  >  a
>  >  > regular page ;-) ?
>  >  >
>  >  > Thanks!
>  >  >
>  >  > Michael
>  >  >
>  >  >
>  ---------------------------------------------------------------------
>  >  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  > For additional commands, e-mail: users-help@wicket.apache.org
>  >  >
>  >  >
>  >
>  >
---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


Re: File upload field inside of a modal?

Posted by Igor Vaynberg <ig...@gmail.com>.
via javascript: form.submit();

-igor


On Mon, Mar 24, 2008 at 2:03 PM, Michael Mehrle <mi...@ask.com> wrote:
> That sounds worthwhile exploring. How do I trigger a POST request in an
>  iFrame from within a Wicket modal window?
>
>  Thanks again for your input.
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
>  Sent: Monday, March 24, 2008 1:41 PM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  usually it is done with a hidden iframe which does the POST
>
>  -igor
>
>
>  On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
>  <mi...@ask.com> wrote:
>  > No, I don't have an example - looking for a way to make it work...
>  >
>  >  Michael
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  >  Sent: Monday, March 24, 2008 11:30 AM
>  >  To: users@wicket.apache.org
>  >  Subject: Re: File upload field inside of a modal?
>  >
>  >  dont think so.. ajax file upload is not possible i think.
>  >  Or do you have examples where they do that?
>  >
>  >  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
>  <mi...@ask.com>
>  >  wrote:
>  >
>  >  > According to this old threat, the use of a file upload field inside
>  a
>  >  > wicket Ajax modal was not possible:
>  >  >
>  >  > http://tinyurl.com/3e4z35
>  >  >
>  >  > Has anyone found a work-around to this (besides placing the field
>  into
>  >  a
>  >  > regular page ;-) ?
>  >  >
>  >  > Thanks!
>  >  >
>  >  > Michael
>  >  >
>  >  >
>  ---------------------------------------------------------------------
>  >  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  > For additional commands, e-mail: users-help@wicket.apache.org
>  >  >
>  >  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  >  For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


RE: File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
That sounds worthwhile exploring. How do I trigger a POST request in an
iFrame from within a Wicket modal window?

Thanks again for your input.

Michael

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Monday, March 24, 2008 1:41 PM
To: users@wicket.apache.org
Subject: Re: File upload field inside of a modal?

usually it is done with a hidden iframe which does the POST

-igor


On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle
<mi...@ask.com> wrote:
> No, I don't have an example - looking for a way to make it work...
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  Sent: Monday, March 24, 2008 11:30 AM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  dont think so.. ajax file upload is not possible i think.
>  Or do you have examples where they do that?
>
>  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle
<mi...@ask.com>
>  wrote:
>
>  > According to this old threat, the use of a file upload field inside
a
>  > wicket Ajax modal was not possible:
>  >
>  > http://tinyurl.com/3e4z35
>  >
>  > Has anyone found a work-around to this (besides placing the field
into
>  a
>  > regular page ;-) ?
>  >
>  > Thanks!
>  >
>  > Michael
>  >
>  >
---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  > For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


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


Re: File upload field inside of a modal?

Posted by Igor Vaynberg <ig...@gmail.com>.
usually it is done with a hidden iframe which does the POST

-igor


On Mon, Mar 24, 2008 at 12:05 PM, Michael Mehrle <mi...@ask.com> wrote:
> No, I don't have an example - looking for a way to make it work...
>
>  Michael
>
>
>
>  -----Original Message-----
>  From: Johan Compagner [mailto:jcompagner@gmail.com]
>  Sent: Monday, March 24, 2008 11:30 AM
>  To: users@wicket.apache.org
>  Subject: Re: File upload field inside of a modal?
>
>  dont think so.. ajax file upload is not possible i think.
>  Or do you have examples where they do that?
>
>  On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle <mi...@ask.com>
>  wrote:
>
>  > According to this old threat, the use of a file upload field inside a
>  > wicket Ajax modal was not possible:
>  >
>  > http://tinyurl.com/3e4z35
>  >
>  > Has anyone found a work-around to this (besides placing the field into
>  a
>  > regular page ;-) ?
>  >
>  > Thanks!
>  >
>  > Michael
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  > For additional commands, e-mail: users-help@wicket.apache.org
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>  For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


RE: File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
No, I don't have an example - looking for a way to make it work...

Michael

-----Original Message-----
From: Johan Compagner [mailto:jcompagner@gmail.com] 
Sent: Monday, March 24, 2008 11:30 AM
To: users@wicket.apache.org
Subject: Re: File upload field inside of a modal?

dont think so.. ajax file upload is not possible i think.
Or do you have examples where they do that?

On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle <mi...@ask.com>
wrote:

> According to this old threat, the use of a file upload field inside a
> wicket Ajax modal was not possible:
>
> http://tinyurl.com/3e4z35
>
> Has anyone found a work-around to this (besides placing the field into
a
> regular page ;-) ?
>
> Thanks!
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: File upload field inside of a modal?

Posted by Johan Compagner <jc...@gmail.com>.
dont think so.. ajax file upload is not possible i think.
Or do you have examples where they do that?

On Mon, Mar 24, 2008 at 6:08 PM, Michael Mehrle <mi...@ask.com>
wrote:

> According to this old threat, the use of a file upload field inside a
> wicket Ajax modal was not possible:
>
> http://tinyurl.com/3e4z35
>
> Has anyone found a work-around to this (besides placing the field into a
> regular page ;-) ?
>
> Thanks!
>
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

File upload field inside of a modal?

Posted by Michael Mehrle <mi...@ask.com>.
According to this old threat, the use of a file upload field inside a
wicket Ajax modal was not possible:

http://tinyurl.com/3e4z35

Has anyone found a work-around to this (besides placing the field into a
regular page ;-) ?

Thanks!

Michael

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


Re: Ajax CheckGroup problem exception: java.lang.IllegalStateException: No Page found for component

Posted by Eyal Golan <eg...@gmail.com>.
Hey Johan,
thanks to your tip, I was able to locate the problem.
As what you said, each time the page was rendered, I added more checkboxes
to the list.
I am using fragment that add checkbox.
What I did instead, was, using a Map instead of a List:
Here is the change:

///// package and import ....
@SuppressWarnings("unchecked")
abstract class EntitiesPanel<E extends ConfigurationEntity> extends Panel {
    private static final long serialVersionUID = -4638085092491297735L;
    private static final int DEFAULT_PAGING = 100;
    private final String configurationName;
    private final Class browserClass;
    private final boolean withSelect;
    private final int paging;
    /** True if all items are selected */
    private boolean allChecked;
    /** Maintains a list of checked items. */
    private final List<EntityWrapper<E>> checkGroupModel = new
ArrayList<EntityWrapper<E>>();
    /** The select-all check box * */
    private MyAjaxCheckBox checkGroup;
    /** Each select boc * */
    /** The list of all entities* */
    private List<EntityWrapper<E>> entitiesList;
    /** The table * */
    private DataTable entityDataTable;

    *private final Map<EntityWrapper, EntityCheckBox> checkboxesMap;*

    @SpringBean(name = "sageDalSecured")
    protected SageDal sageDal;

    EntitiesPanel(String id, String confName, Class browserClass) {
        this(id, confName, browserClass, false, DEFAULT_PAGING);
    }

    EntitiesPanel(String id, String confName, Class browserClass, boolean
withSelect,
            int paging) {
        super(id);
        add(HeaderContributor.forCss(EntitiesPanel.class, "EntitiesPanel.css
"));
        ...
        this.withSelect = withSelect;
        this.configurationName = confName;
        this.browserClass = browserClass;
        this.paging = paging;
        entitiesList = new ArrayList<EntityWrapper<E>>();
        checkboxesMap = new HashMap<EntityWrapper, EntityCheckBox>();
        addCheckGroup();
    }

    final void addToPanel(Set<EntityWrapper<E>> wrappedEntities) {
        setEntitiesList(wrappedEntities);
        final boolean listEmpty = (entitiesList.size() == 0);
        EntityDataProvider entitiesProvider = new
EntityDataProvider(entitiesList,
                getLinkSortProp());
        final List<String> allFields;
        if (listEmpty) {
            allFields = new ArrayList<String>();
        } else {
            allFields = getAllFields(configurationName);
        }
        createTable(entitiesProvider, allFields);
    }

    List<AbstractColumn> getColumnsForTable(List<String> allFields) {
        List<AbstractColumn> columns = new ArrayList<AbstractColumn>();
        for (String field : allFields) {
            columns.add(createColumn(field));
        }
        return columns;
    }

    final PropertyColumn createColumn(final String fieldName) {
        PropertyColumn p = new PropertyColumn(new
Model(getColumnHeader(fieldName)),
                fieldName, fieldName) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                ConfigurationEntity confEntity = ((EntityWrapper)
rowModel.getObject())
                        .getEntity();
                ...

                Fragment frag = new CellEntityFrag(componentId, "cellFrag",
                        EntitiesPanel.this, strValue);
                cellItem.add(frag);
            }
        };
        return p;
    }

    /** Subclasses can override */
//    protected void onUpdate(AjaxRequestTarget target) {
//    }

    // Private Methods

    private void addCheckGroup() {
        checkGroup = new MyAjaxCheckBox("allChecked", new
PropertyModel(this, "allChecked")) {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                final boolean isSelected = isChecked();
                if (isSelected) {
                    checkGroupModel.addAll(entitiesList);
                } else {
                    checkGroupModel.clear();
                }
                *Collection<EntityCheckBox> checkboxes =
checkboxesMap.values();
                for (EntityCheckBox check : checkboxes) {
                    check.setOutputMarkupId(true);
                    target.addComponent(check);
                }*
                for (EntityWrapper entity : entitiesList) {
                    entity.setSelect(isSelected);
                }
//                EntitiesPanel.this.onUpdate(target);
            }

            @Override
            public boolean isVisible() {
                return (withSelect && entitiesList != null &&
entitiesList.size() > 0);
            }
        };
        checkGroup.setOutputMarkupId(true);
        Label allSelectedLabel = new Label("allSelectedLabel", new
Model(Utils
                .getLocalizationField("allSelected", "entities.label.")));
        add(checkGroup);
        add(allSelectedLabel);
    }

    private void createTable(EntityDataProvider entitiesProvider, final
List<String> allFields) {
        List<AbstractColumn> columns = new ArrayList<AbstractColumn>();
        if (entitiesProvider.size() == 0) {
            columns.add(new AbstractColumn(new Model()) {
                private static final long serialVersionUID = 1L;

                public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                }
            });
        } else {
            if (withSelect) {
                columns.add(createCheckboxColumn());
            }
            if (allFields.size() > 0) {
                columns.add(createLinkColumn());
                columns.addAll(getColumnsForTable(allFields));
            }
        }
        IColumn[] columnsArray = (IColumn[]) columns.toArray(new
IColumn[0]);
        entityDataTable = new DataTable("entitiesList", columnsArray,
                entitiesProvider, paging);
        add(entityDataTable);
    }

    private AbstractColumn createCheckboxColumn() {
        AbstractColumn p = new AbstractColumn(new Model()) {
            private static final long serialVersionUID = 1L;
            private CheckboxEntityFrag frag;

            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                EntityWrapper confEntity = (EntityWrapper)
rowModel.getObject();
                frag = new CheckboxEntityFrag(componentId, "checkboxFrag",
EntitiesPanel.this,
                        confEntity);
                cellItem.add(frag);
            }
        };
        return p;
    }

    private PropertyColumn createLinkColumn() {
        PropertyColumn p = new PropertyColumn(new Model(getLinkHeader()),
getLinkSortProp(),
                getLinkHeader()) {
            private static final long serialVersionUID = 11L;

            @Override
            public void populateItem(Item cellItem, String componentId,
IModel rowModel) {
                ConfigurationEntity confEntity = ((EntityWrapper)
rowModel.getObject())
                        .getEntity();
                Fragment frag = new LinkFrag(componentId, "linkFrag",
EntitiesPanel.this,
                        confEntity);
                cellItem.add(frag);
            }
        };
        return p;
    }

    *private EntityCheckBox getEntityCheckBox(final EntityWrapper
entityWrapper) {
        EntityCheckBox checkbox = checkboxesMap.get(entityWrapper);
        if (checkbox == null) {
            // null indicates that the map doesn't contain this key
            checkbox = new EntityCheckBox(entityWrapper);
            checkboxesMap.put(entityWrapper, checkbox);
        }
        return checkbox;
    }*

    // Fragment Classes

    private class LinkFrag extends Fragment {
        private static final long serialVersionUID = 1L;

        private LinkFrag(String id, String markupId, MarkupContainer
markupProvider,
                ConfigurationEntity confEntity) {
            super(id, markupId, markupProvider);
            PageParameters params = new PageParameters();
            params.put("configurationName", configurationName);
            putOtherParams(params, confEntity);

            PopupSettings popupSettings = new BrowserPopupSettings();
            Link linkToEntity = new BookmarkablePageLink("linkToEntity",
browserClass, params)
                    .setPopupSettings(popupSettings);
            Label label = new Label("markupLabel", new
Model(getLinkLabel(confEntity)));
            linkToEntity.add(label);
            add(linkToEntity);

        }
    }

    private class CellEntityFrag extends Fragment {
        private static final long serialVersionUID = 1L;

        private CellEntityFrag(String id, String markupId, MarkupContainer
markupProvider,
                String value) {
            super(id, markupId, markupProvider);
            Label label = new Label("value", new Model(value));
            add(label);
        }
    }

    private class CheckboxEntityFrag extends Fragment {
        private static final long serialVersionUID = 1L;

        private CheckboxEntityFrag(String id, String markupId,
MarkupContainer markupProvider,
                final EntityWrapper entityWrapper) {
            super(id, markupId, markupProvider);
            *final EntityCheckBox checkbox =
getEntityCheckBox(entityWrapper);*
            add(checkbox);
        }
    }

    // Getters and Setters
    public boolean isAllChecked() {
        return allChecked;
    }

    public void setAllChecked(boolean allChecked) {
        this.allChecked = allChecked;
    }

    public List<EntityWrapper<E>> getCheckGroupModel() {
        return checkGroupModel;
    }

    public List<EntityWrapper<E>> getEntitiesList() {
        return entitiesList;
    }

    public final void setEntitiesList(Collection<EntityWrapper<E>>
entitiesList) {
        this.entitiesList.clear();
        this.entitiesList.addAll(entitiesList);
    }

    // Abstract methods
    abstract String getColumnHeader(String fieldName);

    abstract String getLinkHeader();

    abstract String getLinkLabel(ConfigurationEntity confEntity);

    abstract void putOtherParams(PageParameters params, ConfigurationEntity
confEntity);

    abstract List<String> getAllFields(String configurationName);

    abstract String getLinkSortProp();

    // Private Clases

    private class EntityCheckBox extends MyAjaxCheckBox {
        private static final long serialVersionUID = -3711335571709705139L;
        final EntityWrapper entityWrapper;

        private EntityCheckBox(final EntityWrapper entityWrapper) {
            super("entityCheckbox", new PropertyModel(entityWrapper,
"select"));
            this.entityWrapper = entityWrapper;
        }

        @Override
        protected void onUpdate(AjaxRequestTarget target) {
            if (isChecked()) {
                if (!checkGroupModel.contains(entityWrapper))
                    checkGroupModel.add(entityWrapper);
            } else {
                checkGroupModel.remove(entityWrapper);
            }
            setAllChecked(checkGroupModel.size() == entitiesList.size());
            checkGroup.setOutputMarkupId(true);
            target.addComponent(checkGroup);
//            EntitiesPanel.this.onUpdate(target);
        }
    }
}


-- 
Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/

Re: Ajax CheckGroup problem exception: java.lang.IllegalStateException: No Page found for component

Posted by Eyal Golan <eg...@gmail.com>.
I understood the problem.
The solution appears to be tricky.
If and when I have it, I'll inform.

Thanks for the tip. It was most helpful.

Eyal

On Thu, Mar 13, 2008 at 2:32 PM, Johan Compagner <jc...@gmail.com>
wrote:

> you can't hold reference to    checkboxes.add(checkbox); like that
> Because onPopulate() can be called again when you refresh the page and
> then
> you get a new set
>
> You can use a reusestrategy for that but still
> If you want to set states then you should set states on your model object
> that the checkboxes have
>
>
>
> On Wed, Mar 12, 2008 at 1:18 PM, Eyal Golan <eg...@gmail.com> wrote:
>
> > Hi,
> > I made a select-all check box inside a table.
> > I used the example from
> >
> >
> http://javathoughts.capesugarbird.com/2007/09/ajax-select-all-checkbox-for-wicket.html
> > It works well in most cases.
> >
> > Here's some code:
> >
> > Adding the checkgroup to the panel:
> >    private void addCheckGroup() {
> >        checkGroup = new MyAjaxCheckBox("allChecked", new
> > PropertyModel(this, "allChecked")) {
> >            private static final long serialVersionUID = 1L;
> >
> >            @Override
> >            protected void onUpdate(AjaxRequestTarget target) {
> >                final boolean isSelected = isChecked();
> >                if (isSelected) {
> >                    checkGroupModel.addAll(entitiesList);
> >                } else {
> >                    checkGroupModel.clear();
> >                }
> >                for (MyAjaxCheckBox check : checkboxes) {
> >                    check.setOutputMarkupId(true);
> >                    target.addComponent(check);
> >                }
> >                for (EntityWrapper entity : entitiesList) {
> >                    entity.setSelect(isSelected);
> >                }
> > //                target.addComponent(EntitiesPanel.this);
> >                EntitiesPanel.this.onUpdate(target);
> >            }
> >            @Override
> >            public boolean isVisible() {
> >                return (withSelect && entitiesList != null &&
> > entitiesList.size() > 0);
> >            }
> >        };
> >        checkGroup.setOutputMarkupId(true);
> > //        checkGroup.setVisible(false);
> >        add(checkGroup);
> >    }
> >
> > The Checkbox column inside the table, and the fragment it uses:
> >    private AbstractColumn createCheckboxColumn() {
> >        AbstractColumn p = new AbstractColumn(new Model()) {
> >            private static final long serialVersionUID = 1L;
> >
> >            public void populateItem(Item cellItem, String componentId,
> > IModel rowModel) {
> >                EntityWrapper confEntity = (EntityWrapper)
> > rowModel.getObject();
> >                Fragment frag = new CheckboxEntityFrag(componentId,
> > "checkboxFrag",
> >                        EntitiesPanel.this, confEntity);
> >                cellItem.add(frag);
> >            }
> >        };
> >        return p;
> >    }
> >
> >        private CheckboxEntityFrag(String id, String markupId,
> > MarkupContainer markupProvider,
> >                final EntityWrapper value) {
> >            super(id, markupId, markupProvider);
> >            checkbox = new MyAjaxCheckBox("entityCheckbox", new
> > PropertyModel(value, "select")) {
> >                private static final long serialVersionUID = 1L;
> >
> >                @Override
> >                protected void onUpdate(AjaxRequestTarget target) {
> >                    if (isChecked()) {
> >                        if (!checkGroupModel.contains(value))
> >                            checkGroupModel.add(value);
> >                    } else {
> >                        checkGroupModel.remove(value);
> >                    }
> >                    setAllChecked(checkGroupModel.size() ==
> > entitiesList.size());
> >                    checkGroup.setOutputMarkupId(true);
> >                    target.addComponent(checkGroup);
> >                    EntitiesPanel.this.onUpdate(target);
> >                }
> >            };
> >            add(checkbox);
> >            checkboxes.add(checkbox);
> >        }
> >    }
> >
> > The problem:
> > someone else uses my panel for his purposes.
> > He has a page (search page) that has my panel (with the table and the
> > checkboxes).
> > His page has a navigation button - NEXT that uses setResponsePage.
> > The next page has a PREV button to go back.
> > Going back is also with setResponsePage WITH THE ORIGINAL one.
> >
> > The scenario:
> > Open the search page (with my panel) - the 'select-all' work fine.
> > Press next.
> > Press back.
> >
> > Press the 'select-all' again.
> > I get an exception: java.lang.IllegalStateException: No Page found for
> > component [MarkupContainer [Component id = entityCheckbox, page = <No
> > Page>,
> > path = 1:cells:1:cell:entityCheckbox.EntitiesPanel$CheckboxEntityFrag$1
> ]]
> >
> > Is there something in a page's component's life cycle that I'm missing?
> >
> > Hope it's clear.
> >
> > (I'll be away for a few days so bare with me if I'm not answering)
> >
> > Thanks
> > --
> > Eyal Golan
> > egolan74@gmail.com
> >
> > Visit: http://jvdrums.sourceforge.net/
> >
>



-- 
Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/

Re: Ajax CheckGroup problem exception: java.lang.IllegalStateException: No Page found for component

Posted by Johan Compagner <jc...@gmail.com>.
you can't hold reference to    checkboxes.add(checkbox); like that
Because onPopulate() can be called again when you refresh the page and then
you get a new set

You can use a reusestrategy for that but still
If you want to set states then you should set states on your model object
that the checkboxes have



On Wed, Mar 12, 2008 at 1:18 PM, Eyal Golan <eg...@gmail.com> wrote:

> Hi,
> I made a select-all check box inside a table.
> I used the example from
>
> http://javathoughts.capesugarbird.com/2007/09/ajax-select-all-checkbox-for-wicket.html
> It works well in most cases.
>
> Here's some code:
>
> Adding the checkgroup to the panel:
>    private void addCheckGroup() {
>        checkGroup = new MyAjaxCheckBox("allChecked", new
> PropertyModel(this, "allChecked")) {
>            private static final long serialVersionUID = 1L;
>
>            @Override
>            protected void onUpdate(AjaxRequestTarget target) {
>                final boolean isSelected = isChecked();
>                if (isSelected) {
>                    checkGroupModel.addAll(entitiesList);
>                } else {
>                    checkGroupModel.clear();
>                }
>                for (MyAjaxCheckBox check : checkboxes) {
>                    check.setOutputMarkupId(true);
>                    target.addComponent(check);
>                }
>                for (EntityWrapper entity : entitiesList) {
>                    entity.setSelect(isSelected);
>                }
> //                target.addComponent(EntitiesPanel.this);
>                EntitiesPanel.this.onUpdate(target);
>            }
>            @Override
>            public boolean isVisible() {
>                return (withSelect && entitiesList != null &&
> entitiesList.size() > 0);
>            }
>        };
>        checkGroup.setOutputMarkupId(true);
> //        checkGroup.setVisible(false);
>        add(checkGroup);
>    }
>
> The Checkbox column inside the table, and the fragment it uses:
>    private AbstractColumn createCheckboxColumn() {
>        AbstractColumn p = new AbstractColumn(new Model()) {
>            private static final long serialVersionUID = 1L;
>
>            public void populateItem(Item cellItem, String componentId,
> IModel rowModel) {
>                EntityWrapper confEntity = (EntityWrapper)
> rowModel.getObject();
>                Fragment frag = new CheckboxEntityFrag(componentId,
> "checkboxFrag",
>                        EntitiesPanel.this, confEntity);
>                cellItem.add(frag);
>            }
>        };
>        return p;
>    }
>
>        private CheckboxEntityFrag(String id, String markupId,
> MarkupContainer markupProvider,
>                final EntityWrapper value) {
>            super(id, markupId, markupProvider);
>            checkbox = new MyAjaxCheckBox("entityCheckbox", new
> PropertyModel(value, "select")) {
>                private static final long serialVersionUID = 1L;
>
>                @Override
>                protected void onUpdate(AjaxRequestTarget target) {
>                    if (isChecked()) {
>                        if (!checkGroupModel.contains(value))
>                            checkGroupModel.add(value);
>                    } else {
>                        checkGroupModel.remove(value);
>                    }
>                    setAllChecked(checkGroupModel.size() ==
> entitiesList.size());
>                    checkGroup.setOutputMarkupId(true);
>                    target.addComponent(checkGroup);
>                    EntitiesPanel.this.onUpdate(target);
>                }
>            };
>            add(checkbox);
>            checkboxes.add(checkbox);
>        }
>    }
>
> The problem:
> someone else uses my panel for his purposes.
> He has a page (search page) that has my panel (with the table and the
> checkboxes).
> His page has a navigation button - NEXT that uses setResponsePage.
> The next page has a PREV button to go back.
> Going back is also with setResponsePage WITH THE ORIGINAL one.
>
> The scenario:
> Open the search page (with my panel) - the 'select-all' work fine.
> Press next.
> Press back.
>
> Press the 'select-all' again.
> I get an exception: java.lang.IllegalStateException: No Page found for
> component [MarkupContainer [Component id = entityCheckbox, page = <No
> Page>,
> path = 1:cells:1:cell:entityCheckbox.EntitiesPanel$CheckboxEntityFrag$1]]
>
> Is there something in a page's component's life cycle that I'm missing?
>
> Hope it's clear.
>
> (I'll be away for a few days so bare with me if I'm not answering)
>
> Thanks
> --
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/
>

Re: Ajax CheckGroup problem exception: java.lang.IllegalStateException: No Page found for component

Posted by Eyal Golan <eg...@gmail.com>.
One more thing.
The problem occurs also when reloading the search (original) page. ie -
pressing the F5.


On Wed, Mar 12, 2008 at 2:18 PM, Eyal Golan <eg...@gmail.com> wrote:

> Hi,
> I made a select-all check box inside a table.
> I used the example from
> http://javathoughts.capesugarbird.com/2007/09/ajax-select-all-checkbox-for-wicket.html
> It works well in most cases.
>
> Here's some code:
>
> Adding the checkgroup to the panel:
>     private void addCheckGroup() {
>         checkGroup = new MyAjaxCheckBox("allChecked", new
> PropertyModel(this, "allChecked")) {
>             private static final long serialVersionUID = 1L;
>
>             @Override
>             protected void onUpdate(AjaxRequestTarget target) {
>                 final boolean isSelected = isChecked();
>                 if (isSelected) {
>                     checkGroupModel.addAll(entitiesList);
>                 } else {
>                     checkGroupModel.clear();
>                 }
>                 for (MyAjaxCheckBox check : checkboxes) {
>                     check.setOutputMarkupId(true);
>                     target.addComponent(check);
>                 }
>                 for (EntityWrapper entity : entitiesList) {
>                     entity.setSelect(isSelected);
>                 }
> //                target.addComponent(EntitiesPanel.this);
>                 EntitiesPanel.this.onUpdate(target);
>             }
>             @Override
>             public boolean isVisible() {
>                 return (withSelect && entitiesList != null &&
> entitiesList.size() > 0);
>             }
>         };
>         checkGroup.setOutputMarkupId(true);
> //        checkGroup.setVisible(false);
>         add(checkGroup);
>     }
>
> The Checkbox column inside the table, and the fragment it uses:
>     private AbstractColumn createCheckboxColumn() {
>         AbstractColumn p = new AbstractColumn(new Model()) {
>             private static final long serialVersionUID = 1L;
>
>             public void populateItem(Item cellItem, String componentId,
> IModel rowModel) {
>                 EntityWrapper confEntity = (EntityWrapper)
> rowModel.getObject();
>                 Fragment frag = new CheckboxEntityFrag(componentId,
> "checkboxFrag",
>                         EntitiesPanel.this, confEntity);
>                 cellItem.add(frag);
>             }
>         };
>         return p;
>     }
>
>         private CheckboxEntityFrag(String id, String markupId,
> MarkupContainer markupProvider,
>                 final EntityWrapper value) {
>             super(id, markupId, markupProvider);
>             checkbox = new MyAjaxCheckBox("entityCheckbox", new
> PropertyModel(value, "select")) {
>                 private static final long serialVersionUID = 1L;
>
>                 @Override
>                 protected void onUpdate(AjaxRequestTarget target) {
>                     if (isChecked()) {
>                         if (!checkGroupModel.contains(value))
>                             checkGroupModel.add(value);
>                     } else {
>                         checkGroupModel.remove(value);
>                     }
>                     setAllChecked(checkGroupModel.size() ==
> entitiesList.size());
>                     checkGroup.setOutputMarkupId(true);
>                     target.addComponent(checkGroup);
>                     EntitiesPanel.this.onUpdate(target);
>                 }
>             };
>             add(checkbox);
>             checkboxes.add(checkbox);
>         }
>     }
>
> The problem:
> someone else uses my panel for his purposes.
> He has a page (search page) that has my panel (with the table and the
> checkboxes).
> His page has a navigation button - NEXT that uses setResponsePage.
> The next page has a PREV button to go back.
> Going back is also with setResponsePage WITH THE ORIGINAL one.
>
> The scenario:
> Open the search page (with my panel) - the 'select-all' work fine.
> Press next.
> Press back.
>
> Press the 'select-all' again.
> I get an exception: java.lang.IllegalStateException: No Page found for
> component [MarkupContainer [Component id = entityCheckbox, page = <No Page>,
> path = 1:cells:1:cell:entityCheckbox.EntitiesPanel$CheckboxEntityFrag$1]]
>
> Is there something in a page's component's life cycle that I'm missing?
>
> Hope it's clear.
>
> (I'll be away for a few days so bare with me if I'm not answering)
>
> Thanks
> --
> Eyal Golan
> egolan74@gmail.com
>
> Visit: http://jvdrums.sourceforge.net/




-- 
Eyal Golan
egolan74@gmail.com

Visit: http://jvdrums.sourceforge.net/