Thursday, December 23, 2004

Performance Tip: Make More Memory Available!

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.


I've seen a couple of customer projects today (thanks for sending those in!), and one thing became obvious: we've set the default maximum heap size for the Java VM too small. It's currently set to 128 Mb; but with the IDE running, lots of data sources, a dozen pages with lots of components on them etc. two of the projects were up in the 120 Mb range when all the pages are open at the same time.



So you should increase the amount of memory you make available to the IDE. This will not only make the IDE run faster (because when the IDE is getting near the memory limit it does a lot more garbage collection), but it will avoid OutOfMemory exceptions and other problems that occur if you actually get up to the limit.



To change the memory limit, do this: locate your IDE installation, and edit bin/ide.cfg with a text editor. It currently looks like this:


-J-Xms24m -J-Xmx128m
-J-Xverify:none
...

Change this into

-J-Xms24m -J-Xmx256m
-J-Xverify:none
...

and restart the IDE.



It's possible some of the Patch 5 symptoms showed up for some of you whose project memory requirements were near the limit, simply because with the extra preview features and other fixes, the IDE is taking up more of the available heap space and you run out of memory.


Creator patch 5 problems

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.


So I mentioned yesterday that patch 5, also known as "Reef", is shipping.
Some users on the Creator forum have
reported seeing problems with the latest patch. We've dropped everything else
and spent the day studying the problem and have some preliminary ideas
about what the problem is. Hopefully the following explanation can help
those of you who are affected by this.



By the way, my coworker Eric has
started blogging. This issue
is in his area of expertise so I'm sure he'll have more to say, but at
the moment he's busy thinking of the best way to fix this problem!



