[Wicket-user] add class onlclick

2007-07-03 Thread Pieter Cogghe

If some link is clicked, I want to change the css-class of a label like
this:

// text
final Label text = new Label(text, resourceRecord.getText());
add(text)

// edit link
add(new AjaxFallbackLink(edit-link){
   @Override
   public void onClick(AjaxRequestTarget target) {
   // dome some other stuff
   text.add(new SimpleAttributeModifier(id,test));
   if (target != null) {
   // add some other components
   target.addComponent(text);
   }
   }

});


Somehow this doesn't work. I guess I simply missed something?

thanks,

Pieter

--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] add class onlclick

2007-07-03 Thread Nino Saturnino Martinez Vazquez Wael
I think it might have something todo with the fact that you are adding 
the attributemodifier in the ajax call? So each time you get the call 
you add another modifier, it would be better to add to modifier once and 
then change its model instead...

regards Nino

Pieter Cogghe wrote:
 If some link is clicked, I want to change the css-class of a label 
 like this:

 // text
 final Label text = new Label(text, resourceRecord.getText());
 add(text)

 // edit link
 add(new AjaxFallbackLink(edit-link){
 @Override
 public void onClick(AjaxRequestTarget target) {  
 // dome some other stuff
 text.add(new SimpleAttributeModifier(id,test));
 if (target != null) {
 // add some other components
 target.addComponent(text);
 }
 }

 });


 Somehow this doesn't work. I guess I simply missed something?

 thanks,

 Pieter

 -- 
 Pieter Cogghe
 Ganzendries 186
 9000 Gent
 0487 10 14 21
 

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] add class onlclick

2007-07-03 Thread Alex Objelean

First of all you must setOutputMarkupId to true for the text component:
text.setOutputMarkupId(true);

Also, you are modifying the id attribute, and not the css... this is also a
problem
so instead of:
text.add(new SimpleAttributeModifier(id,test));
do this:
text.add(new SimpleAttributeModifier(class,mySuperClass));




yuccaplant wrote:
 
 If some link is clicked, I want to change the css-class of a label like
 this:
 
 // text
 final Label text = new Label(text, resourceRecord.getText());
 add(text)
 
 // edit link
 add(new AjaxFallbackLink(edit-link){
 @Override
 public void onClick(AjaxRequestTarget target) {
 // dome some other stuff
 text.add(new SimpleAttributeModifier(id,test));
 if (target != null) {
 // add some other components
 target.addComponent(text);
 }
 }
 
 });
 
 
 Somehow this doesn't work. I guess I simply missed something?
 
 thanks,
 
 Pieter
 
 -- 
 Pieter Cogghe
 Ganzendries 186
 9000 Gent
 0487 10 14 21
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

-- 
View this message in context: 
http://www.nabble.com/add-class-onlclick-tf4017981.html#a11411738
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] add class onlclick

2007-07-03 Thread Pieter Cogghe

I just tried to modify the id to see if the worked, I'm sorry for the
confusion.

@Nino
I think you might be right, but I couldn't get it to work. (I changed it to
modifying the style attribute, just to quick test visually.)

My modified code:

// text
final Label text = new Label(text, resourceRecord.getText());
final Model textClassModel = new Model(color: red;);
final AttributeModifier textClass = new AttributeModifier(style, true,
textClassModel);
text.add(textClass);
add(text);

//(...)

// edit link
add(new AjaxFallbackLink(edit-link){
   @Override
   public void onClick(AjaxRequestTarget target) {
   //(...)
   textClassModel.setObject(color: blue;);

   if (target != null) {
   // (...)
   target.addComponent(text);
   }
   }

});

2007/7/3, Alex Objelean [EMAIL PROTECTED]:



First of all you must setOutputMarkupId to true for the text component:
text.setOutputMarkupId(true);

Also, you are modifying the id attribute, and not the css... this is also
a
problem
so instead of:
text.add(new SimpleAttributeModifier(id,test));
do this:
text.add(new SimpleAttributeModifier(class,mySuperClass));




yuccaplant wrote:

 If some link is clicked, I want to change the css-class of a label like
 this:

 // text
 final Label text = new Label(text, resourceRecord.getText());
 add(text)

 // edit link
 add(new AjaxFallbackLink(edit-link){
 @Override
 public void onClick(AjaxRequestTarget target) {
 // dome some other stuff
 text.add(new SimpleAttributeModifier(id,test));
 if (target != null) {
 // add some other components
 target.addComponent(text);
 }
 }

 });


 Somehow this doesn't work. I guess I simply missed something?

 thanks,

 Pieter

 --
 Pieter Cogghe
 Ganzendries 186
 9000 Gent
 0487 10 14 21


-
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



--
View this message in context:
http://www.nabble.com/add-class-onlclick-tf4017981.html#a11411738
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] add class onlclick

2007-07-03 Thread Alex Objelean

You forgot again to call text.setOutputMarkupId(true);
This is an important method to make components ajax aware..


