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>

Michael Sparer wrote:
> 
> show us some code
> 
> miro wrote:
>> 
>> I have a link    this contains a label , now I want  to change the style
>> of the label   whenever user clicks on the link ,  to do this   I
>> override  the method onClick()  in  link component  I am retrieving the
>> label  and adding  simpleattributemodifier to the label , but there is no
>> change , when I see the generated html it does not include  the added
>> style  , can I change the style of a component in  any of the   events of
>> a component ?
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/attribute-modifier-on-onclick-tp20310246p20320579.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