You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Vishal Popat <vi...@cipriati.co.uk> on 2010/11/09 17:04:02 UTC
Cannot get current page from AjaxPagingNavigator
Hi all,
For some reason I cannot get the current page number. This is the relevant
part of my code:
PageableListView dataList = new PageableListView("dataList", results, 10) {
protected void populateItem(ListItem item) {
..
}
}
AjaxPagingNavigator pagination = new
AjaxPagingNavigator("navigator", dataList);
add(pagination);
Label currentPage = new Label("currentPage",
pagination.getPageable().getCurrentPage() + "");
currentPage.setOutputMarkupId(true);
add(currentPage);
currentPage always returns 0.
I have also tried PagingNavigator with similar results.
Can anyone tell me what I have missed?
Regards
Vishal
Re: Cannot get current page from AjaxPagingNavigator
Posted by Pedro Santos <pe...@gmail.com>.
Use an dinamic model, ex:
Label currentPage = new Label("currentPage", new
AbstractReadOnlyModel<String>() {
public String getObject() {
return pagination.getPageable().getCurrentPage();
}
});
On Tue, Nov 9, 2010 at 2:04 PM, Vishal Popat <vi...@cipriati.co.uk>wrote:
> Hi all,
>
> For some reason I cannot get the current page number. This is the relevant
> part of my code:
>
>
>
> PageableListView dataList = new PageableListView("dataList", results, 10) {
>
> protected void populateItem(ListItem item) {
>
> ..
>
> }
>
> }
>
>
>
> AjaxPagingNavigator pagination = new
> AjaxPagingNavigator("navigator", dataList);
>
> add(pagination);
>
>
>
> Label currentPage = new Label("currentPage",
> pagination.getPageable().getCurrentPage() + "");
>
> currentPage.setOutputMarkupId(true);
>
> add(currentPage);
>
>
>
> currentPage always returns 0.
>
> I have also tried PagingNavigator with similar results.
>
>
>
> Can anyone tell me what I have missed?
>
>
>
> Regards
>
>
>
> Vishal
>
>
--
Pedro Henrique Oliveira dos Santos
Re: Cannot get current page from AjaxPagingNavigator
Posted by jcgarciam <jc...@gmail.com>.
Ohh sorry, now that i read your code carefully i see you have a case of the
Chicken and the Egg!! :)
On Wed, Nov 10, 2010 at 11:30 AM, Juan Carlos Garcia <jc...@gmail.com>wrote:
> I would change:
> final Label currentPage = new Label("currentPage", new Model());
>
> to this:
> Label currentPage = new Label("currentPage", new LoadableDetachableModel(){
> public Object load(){
> return pagination.getPageable().getCurrentPage() + 1;
>
>
> }
>
> });
>
> and then just remove the last part:
> currentPage.setDefaultModel(model);
>
> On Wed, Nov 10, 2010 at 5:19 AM, vp143 [via Apache Wicket] <
> ml-node+3035648-2145298352-65838@n4.nabble.com<ml...@n4.nabble.com>
> > wrote:
>
>> I got it working with the following code- thanks Pedro and JC
>>
>> final Label currentPage = new Label("currentPage", new Model());
>> currentPage.setOutputMarkupId(true);
>> add(currentPage);
>>
>> final AjaxPagingNavigator pagination = new
>> AjaxPagingNavigator("navigator", dataList) {
>> @Override
>> protected void onAjaxEvent(AjaxRequestTarget target) {
>> target.addComponent(currentPage);
>> super.onAjaxEvent(target);
>> }
>> };
>> add(pagination);
>>
>> LoadableDetachableModel model = new LoadableDetachableModel() {
>> public Object load(){
>> return pagination.getPageable().getCurrentPage() + 1;
>> }
>> };
>> currentPage.setDefaultModel(model);
>>
>> It had to be written like this because the model needs pagination which
>> would not have been initialised if written as an inner class when creating
>> the label.
>> Please let me know if anyone finds a better way of writing it.
>>
>> Many thanks again
>> Vishal
>>
>> ------------------------------
>> View message @
>> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3035648.html
>> To start a new topic under Apache Wicket, email
>> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
>> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>>
>>
>>
>
>
> --
> Sincerely,
> JC (http://www.linkedin.com/in/jcgarciam)
> Work smarter, not harder!.
>
>
--
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3036177.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Panel to be used as an abstract container
Posted by Poko Booth <po...@gmail.com>.
Martin, wicket border was what I actually needed ;)
Thanx for your time
On Nov 11, 2010, at 12:29 PM, Poko Booth wrote:
> Yes! Exactly, that's what I described in the previous mail. I hope panel will able to "find" the fragment declared to its parent. I'll let you know.
>
> On Thu, Nov 11, 2010 at 12:23 PM, Martin Grigorov <mg...@apache.org> wrote:
> If you have rounded corners at bottom of the panel then you'll need to add
> the Fragment *in* the Panel, but provide <wicket:fragment> in the Page (the
> fragment's markup provider)
> It is a bit tricky but I'm sure you'll manage it.
>
> On Thu, Nov 11, 2010 at 11:02 AM, Poko Booth <po...@gmail.com> wrote:
>
> > Exactly, thank you very much! I will try that in the afternoon. I had no
> > idea about Fragments, never used them before.
> >
> > I want to use this panel only for ui purposes. I don't want to repeat
> > "rounded corners" markup in each page or multiple times in the same page,
> > better have it in one place.
> >
> > Thank you again
> >
> > On Thu, Nov 11, 2010 at 11:53 AM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> >
> > > Yes, the panel always contribute with its .html (always the same html).
> > > The Fragment is the dynamic content (so small that you don't to create
> > > Panel
> > > for it).
> > >
> > > This is what you want, right ?
> > >
> > > On Thu, Nov 11, 2010 at 10:35 AM, Poko Booth <po...@gmail.com>
> > wrote:
> > >
> > > > Just to see if we are on the same page:
> > > >
> > > > You mean that the CustomPanel.html will be like this:
> > > > ...
> > > > <div class="RoundedStuff>
> > > > <div wicket:id="contents" />
> > > > </div>
> > > > ...
> > > >
> > > > And in the APage.html:
> > > > ...
> > > > <div wicket:id="pnl" />
> > > > <wicket:fragment wicket:id="whatever">
> > > > ...PANEL CONTENTS HERE...
> > > > </wicket:fragment>
> > > > ...
> > > >
> > > > and in APage.java:
> > > > ...
> > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > pnl.add(new Fragment("contents","whatever");
> > > > ...
> > > >
> > > > Right?
> > > >
> > > >
> > > > On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <
> > mgrigorov@apache.org
> > > > >wrote:
> > > >
> > > > > I think you need Fragment instead of Panel
> > > > >
> > > > > On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi all, my first mail here, glad to join your community!
> > > > > >
> > > > > > I want to do the following:
> > > > > >
> > > > > > Create a panel that will be rendered as a box with rounded corners.
> > I
> > > > > dont
> > > > > > want it to have it's inner components predefined in its class but
> > > > > > dynamically adding them on each page the panel is present. I wish I
> > > > could
> > > > > > have its html file containg something like <wicket:extend /> and
> > put
> > > > > there
> > > > > > the markup defined when used in pages.
> > > > > >
> > > > > > Since I dont understand my own words so far, I'll give an example:
> > > > > >
> > > > > > CustomPanel.html
> > > > > > ...
> > > > > > <div class="Foo">
> > > > > > [other ui stuff here]
> > > > > > <wicket:extend />
> > > > > > </div>
> > > > > > ...
> > > > > >
> > > > > > APage.java
> > > > > > ...
> > > > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > > > pnl.add(new Label("test-lbl", "Tadaaa"));
> > > > > > add(pnl);
> > > > > > ...
> > > > > >
> > > > > > APage.html
> > > > > > ...
> > > > > > <span wicket:id="pnl">
> > > > > > <span wicket:id="test-lbl">
> > > > > > </span>
> > > > > > ...
> > > > > >
> > > > > > I want the page rendered having the label inside the custom panel
> > > > without
> > > > > > having to implicitly create another panel extending the
> > CustomPanel.
> > > > > >
> > > > > > So, if you understood this and have any ideas, let me know.
> > > > > >
> > > > > > Greetings from Greece,
> > > > > > Poko
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
Re: Panel to be used as an abstract container
Posted by Poko Booth <po...@gmail.com>.
Yes! Exactly, that's what I described in the previous mail. I hope panel
will able to "find" the fragment declared to its parent. I'll let you know.
On Thu, Nov 11, 2010 at 12:23 PM, Martin Grigorov <mg...@apache.org>wrote:
> If you have rounded corners at bottom of the panel then you'll need to add
> the Fragment *in* the Panel, but provide <wicket:fragment> in the Page (the
> fragment's markup provider)
> It is a bit tricky but I'm sure you'll manage it.
>
> On Thu, Nov 11, 2010 at 11:02 AM, Poko Booth <po...@gmail.com> wrote:
>
> > Exactly, thank you very much! I will try that in the afternoon. I had no
> > idea about Fragments, never used them before.
> >
> > I want to use this panel only for ui purposes. I don't want to repeat
> > "rounded corners" markup in each page or multiple times in the same page,
> > better have it in one place.
> >
> > Thank you again
> >
> > On Thu, Nov 11, 2010 at 11:53 AM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> >
> > > Yes, the panel always contribute with its .html (always the same html).
> > > The Fragment is the dynamic content (so small that you don't to create
> > > Panel
> > > for it).
> > >
> > > This is what you want, right ?
> > >
> > > On Thu, Nov 11, 2010 at 10:35 AM, Poko Booth <po...@gmail.com>
> > wrote:
> > >
> > > > Just to see if we are on the same page:
> > > >
> > > > You mean that the CustomPanel.html will be like this:
> > > > ...
> > > > <div class="RoundedStuff>
> > > > <div wicket:id="contents" />
> > > > </div>
> > > > ...
> > > >
> > > > And in the APage.html:
> > > > ...
> > > > <div wicket:id="pnl" />
> > > > <wicket:fragment wicket:id="whatever">
> > > > ...PANEL CONTENTS HERE...
> > > > </wicket:fragment>
> > > > ...
> > > >
> > > > and in APage.java:
> > > > ...
> > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > pnl.add(new Fragment("contents","whatever");
> > > > ...
> > > >
> > > > Right?
> > > >
> > > >
> > > > On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <
> > mgrigorov@apache.org
> > > > >wrote:
> > > >
> > > > > I think you need Fragment instead of Panel
> > > > >
> > > > > On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com>
> > > > wrote:
> > > > >
> > > > > > Hi all, my first mail here, glad to join your community!
> > > > > >
> > > > > > I want to do the following:
> > > > > >
> > > > > > Create a panel that will be rendered as a box with rounded
> corners.
> > I
> > > > > dont
> > > > > > want it to have it's inner components predefined in its class but
> > > > > > dynamically adding them on each page the panel is present. I wish
> I
> > > > could
> > > > > > have its html file containg something like <wicket:extend /> and
> > put
> > > > > there
> > > > > > the markup defined when used in pages.
> > > > > >
> > > > > > Since I dont understand my own words so far, I'll give an
> example:
> > > > > >
> > > > > > CustomPanel.html
> > > > > > ...
> > > > > > <div class="Foo">
> > > > > > [other ui stuff here]
> > > > > > <wicket:extend />
> > > > > > </div>
> > > > > > ...
> > > > > >
> > > > > > APage.java
> > > > > > ...
> > > > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > > > pnl.add(new Label("test-lbl", "Tadaaa"));
> > > > > > add(pnl);
> > > > > > ...
> > > > > >
> > > > > > APage.html
> > > > > > ...
> > > > > > <span wicket:id="pnl">
> > > > > > <span wicket:id="test-lbl">
> > > > > > </span>
> > > > > > ...
> > > > > >
> > > > > > I want the page rendered having the label inside the custom panel
> > > > without
> > > > > > having to implicitly create another panel extending the
> > CustomPanel.
> > > > > >
> > > > > > So, if you understood this and have any ideas, let me know.
> > > > > >
> > > > > > Greetings from Greece,
> > > > > > Poko
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > > >>
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
Re: Panel to be used as an abstract container
Posted by Martin Grigorov <mg...@apache.org>.
If you have rounded corners at bottom of the panel then you'll need to add
the Fragment *in* the Panel, but provide <wicket:fragment> in the Page (the
fragment's markup provider)
It is a bit tricky but I'm sure you'll manage it.
On Thu, Nov 11, 2010 at 11:02 AM, Poko Booth <po...@gmail.com> wrote:
> Exactly, thank you very much! I will try that in the afternoon. I had no
> idea about Fragments, never used them before.
>
> I want to use this panel only for ui purposes. I don't want to repeat
> "rounded corners" markup in each page or multiple times in the same page,
> better have it in one place.
>
> Thank you again
>
> On Thu, Nov 11, 2010 at 11:53 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > Yes, the panel always contribute with its .html (always the same html).
> > The Fragment is the dynamic content (so small that you don't to create
> > Panel
> > for it).
> >
> > This is what you want, right ?
> >
> > On Thu, Nov 11, 2010 at 10:35 AM, Poko Booth <po...@gmail.com>
> wrote:
> >
> > > Just to see if we are on the same page:
> > >
> > > You mean that the CustomPanel.html will be like this:
> > > ...
> > > <div class="RoundedStuff>
> > > <div wicket:id="contents" />
> > > </div>
> > > ...
> > >
> > > And in the APage.html:
> > > ...
> > > <div wicket:id="pnl" />
> > > <wicket:fragment wicket:id="whatever">
> > > ...PANEL CONTENTS HERE...
> > > </wicket:fragment>
> > > ...
> > >
> > > and in APage.java:
> > > ...
> > > CustomPanel pnl = new CustomPanel("pnl");
> > > pnl.add(new Fragment("contents","whatever");
> > > ...
> > >
> > > Right?
> > >
> > >
> > > On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <
> mgrigorov@apache.org
> > > >wrote:
> > >
> > > > I think you need Fragment instead of Panel
> > > >
> > > > On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com>
> > > wrote:
> > > >
> > > > > Hi all, my first mail here, glad to join your community!
> > > > >
> > > > > I want to do the following:
> > > > >
> > > > > Create a panel that will be rendered as a box with rounded corners.
> I
> > > > dont
> > > > > want it to have it's inner components predefined in its class but
> > > > > dynamically adding them on each page the panel is present. I wish I
> > > could
> > > > > have its html file containg something like <wicket:extend /> and
> put
> > > > there
> > > > > the markup defined when used in pages.
> > > > >
> > > > > Since I dont understand my own words so far, I'll give an example:
> > > > >
> > > > > CustomPanel.html
> > > > > ...
> > > > > <div class="Foo">
> > > > > [other ui stuff here]
> > > > > <wicket:extend />
> > > > > </div>
> > > > > ...
> > > > >
> > > > > APage.java
> > > > > ...
> > > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > > pnl.add(new Label("test-lbl", "Tadaaa"));
> > > > > add(pnl);
> > > > > ...
> > > > >
> > > > > APage.html
> > > > > ...
> > > > > <span wicket:id="pnl">
> > > > > <span wicket:id="test-lbl">
> > > > > </span>
> > > > > ...
> > > > >
> > > > > I want the page rendered having the label inside the custom panel
> > > without
> > > > > having to implicitly create another panel extending the
> CustomPanel.
> > > > >
> > > > > So, if you understood this and have any ideas, let me know.
> > > > >
> > > > > Greetings from Greece,
> > > > > Poko
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > > >>
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > > >
> > > > >
> > > >
> > >
> >
>
Re: Panel to be used as an abstract container
Posted by Poko Booth <po...@gmail.com>.
Exactly, thank you very much! I will try that in the afternoon. I had no
idea about Fragments, never used them before.
I want to use this panel only for ui purposes. I don't want to repeat
"rounded corners" markup in each page or multiple times in the same page,
better have it in one place.
Thank you again
On Thu, Nov 11, 2010 at 11:53 AM, Martin Grigorov <mg...@apache.org>wrote:
> Yes, the panel always contribute with its .html (always the same html).
> The Fragment is the dynamic content (so small that you don't to create
> Panel
> for it).
>
> This is what you want, right ?
>
> On Thu, Nov 11, 2010 at 10:35 AM, Poko Booth <po...@gmail.com> wrote:
>
> > Just to see if we are on the same page:
> >
> > You mean that the CustomPanel.html will be like this:
> > ...
> > <div class="RoundedStuff>
> > <div wicket:id="contents" />
> > </div>
> > ...
> >
> > And in the APage.html:
> > ...
> > <div wicket:id="pnl" />
> > <wicket:fragment wicket:id="whatever">
> > ...PANEL CONTENTS HERE...
> > </wicket:fragment>
> > ...
> >
> > and in APage.java:
> > ...
> > CustomPanel pnl = new CustomPanel("pnl");
> > pnl.add(new Fragment("contents","whatever");
> > ...
> >
> > Right?
> >
> >
> > On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <mgrigorov@apache.org
> > >wrote:
> >
> > > I think you need Fragment instead of Panel
> > >
> > > On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com>
> > wrote:
> > >
> > > > Hi all, my first mail here, glad to join your community!
> > > >
> > > > I want to do the following:
> > > >
> > > > Create a panel that will be rendered as a box with rounded corners. I
> > > dont
> > > > want it to have it's inner components predefined in its class but
> > > > dynamically adding them on each page the panel is present. I wish I
> > could
> > > > have its html file containg something like <wicket:extend /> and put
> > > there
> > > > the markup defined when used in pages.
> > > >
> > > > Since I dont understand my own words so far, I'll give an example:
> > > >
> > > > CustomPanel.html
> > > > ...
> > > > <div class="Foo">
> > > > [other ui stuff here]
> > > > <wicket:extend />
> > > > </div>
> > > > ...
> > > >
> > > > APage.java
> > > > ...
> > > > CustomPanel pnl = new CustomPanel("pnl");
> > > > pnl.add(new Label("test-lbl", "Tadaaa"));
> > > > add(pnl);
> > > > ...
> > > >
> > > > APage.html
> > > > ...
> > > > <span wicket:id="pnl">
> > > > <span wicket:id="test-lbl">
> > > > </span>
> > > > ...
> > > >
> > > > I want the page rendered having the label inside the custom panel
> > without
> > > > having to implicitly create another panel extending the CustomPanel.
> > > >
> > > > So, if you understood this and have any ideas, let me know.
> > > >
> > > > Greetings from Greece,
> > > > Poko
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > > >>
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > > >
> > >
> >
>
Re: Panel to be used as an abstract container
Posted by Martin Grigorov <mg...@apache.org>.
Yes, the panel always contribute with its .html (always the same html).
The Fragment is the dynamic content (so small that you don't to create Panel
for it).
This is what you want, right ?
On Thu, Nov 11, 2010 at 10:35 AM, Poko Booth <po...@gmail.com> wrote:
> Just to see if we are on the same page:
>
> You mean that the CustomPanel.html will be like this:
> ...
> <div class="RoundedStuff>
> <div wicket:id="contents" />
> </div>
> ...
>
> And in the APage.html:
> ...
> <div wicket:id="pnl" />
> <wicket:fragment wicket:id="whatever">
> ...PANEL CONTENTS HERE...
> </wicket:fragment>
> ...
>
> and in APage.java:
> ...
> CustomPanel pnl = new CustomPanel("pnl");
> pnl.add(new Fragment("contents","whatever");
> ...
>
> Right?
>
>
> On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <mgrigorov@apache.org
> >wrote:
>
> > I think you need Fragment instead of Panel
> >
> > On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com>
> wrote:
> >
> > > Hi all, my first mail here, glad to join your community!
> > >
> > > I want to do the following:
> > >
> > > Create a panel that will be rendered as a box with rounded corners. I
> > dont
> > > want it to have it's inner components predefined in its class but
> > > dynamically adding them on each page the panel is present. I wish I
> could
> > > have its html file containg something like <wicket:extend /> and put
> > there
> > > the markup defined when used in pages.
> > >
> > > Since I dont understand my own words so far, I'll give an example:
> > >
> > > CustomPanel.html
> > > ...
> > > <div class="Foo">
> > > [other ui stuff here]
> > > <wicket:extend />
> > > </div>
> > > ...
> > >
> > > APage.java
> > > ...
> > > CustomPanel pnl = new CustomPanel("pnl");
> > > pnl.add(new Label("test-lbl", "Tadaaa"));
> > > add(pnl);
> > > ...
> > >
> > > APage.html
> > > ...
> > > <span wicket:id="pnl">
> > > <span wicket:id="test-lbl">
> > > </span>
> > > ...
> > >
> > > I want the page rendered having the label inside the custom panel
> without
> > > having to implicitly create another panel extending the CustomPanel.
> > >
> > > So, if you understood this and have any ideas, let me know.
> > >
> > > Greetings from Greece,
> > > Poko
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
Re: Panel to be used as an abstract container
Posted by Poko Booth <po...@gmail.com>.
Just to see if we are on the same page:
You mean that the CustomPanel.html will be like this:
...
<div class="RoundedStuff>
<div wicket:id="contents" />
</div>
...
And in the APage.html:
...
<div wicket:id="pnl" />
<wicket:fragment wicket:id="whatever">
...PANEL CONTENTS HERE...
</wicket:fragment>
...
and in APage.java:
...
CustomPanel pnl = new CustomPanel("pnl");
pnl.add(new Fragment("contents","whatever");
...
Right?
On Thu, Nov 11, 2010 at 11:12 AM, Martin Grigorov <mg...@apache.org>wrote:
> I think you need Fragment instead of Panel
>
> On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com> wrote:
>
> > Hi all, my first mail here, glad to join your community!
> >
> > I want to do the following:
> >
> > Create a panel that will be rendered as a box with rounded corners. I
> dont
> > want it to have it's inner components predefined in its class but
> > dynamically adding them on each page the panel is present. I wish I could
> > have its html file containg something like <wicket:extend /> and put
> there
> > the markup defined when used in pages.
> >
> > Since I dont understand my own words so far, I'll give an example:
> >
> > CustomPanel.html
> > ...
> > <div class="Foo">
> > [other ui stuff here]
> > <wicket:extend />
> > </div>
> > ...
> >
> > APage.java
> > ...
> > CustomPanel pnl = new CustomPanel("pnl");
> > pnl.add(new Label("test-lbl", "Tadaaa"));
> > add(pnl);
> > ...
> >
> > APage.html
> > ...
> > <span wicket:id="pnl">
> > <span wicket:id="test-lbl">
> > </span>
> > ...
> >
> > I want the page rendered having the label inside the custom panel without
> > having to implicitly create another panel extending the CustomPanel.
> >
> > So, if you understood this and have any ideas, let me know.
> >
> > Greetings from Greece,
> > Poko
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
Re: Panel to be used as an abstract container
Posted by Martin Grigorov <mg...@apache.org>.
I think you need Fragment instead of Panel
On Thu, Nov 11, 2010 at 9:47 AM, Poko Booth <po...@gmail.com> wrote:
> Hi all, my first mail here, glad to join your community!
>
> I want to do the following:
>
> Create a panel that will be rendered as a box with rounded corners. I dont
> want it to have it's inner components predefined in its class but
> dynamically adding them on each page the panel is present. I wish I could
> have its html file containg something like <wicket:extend /> and put there
> the markup defined when used in pages.
>
> Since I dont understand my own words so far, I'll give an example:
>
> CustomPanel.html
> ...
> <div class="Foo">
> [other ui stuff here]
> <wicket:extend />
> </div>
> ...
>
> APage.java
> ...
> CustomPanel pnl = new CustomPanel("pnl");
> pnl.add(new Label("test-lbl", "Tadaaa"));
> add(pnl);
> ...
>
> APage.html
> ...
> <span wicket:id="pnl">
> <span wicket:id="test-lbl">
> </span>
> ...
>
> I want the page rendered having the label inside the custom panel without
> having to implicitly create another panel extending the CustomPanel.
>
> So, if you understood this and have any ideas, let me know.
>
> Greetings from Greece,
> Poko
> >>
> >>
> >>
> >>
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Panel to be used as an abstract container
Posted by Poko Booth <po...@gmail.com>.
Hi all, my first mail here, glad to join your community!
I want to do the following:
Create a panel that will be rendered as a box with rounded corners. I dont want it to have it's inner components predefined in its class but dynamically adding them on each page the panel is present. I wish I could have its html file containg something like <wicket:extend /> and put there the markup defined when used in pages.
Since I dont understand my own words so far, I'll give an example:
CustomPanel.html
...
<div class="Foo">
[other ui stuff here]
<wicket:extend />
</div>
...
APage.java
...
CustomPanel pnl = new CustomPanel("pnl");
pnl.add(new Label("test-lbl", "Tadaaa"));
add(pnl);
...
APage.html
...
<span wicket:id="pnl">
<span wicket:id="test-lbl">
</span>
...
I want the page rendered having the label inside the custom panel without having to implicitly create another panel extending the CustomPanel.
So, if you understood this and have any ideas, let me know.
Greetings from Greece,
Poko
>>
>>
>>
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: WicketTester clickLink: Ajax-Response not rendered into the page?
Posted by Martin Grigorov <mg...@apache.org>.
you need to use tester.clickLink("path", true)
after clicking on ajax link you need to use tester.getLastRenderedPage() and
do whatever you want with that page (click another link, submit form, ...)
On Wed, Nov 10, 2010 at 8:51 PM, Hans Lesmeister <
hans.lesmeister@lessy-software.de> wrote:
> Hi,
>
> I have a page processed by the wicket-tester. On the page, there is an
> AjaxLink. Now I do a clickLink on that AjaxLink. If I do a pagedump after
> the clickLink, I can see the Ajax-Response which looks good. The Response
> contains markup to replace an exisiting Container. Unfortunately, the
> container is not actually replaced in the last rendered page.
>
> If I try to get the container with getByWicketId(..) but it returns null
> because now that method works on the Ajax-Response from the clickLink
> (before the clickLink, getByWicketId(...) gives me the correct container)
>
> I guess I oversee something obvious but I am stuck here. How can I simulate
> a series of ajax-clicks on a page?
>
> Regards
> Hans
>
>
>
WicketTester clickLink: Ajax-Response not rendered into the page?
Posted by Hans Lesmeister <ha...@lessy-software.de>.
Hi,
I have a page processed by the wicket-tester. On the page, there is an
AjaxLink. Now I do a clickLink on that AjaxLink. If I do a pagedump after
the clickLink, I can see the Ajax-Response which looks good. The Response
contains markup to replace an exisiting Container. Unfortunately, the
container is not actually replaced in the last rendered page.
If I try to get the container with getByWicketId(..) but it returns null
because now that method works on the Ajax-Response from the clickLink
(before the clickLink, getByWicketId(...) gives me the correct container)
I guess I oversee something obvious but I am stuck here. How can I simulate
a series of ajax-clicks on a page?
Regards
Hans
Re: Cannot get current page from AjaxPagingNavigator
Posted by jcgarciam <jc...@gmail.com>.
I would change:
final Label currentPage = new Label("currentPage", new Model());
to this:
Label currentPage = new Label("currentPage", new LoadableDetachableModel(){
public Object load(){
return pagination.getPageable().getCurrentPage() + 1;
}
});
and then just remove the last part:
currentPage.setDefaultModel(model);
On Wed, Nov 10, 2010 at 5:19 AM, vp143 [via Apache Wicket] <
ml-node+3035648-2145298352-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:
> I got it working with the following code- thanks Pedro and JC
>
> final Label currentPage = new Label("currentPage", new Model());
> currentPage.setOutputMarkupId(true);
> add(currentPage);
>
> final AjaxPagingNavigator pagination = new
> AjaxPagingNavigator("navigator", dataList) {
> @Override
> protected void onAjaxEvent(AjaxRequestTarget target) {
> target.addComponent(currentPage);
> super.onAjaxEvent(target);
> }
> };
> add(pagination);
>
> LoadableDetachableModel model = new LoadableDetachableModel() {
> public Object load(){
> return pagination.getPageable().getCurrentPage() + 1;
> }
> };
> currentPage.setDefaultModel(model);
>
> It had to be written like this because the model needs pagination which
> would not have been initialised if written as an inner class when creating
> the label.
> Please let me know if anyone finds a better way of writing it.
>
> Many thanks again
> Vishal
>
> ------------------------------
> View message @
> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3035648.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>
--
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3036168.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Cannot get current page from AjaxPagingNavigator
Posted by vp143 <vi...@cipriati.co.uk>.
I got it working with the following code- thanks Pedro and JC
final Label currentPage = new Label("currentPage", new Model());
currentPage.setOutputMarkupId(true);
add(currentPage);
final AjaxPagingNavigator pagination = new
AjaxPagingNavigator("navigator", dataList) {
@Override
protected void onAjaxEvent(AjaxRequestTarget target) {
target.addComponent(currentPage);
super.onAjaxEvent(target);
}
};
add(pagination);
LoadableDetachableModel model = new LoadableDetachableModel() {
public Object load(){
return pagination.getPageable().getCurrentPage() + 1;
}
};
currentPage.setDefaultModel(model);
It had to be written like this because the model needs pagination which
would not have been initialised if written as an inner class when creating
the label.
Please let me know if anyone finds a better way of writing it.
Many thanks again
Vishal
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3035648.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Cannot get current page from AjaxPagingNavigator
Posted by Pedro Santos <pe...@gmail.com>.
I think you need to implement the AjaxPagingNavigator#onAjaxEvent method and
add the currentPage component on target.
On Tue, Nov 9, 2010 at 4:20 PM, vp143 <vi...@cipriati.co.uk> wrote:
>
> Thank you both for your responses- I totally forgot about it being dynamic.
>
> However, I have tried both code snippets above but still no luck.
> I printed the current page within the load() method which prints 0 only on
> first load. No message is printed when the page numbers from
> AjaxPagingNavigator are clicked on.
>
> Any thoughts?
> Vishal
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034840.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Pedro Henrique Oliveira dos Santos
Re: Cannot get current page from AjaxPagingNavigator
Posted by vp143 <vi...@cipriati.co.uk>.
Thank you both for your responses- I totally forgot about it being dynamic.
However, I have tried both code snippets above but still no luck.
I printed the current page within the load() method which prints 0 only on
first load. No message is printed when the page numbers from
AjaxPagingNavigator are clicked on.
Any thoughts?
Vishal
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034840.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Cannot get current page from AjaxPagingNavigator
Posted by jcgarciam <jc...@gmail.com>.
You are using an static model, which only knows about the value by the time
of construction. Use a dynamic model
i.e: (make sure you define pagination as final)
Label currentPage = new Label("currentPage", new LoadableDetachableModel(){
public Object load(){
return pagination.getPageable().getCurrentPage();
}
});
On Tue, Nov 9, 2010 at 1:04 PM, vp143 [via Apache Wicket] <
ml-node+3034524-366758351-65838@n4.nabble.com<ml...@n4.nabble.com>
> wrote:
> Hi all,
>
> For some reason I cannot get the current page number. This is the relevant
> part of my code:
>
>
>
> PageableListView dataList = new PageableListView("dataList", results, 10) {
>
>
> protected void populateItem(ListItem item) {
>
> ..
>
> }
>
> }
>
>
>
> AjaxPagingNavigator pagination = new
> AjaxPagingNavigator("navigator", dataList);
>
> add(pagination);
>
>
>
> Label currentPage = new Label("currentPage",
> pagination.getPageable().getCurrentPage() + "");
>
> currentPage.setOutputMarkupId(true);
>
> add(currentPage);
>
>
>
> currentPage always returns 0.
>
> I have also tried PagingNavigator with similar results.
>
>
>
> Can anyone tell me what I have missed?
>
>
>
> Regards
>
>
>
> Vishal
>
>
>
> ------------------------------
> View message @
> http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034524.html
> To start a new topic under Apache Wicket, email
> ml-node+1842946-398011874-65838@n4.nabble.com<ml...@n4.nabble.com>
> To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>.
>
>
>
--
Sincerely,
JC (http://www.linkedin.com/in/jcgarciam)
Work smarter, not harder!.
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Cannot-get-current-page-from-AjaxPagingNavigator-tp3034524p3034563.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org