Monday, October 11, 2004

Hidden Creator Feature #3: HTML Palette

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.



Here's another hidden Creator feature: The HTML palette.
Before telling you how to find it, let me make something
very clear: this is dangerous territory.
Craig warns
that you can get into a lot of trouble mixing JSF components
and HTML markup. However, the tool already allows you to go
to the Source tab and enter HTML at will, so the new html tab is not
opening up new opportunities to shoot yourself in the foot.
The designer already tries to prevent the most dangerous
situations from arising, such as using markup inside a component
like a DataTable which renders its own children. To do this
properly, you'll probably want to either use a verbatim tag
or a JSF component library that directly exposes the HTML
components (here's one
, but I haven't tried it and it probably isn't integrated
with Creator, and yes, we ought to provide a library like this.)



Okay, with that out of the way: to get an HTML palette, you
need to run Creator with this flag:


-J-Drave.showHtmlTab=1

Now the palette should show an HTML top level tab, as shown in
the screenshot on the right. Notice that it is not including
input tags since you really need to use JSF components for these.



There is unfortunately one annoying behavior: for every session
of the IDE, the first time you open the palette, you get a warning
telling you that HTML components are dangerous. We were planning to ship
with the HTML palette enabled, but were concerned about people getting
into trouble mixing JSF and HTML, so we thought the warning would give a
heads-up and also point to a help topic with more information. The
problem is that in the shipping bits, the above flag should have turned
off the dialog but alas, that is not the case.



Let me end with a little bit of philosophy. One of the nice things about
JSF is that since processing happens on the server, in theory the JSF
components can render anything to the target device; thus letting you
target not just web browsers but for example mobile devices.
When I

met Coocoon developer Sylvain Wallez
after a Creator event in Toulouse a couple of weeks ago we had an
interesting discussion about

multi channel
technology: the ability to have the page you're designing not just
used in popular web browsers, but also on cell phones and other devices.
Sylvain pointed out that in Creator, when you drop down components
at pixel positions in absolute layout, you're making multi-channel support
difficult. The thing of course is that Creator is not optimized for
multi channel support, it's optimized for usability and developer
productivity. While a declarative approach to defining pages makes it
easier to support different output devices, it's pretty difficult to
go in the "opposite direction": providing WYSIWYG design down to a
declarative model. For example,
TeX produces beautiful
documents, but reality is that most people use wordprocessors like
Word and Star/OpenOffice because of the simple user model and WYSIWYG
capabilities.



The challenge is to make page design simple, yet create a page definition
that offers the flexibility to be rendered to varying kinds of output
devices. If you go down the road of using lots of HTML markup this is going to
be more difficult. Hopefully, as more JSF layout components become available
this will become less necessary, and a future JSF renderkit will render
your pages properly to other kinds of devices as well.


No comments:

Post a Comment