|
|
|||||
Tim Boudreau's BlogCommunity: NetBeans ArchivesManila; Moderation done right; Breadcrumbs for NetBeansPosted by timboudreau on June 24, 2008 at 07:41 PM | Permalink | Comments (0)Here's three blogs in one (I know, I know, you're not supposed to do that): My friend Geertjan and I just did NetBeans Day Manila, in the Philippines, followed by two days of plugin-writing training at the University of the Philippines. The students were wonderful and bright and motivated and it's always a joy to teach to people who are really interested in what you have to say. There's a conversation going on on the mailing list for bloggers on this site - there's been a big issue with people posting comments that consist of 500 porn URLs and such. Back when we were little-bitty NetBeans-the-tiny-Czech-startup we had this solved on our mailing lists - 100% spam-free - a lot better than I can say for how things were after we joined Sun. The system was incredibly simple. My friend, and later, roommate for two years Karel Zatloukal, came up with this brilliant and blindingly obvious system - his becoming a manager was a huge loss to hackers everywhere. It's dead-simple:
majordomo hacked within an inch of its life, but the model is simple and easily repeated on any similar system. I feel like most moderation systems for mailing lists and blog posts are still stuck in the stone-age, and I've experienced vastly better almost ten years ago.
Lastly, at the booth in Manila last week, someone commented to me about a new "breadcrumb" feature in IDEA or Eclipse that they wished NetBeans had. I thought, gee, that would take about 20 minutes to implement, and set about doing it. Well, 20 minutes to get the rough draft. Another few hours to really make it useful. Geertjan already blogged about it (do a text search for "breadcrumb"). It's now available for NetBeans 6.0 and 6.1 on the plugin portal at this URL and should be available in the 6.0 and 6.1 built-in plugin managers soon.
Egads! An actual Swing Tree-Table!Posted by timboudreau on June 03, 2008 at 03:36 AM | Permalink | Comments (19)Four years ago, I went on a hunt for best practices for doing tree table components in Swing. We had a tree-table component in NetBeans, whose maintenance was my never-ending nightmare and the biggest source of bugs on my bug list. It had been written, with the best of intentions, based on Scott Violet's Swing Connection article about how to quickly hack up a tree-table component in Swing (Scott's article was also written with the best of intentions, and I have no intention to ding him here - what he wrote does work for simple use-cases - a debugger is not a simple use-case). When I canvassed folks who had done Swing tree-tables on our mailing lists, most of them were based on that article, as ours was. What I heard back varied between groans of pain and mad rabid howls of pain. There are a few things in that original tree table design that just don't work - not reliably, anyway. Sending events to an offscreen component as if it were on-screen and expecting it to behave sanely is just a really bad idea that happens to work if the look and feel is a subclass of BasicLookAndFeel, and other look and feel implementations have been tormented into supporting this abuse by all the evil Tree-Table implementations in the wild. But the bottom line is, a look-and-feel author would have to be slightly insane to code their TreeUI to behave as if it were a live component when it has no parent and obviously is not one. In other words, the fact that the JTree-as-cell-renderer design works at all is just an accident of how BasicLookAndFeel's TreeUI implementation was designed, which other look and feels inherited. Never mind trying to use said JTree as a cell renderer in a table (I once made a 400% performance improvement in our tired, tortured, hacked-up TreeTable just by having it translate the graphics context instead of repositioning - and thus causing a re-layout) is seriously abusing the component. Now try convincing said offscreen JTree that it has keyboard focus in order to get it to paint appropriately in its role as a cell renderer for another component. On all look and feels. On all platforms. Everywhere. You see what I mean. After doing that canvassing back in '04, it was obvious that Swing needed a real tree-table component. So I started to write one (and the layout cache classes JTree uses were very, very helpful - thanks, Scott!). I started on it, got the basics working, and then moved back to the U.S., changed jobs and ended up travelling the world full-time teaching other people to write NetBeans modules - but it didn't leave time to finish up the Tree Table work. Thankfully, my former office-mate, David Strupl, picked up where I left off when he left Sun to work on Nokia's NetBeans RCP app for managing cellular telephone networks. The really, really great news is: This week, Standa Aubrecht - who took over a bunch of the stuff when I left full-time development of NetBeans in '04 and amazed me with how quickly he was able to get going in a complex codebase - committed it into the main line of NetBeans sources yesterday. So anybody who gets a dev build of NetBeans as of today has a perfectly working Swing Tree Table component they can use (the class name is Outline - I borrowed the name from Apple's Cocoa library - it's a little less clunky than "tree table" but gets the point across). The JAR file is org.netbeans.swing.outline.jar. Usage is incredibly easy - you just provide a standard Swing TreeModel of whatever sort you like, and an additional RowModel that can be queried for the other columns contents, editability and so forth. And you never have to worry about cells painted half one color and half another because the tree-cell part got repainted after focus went to a popup menu. It actually works!
The real credit here goes to David and Standa for getting this thing production-worthy - I just was pissed-off enough at having a gargantuan list of unfixable bugs (well, fix it on one platform, break it on another, or leave it unfixed everywhere, or semi-fixed some places - pure evil if you hold the illusion that what we do is computer science) four years ago to get the ball rolling. They're the guys who delivered it.
I'm incredibly happy to see this finally be real and available not just to people writing NetBeans modules, but anybody doing GUI apps in Java. There has been a need for a real, reliable tree table component for Swing programmers for a long, long, long time. All hail David and Standa!
What technology evangelists really do for a livingPosted by timboudreau on April 11, 2008 at 08:21 AM | Permalink | Comments (1)We shot some video on our recent whirlwind tour of South America. This fun video shows one of our adventures. What do technology evangelists really do for a living? Ride in taxis and buses, of course! BTW, the video editing and post-production was done by my good friend and music buddy Doug Finn (douglas dot finn at gmail). He is a supremely talented video editor, actor, director and musician. If you're looking for something like this, I highly recommend him. A couple of other videos from this trip (less slickly edited, since it was me doing them not Doug) are visible at the bottom of this page on netbeans.tv. The person I really feel for in the above video is Juan Daniel Perez, whose reward for helping organize our event in Cordoba was that five guys piled into his hotel room at 6:30 in the morning to use his shower :-) See Java code the way javac sees itPosted by timboudreau on February 28, 2008 at 03:50 PM | Permalink | Comments (22)I wrote a small Swing app to browse javac's abstract syntax trees (ASTs) of source code. If you've ever wanted to write a tool that analyzes Java source code, it is a big help for understanding the Javac tree API. Last spring I set about learning javac's Tree API (JSR 199) - NetBeans uses it internally as its parser for Java source code. It has a bit of a learning curve, and contains lots of this-tree and that-tree interfaces for different types of structures in Java source code. So to help me develop an intuitive understanding of what all of these classes map to, I wrote a tool - a standalone Swing app that lets you open a Java source file and then browse its AST.
The tree on the left lets you drill through the syntax tree itself. The middle pane shows you the object that is selected, and a tree of all of its fields and methods via introspection, which you can drill as deeply as you want through. The right pane is sensitive to selection in whichever of the other two panes has focus. The top half shows you the list of all types the selected object implements (and boldfaces those that are part of the official API), and the bottom half shows you the value of toString() for the selected object (if it's part of the syntax tree, it will be the source code text).
I found it very useful, and still use it to figure out just how to hunt down a particular thing I want to find in source code. Hopefully it will inspire some others to play with javac as well. It requires JDK 6. You can download the JAR file here and just run it with java -jar.
contrib/SyntaxTreeNavigator (everything was reorganized for the recent migration to Mercurial, and I haven't figured out where it is in the new source structure yet).
I have updated the JAR file to produce better diagnostic information, and added a source zip file.
What if we built Java code with...Java?Posted by timboudreau on January 30, 2008 at 01:36 PM | Permalink | Comments (23)My friend Jon had an interesting insight: Both Ant and Maven rely on lots of XML. XML is good for describing data and terrible for describing behavior. A build is mostly behavior. What if, instead of tormenting Ant into iterating on a bunch of subprojects of subprojects, if we just used an actual programming language to write build scripts. Like, oh, say...Java, for instance? So he created the Gosling project. It's pretty embryonic - and I think some of the file and resource classes could be replaced by straight usage of things like javax.tools.FileObject, but it has a nice simplicity. Here's the constructor for Gosling's own build to build itself. It has a similar feel to what Jon did in designing Wicket's APIs:
public GoslingProject() {
final Folder root = new Folder("/Projects/gosling/workspace/gosling");
final Folder source = root.folder("src");
final Folder lib = root.folder("lib");
final Folder target = root.folder("target");
add(new JavaApplicationBuilder() {
@Override
protected Set
NetBeans Editor Demo videoPosted by timboudreau on December 21, 2007 at 04:24 PM | Permalink | Comments (1)Someone who attended my talk in Florianopolis, Brazil put this video on YouTube. The sound isn't great, but you do get to see some of the cool NetBeans 6 editor features. To the person who posted it - if you can send me a .wav file of the audio, I'd be happy to clean out the ambient noise and make the soundtrack much easier to understand - I was a sound engineer in a former life... The NetBeans South American Tour Wraps UpPosted by timboudreau on November 24, 2007 at 04:04 AM | Permalink | Comments (3)After 11 cities in three weeks, we finished up the NetBeans/OpenSolaris South American University Tour last week in Natal, Brazil. On Saturday, after our five hours of NetBeans talks, I was scheduled to do a talk at Natal Java Day, at 9:40AM. I awoke to blazing sunlight coming through the window of my hotel room. My mental clock that judges such things told me it looked like 9 or 10AM. Oh, crap, I thought - I slept through my talk! So I power up the laptop. It says it is 5:45AM. So I call the reception desk. Yes, it really is 5:45AM. Natal is in the tropics - quite close to the equator. Sunrise happens very fast, and it is full light very early. We spent Sunday cruising around the dunes of Natal in a dune buggy, with a driver who offered us the options of a tour with emotion, or a tour without emotion. We realized what with emotion means the first time we went down a near-vertical grade. There were various stops to zip down ropes at high speed into a lake and other such madness. Actually, I'd recommend this sort of tour (maybe with slightly less emotion when it comes to the driving) to anyone with kids - it's very kid-friendly. I'm taking some vacation now, which has given me time to work on one of my Friday-afternoon-projects, a persistence framework for Wicket that makes writing database-aware applications really trivial. I'll be contributing it to Wicket Stuff sometime in the next week or two - so a blog containing some actual Java code is coming, I promise :-) Meanwhile, some photos from our travels...
Cows on the beach - who knew?
A fisherman in Natal, Brazil
Street vendor in Natal, Brazil Can you find the computer programmers in this picture? Florianopolis, Brazil - one of my favorite places on earth! The NetBeans Latin American Tour - Starting Week ThreePosted by timboudreau on November 12, 2007 at 12:19 PM | Permalink | Comments (2)It's been a wild week of travel, to Buenos Aires and Cordoba, Argentina and now Santiago, Chile. We've had some adventures along the way. In Buenos Aires, 90% of the airline pilots were grounded for not having had sufficient vacation to comply with safety regulations. So our flight to Cordoba was cancelled. The next option was to take an overnight bus. So we went to do a little tourism shopping in the afternoon before the bus, and got back to pick up at our bags at the hotel and go the short distance to the bus station for our 6:30pm bus at 6pm (we had already bought tickets). Well, the thing we didn't know is that it is impossible to get a taxi in Buenos Aires in less than 20 minutes at 6pm on a work-day. So we end up hauling bags and boxes of cd's and backpacks several blocks, trying to find a more major street to get a cab - and I end up begging a busboy at a Sheraton hotel to help us get a taxi ahora to the airport, in extremely broken and forgotten Spanish. (Spanish is a challenge - after three years of Russian and five and a half years speaking Czech daily, actually constructing a sentence is nearly impossible - in Fortaleza, a security guard questioned what I was doing there, and I replied "Yo soy [spanish] paletrante [portuguese] na treti patro [czech]"). So we pile into a taxi at the Sheraton, but we need more than one taxi. And there is no other taxi. So Bruno and I go ahead to the bus station, leaving Mauricio and Tim Jacobson to find another taxi while we try to stall the bus. We succeed in delaying the bus, though it did not make us popular with the driver, and finally the guys arrive and off we go.
Wall of a cathedral in Cordoba, Argentina
Jack - one of Bruno's wonderful puppets, who loves OpenSolaris
Now this is art!
Not quite what it is advertised as...
But definitely an unusual sensation, as Bruno discovered The NetBeans South America Tour, week 1.5Posted by timboudreau on November 07, 2007 at 10:46 PM | Permalink | Comments (2)It has been a whirlwind trip so far in South America. Last week we did one city a day for four days - lots of arriving in airports at 3AM, sleeping for four hours and then presenting for five, then talking with JUG members and professors into the night, then getting on another plane. But it's been a blast. We've been shooting a lot of videos, so we should have some interesting stuff for netbeans.tv - though Bruno was cursing me this morning for shooting everything in HD - one hour of HD video is 500Gb+, so we now have about five terabytes of video to do...something...with. I think I'll be buying some hard drives... The turnout has been excellent in all of the cities we have visited, and we are having a lot of fun meeting local Java developers and users groups. Some of the highlights:
NetBeans: The Flan
Lunch in Montevideo (the fluffy looking things are cow lymph nodes)
I need more coffee if you want me to talk for five hours
Mauricio, Bruno and 1/10 of me, in the world's smallest taxi
Moqueca de Camaraoes - quite possibly the best food on earth
Trash collection in Montevideo NetBeans Goes to South America!Posted by timboudreau on October 30, 2007 at 03:14 AM | Permalink | Comments (12)We've begun the South American University Tour. This will be a break-neck schedule, whirlwind tour of universities in South America - covering 9 cities in Brazil, two in Argentina and one each in Uruguay and Chile. I drove the NetBeans Mobile to its destination last week, arrived in Massachusetts on Thursday; unloaded it all day Friday, and flew to Brazil on Saturday. A steady diet of vast quantities of barbecue (the death-by-meat approach to dining), tiny cups of super-sweet coffee and Guaraná soda is keeping me vertical. We began yesterday in São José do Rio Preto, with a crowd of 102 for five hours covering an intro to Java, Open Source and NetBeans. It's fun doing an intro-to-Java talk - a nice change from what I'm usually doing, and some of the students have some programming experience but not necessarily Java. So I get to go into the history of programming, languages, computer science, how programming languages have evolved, what Objects are, why there is equals() and hashCode(). Believe it or not, it's a fun topic.
Waiting at the airport I think I hit on a useful metaphor if you want to explain what multi-threading in programming is, to someone new to it: You get off an airplane. You are one thread of execution. The folks taking your bag off the plane and loading it on the conveyer belt are another thread of execution. Ideally they get done at the same time, and you walk up and your bag is there. Sometimes no; so the threading constructs in Java allow you to handle those cases.
I like teaching through metaphor - my grandfather had my wiring up circuits when I was four years old, and he used metaphor heavily: think of the electricity in the wire as water running through a pipe - current and voltage mapping to water pressure and how much water comes out - and a four year old can understand it (with a demonstration or two at the kitchen sink if needed). It's necessarily imprecise, but it gives people a handle to grab onto. So when I'm teaching or presenting, I really just try to channel my grandfather and ask myself how he would have explained things.
As I write this, we are getting ready to land in São Paulo, to connect and fly to Brasilia. The sheer expanse of São Paulo is astounding - I'm looking at tall buildings like twigs stretching out to the horizon. Alas in my high-speed moving and unpacking chaos, I forgot to pack my good camera - so I'll either borrow one, or go luddite and try to find a good used SLR.
We'll spend the afternoon doing the NetBeans road-show there, and then it's on to Fortaleza this evening. And I hope to learn a little Portuguese this time around - with a month in Brazil there is no excuse not to. My seven years of Spanish, 19 years neglected and buried under Russian and Czech ought to help a little if I can dredge it up!
Our schedule for the trip:
The view from the restaurant in Congonhas airport - doesn't really show the scale of the city, but can give an idea of what the buildings look like The Return of the NetBeansMobilePosted by timboudreau on October 23, 2007 at 12:15 PM | Permalink | Comments (1)Like a phoenix from the ashes, perhaps like NetBeans itself, the NetBeans Mobile is once again on the road - I just uploaded my first new photos of the white lines in the middle of the road :-) I owe a huge thanks to the folks at Jantz Auto in Kenosha, Wisconsin who put a new engine in it over the last month - and were kind enough to notice that the clutch was shot and that they had new-old parts for it, and so threw in a new clutch at no charge. She's running like a champ! Unfortunately I likely won't be able to do any stops along the way for this part of the trip - I need to make good time, get back to Massachusetts, drop the truck off (probably without time to unload it) and get on a plane for Brazil for a university tour we're doing there. But I haven't forgotten the folks from the Ann Arbor and Albany JUGs - Albany is easy, since I'll be living in Northampton, MA; and we'll figure something out for a visit to Ann Arbor down the road too. It's sunny and warm and a perfect day for driving, so, back to the road! The NetBeansMobile goes on HiatusPosted by timboudreau on September 14, 2007 at 09:08 AM | Permalink | Comments (1)With a blown engine in Kenosha, Wisconsin, the NetBeans Mobile is going for a bit of TLC for a few weeks, but will be back on the road in October. For the gory details, see the JavaLobby thread. The NetBeans Mobile is half way across the U.S.Posted by timboudreau on September 10, 2007 at 03:45 AM | Permalink | Comments (1)In Avoca, Iowa. Travelling is always an adventure, and this is no exception. I bought some Gatorade and nuts at the truck stop yesterday (the dinner of champions!). Two guys wearing turbans entered the store at about the time I brought my items to the counter. The woman selling me the things said, "You know it still scares me when I see people who look like that. And I'm not a racist person". I said "Well, I suppose we have the news to blame for that". I mean, what do you say? There are no racist people. There are people who have learned to fear something. That can happen through first-hand experience, or through the media, or through any variety of indoctrination. But the bottom line is, I can meet the person whose grandfather killed my grandfather, and I will never know that fact unless somebody told me it - and if they told me it, it was probably them looking out for their personal gain via what I might do because I knew that "fact". There are no age-old conflicts. There are no "These people have been fighting for 6000 years, it's unstoppable" conflicts. That's a lie. All of that is just manipulation - people turning easily available knobs on other people. This is basic: There are no 6000 year conflicts because there is nobody who has been alive for 6000 years. Period. These conflicts need to be refreshed and renewed with each generation, and the appalling thing is that there are people who have no reservations about doing that. Slobodan Milosevich exploded the Balkans into a war with the phrase "No one will beat you again." As a species, as a whole, we need to get more media-savvy fast. This stuff is not going to slow down. Human beings are a product of biology. We are vulnerable. The environment we were built for is not the one we are in. The essence of evil is exploiting those vulnerabilities for gain without regard for the multitude of consequences. Anyway, this is a longer and less focused blog than I'd planned writing. The NetBeans Mobile is doing well, and I'm looking forward to meeting the Java Users Group in Madison, Wisconsin on Tuesday, and the folks in Milwaukee on Wednesday. And I'm a little creeped out by people thinking I must be a skinhead. I'm just going bald in a big way and every other alternative I've seen looked pretty embarrassing. -Tim The NetBeansMobile updatePosted by timboudreau on August 31, 2007 at 11:03 AM | Permalink | Comments (0)An update on the NetBeansMobile: I expect to actually hit the road tomorrow or Sunday, depending on how much I get done between now and then. Kinko's didn't have the graphics ready on Wednesday, so I picked them up yesterday evening, and am about to try not to screw up sticking them on the vehicle. Wish me luck! Meanwhile, the NetBeansMobile is inspiring commentary:
The NetBeansMobile - coming to a city near you?Posted by timboudreau on August 29, 2007 at 04:34 AM | Permalink | Comments (17)I'm going to doing a road trip - part me moving to the east coast of the U.S., part NetBeans World Tour. So I'm loading up this truck with NetBeans books and t-shirts (along with my earthly posessions). And it will have a web cam and gps tracking installed, and will regularly upload photos out the windshield and its location to a web site... Yes, this is truly geeky... I'd love to get together with folks interested in NetBeans or Java in places I stop...it will be the northern route, I80 from San Francisco to Chicago, I90 from there. I'll be starting off on the trip Friday or Saturday...
Places I could use some help Generate a NetBeans module for your library or JavaBeans in one Ant taskPosted by timboudreau on February 07, 2007 at 10:52 PM | Permalink | Comments (10)A while back I wrote a tool called BeanNetter that would take any library JAR file and generate a NetBeans module that added the library to the list of libraries you can use from your projects (a handy way to bundle source and Javadoc all together so people can debug). It also would add any JavaBeans in the JAR to the Matisse (Swing GUI Designer) component palette. Well, it is now also an Ant task. So you can make it part of the build process for any library to also generate a NetBeans module.
This afternoon I got an email from Mikael Grev about the tool, and asking if there was an Ant task. I'd planned to do one but hadn't gotten around to it. This afternoon I finally did. It can still benefit from some prettification, but it's ready to try. You can download it here.
Easy way to use it: The first time, just run the GUI using For examples, the Quick Color Chooser and Wizard projects are now set up with build scripts to use the task. Here is the ColorChooser build script. Please try it - comments and feedback are most welcome! And many thanks to Mikael for the suggestion! For convenience, here is a sample target:
<target name="nbm" description="Generate a NetBeans Module"
depends="jar,release-javadoc">
<taskdef classpath="lib/beans2nbm.jar"
classname="beans2nbm.ant.GenNbmTask"
name="nbm"/>
<zip zipfile="dist/colorchooser-src.zip">
<fileset dir="src">
<exclude name="**/CVS"/>
</fileset>
</zip>
<nbm destFolder="dist"
destFileName="net-java-dev-colorchooser.nbm"
description="A color chooser"
version="1.1"
homepage="http://colorchooser.dev.java.net"
codeName="net.java.dev.colorchooser"
jarFileName="dist/colorchooser.jar"
author="Tim Boudreau"
displayName="Color Chooser"
license="CDDL"
docsJar="www/release/colorchooser-javadoc.zip"
sourceJar="dist/colorchooser-src.zip"
minJDK="1.4"/>
</target>
Mobile Bay, Mobile, Alabama
How to replace the selection model in the NetBeans PlatformPosted by timboudreau on January 23, 2007 at 12:48 AM | Permalink | Comments (1)NetBeans has a selection model where whatever logical window has focus owns the selection (determines what actions are enabled/disabled, what the property sheet shows, etc.). Some applications need something different - for example, an image editor probably wants the current image to own the selection no matter what logical window has focus. You can completely replace the selection management mechanism in the NetBeans platform, to accomodate any selection model you want. Here's how...
First, let's go over how NetBeans defines selection. The selection is a Lookup. That's basically a bag-o-stuff owned (by default) by whatever component has focus. So, an Let me back up a bit...a Lookup is like a Map, where the keys are Class objects and the value for any Class key is a Collection of zero or more instances of that class. A lot of lookup-like APIs use Strings for keys (think JNDI - when you realize that could have been done in a type-safe way and wasn't, it seems kind of grotesque and depressing, doesn't it? A Lookup may be a magic bag-o-stuff, but it's a type-safe magic bag-o-stuff - I want all the help the compiler can give me!); Lookup is nicer in that you have type-safety - if I call Map.get ("foo"), I have no idea what I will get back - the compiler cannot help me; if I call Lookup.lookup (MyObject.class), I know I'm getting back instances of MyObject.
For some applications, that's not what you want. I discovered this when working on the Imagine project - this is an image editor. There are palettes that display attributes of the image being edited. It would be very disconcerting if the component that shows all of the individual layers that make up the currently edited image suddenly disappeared when you clicked the tool palette to select a different tool - the image you are editing hasn't changed. I spent the last couple of days here in New Orleans working with some folks with a similar problem - they are building a CRM application on the NetBeans Platform, and the appropriate context for actions and palettes is the selected Customer - it doesn't matter which window has focus.
public final class Ctx implements ContextGlobalProvider {
private final InstanceContent content = new InstanceContent();
private final Lookup lkp = new AbstractLookup (content);
public Lookup getLookup() {
return lkp;
}
}
The next step is to actually put something in the empty lookup, whose content we control. So we add a method:
public void setContent (Collection c) {
ic.set (c, null);
}
Depending on what kind of contents you want the lookup to have, you might expose add, remove, or whatever methods you want. If, as in the CRM application, there is only one selected customer, you might do something like
public void setCustomer (Customer customer) {
Customer old = lkp.lookup (Customer.class);
if (((old == null) != (customer == null)) || (customer != null && !customer.equals(old))) {
ic.remove (old);
if (customer != null) {
ic.add (customer);
}
}
}
Now you have a guarantee that there is only either zero or one Customer objects selectable. You can always put addition objects of other types into the global selection - that's the whole point - you're in control. If a customer might have multiple addresses or names, you can put as many Address objects in there as you need - the UI that displays them just needs to be able to handle getting more than one.
Then you have the question of event model; in the case of the CRM app, there are a bunch of UI pieces that display the address, etc. of a customer. Different user roles will see different attributes. There are two ways to solve this: First is the Swing-like way, where you can add property change listeners to a Customer object, and the UI that cares about it can listen for changes. But this introduces boatloads of bookkeeping, because probably Address, etc. objects all ought to have listeners, and pretty soon you are drowning in potential memory leaks and objects listening to each other. Particularly in this case, where the Customer object arrived from a web service and its object-identity is determined by its database id.
So we can simply make the model more granular - object identity remains the same, but we need to update all UI's showing an attribute of a customer when it changes. Since we control the selection model, we can simply remove the current customer and re-add it. Slightly less efficient, but one line of code and a thousand trips through a heap-dump averted - just remove The point here isn't so much that the above is good or bad, but that if you're writing an application on the NetBeans Platform, you can create whatever selection model makes sense for your application.
The final step is to register the custom implementation of #-org.netbeans.modules.openide.windows.GlobalActionContextImpl net.java.dev.imagine.CtxThese lines do two things. The first is an extension to the spec, legally embedded in a comment - Lookup lets you delete an entry by putting its name in a comment line preceded by a minus sign. So the first line ensures that the default selection model provided by the NetBeans window system is removed. The following line, in accordance with the spec, registers our own selection model implementation - an implementation of ContextGlobalProvider, by listing its fully-qualified class name.
While all of this may take a moment to digest, the important fact is that the NetBeans Platform and window system are not married to the NetBeans IDE's notion of what is selection context - you can customize how selection works to your heart's content.
Poetic commit messagesPosted by timboudreau on October 26, 2006 at 09:48 PM | Permalink | Comments (3)Since I published my friend Jarda's "most poetic CVS commit message of the year" I seem to have become a collector. Jarda points out the poignant beauty of the following User: jglick NetBeans Workshop @ OOPSLA 06Posted by timboudreau on October 16, 2006 at 12:01 AM | Permalink | Comments (0)NetBeans architect Jarda Tulach, Rich Unger from Nuance and I will be doing a full day workshop on modular architecture and design, using the NetBeans module system and Platform next week at OOPSLA 2006 in Portland, Oregon. We hope to provide an interesting day of activity - bring interesting design problems! If you plan to attend Send email to Tim dot Boudreau at Sun dot Com if you can attend. More info is available on the OOPSLA web site. For a taste of some of the sorts of things we may touch on, have a look at Jarda's recent API Fest in Prague.
NetBeans Day Seattle - Tomorrow 1PMPosted by timboudreau on September 05, 2006 at 11:39 PM | Permalink | Comments (0)
NetBeans Day Seattle is tomorrow! You can register here. We've got a fun line up of speakers, including Craig McClanahan, father of JSF, Pavel Buzek, one of the guys who write Java EE support (we'll have some greate EJB 3 demos), and Angela Caicedo, who speaks publicly even more than I do. And of course, I'll be doing a couple of talks too.
When: Wednesday September 6, 2006
I will also be doing a talk on Monday, for SeaJUG members and anyone else who cares to show up, on the NetBeans Platform, NetBeans APIs. Pizza will be provided. Email Charles dot Ditzel at Sun dot Com to sign up - he is graciously organizing it.
It's good to be back in Seattle - it's one of my favorite cities! (no the picture above was not taken here :-))
"Fishbowl Debate" at NetBeans Day SeattlePosted by timboudreau on September 02, 2006 at 09:10 AM | Permalink | Comments (0)We've made some progress on the "unconference" hour at NetBeans Day Seattle - it's sure to be interesting. I'm still looking for theme/topic suggestions from people who plan to attend - please post them here (or wherever you want, but tell me about them). I was talking with friend and colleague Simon Phipps, who suggested the "fishbowl debate" format for it. How this works, more or less:
The idea is to have an group-driven discussion driven by people who really care about the topic. For the record, the topic will not be "why is NetBeans great" or something like that :-) One theme that seems worth pursuing is "What takes too much time when you're writing code"; I can think of others, but what's more important is that you think of the themes/topics - if you've got ideas for topics you really care about, feel free to suggest them below. Probably 3-4 themes will do the trick for a one-hour event, so we don't even need that many. What I'm most concerned about right now is making it a fun and interesting time for all. A really bare-bones platformPosted by timboudreau on August 13, 2006 at 09:32 AM | Permalink | Comments (4)My friend Jarda has a NetBeans-based application which uses only the NetBeans module system - i.e. you can use the NB module system to write server-side modular applications or whatever you want. It's a SourceForge project called DVB Central, which I believe he wrote for controlling his home video setup (signal comes into the computer and is routed to one of various destinations). It's a pretty cool example of just what you can do with the NetBeans platform. The crack-cocaine of coding for NetBeans is the module system - the fact that you can have public classes that are public only within their own JAR, so you can design really clean, well-separated APIs. And it comes with a Manifesto - what's not to love about that? We'll probably use DVBCentral as part of our workshop at OOPSLA 2006 in Portland, Oregon this October.
![]() This little fellow was crossing the sidewalk early the other morning when I interrupted him (her?) to pose for the camera NetBeans Modules for HTML AuthoringPosted by timboudreau on August 05, 2006 at 02:08 AM | Permalink | Comments (15)I write tutorials and articles quite a bit. NetBeans is an excellent editor for HTML, but there were a few things missing. So I wrote some modules to plug the gaps. If you have a development build of NetBeans, you can get any of these from the development build update center off the Tools menu. They are:
All of the above (click image for full size) Addendum: For users of 5.0 and 5.5, here are NBM files for the modules. Simply download them to some folder, open Tools | Update Center and choose Install Manually Downloaded Modules and select them all and continue through the wizard to install them.
Oh, the wonders of the tech press...Posted by timboudreau on May 18, 2006 at 02:47 AM | Permalink | Comments (11)I attended the JavaPro Magazine awards ceremony earlier this evening. It was possibly the most surreal moment I have ever experienced in the Java world... First, WebLogic won an award as the "best visual java component". Now, the only problem with that is, WebLogic isn't one. Then, Oracle JDeveloper won the "best mobile development toolkit". The only problem there is that Oracle actually has no mobile tools. I'm really not sure whether to laugh or cry. It would be nice if I could say something alarming like, "the foxes are guarding the chicken coop." But it's more like the turkeys are guarding the chicken coop. The next time you hear anything is "award winning," contemplate how astonishingly little that actually means.
Oh, and I'm running to be Miss America. Surely if we all band together and place a few ads, we'll be able to get past the gender issue. I'm taking contributions...and if I really, really have to I'll shave...
NetBeans' portability mattersPosted by timboudreau on January 19, 2006 at 08:13 AM | Permalink | Comments (0)In his blog today, Charles Lamb points out precisely one of the advantages of NetBeans over Eclipse - portability. With NetBeans, exactly the same bits run on any platform with a 1.4 or greater JVM - there's no native code to worry about. You can take the zip distribution, just unzip it on any machine with a modern JDK and there you go.
And more importantly, working with a J2EE project requires no configuration, no additional downloads - it just works out of the box, which Charles also points out.
I thought I'd never see the day...Posted by timboudreau on January 17, 2006 at 10:56 AM | Permalink | Comments (0)When an analyst says that Microsoft and IBM are following Sun/NetBeans in tools. Yet James Governor of RedMonk does just that in his blog today.
What a lovely thing to read over my first cup of coffee on a Tuesday (de-facto Monday - yesterday was a holiday in the U.S.) morning. It's going to be a good week :-)
NetBeans in BudapestPosted by timboudreau on October 20, 2005 at 05:56 AM | Permalink | Comments (0)(Yes, buried in here is a link to a new cool NetBeans tutorial...)
Budapest is lovely... It was my first time in Budapest since backpacking through there in the summer of 1998, and I was back to do a presentation at a Java developer event - along with Martin "the mobility guy" Ryzl, and Petr Jiricka, Mr. Web Tools who drove down from Prague to talk.
![]() Martin Ryzl demos Mobility in Budapest Martin is an interesting guy - in 1999, we (NetBeans the tiny Czech company) had just been acquired by Sun, and he'd written this really cool plugin for KJava. We were in New York for the long defunct Java Business Expo conference - it was my first time back in the U.S. after moving to Prague. So, this KJava module was an amazing thing to demo - write some code, press F9 and it deploys to your Palm Pilot, and there's your code. There was just one hitch: He had written it on his own time, and we weren't supposed to be demoing it. So we had to demo it only when his management wasn't around so he wouldn't get in trouble. Eventually it was clear nobody was going to stop Martin from writing mobile development tools on NetBeans (I'm not sure why anyone ever wanted to stop him), and so the Mobility pack was born. Today Martin manages the mobility development team (a sad loss to development, but he's a good guy to work with).
![]() Austin Powers, ahem, Jirka Prazak (foreground, center) and Martin hijacked a table to do demos during lunch Petr Jiricka did his talk about Web and J2EE support in NetBeans, including demoing the new Struts support in 5.0. It's pretty amazing stuff. Makes me almost want to do server-side development, which I haven't done in years (as long as I can do it as NetBeans plugins...hmm, now there's a neat tutorial idea...).
Petr Jiricka likes cake Anyway, I said something about a new tutorial, and I'm spewing trivia. On Wednesday, post-plane-flight-from-California, I wrote a pretty cool app based on NetBeans to demo the next day at the event in Budapest. The coolest thing is that it really looks and feels like its own application - and it took an hour to write. It's a cute little paint program. So having nothing to do on Friday but catch up on email, I spent the day turning it into a tutorial. The draft version is online here. Reviews and feedback appreciated - I hope to write up several more in the next couple of months. In that vein, I spent the 26 hour train ride from Budapest to Grenoble, France, turning the app from that tutorial into a slightly-insanely decoupled demo. So, coming soon: Photoshop in Netbeans. The painting window is a plugin. The tools palette is a plugin. The layers window is a plugin. The brushes are plugins. The color fills are plugins. All any of them know about each other is a single, small, shared API module. Be very scared... Here in Grenoble, I'm working with Sun's Real Time Java team on tools for that. There are some truly fascinating problems in this space - difficult, challenging, fun to have. And a great bunch of extremely smart guys working on them.
Would you trust these guys with your JVM? Grenoble is also, as always, lovely.
Follow-mode for NetBeans?Posted by timboudreau on September 20, 2005 at 12:51 PM | Permalink | Comments (4)I've been playing with creating "follow-mode" for NetBeans - essentially the ability to have a multi-column editor, emacs-style. Is that a thing anybody wants? I've written some (admittedly crude) patches that do the very basics; doing it right would be considerably more work (lots of little things like making sure you can't have two selections, eliminating duplicated decorations, etc.).
Somebody asked for a screen shot of the usages tree view - that's it on the left (sorry about the resolution, I haven't got anything decent for picture editing for windows on my laptop).
And another new NetBeans plug-in...Posted by timboudreau on September 20, 2005 at 01:44 AM | Permalink | Comments (5)A few people have mentioned that they would like to see better support for managing import statements in NetBeans. Having the flu gave me plenty of time to code this weekend...so, here is a module that does that. There are some bells and whistles still to be added - like using wildcard imports if the number of imports from a single package exceeds some threshold number. But still, right now it should do what a lot of people have been asking for:
Probably eventually this functionality should be merged with Fix Imports in NetBeans, but I figured I could make some people happy by writing a small module that does that now.
Sate yourself with pleasure...read the NetBeans developer FAQ...Posted by timboudreau on September 17, 2005 at 11:30 AM | Permalink | Comments (2)Okay, the first half of that title is from a package of cashews I bought in a supermarket in Beijing. I had dinner in a restaurant the other night, where, on the menu was a dish called "The Tile Pot Loves the Fatty Intestine" (I'm afraid I didn't order it). Nothing like a good mistranslation. As I mentioned above, I've been feverishly growing the NetBeans Developer FAQ for plugin authors - have a look, edit, delete, whack away - it's a Wiki. In the meantime, I can thank Judith Lillienfeld for finding these wonderful cashews with even more wonderful packaging in the supermarket here:
I'm not sure which I love more, the slogan
or the ominous yet pleasing sounding warning
Everybody, be on the lookout for the tasty. Alas, I'll be sauntering back to California soon.
More Navigator fixes, the road from St. Petersburg to BeijingPosted by timboudreau on September 12, 2005 at 09:29 AM | Permalink | Comments (4)St. Petersburg is a beautiful city! Other than the nightly battles with mosquitos in my hotel room, the trip was excellent. I spent a week meeting with engineers who are working on NetBeans plugins, and finally got to meet a lot of people I'd conversed with via email. We've got a great group of folks there.
Nevsky Prospect in St. Petersburg at sunset Saturday, my friend Martin Ryzl, the original author of, and current manager of the development team for the NetBeans Mobility Pack and I flew from St. Petersburg to Beijing. It was the first trip for both of us to both cities. Particularly interesting was when the plane did a 180 degree turn in the middle of the runway (there are three sets of wheels, two under the wings and one in the middle - reverse the directions of the wing sets and pivot) - it was a disconcerting moment when we suddenly seemed to be executing an impossibly tight turn on the runway for our stop in Novosibirsk. For the Novosibirsk to Beijing leg, I bug-fixed and growled and cursed at my laptop, while Martin glowingly showed me one after another another cool thing his guys had implemented in Mobility, that he hadn't had a chance to try before, but could include in his demo - for example, a stack trace from KVM only gives you a bytecode offset; NetBeans will now reverse engineer a real stack trace for you by reading the class file. You can now edit guarded blocks in the editor. Mobility just keeps getting cooler.
Martin Ryzl in the cavernous hall of Sun's temporary digs in St. Petersburg The plane flight was productive. In a recent blog I listed some interesting line switches that affect the behavior of the Navigator component in NetBeans. A couple people pointed out that some of them were no longer working in NetBeans 5.0. Plane flights are a great time to get things working, so now they all are. A quick recap (with some new ones):
./netbeans -J-Dsome.line.switch=trueBeijing is fascinating. We did a full on NetBeans Day, in preparation for JavaChina tomorrow. It was very well attended and a lot of fun - Gregg Sporar did a nice write up of it. People who know me know I have a perverse love of non sequiturs and mistranslations - even to the point of writing software that generates its very own non-sequiturs (almost a decade ago, but it still works...as well as it ever did). While my all time favorites come from an English menu in Warsaw, fascinating sayings in English abound. The following can hardly be called a mistranslation - this ATM machine is perfectly succinct and to-the-point:
Led Zeppelin meets ATM - who knew?
The food here has been fascinating and wonderful - particularly something called "Chrysanthemum water with honey" was wonderfully refreshing after a dehydrating international flight. I have no idea what these folks do, but it sounds interesting: NetBeans tweaks you've probably never heard ofPosted by timboudreau on August 08, 2005 at 02:11 PM | Permalink | Comments (11)In its rich history, NetBeans has grown various command-line options that affect how some things work or look. Some are for screen-real-estate freaks who want to minimize the size of everything but the editor; some turn on features that are off by default for one reason or another. Just for fun, the other day I patched Boolean.getBoolean() to find out just what was actually still in use (now, how many people do that for fun?). As with anything undocumented and unsupported, caveat emptor - nothing is guaranteed to work or keep working in the future. But here are some useful ones. First, how to use them:
Here we go. Unless otherwise noted, all of these are boolean, and most are defaulted to false - so you want to specify Settings for Screen Real Estate Fanatics
Settings that affect the Navigator component Some of these are features that I wrote into the original navigator module which are disabled either for performance or aesthetic reasons. The highlighting stuff
And, one switch you definitely won't want to use in daily, but which is briefly amusing:
Remember, caveat emptor. Enjoy...
When engineers (sort-of) read licenses - a cautionary talePosted by timboudreau on July 29, 2005 at 12:54 AM | Permalink | Comments (17)My week began with a licensing debate. While those tend to be endless, this one, I hope, can be finite. It started when Elliotte Rusty Harold wrote in his blog the following:
...the download requires me to accept a non-open-source license that severely restricts what I'm allowed to do. I've heard Sun claim that Netbeans is open source, but that doesn't seem to be true. So I went to the NetBeans download page, to see what he was talking about. And took a look at the license, and said to myself..."Whoa...this is a major screw-up!" Here was, indeed, this rather scary legal text. It didn't look like an open source license to me either. But it's what you agree to when you download NetBeans builds. Did I scroll down and go through the whole thing with a fine toothed comb? Nope. Neither did anybody else - that's the cautionary part of this tale. The license text he's referring to is this. It's actually the same text you agree to when you download the JDK. And indeed, it doesn't look anything like an open source license. And I wrote to Elliotte, to mention that,
The license agreement is a bit of legal boilerplate. It is the result of a bunch of folks like me complaining that everything you download from Sun had its own unique, slightly different license agreement, and why couldn't we just have a generic agreement for most things and simplify everything. It worked. It got simplified. And it actually was done correctly, as you'll see below. But the document is written so perfectly backwards for an open source site that it's almost impossible to tell that. It definitely means I should be careful what I wish for. Correct doesn't necessarily mean human-readable. In the meantime, Weiqi Gao picked up on what Elliotte had written, and repeated it, but his blog restated it as fact, saying flatly that NetBeans isn't open source. And that's the danger of this sort of thing - misinformation spreads, and nobody necessarily goes back and checks it. And we were all, myself included, not reading the whole thing. It just smelled bad, and we all said, "Yup, smells bad." But the license text doesn't look like an open source license at all. In fact it isn't one. How in the world could that be kosher? I asked our legal folks about it, and they replied, in essence, "What's wrong with it? The license specifically mentions what it covers." How could a lawyer think that it's perfectly clear that this agreement only applies to the libraries that are linked to by NetBeans, and I and everyone else would see something completely different? I put on my thinking cap, and tried to think like a lawyer for a minute. It hurt like hell and I took my thinking cap off. The answer is really an impedance mismatch in the kind of reasoning an engineer uses when he or she says "Let's see how this software is licensed," and the reasoning of a lawyer thinking about a legal agreement. If you're a lawyer, you look for the holes first. So I went back and really read it this time. For the missing piece of the puzzle, you have to scroll way down to section 6, which says:
Sun supports and benefits from the global community of open source developers, and thanks the community for its important contributions and open standards-based technology, which Sun has adopted into many of its products. So, here it is in a nutshell: When you download NetBeans, you click through a license. That license says "This license covers everything except the parts that are covered by open source licenses." Which, in this case, happens to be...all of NetBeans. For a lawyer, it is perfectly clear because it says it doesn't supercede the open source stuff - how could anyone read it and not figure that out? For an engineer downloading software, the first thing you look for isn't what the license says it doesn't cover - and probably nobody expects a license agreement to say "This agreement doesn't apply to a bunch of stuff, and by the way, one of the things it doesn't apply to is the product you're downloading." The agreement is, as I mentioned, boilerplate. It was created for closed-source software that uses open source components. It applies equally well to both, but I can't blame anyone for misunderstanding it - I did. And it's totally non-intuitive to find that on an open-source project's download page. To be fair, I'm not saying that Elliotte is now perfectly happy about the agreement - we exchanged some emails, and it's clear he doesn't really like the agreement as it applies to Java either. At the same time, one of the things he objects to is the indemnity clause (4e) - we exchanged some emails about that, and do you know what? Neither of us noticed that that section is about redistributing libraries that are part of Java (i.e. the JDK, or JavaHelp, for example). So we were both talking nonsense to each other. Also to be fair, there are people who will object to the very fact that NetBeans links to libraries that are not open source, even though they are all either parts of the JDK or Java standards like JavaHelp or JMI - even though they are under the same license as Java itself. So let this be a cautionary tale about what happens when engineers read - or especially, skim - legal agreements. I had a lengthy, and ultimately useless (my fault) conversation about the indemnity clause, because neither of us had noticed that it doesn't apply to NetBeans users. The rumor could have taken on a life of its own and done quite a bit of harm (and nobody here was trying to do harm) - it was already repeated once. It wouldn't have been true, but that doesn't matter with rumors. Richard Feynman once wrote about his experience reviewing science textbooks for the state of California in the 50s. It turned out that the book the group gave the highest marks to consisted entirely of blank pages. The publisher couldn't get it done on time, but the law required they submit a book by the deadline. And the reviewers gave it high marks because nobody had actually opened it. It's incredibly easy for debates to get wildly off the mark, especially when they involve texts that a lot of people don't enjoy reading anyway - like (unfortunately) a science textbook...or a software license.
Anyway, there's a happy ending here: I don't like that legal agreement either. There's no click through license
on other open source projects when I download them. Why
should NetBeans have to have one? Well, we get our wish. The click through license on the download page will be deleted. Let me repeat that, loudly:
For those who downloaded NetBeans, there's no need to delete it or download it again - as I hope I've made clear, your copy of NetBeans is covered under the SPL - it always was. But I'm very happy to see this confusing and unnecessary piece of legalese go. So, thank you, Elliott and Weiqi, for helping to make that happen.
Now perhaps I'll get to spend some time coding.
| |||||
|
|