repaint a fragment

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

repaint a fragment

fachhoch
I have a fragment I want to  repaint when user click on ajax link

here is my fragment
	private class  ProgramFragment  extends  Fragment {
		Long sysAuditProgId;
		public ProgramFragment( final ProgramStatusDTO  programStatusDTO) {
			super("program", "programFragment",ProgramStatusPanel.this);
			this.sysAuditProgId=programStatusDTO.eaAuditProgram.getSysAuditProgId();
			setOutputMarkupId(true);
			
			add(new Label("programAcronym", programStatusDTO.eaAuditProgram.getInfGrantProgram().getProgAcronym()));
			EaAuditProgramAmednment amendment= programStatusDTO.eaAuditProgram.getAmednment();
			add(new Label("modifier",amendment==null ? "" :"(Amend)"));
			add(new Label("status",programStatusDTO.getName()));
			add(new Label("daysPassed",programStatusDTO.getDaysPassed()==0?"-":String.valueOf(programStatusDTO.getDaysPassed())));
		}
	}

in onClick I am calling

target.addComponent(getPage().get("program")));


when I click on the link nothing happens, a refreshing view or ListView onPopulate method is called for repaint, for a Fragment or WebMarkupContainer what method is called ?
Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

scott.swank
No html is rendered to represent a fragment.  You will have to wrap it
with a div and then refresh the div.

Scott

On Mon, Oct 11, 2010 at 5:06 PM, fachhoch <[hidden email]> wrote:

>
> I have a fragment I want to  repaint when user click on ajax link
>
> here is my fragment
>
>        private class  ProgramFragment  extends  Fragment {
>                Long sysAuditProgId;
>                public ProgramFragment( final ProgramStatusDTO  programStatusDTO) {
>                        super("program", "programFragment",ProgramStatusPanel.this);
>                        this.sysAuditProgId=programStatusDTO.eaAuditProgram.getSysAuditProgId();
>                        setOutputMarkupId(true);
>
>                        add(new Label("programAcronym",
> programStatusDTO.eaAuditProgram.getInfGrantProgram().getProgAcronym()));
>                        EaAuditProgramAmednment amendment=
> programStatusDTO.eaAuditProgram.getAmednment();
>                        add(new Label("modifier",amendment==null ? "" :"(Amend)"));
>                        add(new Label("status",programStatusDTO.getName()));
>                        add(new
> Label("daysPassed",programStatusDTO.getDaysPassed()==0?"-":String.valueOf(programStatusDTO.getDaysPassed())));
>                }
>        }
>
>
> in onClick I am calling
>
>
> target.addComponent(getPage().get("program")));
>
>
>
> when I click on the link nothing happens, a refreshing view or ListView
> onPopulate method is called for repaint, for a Fragment or
> WebMarkupContainer what method is called ?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/repaint-a-fragment-tp2990937p2990937.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

fachhoch
you mean If I put this fragment inside a webmarkupcontainer and add this webmarkupcontainer to target this will repaint my fragmnet ?
Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

scott.swank
Exactly.

On Mon, Oct 11, 2010 at 7:24 PM, fachhoch <[hidden email]> wrote:

>
> you mean If I put this fragment inside a webmarkupcontainer and add this
> webmarkupcontainer to target this will repaint my fragmnet ?
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/repaint-a-fragment-tp2990937p2991045.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

fachhoch
my fragment is inside a listitem ,on click I added this listitem to taget nothing happened but if I call listitem.replace with new fragment it was adding an additional div is ths the right way to repaint fragment ?
Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

jeremy@wickettraining.com
On Mon, Oct 11, 2010 at 10:59 PM, fachhoch <[hidden email]> wrote:

>
> my fragment is inside a listitem ,on click I added this listitem to taget
> nothing happened but if I call listitem.replace with new fragment it was
> adding an additional div is ths the right way to repaint fragment ?


You can call item.setOutputMarkupId(true) and add that item to the
AjaxRequestTarget to repaint it (and the frag inside it).

Jeremy Thomerson
http://www.wickettraining.com
Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

fachhoch
I am confused ,

I have an Item with a fragment .

to repaint  this fragment I should just add this item to target and no need of calling item.replaceWith(new Freagment()) ?
Reply | Threaded
Open this post in threaded view
|

Re: repaint a fragment

jeremy@wickettraining.com
item.replaceWith(new Fragment()) will replace the *item* with the
*fragment*, which is definitely not what you want.

On Tue, Oct 12, 2010 at 6:57 AM, fachhoch <[hidden email]> wrote:

>
> I am confused ,
>
> I have an Item with a fragment .
>
> to repaint  this fragment I should just add this item to target and no need
> of calling item.replaceWith(new Freagment()) ?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/repaint-a-fragment-tp2990937p2991715.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


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