>>Use a model like it's intended?

You mean I should use AbstractReadOnlyModel?

>>protected void onBeforeRender() {
    super.onBeforeRender();
    inputComponent.add(new SimpleAttributeModifier("class", true, new
AbstractReadOnlyModel<String>() {
        public String getObject() {
            return inputComponent.getFeedbackMessage() != null
? "errorField" : "";
        }
    });
}

There is no such constructor forSimpleAttributeModifier.

Thanks.



--- On Wed, 6/16/10, Jeremy Thomerson <[email protected]> wrote:

> From: Jeremy Thomerson <[email protected]>
> Subject: Re: How to remove css class from a component?
> To: [email protected]
> Date: Wednesday, June 16, 2010, 1:52 AM
> On Wed, Jun 16, 2010 at 12:48 AM,
> David Chang <[email protected]>wrote:
> 
> > Jeremy, glad to hear from you!
> >
> > My situation is a little different. The CSS class is
> added in the following
> > way. Please see the following code.
> >
> >        protected void
> onBeforeRender() {
> >               
> super.onBeforeRender();
> >               
> if (inputComponent.getFeedbackMessage() != null) {
> >               
>      
>    inputComponent.add(new
> AttributeAppender("class",
> > new Model<String>("errorField"), " "));
> >             
>    } else {
> >               
>         // how to remove CSS class
> here??
> >               
> }
> >        }
> >
> >
> > Thanks!
> >
> >
> > --- On Wed, 6/16/10, Jeremy Thomerson <[email protected]>
> wrote:
> >
> > > From: Jeremy Thomerson <[email protected]>
> > > Subject: Re: How to remove css class from a
> component?
> > > To: [email protected]
> > > Cc: "John Krasnay" <[email protected]>
> > > Date: Wednesday, June 16, 2010, 1:40 AM
> > > onComponentTag(...) {
> > > tag.remove("class");
> > > }
> > >
> > > On Wed, Jun 16, 2010 at 12:37 AM, David Chang
> <[email protected]
> > >wrote:
> > >
> > > > Hello,
> > > >
> > > > I add a CSS class to component dynamcially
> the
> > > following way:
> > > >
> > > > inputComponent.add(new
> AttributeAppender("class", new
> > > > Model<String>("errorField"), " "));
> > > >
> > > > How can I remove this CSS class in java
> code?
> > > >
> > > > Best!
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [email protected]
> > > > For additional commands, e-mail: [email protected]
> > > >
> > > >
> > >
> > >
> > > --
> > > Jeremy Thomerson
> > > http://www.wickettraining.com
> > >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> Use a model like it's intended?
> 
> protected void onBeforeRender() {
>     super.onBeforeRender();
>     inputComponent.add(new
> SimpleAttributeModifier("class", true, new
> AbstractReadOnlyModel<String>() {
>         public String getObject() {
>             return
> inputComponent.getFeedbackMessage() != null
> ? "errorField" : "";
>         }
>     });
> }
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 




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

Reply via email to