Re: How to add and remove css classes the right way?

2010-12-10 Thread ncollette

Obviously this is an old thread, but I just wanted to throw out another way
to remove a css class whilst preserving any existing css classes.

new SimpleAttributeModifier(class,
String.valueOf(this.getMarkupAttributes().get(class)).replaceFirst(edit,
));

In the case above - edit was the class I was removing.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-add-and-remove-css-classes-the-right-way-tp1868408p3082769.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to add and remove css classes the right way?

2010-02-05 Thread Martin Sachs
Hi Martin

user the AttributeModifier or AttributeAppender classes.



Martin

Martin U schrieb:
 Hi Folks,

 I'am getting totally confused how to add and remove css classes to and form
 my text-input-fields on ajax-form-validation.

 At first i try to add two css classes step by step:

 IteratorFeedbackMessage iter =
 Session.get().getFeedbackMessages().messages(getFeedbackMessageFilter()).iterator();
 if(iter.hasNext()){
 indicatorFor.add(new SimpleAttributeModifier(class,validation_error));
 indicatorFor.add(new SimpleAttributeModifier(class, test));
 }

 But gets the Markup only with class='test' 

 How can i add more than one value to class?

 And how can i remove one special css-class from an component if the
 validation is okay to this field?


 Thanks in Advance for any help.

 - Martin

   


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



Re: How to add and remove css classes the right way?

2010-02-05 Thread MattyDE

Hello Martin ;)

i tired

indicatorFor.add(new AttributeModifier(class,new
ModelString(validation_error)));
inicatorFor.add(new AttributeModifier(class,new ModelString(test)));

but in the markup no class attribute appears?

- Martin




Martin Sachs wrote:
 
 Hi Martin
 
 user the AttributeModifier or AttributeAppender classes.
 
 
 
 Martin
 
 Martin U schrieb:
 Hi Folks,

 I'am getting totally confused how to add and remove css classes to and
 form
 my text-input-fields on ajax-form-validation.

 At first i try to add two css classes step by step:

 IteratorFeedbackMessage iter =
 Session.get().getFeedbackMessages().messages(getFeedbackMessageFilter()).iterator();
 if(iter.hasNext()){
 indicatorFor.add(new
 SimpleAttributeModifier(class,validation_error));
 indicatorFor.add(new SimpleAttributeModifier(class, test));
 }

 But gets the Markup only with class='test' 

 How can i add more than one value to class?

 And how can i remove one special css-class from an component if the
 validation is okay to this field?


 Thanks in Advance for any help.

 - Martin

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

-- 
View this message in context: 
http://old.nabble.com/How-to-add-and-remove-css-classes-the-right-way--tp27464616p27464720.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to add and remove css classes the right way?

2010-02-05 Thread MattyDE

Ohhkay.. i see

indicatorFor.add(new AttributeAppender(class,new
ModelString(validation_error),  ));
indicatorFor.add(new AttributeAppender(class,new ModelString(test),
));

did it .. but how can i remove now an attribute from class .. or how could
i access the attributes to replace one?





MattyDE wrote:
 
 Hello Martin ;)
 
 i tired
 
 indicatorFor.add(new AttributeModifier(class,new
 ModelString(validation_error)));
 inicatorFor.add(new AttributeModifier(class,new ModelString(test)));
 
 but in the markup no class attribute appears?
 
 - Martin
 
 
 
 
 Martin Sachs wrote:
 
 Hi Martin
 
 user the AttributeModifier or AttributeAppender classes.
 
 
 
 Martin
 
 Martin U schrieb:
 Hi Folks,

 I'am getting totally confused how to add and remove css classes to and
 form
 my text-input-fields on ajax-form-validation.

 At first i try to add two css classes step by step:

 IteratorFeedbackMessage iter =
 Session.get().getFeedbackMessages().messages(getFeedbackMessageFilter()).iterator();
 if(iter.hasNext()){
 indicatorFor.add(new
 SimpleAttributeModifier(class,validation_error));
 indicatorFor.add(new SimpleAttributeModifier(class, test));
 }

 But gets the Markup only with class='test' 

 How can i add more than one value to class?

 And how can i remove one special css-class from an component if the
 validation is okay to this field?


 Thanks in Advance for any help.

 - Martin

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

-- 
View this message in context: 
http://old.nabble.com/How-to-add-and-remove-css-classes-the-right-way--tp27464616p27464823.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: How to add and remove css classes the right way?

2010-02-05 Thread MattyDE

Ah i did it . but is this the best way?

@Override
protected void onValidate() {   
super.onValidate();

visitFormComponents(new FormComponent.IVisitor() {

@Override
public Object formComponent(IFormVisitorParticipant 
formComponent) {
Component _c = (Component)formComponent;

if(formComponent instanceof 
IValidatingComponent){  



if(((IValidatingComponent)_c).getField().hasErrorMessage()){
AttributeAppender _attr = new 
AttributeAppender(class,new
ModelString(validation_error),  ){
@Override
public boolean 
isTemporary() {return true; }
};



((IValidatingComponent)_c).getField().add(_attr);   

}

}
return _c;
}
});


}






MattyDE wrote:
 
 Ohhkay.. i see
 
 indicatorFor.add(new AttributeAppender(class,new
 ModelString(validation_error),  ));
 indicatorFor.add(new AttributeAppender(class,new ModelString(test),
 ));
 
 did it .. but how can i remove now an attribute from class .. or how
 could i access the attributes to replace one?
 
 
 
 
 
 MattyDE wrote:
 
 Hello Martin ;)
 
 i tired
 
 indicatorFor.add(new AttributeModifier(class,new
 ModelString(validation_error)));
 inicatorFor.add(new AttributeModifier(class,new
 ModelString(test)));
 
 but in the markup no class attribute appears?
 
 - Martin
 
 
 
 
 Martin Sachs wrote:
 
 Hi Martin
 
 user the AttributeModifier or AttributeAppender classes.
 
 
 
 Martin
 
 Martin U schrieb:
 Hi Folks,

 I'am getting totally confused how to add and remove css classes to and
 form
 my text-input-fields on ajax-form-validation.

 At first i try to add two css classes step by step:

 IteratorFeedbackMessage iter =
 Session.get().getFeedbackMessages().messages(getFeedbackMessageFilter()).iterator();
 if(iter.hasNext()){
 indicatorFor.add(new
 SimpleAttributeModifier(class,validation_error));
 indicatorFor.add(new SimpleAttributeModifier(class, test));
 }

 But gets the Markup only with class='test' 

 How can i add more than one value to class?

 And how can i remove one special css-class from an component if the
 validation is okay to this field?


 Thanks in Advance for any help.

 - Martin

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

-- 
View this message in context: 
http://old.nabble.com/How-to-add-and-remove-css-classes-the-right-way--tp27464616p27465079.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



How to add and remove css classes the right way?

2010-02-04 Thread Martin U
Hi Folks,

I'am getting totally confused how to add and remove css classes to and form
my text-input-fields on ajax-form-validation.

At first i try to add two css classes step by step:

IteratorFeedbackMessage iter =
Session.get().getFeedbackMessages().messages(getFeedbackMessageFilter()).iterator();
if(iter.hasNext()){
indicatorFor.add(new SimpleAttributeModifier(class,validation_error));
indicatorFor.add(new SimpleAttributeModifier(class, test));
}

But gets the Markup only with class='test' 

How can i add more than one value to class?

And how can i remove one special css-class from an component if the
validation is okay to this field?


Thanks in Advance for any help.

- Martin