You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Rangel Preis <ra...@gmail.com> on 2010/02/05 20:50:56 UTC

How reRender a component from parent page?

How can I use Ajax to change value from a parent page in my layout. I
try to change values in header using a action from content page.

I have this:

    |-------------------------------|
    |           HEADER           |
    |-------------------------------|
    | MENU |   CONTENT   |
    |             |                       |
    |             |                       |
    |             |                       |
    |-----------|-------------------|
    |          FOOTER            |
    |-------------------------------|

public class MyTemplate{
 public MyTemplate() {
        super();

        this.add(CSSPackageResource.getHeaderContribution(...);

        this.add(AbstractTemplatePage.FEEDBACK);

        this.addOrReplace(new Header());

        this.add(new Menu());

        this.add(new Footer());
    .....


public class MyContetPage extends MyTemplate {
public MyContetPage(final PageParameters _parameters) {
add(new AjaxFallbackLink<Void>("rem") {

    @Override
    public void onClick(final AjaxRequestTarget target) {
        …...
     }
   });
….
}
}

How change value in the header when i click on the ajaxlink of my content page?

In the onClick i try this; but don't work

//some function to change the model value...
this.getPage().get("header:component").modelChanged();
target.addComponent(this.getPage().get("header:component"));

And in my Header.java I override onModelChanged:
    protected void onModelChanged() {
        super.onModelChanged();
        this.addOrReplace(component).setOutputMarkupId(true));
    }

Thanks all.

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


Re: Changing css class based on page

Posted by Ioannis Mavroukakis <im...@gameaccount.com>.
In fact it was a lot simpler than I thought, this works like a charm.

	private Link pageLink(final String id, final Class clazz) {
		final BookmarkablePageLink link = new BookmarkablePageLink(id, clazz);
		link.add(new AttributeModifier("id", true, new AbstractReadOnlyModel<String>() {
			@Override
			public String getObject() {
				return AbstractBasePage.this.getClass().equals(clazz) ? "current" : "";
			}
		}));
		return link;
	}


On 17 May 2010, at 22:40, Ioannis Mavroukakis wrote:

> Thanks Jeremy that's great help as that's the route I considered initially going down, trying to make it reusable is the next step..
> 
> Y.
> On 17 May 2010, at 22:28, Jeremy Thomerson wrote:
> 
>> link1.add(new AttributeModifier("class", true, new
>> AbstractReadOnlyModel<String>() {
>> public String getObject() {
>> return AbstractBasePage.this.getClass().equals(LinkOnePageClass.class) ?
>> "selectedPage" : "notSelectedPage";
>> }
>> });
>> 
>> There's probably a way to make that more reusable - but that should get you
>> started.
>> 
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>> 
>> 
>> 
>> On Mon, May 17, 2010 at 4:24 PM, Ioannis Mavroukakis <
>> imavroukakis@gameaccount.com> wrote:
>> 
>>> Hey guys got a newbish question I cannot get my head around, and I would
>>> appreciate any help.
>>> 
>>> I've got an AbstractBasePage template using markup inheritance. It very
>>> simply has some BookmarkablePageLink's which are common
>>> across all pages. What I want to do, is have a different css class for the
>>> active link (i.e. the one whose page you are on) and another for the
>>> inactive ones
>>> and I cannot for the life of me figure out what's the best way to do it.
>>> Is it something I should be doing in code ?
>>> 
>>> TIA!
>>> 
>>> Yiannis.
>> 
>> 
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email 
>> ______________________________________________________________________
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________


Re: Changing css class based on page

Posted by Ioannis Mavroukakis <im...@gameaccount.com>.
Thanks Jeremy that's great help as that's the route I considered initially going down, trying to make it reusable is the next step..

Y.
On 17 May 2010, at 22:28, Jeremy Thomerson wrote:

> link1.add(new AttributeModifier("class", true, new
> AbstractReadOnlyModel<String>() {
> public String getObject() {
>  return AbstractBasePage.this.getClass().equals(LinkOnePageClass.class) ?
> "selectedPage" : "notSelectedPage";
> }
> });
> 
> There's probably a way to make that more reusable - but that should get you
> started.
> 
> --
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> 
> 
> On Mon, May 17, 2010 at 4:24 PM, Ioannis Mavroukakis <
> imavroukakis@gameaccount.com> wrote:
> 
>> Hey guys got a newbish question I cannot get my head around, and I would
>> appreciate any help.
>> 
>> I've got an AbstractBasePage template using markup inheritance. It very
>> simply has some BookmarkablePageLink's which are common
>> across all pages. What I want to do, is have a different css class for the
>> active link (i.e. the one whose page you are on) and another for the
>> inactive ones
>> and I cannot for the life of me figure out what's the best way to do it.
>> Is it something I should be doing in code ?
>> 
>> TIA!
>> 
>> Yiannis.
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________


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


Re: Changing css class based on page

Posted by Jeremy Thomerson <je...@wickettraining.com>.
link1.add(new AttributeModifier("class", true, new
AbstractReadOnlyModel<String>() {
public String getObject() {
  return AbstractBasePage.this.getClass().equals(LinkOnePageClass.class) ?
"selectedPage" : "notSelectedPage";
}
});

There's probably a way to make that more reusable - but that should get you
started.

--
Jeremy Thomerson
http://www.wickettraining.com



On Mon, May 17, 2010 at 4:24 PM, Ioannis Mavroukakis <
imavroukakis@gameaccount.com> wrote:

> Hey guys got a newbish question I cannot get my head around, and I would
> appreciate any help.
>
> I've got an AbstractBasePage template using markup inheritance. It very
> simply has some BookmarkablePageLink's which are common
> across all pages. What I want to do, is have a different css class for the
> active link (i.e. the one whose page you are on) and another for the
> inactive ones
> and I cannot for the life of me figure out what's the best way to do it.
>  Is it something I should be doing in code ?
>
> TIA!
>
> Yiannis.

Changing css class based on page

Posted by Ioannis Mavroukakis <im...@gameaccount.com>.
Hey guys got a newbish question I cannot get my head around, and I would appreciate any help.

I've got an AbstractBasePage template using markup inheritance. It very simply has some BookmarkablePageLink's which are common
across all pages. What I want to do, is have a different css class for the active link (i.e. the one whose page you are on) and another for the inactive ones
and I cannot for the life of me figure out what's the best way to do it.  Is it something I should be doing in code ?

TIA!

Yiannis.

Re: How reRender a component from parent page?

Posted by Rangel Preis <ra...@gmail.com>.
Yes, it's make sense.
I change to ptopertyModel and now thinks works.

Thanks Cemal.

2010/2/9 Cemal Bayramoglu <jW...@cabouge.com>:
> Rangel,
>
> The is a common problem people encounter while they get their head
> aroung Wicket models.
> In your Header class, the label's "data" is only ever calculated once,
> on construction of the Header and is therefore is fixed.
>
> Try something like:
>
>        final Label itens = new Label("itens", new
> PropertyModel(WicketSession.get(),"cart.amount"));
>
> (I have retained your spelling of "itens" but I assume this should be "items").
>
> If you want to format the resulting string (as per your apparent
> intention in your QuickStart), use a converter, probably best in your
> case by overriding the your label's getConverter method.
>
> The rest of your code looks OK.
>
> Does that make sense?
>
> Regards - Cemal
> jWeekend
> OO & Java Technologies, Wicket
> Consulting, Development, Training
> http://jWeekend.com
>
>
>
> On 9 February 2010 14:50, Rangel Preis <ra...@gmail.com> wrote:
>> I make a quick start project (maven) to show my problem, if someone have time...
>>
>> The problem are in HomePage.java in the onClick... this don't reRender
>> my componente in the header.
>>
>> Thanks.
>>
>> 2010/2/9 Rangel Preis <ra...@gmail.com>:
>>> I try this again using only setOutputMarkupId without modelChanged and
>>> onModelChange, and don't work.
>>>
>>> I just setOutputMarkupId on my component and in the ajaxEvent i put:
>>> target.addComponent(getPage().get("header:counter"));
>>>
>>> header is a panel and counter is a Label in this panel.
>>>
>>> Thanks All.
>>>
>>>
>>>
>>> 2010/2/8 Rangel Preis <ra...@gmail.com>:
>>>> Thanks, Don but this don't work the value don't change. And I call
>>>> setOutputMarkupId when i build it. and call it again later...
>>>>
>>>> Thanks All.
>>>>
>>>> 2010/2/8 Don Ferguson <do...@rixty.com>:
>>>>> I think setOutputMarkupId() should have been called earlier, in the
>>>>> MyTemplate constructor when the Header was constructed.  Ajax processing
>>>>> needs the markup id to find the component you're changing, so setting it in
>>>>> onModelChanged() is too late.  Also, I don't think you need the call to
>>>>> modelChanged() or to override onModelChanged.  Changing the model object and
>>>>> adding the component to the target should be sufficient.
>>>>>
>>>>> -Don
>>>>>
>>>>> On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:
>>>>>
>>>>>> My template HTML
>>>>>>
>>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>>
>>>>>> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>>>>>>        <head>
>>>>>>                <title wicket:id="title"></title>
>>>>>>                <meta wicket:id="description" name="description"
>>>>>> content=""/>
>>>>>>                <meta wicket:id="keywords" name="keywords" content=""/>
>>>>>>                <meta wicket:id="version" name="version" content=""/>
>>>>>>        </head>
>>>>>>        <body>
>>>>>>
>>>>>>       <a href="#irconteudo" style="display: none;"></a>
>>>>>>
>>>>>>
>>>>>>                <div wicket:id="header" class="header"></div>
>>>>>>
>>>>>>                <!-- conteudo -->
>>>>>>                <div id="conteudo">
>>>>>>                        <table class="layout">
>>>>>>                                <tr>
>>>>>>                                        <td wicket:id="col_esq"
>>>>>> class="col_esq"/>
>>>>>>                                        <td>
>>>>>>                                                <a name="irconteudo"
>>>>>> style="display: none;"></a>
>>>>>>                            <div wicket:id="feedback" id="feedback"/>
>>>>>>                                <wicket:child/>
>>>>>>                                        </td>
>>>>>>                                        <td class="col_dir">
>>>>>>                                        </td>
>>>>>>                                </tr>
>>>>>>                        </table>
>>>>>>                </div>
>>>>>>                <div wicket:id="footer" class="footer"></div>
>>>>>>        </body>
>>>>>> </html>
>>>>>>
>>>>>> Header.html
>>>>>>
>>>>>> <wicket:panel>
>>>>>>   <div class="right">
>>>>>>       <div wicket:id="header_client" class="client"></div>
>>>>>>   </div>
>>>>>>        //Value that i want to change
>>>>>>        <div class="conter">
>>>>>>        <a wicket:id="conter"><span wicket:id="itens"/></a>
>>>>>>   </div>
>>>>>>
>>>>>>   <div class="left">
>>>>>>        <a wicket:id="header_home_link"><div class="logo"/></a>
>>>>>>        </div>
>>>>>>
>>>>>>        <div wicket:id="header_search" class="search"></div>
>>>>>> </wicket:panel>
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>>>>>>>
>>>>>>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>>>>>>
>>>>>>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> How can I use Ajax to change value from a parent page in my layout. I
>>>>>>>> try to change values in header using a action from content page.
>>>>>>>>
>>>>>>>> I have this:
>>>>>>>>
>>>>>>>>   |-------------------------------|
>>>>>>>>   |           HEADER           |
>>>>>>>>   |-------------------------------|
>>>>>>>>   | MENU |   CONTENT   |
>>>>>>>>   |             |                       |
>>>>>>>>   |             |                       |
>>>>>>>>   |             |                       |
>>>>>>>>   |-----------|-------------------|
>>>>>>>>   |          FOOTER            |
>>>>>>>>   |-------------------------------|
>>>>>>>>
>>>>>>>> public class MyTemplate{
>>>>>>>>  public MyTemplate() {
>>>>>>>>        super();
>>>>>>>>
>>>>>>>>        this.add(CSSPackageResource.getHeaderContribution(...);
>>>>>>>>
>>>>>>>>        this.add(AbstractTemplatePage.FEEDBACK);
>>>>>>>>
>>>>>>>>        this.addOrReplace(new Header());
>>>>>>>>
>>>>>>>>        this.add(new Menu());
>>>>>>>>
>>>>>>>>        this.add(new Footer());
>>>>>>>>    .....
>>>>>>>>
>>>>>>>>
>>>>>>>> public class MyContetPage extends MyTemplate {
>>>>>>>> public MyContetPage(final PageParameters _parameters) {
>>>>>>>> add(new AjaxFallbackLink<Void>("rem") {
>>>>>>>>
>>>>>>>>    @Override
>>>>>>>>    public void onClick(final AjaxRequestTarget target) {
>>>>>>>>        …...
>>>>>>>>     }
>>>>>>>>   });
>>>>>>>> ….
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> How change value in the header when i click on the ajaxlink of my
>>>>>>>> content page?
>>>>>>>>
>>>>>>>> In the onClick i try this; but don't work
>>>>>>>>
>>>>>>>> //some function to change the model value...
>>>>>>>> this.getPage().get("header:component").modelChanged();
>>>>>>>> target.addComponent(this.getPage().get("header:component"));
>>>>>>>>
>>>>>>>> And in my Header.java I override onModelChanged:
>>>>>>>>    protected void onModelChanged() {
>>>>>>>>        super.onModelChanged();
>>>>>>>>        this.addOrReplace(component).setOutputMarkupId(true));
>>>>>>>>    }
>>>>>>>>
>>>>>>>> Thanks all.
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> 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: How reRender a component from parent page?

Posted by Cemal Bayramoglu <jW...@cabouge.com>.
Rangel,

The is a common problem people encounter while they get their head
aroung Wicket models.
In your Header class, the label's "data" is only ever calculated once,
on construction of the Header and is therefore is fixed.

Try something like:

        final Label itens = new Label("itens", new
PropertyModel(WicketSession.get(),"cart.amount"));

(I have retained your spelling of "itens" but I assume this should be "items").

If you want to format the resulting string (as per your apparent
intention in your QuickStart), use a converter, probably best in your
case by overriding the your label's getConverter method.

The rest of your code looks OK.

Does that make sense?

Regards - Cemal
jWeekend
OO & Java Technologies, Wicket
Consulting, Development, Training
http://jWeekend.com



On 9 February 2010 14:50, Rangel Preis <ra...@gmail.com> wrote:
> I make a quick start project (maven) to show my problem, if someone have time...
>
> The problem are in HomePage.java in the onClick... this don't reRender
> my componente in the header.
>
> Thanks.
>
> 2010/2/9 Rangel Preis <ra...@gmail.com>:
>> I try this again using only setOutputMarkupId without modelChanged and
>> onModelChange, and don't work.
>>
>> I just setOutputMarkupId on my component and in the ajaxEvent i put:
>> target.addComponent(getPage().get("header:counter"));
>>
>> header is a panel and counter is a Label in this panel.
>>
>> Thanks All.
>>
>>
>>
>> 2010/2/8 Rangel Preis <ra...@gmail.com>:
>>> Thanks, Don but this don't work the value don't change. And I call
>>> setOutputMarkupId when i build it. and call it again later...
>>>
>>> Thanks All.
>>>
>>> 2010/2/8 Don Ferguson <do...@rixty.com>:
>>>> I think setOutputMarkupId() should have been called earlier, in the
>>>> MyTemplate constructor when the Header was constructed.  Ajax processing
>>>> needs the markup id to find the component you're changing, so setting it in
>>>> onModelChanged() is too late.  Also, I don't think you need the call to
>>>> modelChanged() or to override onModelChanged.  Changing the model object and
>>>> adding the component to the target should be sufficient.
>>>>
>>>> -Don
>>>>
>>>> On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:
>>>>
>>>>> My template HTML
>>>>>
>>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>>
>>>>> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>>>>>        <head>
>>>>>                <title wicket:id="title"></title>
>>>>>                <meta wicket:id="description" name="description"
>>>>> content=""/>
>>>>>                <meta wicket:id="keywords" name="keywords" content=""/>
>>>>>                <meta wicket:id="version" name="version" content=""/>
>>>>>        </head>
>>>>>        <body>
>>>>>
>>>>>       <a href="#irconteudo" style="display: none;"></a>
>>>>>
>>>>>
>>>>>                <div wicket:id="header" class="header"></div>
>>>>>
>>>>>                <!-- conteudo -->
>>>>>                <div id="conteudo">
>>>>>                        <table class="layout">
>>>>>                                <tr>
>>>>>                                        <td wicket:id="col_esq"
>>>>> class="col_esq"/>
>>>>>                                        <td>
>>>>>                                                <a name="irconteudo"
>>>>> style="display: none;"></a>
>>>>>                            <div wicket:id="feedback" id="feedback"/>
>>>>>                                <wicket:child/>
>>>>>                                        </td>
>>>>>                                        <td class="col_dir">
>>>>>                                        </td>
>>>>>                                </tr>
>>>>>                        </table>
>>>>>                </div>
>>>>>                <div wicket:id="footer" class="footer"></div>
>>>>>        </body>
>>>>> </html>
>>>>>
>>>>> Header.html
>>>>>
>>>>> <wicket:panel>
>>>>>   <div class="right">
>>>>>       <div wicket:id="header_client" class="client"></div>
>>>>>   </div>
>>>>>        //Value that i want to change
>>>>>        <div class="conter">
>>>>>        <a wicket:id="conter"><span wicket:id="itens"/></a>
>>>>>   </div>
>>>>>
>>>>>   <div class="left">
>>>>>        <a wicket:id="header_home_link"><div class="logo"/></a>
>>>>>        </div>
>>>>>
>>>>>        <div wicket:id="header_search" class="search"></div>
>>>>> </wicket:panel>
>>>>>
>>>>> Thanks.
>>>>>
>>>>> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>>>>>>
>>>>>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>>>>>
>>>>>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>> How can I use Ajax to change value from a parent page in my layout. I
>>>>>>> try to change values in header using a action from content page.
>>>>>>>
>>>>>>> I have this:
>>>>>>>
>>>>>>>   |-------------------------------|
>>>>>>>   |           HEADER           |
>>>>>>>   |-------------------------------|
>>>>>>>   | MENU |   CONTENT   |
>>>>>>>   |             |                       |
>>>>>>>   |             |                       |
>>>>>>>   |             |                       |
>>>>>>>   |-----------|-------------------|
>>>>>>>   |          FOOTER            |
>>>>>>>   |-------------------------------|
>>>>>>>
>>>>>>> public class MyTemplate{
>>>>>>>  public MyTemplate() {
>>>>>>>        super();
>>>>>>>
>>>>>>>        this.add(CSSPackageResource.getHeaderContribution(...);
>>>>>>>
>>>>>>>        this.add(AbstractTemplatePage.FEEDBACK);
>>>>>>>
>>>>>>>        this.addOrReplace(new Header());
>>>>>>>
>>>>>>>        this.add(new Menu());
>>>>>>>
>>>>>>>        this.add(new Footer());
>>>>>>>    .....
>>>>>>>
>>>>>>>
>>>>>>> public class MyContetPage extends MyTemplate {
>>>>>>> public MyContetPage(final PageParameters _parameters) {
>>>>>>> add(new AjaxFallbackLink<Void>("rem") {
>>>>>>>
>>>>>>>    @Override
>>>>>>>    public void onClick(final AjaxRequestTarget target) {
>>>>>>>        …...
>>>>>>>     }
>>>>>>>   });
>>>>>>> ….
>>>>>>> }
>>>>>>> }
>>>>>>>
>>>>>>> How change value in the header when i click on the ajaxlink of my
>>>>>>> content page?
>>>>>>>
>>>>>>> In the onClick i try this; but don't work
>>>>>>>
>>>>>>> //some function to change the model value...
>>>>>>> this.getPage().get("header:component").modelChanged();
>>>>>>> target.addComponent(this.getPage().get("header:component"));
>>>>>>>
>>>>>>> And in my Header.java I override onModelChanged:
>>>>>>>    protected void onModelChanged() {
>>>>>>>        super.onModelChanged();
>>>>>>>        this.addOrReplace(component).setOutputMarkupId(true));
>>>>>>>    }
>>>>>>>
>>>>>>> Thanks all.
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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: How reRender a component from parent page?

Posted by Wilhelmsen Tor Iver <To...@arrive.no>.
> The problem are in HomePage.java in the onClick... this don't reRender
> my componente in the header.

Are you sure? The real problem seems that your itens label uses an implicit model based on the constructor-time value of getAmount(), and which is never changed.

Look into using a model instead, e.g. a StringResourceModel with a substitution based on a PropertyModel that gets the amount from the cart.

- Tor Iver

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


Re: How reRender a component from parent page?

Posted by Rangel Preis <ra...@gmail.com>.
I make a quick start project (maven) to show my problem, if someone have time...

The problem are in HomePage.java in the onClick... this don't reRender
my componente in the header.

Thanks.

2010/2/9 Rangel Preis <ra...@gmail.com>:
> I try this again using only setOutputMarkupId without modelChanged and
> onModelChange, and don't work.
>
> I just setOutputMarkupId on my component and in the ajaxEvent i put:
> target.addComponent(getPage().get("header:counter"));
>
> header is a panel and counter is a Label in this panel.
>
> Thanks All.
>
>
>
> 2010/2/8 Rangel Preis <ra...@gmail.com>:
>> Thanks, Don but this don't work the value don't change. And I call
>> setOutputMarkupId when i build it. and call it again later...
>>
>> Thanks All.
>>
>> 2010/2/8 Don Ferguson <do...@rixty.com>:
>>> I think setOutputMarkupId() should have been called earlier, in the
>>> MyTemplate constructor when the Header was constructed. �Ajax processing
>>> needs the markup id to find the component you're changing, so setting it in
>>> onModelChanged() is too late. �Also, I don't think you need the call to
>>> modelChanged() or to override onModelChanged. �Changing the model object and
>>> adding the component to the target should be sufficient.
>>>
>>> -Don
>>>
>>> On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:
>>>
>>>> My template HTML
>>>>
>>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>>
>>>> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>>>> � � � �<head>
>>>> � � � � � � � �<title wicket:id="title"></title>
>>>> � � � � � � � �<meta wicket:id="description" name="description"
>>>> content=""/>
>>>> � � � � � � � �<meta wicket:id="keywords" name="keywords" content=""/>
>>>> � � � � � � � �<meta wicket:id="version" name="version" content=""/>
>>>> � � � �</head>
>>>> � � � �<body>
>>>>
>>>> � � � <a href="#irconteudo" style="display: none;"></a>
>>>>
>>>>
>>>> � � � � � � � �<div wicket:id="header" class="header"></div>
>>>>
>>>> � � � � � � � �<!-- conteudo -->
>>>> � � � � � � � �<div id="conteudo">
>>>> � � � � � � � � � � � �<table class="layout">
>>>> � � � � � � � � � � � � � � � �<tr>
>>>> � � � � � � � � � � � � � � � � � � � �<td wicket:id="col_esq"
>>>> class="col_esq"/>
>>>> � � � � � � � � � � � � � � � � � � � �<td>
>>>> � � � � � � � � � � � � � � � � � � � � � � � �<a name="irconteudo"
>>>> style="display: none;"></a>
>>>> � � � � � � � � � � � � � �<div wicket:id="feedback" id="feedback"/>
>>>> � � � � � � � � � � � � � � � �<wicket:child/>
>>>> � � � � � � � � � � � � � � � � � � � �</td>
>>>> � � � � � � � � � � � � � � � � � � � �<td class="col_dir">
>>>> � � � � � � � � � � � � � � � � � � � �</td>
>>>> � � � � � � � � � � � � � � � �</tr>
>>>> � � � � � � � � � � � �</table>
>>>> � � � � � � � �</div>
>>>> � � � � � � � �<div wicket:id="footer" class="footer"></div>
>>>> � � � �</body>
>>>> </html>
>>>>
>>>> Header.html
>>>>
>>>> <wicket:panel>
>>>> � <div class="right">
>>>> � � � <div wicket:id="header_client" class="client"></div>
>>>> � </div>
>>>> � � � �//Value that i want to change
>>>> � � � �<div class="conter">
>>>> � � � �<a wicket:id="conter"><span wicket:id="itens"/></a>
>>>> � </div>
>>>>
>>>> � <div class="left">
>>>> � � � �<a wicket:id="header_home_link"><div class="logo"/></a>
>>>> � � � �</div>
>>>>
>>>> � � � �<div wicket:id="header_search" class="search"></div>
>>>> </wicket:panel>
>>>>
>>>> Thanks.
>>>>
>>>> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>>>>>
>>>>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>>>>
>>>>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> How can I use Ajax to change value from a parent page in my layout. I
>>>>>> try to change values in header using a action from content page.
>>>>>>
>>>>>> I have this:
>>>>>>
>>>>>> � |-------------------------------|
>>>>>> � | � � � � � HEADER � � � � � |
>>>>>> � |-------------------------------|
>>>>>> � | MENU | � CONTENT � |
>>>>>> � | � � � � � � | � � � � � � � � � � � |
>>>>>> � | � � � � � � | � � � � � � � � � � � |
>>>>>> � | � � � � � � | � � � � � � � � � � � |
>>>>>> � |-----------|-------------------|
>>>>>> � | � � � � �FOOTER � � � � � �|
>>>>>> � |-------------------------------|
>>>>>>
>>>>>> public class MyTemplate{
>>>>>> �public MyTemplate() {
>>>>>> � � � �super();
>>>>>>
>>>>>> � � � �this.add(CSSPackageResource.getHeaderContribution(...);
>>>>>>
>>>>>> � � � �this.add(AbstractTemplatePage.FEEDBACK);
>>>>>>
>>>>>> � � � �this.addOrReplace(new Header());
>>>>>>
>>>>>> � � � �this.add(new Menu());
>>>>>>
>>>>>> � � � �this.add(new Footer());
>>>>>> � �.....
>>>>>>
>>>>>>
>>>>>> public class MyContetPage extends MyTemplate {
>>>>>> public MyContetPage(final PageParameters _parameters) {
>>>>>> add(new AjaxFallbackLink<Void>("rem") {
>>>>>>
>>>>>> � �@Override
>>>>>> � �public void onClick(final AjaxRequestTarget target) {
>>>>>> � � � ��...
>>>>>> � � }
>>>>>> � });
>>>>>> �.
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> How change value in the header when i click on the ajaxlink of my
>>>>>> content page?
>>>>>>
>>>>>> In the onClick i try this; but don't work
>>>>>>
>>>>>> //some function to change the model value...
>>>>>> this.getPage().get("header:component").modelChanged();
>>>>>> target.addComponent(this.getPage().get("header:component"));
>>>>>>
>>>>>> And in my Header.java I override onModelChanged:
>>>>>> � �protected void onModelChanged() {
>>>>>> � � � �super.onModelChanged();
>>>>>> � � � �this.addOrReplace(component).setOutputMarkupId(true));
>>>>>> � �}
>>>>>>
>>>>>> Thanks all.
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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: How reRender a component from parent page?

Posted by Rangel Preis <ra...@gmail.com>.
I try this again using only setOutputMarkupId without modelChanged and
onModelChange, and don't work.

I just setOutputMarkupId on my component and in the ajaxEvent i put:
target.addComponent(getPage().get("header:counter"));

header is a panel and counter is a Label in this panel.

Thanks All.



2010/2/8 Rangel Preis <ra...@gmail.com>:
> Thanks, Don but this don't work the value don't change. And I call
> setOutputMarkupId when i build it. and call it again later...
>
> Thanks All.
>
> 2010/2/8 Don Ferguson <do...@rixty.com>:
>> I think setOutputMarkupId() should have been called earlier, in the
>> MyTemplate constructor when the Header was constructed.  Ajax processing
>> needs the markup id to find the component you're changing, so setting it in
>> onModelChanged() is too late.  Also, I don't think you need the call to
>> modelChanged() or to override onModelChanged.  Changing the model object and
>> adding the component to the target should be sufficient.
>>
>> -Don
>>
>> On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:
>>
>>> My template HTML
>>>
>>> <html xmlns="http://www.w3.org/1999/xhtml"
>>>
>>> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>>>        <head>
>>>                <title wicket:id="title"></title>
>>>                <meta wicket:id="description" name="description"
>>> content=""/>
>>>                <meta wicket:id="keywords" name="keywords" content=""/>
>>>                <meta wicket:id="version" name="version" content=""/>
>>>        </head>
>>>        <body>
>>>
>>>       <a href="#irconteudo" style="display: none;"></a>
>>>
>>>
>>>                <div wicket:id="header" class="header"></div>
>>>
>>>                <!-- conteudo -->
>>>                <div id="conteudo">
>>>                        <table class="layout">
>>>                                <tr>
>>>                                        <td wicket:id="col_esq"
>>> class="col_esq"/>
>>>                                        <td>
>>>                                                <a name="irconteudo"
>>> style="display: none;"></a>
>>>                            <div wicket:id="feedback" id="feedback"/>
>>>                                <wicket:child/>
>>>                                        </td>
>>>                                        <td class="col_dir">
>>>                                        </td>
>>>                                </tr>
>>>                        </table>
>>>                </div>
>>>                <div wicket:id="footer" class="footer"></div>
>>>        </body>
>>> </html>
>>>
>>> Header.html
>>>
>>> <wicket:panel>
>>>   <div class="right">
>>>       <div wicket:id="header_client" class="client"></div>
>>>   </div>
>>>        //Value that i want to change
>>>        <div class="conter">
>>>        <a wicket:id="conter"><span wicket:id="itens"/></a>
>>>   </div>
>>>
>>>   <div class="left">
>>>        <a wicket:id="header_home_link"><div class="logo"/></a>
>>>        </div>
>>>
>>>        <div wicket:id="header_search" class="search"></div>
>>> </wicket:panel>
>>>
>>> Thanks.
>>>
>>> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>>>>
>>>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>>>
>>>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>
>>>> wrote:
>>>>>
>>>>> How can I use Ajax to change value from a parent page in my layout. I
>>>>> try to change values in header using a action from content page.
>>>>>
>>>>> I have this:
>>>>>
>>>>>   |-------------------------------|
>>>>>   |           HEADER           |
>>>>>   |-------------------------------|
>>>>>   | MENU |   CONTENT   |
>>>>>   |             |                       |
>>>>>   |             |                       |
>>>>>   |             |                       |
>>>>>   |-----------|-------------------|
>>>>>   |          FOOTER            |
>>>>>   |-------------------------------|
>>>>>
>>>>> public class MyTemplate{
>>>>>  public MyTemplate() {
>>>>>        super();
>>>>>
>>>>>        this.add(CSSPackageResource.getHeaderContribution(...);
>>>>>
>>>>>        this.add(AbstractTemplatePage.FEEDBACK);
>>>>>
>>>>>        this.addOrReplace(new Header());
>>>>>
>>>>>        this.add(new Menu());
>>>>>
>>>>>        this.add(new Footer());
>>>>>    .....
>>>>>
>>>>>
>>>>> public class MyContetPage extends MyTemplate {
>>>>> public MyContetPage(final PageParameters _parameters) {
>>>>> add(new AjaxFallbackLink<Void>("rem") {
>>>>>
>>>>>    @Override
>>>>>    public void onClick(final AjaxRequestTarget target) {
>>>>>        …...
>>>>>     }
>>>>>   });
>>>>> ….
>>>>> }
>>>>> }
>>>>>
>>>>> How change value in the header when i click on the ajaxlink of my
>>>>> content page?
>>>>>
>>>>> In the onClick i try this; but don't work
>>>>>
>>>>> //some function to change the model value...
>>>>> this.getPage().get("header:component").modelChanged();
>>>>> target.addComponent(this.getPage().get("header:component"));
>>>>>
>>>>> And in my Header.java I override onModelChanged:
>>>>>    protected void onModelChanged() {
>>>>>        super.onModelChanged();
>>>>>        this.addOrReplace(component).setOutputMarkupId(true));
>>>>>    }
>>>>>
>>>>> Thanks all.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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: How reRender a component from parent page?

Posted by Rangel Preis <ra...@gmail.com>.
Thanks, Don but this don't work the value don't change. And I call
setOutputMarkupId when i build it. and call it again later...

Thanks All.

2010/2/8 Don Ferguson <do...@rixty.com>:
> I think setOutputMarkupId() should have been called earlier, in the
> MyTemplate constructor when the Header was constructed.  Ajax processing
> needs the markup id to find the component you're changing, so setting it in
> onModelChanged() is too late.  Also, I don't think you need the call to
> modelChanged() or to override onModelChanged.  Changing the model object and
> adding the component to the target should be sufficient.
>
> -Don
>
> On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:
>
>> My template HTML
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>>
>> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
>>        <head>
>>                <title wicket:id="title"></title>
>>                <meta wicket:id="description" name="description"
>> content=""/>
>>                <meta wicket:id="keywords" name="keywords" content=""/>
>>                <meta wicket:id="version" name="version" content=""/>
>>        </head>
>>        <body>
>>
>>       <a href="#irconteudo" style="display: none;"></a>
>>
>>
>>                <div wicket:id="header" class="header"></div>
>>
>>                <!-- conteudo -->
>>                <div id="conteudo">
>>                        <table class="layout">
>>                                <tr>
>>                                        <td wicket:id="col_esq"
>> class="col_esq"/>
>>                                        <td>
>>                                                <a name="irconteudo"
>> style="display: none;"></a>
>>                            <div wicket:id="feedback" id="feedback"/>
>>                                <wicket:child/>
>>                                        </td>
>>                                        <td class="col_dir">
>>                                        </td>
>>                                </tr>
>>                        </table>
>>                </div>
>>                <div wicket:id="footer" class="footer"></div>
>>        </body>
>> </html>
>>
>> Header.html
>>
>> <wicket:panel>
>>   <div class="right">
>>       <div wicket:id="header_client" class="client"></div>
>>   </div>
>>        //Value that i want to change
>>        <div class="conter">
>>        <a wicket:id="conter"><span wicket:id="itens"/></a>
>>   </div>
>>
>>   <div class="left">
>>        <a wicket:id="header_home_link"><div class="logo"/></a>
>>        </div>
>>
>>        <div wicket:id="header_search" class="search"></div>
>> </wicket:panel>
>>
>> Thanks.
>>
>> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>>>
>>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>>
>>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>
>>> wrote:
>>>>
>>>> How can I use Ajax to change value from a parent page in my layout. I
>>>> try to change values in header using a action from content page.
>>>>
>>>> I have this:
>>>>
>>>>   |-------------------------------|
>>>>   |           HEADER           |
>>>>   |-------------------------------|
>>>>   | MENU |   CONTENT   |
>>>>   |             |                       |
>>>>   |             |                       |
>>>>   |             |                       |
>>>>   |-----------|-------------------|
>>>>   |          FOOTER            |
>>>>   |-------------------------------|
>>>>
>>>> public class MyTemplate{
>>>>  public MyTemplate() {
>>>>        super();
>>>>
>>>>        this.add(CSSPackageResource.getHeaderContribution(...);
>>>>
>>>>        this.add(AbstractTemplatePage.FEEDBACK);
>>>>
>>>>        this.addOrReplace(new Header());
>>>>
>>>>        this.add(new Menu());
>>>>
>>>>        this.add(new Footer());
>>>>    .....
>>>>
>>>>
>>>> public class MyContetPage extends MyTemplate {
>>>> public MyContetPage(final PageParameters _parameters) {
>>>> add(new AjaxFallbackLink<Void>("rem") {
>>>>
>>>>    @Override
>>>>    public void onClick(final AjaxRequestTarget target) {
>>>>        …...
>>>>     }
>>>>   });
>>>> ….
>>>> }
>>>> }
>>>>
>>>> How change value in the header when i click on the ajaxlink of my
>>>> content page?
>>>>
>>>> In the onClick i try this; but don't work
>>>>
>>>> //some function to change the model value...
>>>> this.getPage().get("header:component").modelChanged();
>>>> target.addComponent(this.getPage().get("header:component"));
>>>>
>>>> And in my Header.java I override onModelChanged:
>>>>    protected void onModelChanged() {
>>>>        super.onModelChanged();
>>>>        this.addOrReplace(component).setOutputMarkupId(true));
>>>>    }
>>>>
>>>> Thanks all.
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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: How reRender a component from parent page?

Posted by Don Ferguson <do...@rixty.com>.
I think setOutputMarkupId() should have been called earlier, in the  
MyTemplate constructor when the Header was constructed.  Ajax  
processing needs the markup id to find the component you're changing,  
so setting it in onModelChanged() is too late.  Also, I don't think  
you need the call to modelChanged() or to override onModelChanged.   
Changing the model object and adding the component to the target  
should be sufficient.

-Don

On Feb 8, 2010, at 2:16 AM, Rangel Preis wrote:

> My template HTML
>
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd 
> ">
> 	<head>
> 		<title wicket:id="title"></title>
> 		<meta wicket:id="description" name="description" content=""/>
> 		<meta wicket:id="keywords" name="keywords" content=""/>
> 		<meta wicket:id="version" name="version" content=""/>
> 	</head>
> 	<body>
>
>        <a href="#irconteudo" style="display: none;"></a>
>
>
> 		<div wicket:id="header" class="header"></div>
> 	
> 		<!-- conteudo -->
> 		<div id="conteudo">
> 			<table class="layout">
> 				<tr>
> 					<td wicket:id="col_esq" class="col_esq"/>
> 					<td>
> 						<a name="irconteudo" style="display: none;"></a>
>         	            <div wicket:id="feedback" id="feedback"/>
> 		                <wicket:child/>
> 					</td>
> 					<td class="col_dir">
> 					</td>
> 				</tr>
> 			</table>
> 		</div>	
> 		<div wicket:id="footer" class="footer"></div>	
> 	</body>
> </html>
>
> Header.html
>
> <wicket:panel>
>    <div class="right">
>        <div wicket:id="header_client" class="client"></div>
>    </div>
> 	//Value that i want to change
> 	<div class="conter">
>    	<a wicket:id="conter"><span wicket:id="itens"/></a>
>    </div>
>
>    <div class="left">
>    	<a wicket:id="header_home_link"><div class="logo"/></a>
> 	</div>
> 	
> 	<div wicket:id="header_search" class="search"></div>
> </wicket:panel>
>
> Thanks.
>
> 2010/2/5 Riyad Kalla <rk...@gmail.com>:
>> What do the tasty HTML bits look like? (wicket:ids and what not)
>>
>> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com>  
>> wrote:
>>> How can I use Ajax to change value from a parent page in my  
>>> layout. I
>>> try to change values in header using a action from content page.
>>>
>>> I have this:
>>>
>>>    |-------------------------------|
>>>    |           HEADER           |
>>>    |-------------------------------|
>>>    | MENU |   CONTENT   |
>>>    |             |                       |
>>>    |             |                       |
>>>    |             |                       |
>>>    |-----------|-------------------|
>>>    |          FOOTER            |
>>>    |-------------------------------|
>>>
>>> public class MyTemplate{
>>>  public MyTemplate() {
>>>         super();
>>>
>>>         this.add(CSSPackageResource.getHeaderContribution(...);
>>>
>>>         this.add(AbstractTemplatePage.FEEDBACK);
>>>
>>>         this.addOrReplace(new Header());
>>>
>>>         this.add(new Menu());
>>>
>>>         this.add(new Footer());
>>>     .....
>>>
>>>
>>> public class MyContetPage extends MyTemplate {
>>> public MyContetPage(final PageParameters _parameters) {
>>> add(new AjaxFallbackLink<Void>("rem") {
>>>
>>>     @Override
>>>     public void onClick(final AjaxRequestTarget target) {
>>>         …...
>>>      }
>>>    });
>>> ….
>>> }
>>> }
>>>
>>> How change value in the header when i click on the ajaxlink of my  
>>> content page?
>>>
>>> In the onClick i try this; but don't work
>>>
>>> //some function to change the model value...
>>> this.getPage().get("header:component").modelChanged();
>>> target.addComponent(this.getPage().get("header:component"));
>>>
>>> And in my Header.java I override onModelChanged:
>>>     protected void onModelChanged() {
>>>         super.onModelChanged();
>>>         this.addOrReplace(component).setOutputMarkupId(true));
>>>     }
>>>
>>> Thanks all.
>>>
>>> ---------------------------------------------------------------------
>>> 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: How reRender a component from parent page?

Posted by Rangel Preis <ra...@gmail.com>.
My template HTML

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd">
	<head>
		<title wicket:id="title"></title>
		<meta wicket:id="description" name="description" content=""/>
		<meta wicket:id="keywords" name="keywords" content=""/>
		<meta wicket:id="version" name="version" content=""/>
	</head>
	<body>

        <a href="#irconteudo" style="display: none;"></a>


		<div wicket:id="header" class="header"></div>
	
		<!-- conteudo -->
		<div id="conteudo">
			<table class="layout">
				<tr>
					<td wicket:id="col_esq" class="col_esq"/>
					<td>
						<a name="irconteudo" style="display: none;"></a>
         	            <div wicket:id="feedback" id="feedback"/>
		                <wicket:child/>
					</td>
					<td class="col_dir">
					</td>
				</tr>
			</table>
		</div>	
		<div wicket:id="footer" class="footer"></div>	
	</body>
</html>

Header.html

<wicket:panel>
    <div class="right">
        <div wicket:id="header_client" class="client"></div>
    </div>
	//Value that i want to change
	<div class="conter">
    	<a wicket:id="conter"><span wicket:id="itens"/></a>
    </div>

    <div class="left">
    	<a wicket:id="header_home_link"><div class="logo"/></a>
	</div>
	
	<div wicket:id="header_search" class="search"></div>
</wicket:panel>

Thanks.

2010/2/5 Riyad Kalla <rk...@gmail.com>:
> What do the tasty HTML bits look like? (wicket:ids and what not)
>
> On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com> wrote:
>> How can I use Ajax to change value from a parent page in my layout. I
>> try to change values in header using a action from content page.
>>
>> I have this:
>>
>>    |-------------------------------|
>>    |           HEADER           |
>>    |-------------------------------|
>>    | MENU |   CONTENT   |
>>    |             |                       |
>>    |             |                       |
>>    |             |                       |
>>    |-----------|-------------------|
>>    |          FOOTER            |
>>    |-------------------------------|
>>
>> public class MyTemplate{
>>  public MyTemplate() {
>>         super();
>>
>>         this.add(CSSPackageResource.getHeaderContribution(...);
>>
>>         this.add(AbstractTemplatePage.FEEDBACK);
>>
>>         this.addOrReplace(new Header());
>>
>>         this.add(new Menu());
>>
>>         this.add(new Footer());
>>     .....
>>
>>
>> public class MyContetPage extends MyTemplate {
>> public MyContetPage(final PageParameters _parameters) {
>> add(new AjaxFallbackLink<Void>("rem") {
>>
>>     @Override
>>     public void onClick(final AjaxRequestTarget target) {
>>         …...
>>      }
>>    });
>> ….
>> }
>> }
>>
>> How change value in the header when i click on the ajaxlink of my content page?
>>
>> In the onClick i try this; but don't work
>>
>> //some function to change the model value...
>> this.getPage().get("header:component").modelChanged();
>> target.addComponent(this.getPage().get("header:component"));
>>
>> And in my Header.java I override onModelChanged:
>>     protected void onModelChanged() {
>>         super.onModelChanged();
>>         this.addOrReplace(component).setOutputMarkupId(true));
>>     }
>>
>> Thanks all.
>>
>> ---------------------------------------------------------------------
>> 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: How reRender a component from parent page?

Posted by Riyad Kalla <rk...@gmail.com>.
What do the tasty HTML bits look like? (wicket:ids and what not)

On Fri, Feb 5, 2010 at 12:50 PM, Rangel Preis <ra...@gmail.com> wrote:
> How can I use Ajax to change value from a parent page in my layout. I
> try to change values in header using a action from content page.
>
> I have this:
>
>    |-------------------------------|
>    |           HEADER           |
>    |-------------------------------|
>    | MENU |   CONTENT   |
>    |             |                       |
>    |             |                       |
>    |             |                       |
>    |-----------|-------------------|
>    |          FOOTER            |
>    |-------------------------------|
>
> public class MyTemplate{
>  public MyTemplate() {
>         super();
>
>         this.add(CSSPackageResource.getHeaderContribution(...);
>
>         this.add(AbstractTemplatePage.FEEDBACK);
>
>         this.addOrReplace(new Header());
>
>         this.add(new Menu());
>
>         this.add(new Footer());
>     .....
>
>
> public class MyContetPage extends MyTemplate {
> public MyContetPage(final PageParameters _parameters) {
> add(new AjaxFallbackLink<Void>("rem") {
>
>     @Override
>     public void onClick(final AjaxRequestTarget target) {
>         …...
>      }
>    });
> ….
> }
> }
>
> How change value in the header when i click on the ajaxlink of my content page?
>
> In the onClick i try this; but don't work
>
> //some function to change the model value...
> this.getPage().get("header:component").modelChanged();
> target.addComponent(this.getPage().get("header:component"));
>
> And in my Header.java I override onModelChanged:
>     protected void onModelChanged() {
>         super.onModelChanged();
>         this.addOrReplace(component).setOutputMarkupId(true));
>     }
>
> Thanks all.
>
> ---------------------------------------------------------------------
> 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