Friday, March 21, 2008

21 March

A day of using 6.1, mostly editing HTML files. No crashes, no problems. Doesn't seem much different than 6.0.

Thursday, March 20, 2008

integrating generated with existing HTML a.k.a. glomming

I copy the html from the 'show source' screen into a new HTML file in the Netbeans editor, so I can match up the span and /span and other tags. I like the way netbeans highlights matching tags in yellow.

I try various ways of dropping the generated HTML into the existing file. Widgets end up on top of each other. I fiddle with the pixel numbers a bit. Finally decide to give up on the span style absolute positioning, and just put everything in a table. I start to sketch out what goes where in my notebook, then realize it's easier to do that visually back in the Visual Editor. I add the buttons that were missing from the original prototype, get everything where it should go, then drag a table below it all onto the grid, hoping to set rows, columns, and drag everything into it.

The Visual Editor's Table Layout is kind of odd. I don't see an easy way to input number of rows, number of columns.

I look through the menus and finally see a Table Column widget next to the Table widget. By dragging the column widget into the table, I give it more columns. But it's hard to see how to make them all the same width, now that I've scrunched some over to make room for more.
And when I try to drag buttons into cells, they don't snap in. They just sit on top.

I go back to my text HTML file. One can drag stuff from the palette into the text, too. Here, dragging in a table works in a more convenient way. I drag it in, and immediately get a window asking me how many rows and columns & other stuff. Good.

trick to get the html

...went around and around on the FAQ's on the netbeans site, then it occurred to me:

If I use the browser preview button to see the stuff in a web page, then 'view source', will I see the HTML?

Answer: Yeah, pretty much.

Now I can copy & paste it into a new HTML file...

visual HTML editing

I dragged in a label, and a text box that appears to be a pulldown. I've got a button that I'd like to be square, and the size of the pulldown's height, but it needs to be sized to the grid, even though the height of the pulldown is 1-1/3 grid measures.
I'd like to make the grid smaller, for finer-grained size change choices. How do I change the grid?
Can I change the grid?

Copying a button only copies the label on a button. Not surprised, since when the guy in the film demo wanted 3 text fields, he selected them 3 times from the palette. It would be nice to be able to copy an object already sized and labeled in the IDE and then modify it.

I don't see how to add items to a dropdown list. I thought I was able to do it before with a listbox by clicking on items? but when I drag in a new listbox I can't do it with that either. I'll have to hard-code them in later.

I hope this is producing HTML I can edit.

I click "Preview in Browser". Nothing happens. IDE freezes. Then I get three tabs in my firefox browser with the preview. OK, so it just takes it a while. Fine.

There are two choices for page layout: Grid or Flow. I change from Grid to Flow to see if that makes resizing any easier. The grid disappears.

I try moving a listbox to be more aligned with a row of buttons. The listbox hops into the top left corner and won't be dragged out. Even though it's on top of two labels over there. I have a choice of all the way to the top-left, or most of the way in the top-left. It just won't be dragged any further out.

I switch back to Grid Layout and drag out the list box. There is simply no way to get its bottom edge to line up with the bottom edge of my row of buttons. Wait: the right click menu-choice: Align..bottom. It's not a choice when the object is highlighted. It is a choice when I'm just clicking on the page. I select it, try to move the list box. Its bottom still won't align with the grid line. Oh well. Another thing to do while editing the code later. At least this will create the objects for me & be a prototype.

All right, now I have the objects laid out. Where's the HTML page?
I click on Files, find Page1.jsp. Don't tell me this is all JSP.

Oh yes.

webuijsf:dropDown id="viewDropDown" items=\"#{Page1.viewDropDownDefaultOptions.options}\" label=\"View\" labelOnTop=\"true\" required=\"true\" style=\"left: 48px; top: 72px; position: absolute\" valueChangeListenerExpression=\"#{Page1.viewDropDown_processValueChange}\"/\>
Well, I can't say I'm that surprised. I did have to download all the Java Server Faces whatever to get the visual editor to work.

I show this to my boss.

He asks: Can this help in our development?
I reply: If I were doing this from scratch and wanted to do everything their way, with JSF, JSP, their methods, then sure. But we have existing code and HTML and servlets that we want to use, and we need to put our HTML into as small as possible files to handle the low-bandwidth users, so no.
He says: Go on the Forum and see if there's a way to turn this into HTML. Maybe someone has asked this already.

Thither I go.

"missing plugin" p.s.

From 6.1 Release Notes:

The Visual Web JSF Backwards Compatibility kit provides supplemental libraries that are required by the Visual Web designer to support projects that are based on J2SE 1.4 or J2EE 1.4. These libraries are not open source and are therefore distributed as a separate NetBeans plugin. The kit will install the following libraries that are required for J2EE 1.4 projects:
  • JavaServer Faces 1.1 Reference Implementation (RI)
  • Rowset Reference Implementation (RI)
  • JAX-RPC libraries from JWSDP 1.6

