Hi,

> By convention components have their CSS at the class level (inside the
> package) .  Worse than that, some times the CSS (or in the case of the
> DatePicker) reference a handful of other content like images in the same
> class package.  In that case you would have to move every referenced piece
> of content relative to where you made your changes.

> Wicket's component nature introduces the tight relationship with to CSS
> and silly convention of housing the CSS in the packages themselves.
> After this exercise I am convinced component UI frameworks (at least Wicket)
> fall short in allow the developer to "skin" or change the look of a component 
> with ease.
> It is obvious these components are written with the thought that that their 
> look is your
> desired look.  Until this problem can be solved, I believe this is a major 
> weakness
>  of the component framework.

The main reason for Wicket to put markup and resources in packages
*and* facilitate such use (which is something most frameworks do not
provide) is to enable users to create components that you can put in a
jar and enable your users to use it without them having to worry about
what resources they need to put in the web app dir.

I am surprised this ability of writing encapsulated components is
marked as a major weakness; it is quite the opposite if you ask me.
I'm also surprised that the fact that a couple of existing components
depend heavily on packaged resources is taken as a framework weakness.

It is *very easy* to write your own date picker component if you don't
care about the encapsulation. Just get your favorite javascript
widget, wrap a Wicket component around it so that you'd have the
proper header contribution (HeaderContributor#forJavaScript/
HeaderContributor#forCss with the single string argument) and
initialization of the specific widget (e.g. by doing another header
contribution of a little script that initializes the widget using the
component (markup) id). My estimate is that doing this is less than an
hour work! If you follow the user/ dev lists, you can see that we keep
repeating that one of Wicket's major features is the ability to create
custom components easily yourself. This saves us from having to write
kitchen sink components, and others from going through the frustration
that a certain component doesn't do what they want.

> It is obvious these components are written with the thought that that their 
> look is your
> desired look

Huh? DatePicker packages all the skins that the original javascript
component packages, and creating your own style for this is as easy as
creating your own folder (and subfolders if you want) with css and
images etc and then doing something like:

public class MyPicker extends DatePicker {

private static class Settings extends DatePickerSettings {

        public DatePickerSettings() {
                setStyle(new ResourceReference(MyPicker.class, "mystyle.css"));
        }
}

public MyPicker(String id, Component target) {
  super(id, target, new Settings());
}

and you're done! The only thing DatePicker isn't flexible in, is that
it is not written with the idea in mind that people want it to use
resources from a web app dir (and thus break encapsulation). There's
nothing wrong with doing that for your own project (in fact the
project I'm working on has many of such components), but like I
stated, writing such a component yourself would be so easy it would be
better letting people do it themselves so that they have exactly what
they need.

I think we have some work to do getting this message across louder, so
I opened up http://issues.apache.org/jira/browse/WICKET-249

Cheers,

Eelco

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to