You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by William Speirs <ws...@apache.org> on 2013/02/01 15:44:06 UTC

Style Modifier

I created a Behavior the other night that allows one to modify the style
attribute of a tag by easily adding or removing a CSS property. Why is this
better/different than AttributeModifier? Because you can update a CSS
property inside the style attribute. Basic usage:

myComponent.add(new StyleModifier("background-color", "blue")); // changes
(or adds) the background-color property of the style tag on this component
to blue

myComponent.add(new StyleModifier("background-color")); // removes the
background-color property from the style tag on this component

Would anyone else find this useful? Would the devs on this list consider
taking it in for the next release of Wicket (if so I can open an JIRA)? Is
this already implemented and I'm just too stupid to have found it?

Thanks...

Bill-

Re: Style Modifier

Posted by Paul Bors <pa...@bors.ws>.
If I understand you right, you’re using it for in-line "style" attribute
whereas the "class" attribute should be used via Cascading Styling Sheets.


I would normally extends a CSS class and make the change I need (in your
example the background-color) and then append that new class name to an
already existing list of classes that are applied my tag.

Hence why a simple AttributeModifier changing the class attribute of a
tag is all you need.
~ Thank you,
   Paul Bors

On Fri, Feb 1, 2013 at 9:44 AM, William Speirs <ws...@apache.org> wrote:

> I created a Behavior the other night that allows one to modify the style
> attribute of a tag by easily adding or removing a CSS property. Why is this
> better/different than AttributeModifier? Because you can update a CSS
> property inside the style attribute. Basic usage:
>
> myComponent.add(new StyleModifier("background-color", "blue")); // changes
> (or adds) the background-color property of the style tag on this component
> to blue
>
> myComponent.add(new StyleModifier("background-color")); // removes the
> background-color property from the style tag on this component
>
> Would anyone else find this useful? Would the devs on this list consider
> taking it in for the next release of Wicket (if so I can open an JIRA)? Is
> this already implemented and I'm just too stupid to have found it?
>
> Thanks...
>
> Bill-
>

Re: Style Modifier

Posted by William Speirs <ws...@apache.org>.
Cool, thanks Martin!

Bill-


On Sun, Feb 3, 2013 at 2:59 AM, Martin Grigorov <mg...@apache.org>wrote:

> Hi Bill,
>
> As we see there is no much interest to put this in wicket-core, but you can
> contribute it to wicketstuff-minis (
> https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/minis-parent
> )
> if you like.
>
>
> On Sun, Feb 3, 2013 at 5:38 AM, William Speirs <ws...@apache.org> wrote:
>
> > @Paul Bors I would normally do the same type of thing, but I found myself
> > in a situation where I needed to style the background color of a div that
> > is dynamically loaded from a DB. ie, the user is free to chose whatever
> > color they want for the div's background.
> >
> > A quick modification of the style element was useful here...
> >
> > Bill-
> >
> >
> > On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal <vineetsemwal82@gmail.com
> > >wrote:
> >
> > > yes,appears useful to me  :)
> > >  however not sure if this should be added in wicket-core..
> > > another way of doing the same thing is a reusable ondomreadyheaderitem
> > >  using jquery's css(propertyName,value) in a neat way ..
> > >
> > > On Fri, Feb 1, 2013 at 8:14 PM, William Speirs <ws...@apache.org>
> > wrote:
> > > > I created a Behavior the other night that allows one to modify the
> > style
> > > > attribute of a tag by easily adding or removing a CSS property. Why
> is
> > > this
> > > > better/different than AttributeModifier? Because you can update a CSS
> > > > property inside the style attribute. Basic usage:
> > > >
> > > > myComponent.add(new StyleModifier("background-color", "blue")); //
> > > changes
> > > > (or adds) the background-color property of the style tag on this
> > > component
> > > > to blue
> > > >
> > > > myComponent.add(new StyleModifier("background-color")); // removes
> the
> > > > background-color property from the style tag on this component
> > > >
> > > > Would anyone else find this useful? Would the devs on this list
> > consider
> > > > taking it in for the next release of Wicket (if so I can open an
> JIRA)?
> > > Is
> > > > this already implemented and I'm just too stupid to have found it?
> > > >
> > > > Thanks...
> > > >
> > > > Bill-
> > >
> > >
> > >
> > > --
> > > regards,
> > >
> > > Vineet Semwal
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Re: Style Modifier

Posted by Martin Grigorov <mg...@apache.org>.
Hi Bill,