To get the Backwards Compatibilty Kit, in the main menu, choose Tools > Plugins.

--except I couldn't from 6.1. The tab was disabled. Is that the "known issue"?

It works in 6.1

In 6.1, I select Tomcat 6.0.16 and Java EE 5 and whoo-hoo! I get the grid.

I try it in 6.0 and no dice. Maybe I need to restart it?

Restart. Try once again...and...nope.

Well, OK. I can use it in 6.1. If 6.1 crashes or behaves in otherwise flaky beta ways, I know I can probably download the slightly later 6.0.1 that MJ downloaded a few days ago and use that. For now, let's continue in 6.1.

6.0 web jsf project

I get a Navigator window with Page1, & 3 beans.
I double click on Page1 and get HTML text.
There's a button that says "Design". I click on it, and get the Navigator window again.
I ask MJ. He has me repeat this all. He looks surprised when I don't get the grid window.

What's different:
He has Netbeans 6.0.1. I've tried 6.1 and 6.0, not 6.0.1.
He clicked on Tomcat 6.0.16 and Java EE5.
I'll try that now.

open IDE

Well, there's links to tutorials, what's new, etc, but nothing 6.1 vs. 6.0.
Theoretically, I could have got the visual HTML editor in 6.0.
I'm offered sample projects, so I'll open their servlet example and look for a visual HTML file.
Nope. I try clicking on icons, looking at menu choices.
OK. I'll create a new project, and hope to get the "Visual JSF" choice, like the guy in the video.

Under "New Project", "Web", "Visual JSF", there's a choice of existing projects. Which seems odd, since, didn't I select "New Project"? But, OK, I'll open an example. A "Single Page CRUD With Form".

Alert: "One or more projects use database connection that have not been registered. Right-click the project in the Projects window and choose "Resolve Data Source Problem"...

I tried, but get the error: "Unable to add connection... The connection was refused because the database travel was not found."

this is getting annoying. All I want is the stupid edit window. Which should be showing up automatically.
I think I'll ask MJ.

Oh wait. Trying New again. Found I'd been in Samples. I keep hitting next, get an option of Visual Web JavaServer Faces.
Red stuff saying some plugins are missing. "Backwards compatability." sound like something that was on the "known issues list" for 6.1.
I try to add them, don't see them.
I bring up Netbeans 6.0 to see if I can get the same visual JSF option there.

O.K. Same place in dialog, same missing plugin message. Can I install them from 6.0? Tabs were dimmed/disabled in 6.1.
Yep. I can install it from 6.0.
There is something insane about going through all this rigamarole for a plain visual HTML editor. I understand why MJ went back to FrontPage for his prototyping.

Installed. I'll try to open a new visual jsf web project in 6.0 again...


First decision:
Select application servers to install with the IDE:

GlassFish V2 UR1 and
Apache Tomcat 6.0.16

are both default selected. We're using Tomcat 5.5
Do I need either of these? Tomcat is already installed. Will the IDE not work correctly for Tomcat if I don't install its Tomcat?
MJ (the guy over the cubicle wall from me) said that when he tried it on Monday, the visual editor wouldn't work if both applications aren't selected, so I guess I'll leave them both checked. Installation Size 308.4 MB, 225 MB without GlassFish, 214.5 without either. Tempting to leave them unchecked, but, nah. Why not? keep em. I want visual editor ASAP.

Please read the following license agreement carefully:
Because it's a beta, I find myself actually reading it. I move to scroll through. There are bizarre things in it, such as references to Yoyodyne and Ty Coon, and the
You know, it would take the rest of the day and a lawyer to actually read it.
Is there a blog somewhere on license agreements?
"Bill Gates has rights to my firstborn son" I used to say while blindly clicking "Accept" on all those Microsoft licenses.

Yep, it picked a fine place on the disk to put the files.
Wow, it needs an administrator password etc for glassfish. I guess I should change the default.
I don't even know if I need the thing.
I guess I'll change the disk to "D", "C" is filling up.

Hmm. It doesn't ask for a password for Tomcat.
OK. Extracting now.
Kind of a delay at 78%. Glassfish again.
OK. Setup Complete.

why I'm downloading 6.1

Because I couldn't get the visual HTML editor in 6.0 to work. I tried downloading the plugins for JSF Visual and everything else that said Java Server Faces. I looked through the tutorials, which just implied that the visual editor pops up when you created a project. I created web projects, which generated a mass of files. But when I tried New File, HTML, I just got the plain text HTML editor. Though I could drag items from a pallet onto the text & have the text for the items show up. So rather than mess with my current set-up, I thought, why not 6.1?