You probably want to use AjaxLink and when the link is clicked - add to the
target the link itself, in order to see the change.


miro wrote:
> 
> upon debugging i found    the constructor MyLink()  was getting called
> after    onClick() so any changes I make in onClick to components
> behaviour will get washed away because its adding the components    again
> , to better understand  what happens when a link is clicked ?  the
> component is created again ?
>  
> 
> here is the code 
> <code>
>               PageableListView   batchesListView= new 
> PageableListView("batches",batches,10){
>                       
>                       /**
>                        * 
>                        */
>                       private static final long serialVersionUID = 1L;
> 
>                       @Override
>                       protected void populateItem(ListItem item) {
>                               final BatcheModel   
> batcheModel=(BatcheModel)item.getModelObject();
>                               
>                               
>                               class MyLink extends Link  {
>                                       public MyLink() {
>                                               super("batch", new 
> Model(batcheModel));
>                                               add(new 
> Label("name",batcheModel.getName()));
>                                               add(new Label("date", new 
> Date().toString()));
>                                       }
>                                       @Override
>                                       public void onClick() {
>                                               final BatcheModel   
> batcheModel=(BatcheModel)getModelObject();
>                                               AuditsModel auditsModel=null;
>                                               
> if(batcheModel.getName().equals("test1")){
>                                                       auditsModel= new 
> AuditsModel("test1","test1","test1");
>                                               }
>                                               
> if(batcheModel.getName().equals("test2")){
>                                                       auditsModel= new 
> AuditsModel("test2","test2","test2");
>                                               }
>                                               
> if(batcheModel.getName().equals("test3")){
>                                                       auditsModel= new 
> AuditsModel("test3","test3","test3");
>                                               }
>                                               List<AuditsModel> audits= new 
> ArrayList<AuditsModel>();
>                                               audits.add(auditsModel);
>                                               PageableListView 
> pageableListView=   (PageableListView)
> AuditSelectionPage.this.get("audits");
>                                               pageableListView.setModel(new 
> Model((Serializable)audits));
>                                               Label  label=(Label)get("name");
>                                               get("name").add(new 
> SimpleAttributeModifier("style",
> "color:blue;"));
>                                               get("date").add(new 
> SimpleAttributeModifier("style",
> "color:blue;"));
>                                       }
>                               }
>                               
>                               item.add(new MyLink());
> 
> </code>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/attribute-modifier-on-onclick-tp20310246p20323946.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to