yuccaplant wrote:
 
 I just tried to modify the id to see if the worked, I'm sorry for the
 confusion.
 
 @Nino
 I think you might be right, but I couldn't get it to work. (I changed it
 to
 modifying the style attribute, just to quick test visually.)
 
 My modified code:
 
 // text
 final Label text = new Label(text, resourceRecord.getText());
 final Model textClassModel = new Model(color: red;);
 final AttributeModifier textClass = new AttributeModifier(style, true,
 textClassModel);
 text.add(textClass);
 add(text);
 
 //(...)
 
 // edit link
 add(new AjaxFallbackLink(edit-link){
 @Override
 public void onClick(AjaxRequestTarget target) {
 //(...)
 textClassModel.setObject(color: blue;);
 
 if (target != null) {
 // (...)
 target.addComponent(text);
 }
 }
 
 });
 
 2007/7/3, Alex Objelean [EMAIL PROTECTED]:


 First of all you must setOutputMarkupId to true for the text component:
 text.setOutputMarkupId(true);

 Also, you are modifying the id attribute, and not the css... this is also
 a
 problem
 so instead of:
 text.add(new SimpleAttributeModifier(id,test));
 do this:
 text.add(new SimpleAttributeModifier(class,mySuperClass));




 yuccaplant wrote:
 
  If some link is clicked, I want to change the css-class of a label like
  this:
 
  // text
  final Label text = new Label(text, resourceRecord.getText());
  add(text)
 
  // edit link
  add(new AjaxFallbackLink(edit-link){
  @Override
  public void onClick(AjaxRequestTarget target) {
  // dome some other stuff
  text.add(new SimpleAttributeModifier(id,test));
  if (target != null) {
  // add some other components
  target.addComponent(text);
  }
  }
 
  });
 
 
  Somehow this doesn't work. I guess I simply missed something?
 
  thanks,
 
  Pieter
 
  --
  Pieter Cogghe
  Ganzendries 186
  9000 Gent
  0487 10 14 21
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

 --
 View this message in context:
 http://www.nabble.com/add-class-onlclick-tf4017981.html#a11411738
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

 
 
 
 -- 
 Pieter Cogghe
 Ganzendries 186
 9000 Gent
 0487 10 14 21
 
 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

-- 
View this message in context: 
http://www.nabble.com/add-class-onlclick-tf4017981.html#a11413172
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] add class onlclick

2007-07-03 Thread Pieter Cogghe

Super it works. Thanks. I thought you said that because I wrote id instead
of class. I didn't see the connection. I did some Ajax related things
before without setting outPutMarkU... . Either way it works.

2007/7/3, Alex Objelean [EMAIL PROTECTED]:



You forgot again to call text.setOutputMarkupId(true);
This is an important method to make components ajax aware..


yuccaplant wrote:

 I just tried to modify the id to see if the worked, I'm sorry for the
 confusion.

 @Nino
 I think you might be right, but I couldn't get it to work. (I changed it
 to
 modifying the style attribute, just to quick test visually.)

 My modified code:

 // text
 final Label text = new Label(text, resourceRecord.getText());
 final Model textClassModel = new Model(color: red;);
 final AttributeModifier textClass = new AttributeModifier(style, true,
 textClassModel);
 text.add(textClass);
 add(text);

 //(...)

 // edit link
 add(new AjaxFallbackLink(edit-link){
 @Override
 public void onClick(AjaxRequestTarget target) {
 //(...)
 textClassModel.setObject(color: blue;);

 if (target != null) {
 // (...)
 target.addComponent(text);
 }
 }

 });

 2007/7/3, Alex Objelean [EMAIL PROTECTED]:


 First of all you must setOutputMarkupId to true for the text component:
 text.setOutputMarkupId(true);

 Also, you are modifying the id attribute, and not the css... this is
also
 a
 problem
 so instead of:
 text.add(new SimpleAttributeModifier(id,test));
 do this:
 text.add(new SimpleAttributeModifier(class,mySuperClass));




 yuccaplant wrote:
 
  If some link is clicked, I want to change the css-class of a label
like
  this:
 
  // text
  final Label text = new Label(text, resourceRecord.getText());
  add(text)
 
  // edit link
  add(new AjaxFallbackLink(edit-link){
  @Override
  public void onClick(AjaxRequestTarget target) {
  // dome some other stuff
  text.add(new SimpleAttributeModifier(id,test));
  if (target != null) {
  // add some other components
  target.addComponent(text);
  }
  }
 
  });
 
 
  Somehow this doesn't work. I guess I simply missed something?
 
  thanks,
 
  Pieter
 
  --
  Pieter Cogghe
  Ganzendries 186
  9000 Gent
  0487 10 14 21
 
 

-
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 

 --
 View this message in context:
 http://www.nabble.com/add-class-onlclick-tf4017981.html#a11411738
 Sent from the Wicket - User mailing list archive at Nabble.com.



-
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user




 --
 Pieter Cogghe
 Ganzendries 186
 9000 Gent
 0487 10 14 21


-
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



--
View this message in context:
http://www.nabble.com/add-class-onlclick-tf4017981.html#a11413172
Sent from the Wicket - User mailing list archive at Nabble.com.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





--
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Wicket-user mailing list