Until patch 5, there were some scenarios where you could have errors in your
application, and the Creator source modeller wouldn't realize it. This could
lead to some bad results, like your code getting munged. These holes were
closed in patch 5. However, it's not handling the case where you try to
open a "bad" project from disk. If you've been using patch 4 you may not realize
there are problems in your application, since the source modeller wasn't
identifying this problem; you just ran the risk of Bad Stuff(tm) happening.
(Also, there's one change in patch 5 which could cause your project to no
longer be valid (the getContext() issue; see below.)



Now this problem is detected at startup, but it's not handled well so what ends
up happening is that you load your application, various pages are marked as
having errors, and these pages get parsed over and over again (explaining the
CPU spiking two people reported) and consuming a lot more memory than was
required before (explaining some OutOfMemory exceptions another user was
reporting).



So, until we put out a fix for this, if you want an immediate solution,
you need to go edit your project (on disk) to remove the problem, then
you can open it in patch 5 and everything should be fine (and better/safer than
in patch 4; it will now alert you immediately when you do something to
put the project into a bad state.)



The problem is that it's not easy to find out what's wrong about your project.
That's probably what the user visible change of the fix will be: project errors
that blocks the source modeller on project open will be listed immediately so
you can handle them there and then. In the meantime, Eric has
identified a process you can use
to get your project back into shape.



However, before you try that: There's one more potential problem which could explain why your pages are
suddenly not understood by the source modeller: the getContext()
method in your page beans' superclass is missing in patch 5. So if any of
your page beans are using this method,
change the method call to getFacesContext() or add a method
named getContext which calls getFacesContext().



Also, if you have large projects (as some of you do) you may want to bump
up the memory assigned to Creator; edit Creator-location
/bin/ide.cfg and replace -J-Xmx128m on the
first line with -J-Xmx256m .


Wednesday, December 22, 2004

Creator update available

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.


update
Creator Patch 5 is now available. Go hit the Update Center!



There are a number of new features and preview features to look for --
here's the list. Plus of course
lots of bug fixes.




Monday, December 20, 2004

Do you need Internet Explorer support?

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.


I recently went over the designer code in Creator and checked how much of
the CSS 2.1 spec it covers.
It intentionally doesn't address properties
that are nonvisual (such as the audio ones), or the ones for paged media
(not a priority for web apps), or properties that are interactive in
nature, such as cursor - these are not appropriate for
design time rendering. (The cursor for example is already is used to
indicate designer state, like whether the component under the cursor is resizable.)



With the above removals, the list of missing properties is pretty short.
(In fact, the list got much shorter when I updated from CSS 2 to CSS 2.1, since
CSS2.1

removed a number of properties and property values I was not supporting. Now I
no longer need to implement
cjk-ideographic | hiragana | katakana | hiragana-iroha | katakana-iroha for list-style-type to be compliant, for example.



There is however another set of properties I haven't implemented:


  • max-height, min-height, max-width, min-width
  • content, quotes, counter-increment, counter-reset
  • empty-cells
  • background-attachment (apparently implemented in IE but incorrectly)


What's special about these, and why aren't they implemented?
I didn't prioritize them because Internet Explorer
does not support them. Therefore, many users probably don't want to rely
on them given IE's still dominant market share.




So, today I have a question in my blog: If you develop a webapp using Creator,
do you limit yourself to CSS properties supported by IE? Or can you assume
that your users will use a standards compliant browser like
Firefox,
Safari or
Opera?
And if IE support is important, do you need any of the above CSS properties
in particular? Finally, I know there were some rumors/discussions a little while
ago about IE development having been resumed; is there any truth to that,
and have they said anything about plans for full CSS support?



By the way, on Friday I implemented the last five missing properties on
my list (other than the above IE-missing properties):
visibility (clip
was already implemented), font-variant,
text-transform, text-indent, and
font-family search lists. Now I've gotta
go and make sure all the property values are supported for these properties
too.


Thursday, December 16, 2004

iPod to the Rescue!

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.



I just saw this on
webstandards: You can

install the CSS 2.1 spec

on your ipod! Good for offline reading while stuck in line at DMV or elsewhere...



I recently argued
why learning CSS is going to be worth your while when working with Creator and JavaServer Faces in general.



I was just about to install it when I realized I don't really need to; in implementing the designer
I've actually memorized most of the spec! It's the first item in my
Firefox bookmarks list.




Monday, December 13, 2004

The Big Day

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.





Tomorrow (Tuesday) is the big day; my youngest son is having
major surgery. It's been planned for a couple of months, so
it will be great to get it over with, but I will be a nervous
wreck for five hours tomorrow.



Keep your fingers crossed!



I'll be back online in a couple of days.




UPDATE 14. Dec 2004, 9:30 PM PDT: It's over, and the surgery was a success! He is recovering nicely. Thanks for your support everybody!




Saturday, December 11, 2004

New Creator blogger

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.


Another developer in the Creator group, Edwin Goei, has
started blogging.


Friday, December 10, 2004

Forum Solutions

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.


I just caught up on the threads in the
Creator forum
and came across some good stuff. Jonathan of
Solutions In A Box who has been an active
participant in the forums has posted solutions for how to
provide file uploads
(something several forum users have asked how to do, since JSF doesn't ship with a component
for this), and
how to include Jasper
reports
.



There have probably been some other good solutions posted in the past too that I've missed, so point them out and I'll link to them here.


Wednesday, December 8, 2004

Code Clips

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.


There's a new review of Creator on developer.com written by Dick Wall. A nice write-up.



One minor note:


"Adding a new clip is as simple as putting some code into the copy/paste buffer, then choosing a menu option to add it to the clips using a given name."

Actually, it's as simple as selecting the text in the editor, and dragging it and dropping it on the palette! I've seen a lot of comments on Creator that mention the code clips -- I guess it really addresses a need.



There's a cool, but hidden feature related to code clips: if you surround some text in the code clip with "@", it will be become a parameterized code clip. When you drop the code clip, you get a dialog asking you to submit the values for these parameters.

For example, you might have some code like this in the editor for doing a bundle lookup:


NbBundle.getMessage(this.getClass(), "MyKey")


If you change this into

NbBundle.getMessage(this.getClass(), "@key@")


and drag this on the palette, then the next time you drop the clip you get this dialog:





If you enter say the text "Hello" into the value field and hit OK, the text inserted in the editor
at the clip drop point is:

NbBundle.getMessage(this.getClass(), "Hello")



Unfortunately, there's a bug (fixed in the next patch) which prevents this code from working
correctly with code clips where the parameters are repeated in the code (such as the iterator variable in a for loop), but the fix for that should be available soon.


Thursday, December 2, 2004

More Rendering Work

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.


I spent some more time on the XHTML/CSS layout engine in the designer.
One area I was mistreating badly was floating boxes, especially inside
tables - and this comes up more often than you'd think because the
align=left|right attribute in HTML is implemented using floating
boxes. I've fixed that now and as a result some more page tests
are looking better, as you can see in the screenshots below.



The Apple page still isn't looking good because I haven't implemented
the deprecated <center> tag and it looks like they're relying
on it, just like Google does, to center block formatted tags. Sigh.
I was thinking I could simulate it with CSS margin: 0 auto,
but unfortunately margins don't inherit by default so a simple alias won't
work.














screenshot



screenshot



screenshot



screenshot


Monday, November 29, 2004

Get Stylin'

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.



I wrote the

November newsletter editorial
for the Creator site; it covers using CSS styles and components to make better looking web applications. We're going to incorporate more of this in sample applications too.




Tuesday, November 23, 2004

Component Writer Tips

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.


If you're writing a JSF component, there are a couple of things
you can do to make the component behave more nicely at design
time. (Well, there are actually a lot of things you can be doing,
and we'll document these shortly, such that your components
can have the same rich designtime behavior in Creator that for example the
standard JSF data table has.)



Anyway, some of these techniques are general beyond the Creator JSF
designtime library:



First, in your renderer, which generates HTML from the JSF component,
you can check the
Beans.isDesignTime() property. If set, the component
is being rendered during design time preview of the component,
so you can change what you render accordingly. For example,
if you have a "container" component, and it has zero children,
at runtime you probably want your container to render nothing, but
at design time you should render something to show the user
your component; for example, you can set up a particular size
for your component or render some explanatory text within the
container. This example for simplicity just sets the background color to red:


if (Beans.isDesignTime() && component.getChildCount() == 0) {
writer.writeAttribute("bgcolor", "red", null); // Ugly example
} else {
...



Another thing you can do is include images from your component library
at designtime -- these don't need to be included in the user's project
since they are just shown at design time and are therefore available
to the IDE:


if (Beans.isDesignTime() && component.getChildCount() == 0) {
// Show special design time icon
writer.startElement("img", component);
URL url = MyClass.class.getResource("myicon.png");
writer.writeURIAttribute("src", url, null);
...



Finally, I've

already mentioned
how you might want to set the
default property for your component to improve the design time
handling of this component.


Sunday, November 21, 2004

Back In Business

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.


I just got back from a really nice week in Prague. I got to see
some demos of upcoming NetBeans features. Unbelievably cool.
The form editor has a new design mode which is just going to,
well, kick ass. No more

gridbag, dude
.
The new mobile stuff is also fantastic. NetBeans is really
getting fabulous.



What's the deal with airports and power sockets? I really wanted to
connect my laptop while waiting for my next flight (and the battery
was flat) yet I couldn't find a place to plug in anywhere in Frankfurt
airport.
I had the same experience last year at Heathrow. That time I finally found
one in the middle of nowhere, but as soon as I had gotten comfortable
security came by and told me to leave because there's some kind of
"danger" with having people connect their own hardware to the airport power
net. In Frankfurt I walked around for 45 minutes before locating a
place to plug in -- at the airport McDonalds. So I was lovin' it...


Thursday, November 11, 2004

Slow Application Outline?

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.


I recently mentioned the component default properties being shown inline in the application outline, as of Creator patch 3. Turns out there's a performance issue related to this for components whose default property is a value bound expression -- such as an output text in a data-bound data table for example. If you're noticing sluggish performance (this will most likely be the case if you're using a database that is not running locally) try hiding the application outline.



I've just fixed this, so look for the fix in the next patch if this affects you.


TGIF!

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.





It's been quite a week. We had a deadline for an internal milestone
this week, so we've been up coding late every night - I even pulled
an all-nighter Wednesday. Working hard to improve Creator, people :-)
The next version will have some important fixes in it. Yes, I have
to be vague or I will be arrested by the You Can't Promise Anything
Police...



Today my youngest son had a CAT scan in preparation for surgery in the next month;
the picture on the right is from his other scan.



Next week I'm heading out to
Prague
for some interesting engineering discussions. I've been there before
-- it's a beautiful city full
of nice people and good food, so I'm really looking forward to it.




Wednesday, November 10, 2004

Anatomy of a Creator JSF Application

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.


I've written an article for the developers.sun.com Creator site which describes how a Creator application is put together, from the JSPX markup and stylesheets to the page beans and navigation files.
You can read Anatomy of a Java Studio Creator Application here, but be sure to check out the other resources added this month as well, around the theme of JSF components.



Sunday, November 7, 2004

Source Code Profanity

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.


The source code for J2SE 5.0 has been made available. Slashdot covered the event, and one of the posts
showed that the community has already

poured over the source code in an attempt to clean up its quality...



I immediately started a search command on the current Creator source to see if we have any juicy comments I can share with you.... But we don't. I tried successively less "offensive" words, and the only hits I got were for "stupid" and "lame"...


xxx/Utilities.java: * is really lame. The problem is that at the top level, I need
xxx/DnDSupport.java: // insertTab is too stupid to notice that inserting a tab at the



This brought back some good (?) memories though. I used to work on
Sun WorkShop, the C/C++ IDE for Solaris from Sun, and one of the really nice things about the IDE was that it integrated (not emulated) the XEmacs and vi editors. So we shipped XEmacs with the product. Well, XEmacs came with a bunch of supporting packages, such as Zippy -- which had a large database of insults copackaged with it, ready to be automatically attached as e-mail signatures etc. People actually complained about this, so we removed some of these, and we added a script to the emacs source tree integration process which scanned for a list of "offensive words" and yanked elisp packages containing them!


Thursday, November 4, 2004

Default Properties

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 feature in patch 3: the application outline shows the
most important property in a component. For example, if you have
four buttons in the outline, how do you know which one is which?
Most likely the buttons will have different labels, and as you can see
from the screenshot, the button labels now appear next to the instance
names.



This relies on the

default property

of a component. As you can see, the default property for a button is its label (value)
property. For images, it's the (base) filename of the image. For
a hyperlink, it's the url, and for a text component it's the actual
text shown.



Note that you can quickly edit these properties. Click on a component,
such as a button. Now just start typing. Keyboard focus will transfer
to the property sheet, scroll to the default property, and you have
started editing it.



For html tags there's no instance name (since the html markup
does not appear in the page beans), but if tag has an id or
name
attribute, those are shown next to the tag name.




Tuesday, November 2, 2004

Creator Review

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.


I've got a couple of external links to share. First,
App Dev Trends have
reviewed Creator
- 4/5 stars.
Second,

here's an interview with Tim Boudreau
who's done some
really great work on NetBeans, including the Navigator module I can't
live without; I hope it's made part of the standard distribution
soon. I've met Tim several times, last time at JavaOne this summer at
the Creator launch party, and he's a really nice guy. The interview
mentions some future trends for NetBeans which I can't wait to use.



I've been doing a lot of debugging lately (which I use NetBeans 3.6
for), but I decided to take 4.0 beta2 for a test spin. Wow. In addition to
improvements for various usability issues

I had brought up in the past
, there are lots of other improvements.



I really like the new project system. I'm using my own ant files - the
same ones used by release engineering for Creator - and I can run,
debug, and test the project. I've also got Fix & Continue working
now. There's a new special target in my ant file such that when ant is
run inside the IDE, the ant target causes the freshly built class files
to be hotswapped into the running target VM. Unlike the old fix &
continue action, where I'd have to wait about ten seconds, fix and
continue now takes about two seconds.



The new code editor stuff seems to work well too -- I've used rename
refactoring, find usages, and fix imports.



I noticed some sluggishness in one area of my code, so I think I'll
have to check out their new
Performance Profiler as well!



I'm not just happy with these NetBeans changes because they make me more
productive. Creator is built on top of NetBeans and will take advantage
of many of these features when we upgrade to the 4.0 platform.



Happy U.S. election day folks, now do your duty and go and vote! It's
not like it's hard to choose this time.


Thursday, October 28, 2004

Component Linking

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.


One of the new designer features that's available in patch 3
is "component linking". This lets you easily link two related components
together. If you've ever dropped a database table on a dropdown or
Data Table component, you've used component linking. When you dropped,
the rowset was linked to the JSF component (by becoming its data source
through value binding).



Component linking isn't specific to data binding. Take the "Inline
Message" component for example, which displays messages for other
components. The for property points to which component
it displays errors for. If it's tied to a text field for example, and
the text in the text field fails to validate, the validator error
message is displayed in the inline error message.



In 1.0, if you drop an Inline Message, it just displays the text
"msg-summary" (and if you enable the details property on the
component, it would display "msg-summary msg-details"). Not
particularly helpful. I got inspired to fix this when I deployed my application
several times without validation messages showing up, and I (too late) realized
that I had forgotten to associate the inline error message component with
its textfield!! This is now changed such that it will
instead display "Messages for id", where id is the name
of the component it's bound to. Therefore, you can immediately tell whether
your Inline Message is set up correctly, and which component it's associated with.



You change the component it's bound to
by editing the "for" property of the component.
As of patch 3, you can now easily link these components (an Inline
Message, and its associated component, such as a text field). Just
control-shift drag from the textfield to the inline message (or vice
versa), and the two components are linked! As you can see from the
screenshot, there is feedback while you drag; when a link connection
is possible the target is highlighted in blue and the status text area
describes the link. (The screenshot program I used inserted its own
mouse pointer here rather than the one used by Creator during the link
operation.)





Other components allow links too; for example, you can connect
any visual component (other than self) to a Component Label component
using the same technique.




In addition, linking works in the application outline too.
You can now reorder components by simply dragging them around in
the application outline (see screenshot). Normally, if you drag
say a component label component to a Grid Panel, it's going to
move the label into the Grid Panel. How can you link the label
to the grid panel instead, such that it's a label for
the grid panel rather than in it? Hold down Control-Shift
during the drag. The Drag & Drop cursor will change to the
link cursor. Another modifier will cause the component to be
copied rather than linked or moved. The keyboard modifiers should
be the same as the drag & drop modifiers used for file manipulations
on the operating system you're running on.




Monday, October 25, 2004

Creator Patch 3 Available

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.


Patch 3 has hit the update center. You'll definitely want to get this update; it contains a lot of bug fixes. And some new features too. Look in your your Tools menu for the Update Center.



I'll come back and blog more about the new stuff in patch 3 in a day or two.... today's my birthday so I took the day off. And now it's too late to stay up and blog!


Monday, October 18, 2004

Building a Browser

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.





My biggest challenge is to make the Creator page designer properly display "real" web pages, and more importantly, display them the way browsers do. It should be simple, right? I thought I'd start with the Google page -- that's a very small, simple HTML page. But even that page exposed a problem in the designer: it surrounds its main table with a <center> tag (an inline tag containing a block tag, something which shouldn't be valid) - but browsers actually use this to not just center text via the CSS property text-align: center, they actually center block tag children like the table as well. Grrrrr... I'll have to work on that; looks like Mozilla is using clever vendor specific CSS properties to handle <center> right.







But I've spent some time the last couple of days trying to improve rendering of various pages. The Sun home page renders pretty well now as you can see from the screenshot on the left; my blog page does too (bottom right).



I'm definitely not done in this department. Various bugs in my handling of floating boxes means that the Amazon page (which relies heavily on them) looks terrible. I'll attack that next.







I spent some time trying to get the MSDN page to look okay. It looked terrible and I couldn't figure out why: all the fonts were microscopically small!! Turns out Microsoft were using percentages for the CSS font-size property, and not only that, if the page is rendered correctly (as in following the CSS standard) the fonts SHOULD be small. But they're relying on a quirks mode behavior (which Mozilla supports) where if a document doesn't specify a modern DOCTYPE, font size inheritance is turned off when you go through a table tag. I had a really hard time figuring this out, and in the end I resorted to using Mozilla's DOM inspector (I love that tool!) to compare notes for their computed effective styles and my effective styles, and that's when I discovered how CSS properties are inherited in quirks-mode processing of documents. In the end I decided not to worry about this (supporting quirks mode in the designer): we already require you to write XHTML compliant markup, so you should be relying on standard CSS handling.



P.S. Notice how in the third screenshot (you can click on the thumbnail images) the output window has opened and told me that my CSS property value for "font-weight", "medium", is not a valid value for font-weight. The intended value is "normal", not "medium". I hadn't noticed that until loading the page into Creator just now! I guess I should use Creator to edit my blog from now on... we just need to integrate Creator with Roller...



Friday, October 15, 2004

Writing from my couch... finally....

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.


I finally fixed my home wireless network. I work at home three days
a week, and my home office is in the garage. The problem is the wireless
router's signal only barely reaches into the house -- so when I try to
sit on the couch with my laptop I can't actually be online. And thanks
to Murphy's Law, if I'm not online I'll definitely run into some issue
where I need online access - either to access a CVS repository to look
at a file history, or perhaps googling some API.




So I finally went out and bought a wireless network Range
Extender. You just place it near the edge of your current reception
area, and it talks to your existing router, duplicates the id etc. and
effectively extends the range of the network from the new
location. Sounds easy in theory -- but it took three calls to tech
support, one lasting nearly an hour as we kept resetting the router
and range extenders. There were lots of snags - positioning of the
devices during configuration, upgrading firmware - and then the
biggest problem: some problem with the device they apparently know about
(but didn't realize while helping me) where the "valid link" light doesn't turn on when it in fact -is-
working...



Oh well, I'm happily blogging this from my couch!! And I'm noticing
several Sun bloggers are posting many good political blog entries...
Alec Muffett,
Tim Bray,
Geoff Arnold
and others.


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.


Monday, October 4, 2004

Aligning Text in Data Tables and Grid Panels

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.


I've seen a number of users who want to either control the alignment
of text in columns, or control the relative widths or text wrapping
in the columns -- either for Data Table components, or the Grid Panel.
Before I explain how to do that, let me start by explaining the synergy
between JSF components and CSS2.



First, drop a Data Table component on the canvas. Notice how you get
a "striped" color scheme where alternating rows are lighter and darker?
That's not built into the component per se; this is done in Creator
through a combination of CSS and JSF. Go ahead and open the stylesheet
for your page; it's usually under the "Resources" folder, named
"stylesheet.css". You'll notice it has these two rules:


.list-row-even {
}

.list-row-odd {
background-color: #eeeeee;
}

As you might be able to guess from the names, these are the styles
applied to even and odd numbered rows. To see how this is wired up,

go back to your page, select the data table component, and look at its
rowClasses property. In Creator we default this value
to list-row-even,list-row-odd. This property is a list
of CSS style classes. When the component is rendering the table, it
will cycle through the list of classes, assigning the current style
class to a given row. There's nothing magical about odd and even here;
we could have had three styleclasses, "one", "two" and "three", and
if the rowClasses property was set to "one,two,three" then the html
table rendered for the Data Table would take three rows to cycle
through the styles.



With that out of the way, let's return to the question of how to
deal with column widths or column text alignment. Some users have
tried to set the CSS "text-align" properties on the cell contents
themselves, e.g. Output Text components embedded in the table.
That's not what you want; you need the alignment set on the table
cells containing the output texts. To solve that problem, we're
going to use the same technique as the one used for table striping.
Just like the table component cycles through the
rowClasses style classes when writing out rows, it
has a columnClasses property it will cycle through
when writing out columns!



Let's say we want to have a table with three columns. We'd like the
first column to be 10% wide, the second column to be 30% wide, and
the third column to be 60% wide. Furthermore, we want the first column
to be right justified and the third column to be centered. To do
that, add a stylesheet section like this:


.firstColumn {
width: 10%;
text-align: right;
}
.secondColumn {
width: 30%;
text-align: center;
}
.thirdColumn {
width: 60%;
}

Then, for the Data Table or Grid Panel's columnClasses
property, add this value: firstColumn,secondColumn,thirdColumn
Notice how there's a dot/period in front of the style class names in
the stylesheet, but not in the class names in the style property.
That's all there is to it.






In the above screenshot I've also changed the header style to use a different
foreground color, background color and font size. Notice how some columns
are right justified, some are centered and some are left justified.



If you try to add pixel specific widths for particular columns, AND
you've set a total table width to a particular size, the pixel width
may not show up correctly at design time. That bug was fixed recently
and the fix will show up in patch 3. For now, use the "Preview In
Browser" action to see how the table renders in the browser instead.


Thursday, September 30, 2004

Page Designer Productivity Boosters

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.


I wrote the guest editorial for this month's Creator newsletter. It covers a number of little tips to improve your productivity with the page designer; Read it here. Topics covered include techniques for dealing with the selection hierarchy, a way to quickly set default properties for components, and ways to deal with the snap-to-grid mode.


Wednesday, September 29, 2004

Totally Gridbag, dude!

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.


One of my coworkers sent this link to me:

http://madbean.com/blog/2004/17/totallygridbag.html
. I found it hilarious; if you've written Swing code by hand you probably will too.



I don't want to start a flamewar here, but I really like the grid bag layout: it's the only way I can


Of course, I don't do what the animation shows: typing in source code to manipulate the layout directly. This is a perfect occasion for a tool. With NetBeans it's a breeze customizing gridbag layouts using their gridbag layout customizer. Experimenting with it is how I learned how the gridbag layout works, but even now that I know I prefer to use a tool to create layout code.


Monday, September 27, 2004

Creator's Easter Egg

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.



This is not going to help you in your day to day work, but.... here's how you can get to Creator's easter egg (if you're in Sun management, please look away...). Open the designer, drop an Output Text component, change its label to (exactly) "DonkeyOnTheEdge" (who can spot the movie reference?) and then double click on it. Voila!



You can use arrow up and down to speed up or slow down the scrolling list, and hit space to pause and unpause.



Hopefully nobody who participated in the 1.0 release were forgotten from the list. The easter egg code is hidden in a sneaky way inspired by
some code obfuscation ideas by
Peter van der Linden. I highly recommend his Just Java book. I think he has a new edition that he was signing at JavaOne right after the Creator book signing.



Friday, September 24, 2004

Trip Report

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.


Okay this is not going to be a trip report, just thought I'd record some random
impressions from the week here in France.
We've been meeting various customers and component integrators. In Toulouse we
had an open demo of Creator and a number of people have blogged on it:
Here,
here
and
here.
(I'll blog some more on my discussion with Sylvain separately.)



It was a pretty wide-ranging demo; we showed data binding, writing a custom validator,
importing a web service, dynamic navigation, value binding, and more. A couple of things didn't work at first and required some
live debugging - luckily less pressure than
last time .
We had imported a live web service to obtain news headlines from the internet and
wanted to show it in a browser, but we were doing this from behind a firewall, and had
to get the event handler running in the app server to connect to the web service using
a proxy. In earlier versions of Rave this required inserting a code clip in the backing
file to initialize the proxy properties, so Octavian and I were searching all over for
the clip and even went to the App Server administration tool to find the settings - but
turns out it's no longer needed. When we simply imported the web service from the Add Web
Service dialog, we could check the checkbox to use a proxy, and from there it was all
automatic. Sigh. Luckily we discovered this while
Craig was answering a Struts question :)
The second failure happened when I had dropped a Formatted Label component on a page,
without realizing it. (Octavian had selected the label component when demonstrating the context
sensitive help). At runtime the page failed to deploy because that particular component
requires arguments to be set. Luckily again the problem became apparent when checking the
exceptions.



We hadn't planned the demo; we just winged each feature on the fly, so it wasn't as
canned as it should be -- but that's the point I just wanted to make -- demos like these
shouldn't really be canned; it's important to actually see real problems like this happening
in demos because tracking down bugs are a real part of a developers life.



I've done demos on other people laptops. Demoing on French keyboards is a pretty
interesting experience. I press "A" and a "Q" shows up on the screen etc. Takes a while
getting used to. Keyboards can be switched to English layout, which worked better, as long
as I didn't look at the keys!



Finally, I just thought I'd note that some initial notes for integrating JSF components
with Creator are

now available.


Monday, September 20, 2004

Better Elevator Scheduling!

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.





I had a really interesting experience in the hotel this week: I got in
the Elevator and there were no buttons anywhere to select my
destination floor! Turns out I just followed people into the elevator;
I shouldn't have done that.



The floor selector is OUTSIDE the elevator, on every floor. When you
get to the elevator entrance, press the floor you want to go to. It
then tells you which of the three elevator doors to use. You get in,
and the elevator will go to the desired floors.



My first reaction was that this was a really bad user design; I have
been trained to enter an elevator and look for the console to
make sure my floor's button is selected - so this was discomforting.



But on the second trip a little while later I realized that this is a
superior design! Provided of course people can get used to it - which
may take a while.



Why is it superior? Because it allows the elevator controller to schedule
the three elevators more optimally. That's because as soon as you arrive
to the console on your floor, you tell it EXACTLY where you want to go,
not just up or down. This extra information lets the elevator scheduler
make better decisions since it doesn't have to wait until you get into
the elevator to find out exactly where you want to go.



For example, let's say three different people arrive at the elevator
on the eight floor. If they all press the down button in a regular
elevator, one elevator will be dispatched to the eight floor. However,
in this new system, if the three people are going to different floors
and press say 1, 3 and 5, then all three elevators will be dispatched
to the eight floor. And so on. I've used the elevator for a couple of
days now and have totally gotten used to it and I definitely prefer
it.


Sunday, September 19, 2004

In France This Week

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.





I'm spending this week in Paris and Toulouse in France attending
various meetings with customers and potential customers for Creator.
We'll be doing various demos and listening to suggestions and
requirements for upcoming releases.



I was hoping to work on the plane from San Francisco, but couldn't;
I've finally discovered a disadvantage to my nice 17 inch Apple
laptop: I can't open the screen on a plane when the guy in
front of me reclines the seat as far back as it will go... And thanks
to
Murphy's Law
of course the person in front of me went to sleep a half hour
after the flight started and woke up a half hour before we
landed... I saw other people with small laptops happily work through
the night.... Grrrr.... On the other hand, I was able to read href="http://www.oreilly.com/catalog/jscript4/"> a book on JavaScript
so I did get something useful out of those hours.

And I
also did get to do some coding yesterday. After spending all morning in the
beautiful Versailles, I needed to rest my legs so I did some coding in
the hotel room. Rather than fix bugs I worked on a new feature. I wish
I could tell you all about it, but... it's top secret!


Monday, September 13, 2004

Hidden Creator Feature #2: DOM Inspector

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.

DOM inspector screenshot


Last week I told you how to get a selection
hiearchy display
in Studio Creator. This week I'll show you how to inspect the
rendered DOM for your web page. The feature is not very polished since
it's just something I added to help me debug rendering bugs in the CSS2
layout engine, not a product level feature, but it can be useful for others too. For example,
people working on JSF components get an easy way to view the HTML
rendered from a component.



Here's roughly how it works: you press some modifier keys, then click
on the design surface over the component you're interested in. The
closest CSS2 box will be selected (shown with a red border). Various
properties of that box are now shown in the property sheet. Now you
can press Esc repeatedly to select the parent box and the property
sheet is updated. Take a look at the screenshot fragment on the right. I have
a button inside a grid panel, and I've selected the <table> box in
the box hierarchy which corresponds to the grid panel component. The property
sheet is showing the html element and its attributes, the component name, the
rendered html (use the ... button to see it all; that's what's showing in the
(mostly clipped) dialog box on the left).



For all boxes you will see the current page position (x,y), the
size (width, height), the margins, the border width, etc.



You will also see the current CSS styles computed for the element.
This is somewhat helpful, except it has some limitations. I have
a better CSS inspector now that will find its way into the product some day...



One thing that's really useful for component authors (and was invaluable
for me in proving that a bug was in a component's renderer rather than
in the designer :-) is the ability to see the html rendered by a
component. When you get to a box that is the "top level box" for
a particular component, the "Rendered HTML" string for that component
is displayed. For example, if you drop a grid panel, with a button in it,
then DOM-select the button and hit Escape up to the <table> box
rendered by the grid panel, you'll see that the Grid Panel has this
"Rendered HTML" property value:


<?xml version="1.0" encoding="UTF-8"?>
<table id="form1:gridPanel1" style="left: 696px; top: 48px; position: absolute">
<tbody>
<tr>
<td>
<input id="form1:button1" name="form1:button1" type="submit" value="Submit"/>
</td>
</tr>
</tbody>
</table>
</p>



So now I just need to tell you what the modifier keys are. In Creator 1.0, up to patch 2, press control and shift, then click. Starting with patch 3 I had to move the feature to control-alt instead, because in patch 3 control-shift is assigned to a new designer feature that I'll blog about as soon as patch 3 goes out the door!



Usual warning: this is not a supported feature, don't file bugs, etc. etc. Use at your own risk.


Wednesday, September 8, 2004

First Day of School

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.



My daughter Tyra had her first day of school today. She liked it. She's going to an immersion school where her teacher and most of her classmates speak Spanish, so she will soon know more Spanish than I do - which is limited to roughly (and I apologize for the likely spelling mistakes) Hola, Como Estas, Bueno, Si, and Adios. Adios!


Tuesday, September 7, 2004

Hidden Creator Feature: Hierarchy Display

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.



There's a hidden feature in Creator's page designer which lets you view the
current selection "context"; it shows the series of parents for the
currently selected component, and you can click on any of these to
choose the parent. This is useful when you're in the middle of a
nested component tree, such as within a data table for example.



The screenshot should get across the point. Various other page design
tools offer a similar feature.



This is currently implemented by drawing a gray, semi transparent box
on top of the bottom of the page (such that the underlying page can be
seen through it), then writing out the component hierarchy, with the
current selection in bold. Once the selection is cleared the hiearchy
display is removed.



To check it out, run Creator with this flag:


-J-Ddesigner.paintSelHierarchy=1



Of course, this feature is not supported and may even reboot your
computer and cancel your life insurance policy. Perhaps I wasn't even
supposed to let you know about it, so let's keep this between the two of
us, okay?



This feature will become an official part of Creator one day, but people
didn't like it cluttering the design area so it will probably show up
in the tab area background instead.


Tuesday, August 31, 2004

PC Magazine gives Creator 4 out of 5 stars

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.


PC Magazine has published a positive a review of Creator, giving it 4 out of 5 stars.


Monday, August 30, 2004

Shipping Javadocs versus Extracting them

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.


The JDK ships with a "src.zip" file - the sources to the java classes. Yet getting the JDK javadocs requires a separate download - and the download is not small.



But of course the javadocs can be derived from the src.zip file, since the comments are all in the source. So part of the JDK installation should offer to extract the javadocs for you - by running the javadoc command on the src.zip file!!



Creator ships with a bundled JDK, but we don't bundle the javadocs. This should give us a simple solution to that, to improve the out-of-the-box experience.


Friday, August 27, 2004

Creator Patch 2 is available

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.


Go to the Update Center and grab it. There's a large number of fixes in it, many in my area (the designer) to for example handle multiple forms on a page, and better snap-to-grid behavior, as discussed in the forums. Plus we rewrote some of the deployment filecopy code to work around some issues on the Linux 2.6 kernel so Creator should work fine without workarounds there as well now.



Of course what you -really- want is patch 3 which will have not just bug fixes but address some usability issues in the designer and application outline.... but you'll have to be patient a little while longer :)


Monday, August 23, 2004

"Pictorial" created by user

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.


Somebody just posted a tutorial for creating a google-battle webapp using Creator. Well done and lots of screenshots. If anyone is aware of other "third-party" tutorials for Creator let me know. It's really fun to see people using the tool!



He called it a "pictorial". That's a pretty good name for tutorials with lots of pictures.


XHTML is not XML!!

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.


I was always under the impression that XHTML documents are XML documents - with HTML semantics for the tags. You know - must close all tags, tags must be nested, etc. But I recently discovered that that's not the case!



I had this weird bug in Creator that if you did "Preview In Browser" for the following document (not including html, body etc.), rather than have the browser show the text AFTER the text area, it showed up inside the text area!



<textarea/>Hello World


In particular, in XML you can use a minimized form, such that <foo></foo> can be written as <foo/> instead. But as it turns out, that's not always true in XHTML. In particular, some tags must always be minimized (such as br), and other tags can never be minimized - such as p, div, textarea, and friends. The definition of this is all written in one of the appendices to the xhtml spec.



In Creator we were using standard Xerces to parse and serialize the markup, but because of the above "feature" I can't do that anymore, since xerces will not correctly serialize tags as either minimized or not minimized based on the tag name. This was fixed in patch 1.



Of course, I'm still puzzled as to why Mozilla and other browsers choose to treat the fragment above such that the text shows up inside the textarea... perhaps this is some sort of quirks-mode handling which makes old html documents with errors show up correctly?


Tuesday, August 17, 2004

The Caps Lock key MUST DIE!!!

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.


Seriously. Who uses the caps-lock key?



Other than people composing Nigerian Scam (419) e-mails - you know the type, "DEAR SIR... CONFIDENTIAL BUSINESS PROPOSAL... typo typo typo."



I got used to Sun keyboards that put the control key in the location where capslock keys are found on PC keyboards. When I used Linux and Solaris x86 I was able to use xmodmap to remap the caps lock key to act as a control key - but of course anytime I try to use somebody else's computer, such as at an internet cafe when travelling, or worse yet, when doing a demo on fixed hardware somewhere - I keep hitting caps lock and getting myself into trouble. I don't use Windows often enough to justify searching for a program



On my mac powerbook I've found a program to remap the capslock key as well - but it doesn't always work. After suspend and at occasional random times, the key has memories of its previous life and decides to switch case rather than put Emacs into the right mood for the next keystroke.



So here's my question -- why do we give such a prominent position to a key that's probably not used? Or am I missing some big class of business users that say work in spreadsheets with the capslock mode turned on? Since people use the control key a lot (to do ctrl-c and ctrl-v to copy and paste for example), can't we put the control key up there on all keyboards? It's certainly a more comfortable position than where it currently sits.


Monday, August 16, 2004

First Post

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.

Hi. This is my first blog entry.


I work on the Sun Java Studio Creator product (formerly, and by the development team fondly) known as "Rave". (Well, when going public with it last spring we had to rename it "Project Rave" to avoid trademark issues.)



I'm responsible for the visual page designer, as well as the navigation editor.



On this page I plan to post Creator-related news and thoughts - as well as any other random things I want to say. Tune in if you're a Creator user, or if you haven't tried it yet, head over to www.sun.com/jscreator.