As we see there is no much interest to put this in wicket-core, but you can
contribute it to wicketstuff-minis (
https://github.com/wicketstuff/core/tree/master/jdk-1.6-parent/minis-parent)
if you like.


On Sun, Feb 3, 2013 at 5:38 AM, William Speirs <ws...@apache.org> wrote:

> @Paul Bors I would normally do the same type of thing, but I found myself
> in a situation where I needed to style the background color of a div that
> is dynamically loaded from a DB. ie, the user is free to chose whatever
> color they want for the div's background.
>
> A quick modification of the style element was useful here...
>
> Bill-
>
>
> On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal <vineetsemwal82@gmail.com
> >wrote:
>
> > yes,appears useful to me  :)
> >  however not sure if this should be added in wicket-core..
> > another way of doing the same thing is a reusable ondomreadyheaderitem
> >  using jquery's css(propertyName,value) in a neat way ..
> >
> > On Fri, Feb 1, 2013 at 8:14 PM, William Speirs <ws...@apache.org>
> wrote:
> > > I created a Behavior the other night that allows one to modify the
> style
> > > attribute of a tag by easily adding or removing a CSS property. Why is
> > this
> > > better/different than AttributeModifier? Because you can update a CSS
> > > property inside the style attribute. Basic usage:
> > >
> > > myComponent.add(new StyleModifier("background-color", "blue")); //
> > changes
> > > (or adds) the background-color property of the style tag on this
> > component
> > > to blue
> > >
> > > myComponent.add(new StyleModifier("background-color")); // removes the
> > > background-color property from the style tag on this component
> > >
> > > Would anyone else find this useful? Would the devs on this list
> consider
> > > taking it in for the next release of Wicket (if so I can open an JIRA)?
> > Is
> > > this already implemented and I'm just too stupid to have found it?
> > >
> > > Thanks...
> > >
> > > Bill-
> >
> >
> >
> > --
> > regards,
> >
> > Vineet Semwal
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: Style Modifier

Posted by William Speirs <ws...@apache.org>.
@Paul Bors I would normally do the same type of thing, but I found myself
in a situation where I needed to style the background color of a div that
is dynamically loaded from a DB. ie, the user is free to chose whatever
color they want for the div's background.

A quick modification of the style element was useful here...

Bill-


On Sat, Feb 2, 2013 at 5:18 AM, vineet semwal <vi...@gmail.com>wrote:

> yes,appears useful to me  :)
>  however not sure if this should be added in wicket-core..
> another way of doing the same thing is a reusable ondomreadyheaderitem
>  using jquery's css(propertyName,value) in a neat way ..
>
> On Fri, Feb 1, 2013 at 8:14 PM, William Speirs <ws...@apache.org> wrote:
> > I created a Behavior the other night that allows one to modify the style
> > attribute of a tag by easily adding or removing a CSS property. Why is
> this
> > better/different than AttributeModifier? Because you can update a CSS
> > property inside the style attribute. Basic usage:
> >
> > myComponent.add(new StyleModifier("background-color", "blue")); //
> changes
> > (or adds) the background-color property of the style tag on this
> component
> > to blue
> >
> > myComponent.add(new StyleModifier("background-color")); // removes the
> > background-color property from the style tag on this component
> >
> > Would anyone else find this useful? Would the devs on this list consider
> > taking it in for the next release of Wicket (if so I can open an JIRA)?
> Is
> > this already implemented and I'm just too stupid to have found it?
> >
> > Thanks...
> >
> > Bill-
>
>
>
> --
> regards,
>
> Vineet Semwal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Style Modifier

Posted by vineet semwal <vi...@gmail.com>.
yes,appears useful to me  :)
 however not sure if this should be added in wicket-core..
another way of doing the same thing is a reusable ondomreadyheaderitem
 using jquery's css(propertyName,value) in a neat way ..

On Fri, Feb 1, 2013 at 8:14 PM, William Speirs <ws...@apache.org> wrote:
> I created a Behavior the other night that allows one to modify the style
> attribute of a tag by easily adding or removing a CSS property. Why is this
> better/different than AttributeModifier? Because you can update a CSS
> property inside the style attribute. Basic usage:
>
> myComponent.add(new StyleModifier("background-color", "blue")); // changes
> (or adds) the background-color property of the style tag on this component
> to blue
>
> myComponent.add(new StyleModifier("background-color")); // removes the
> background-color property from the style tag on this component
>
> Would anyone else find this useful? Would the devs on this list consider
> taking it in for the next release of Wicket (if so I can open an JIRA)? Is
> this already implemented and I'm just too stupid to have found it?
>
> Thanks...
>
> Bill-



-- 
regards,

Vineet Semwal

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