Small MultiView Editor Experiment (Part 2)

The sample for developers creating multiview editors on the NetBeans Platform (described yesterday in this blog) is now slightly more extensive, since you can add new nodes in the visual view, which will then automatically be added to the source editor (as well as the visual editor, of course):

The sample is available in the Plugin Portal and will work if you are using NetBeans IDE 6.9 Beta:

You will then, once you have installed the NBM, have a new sample in the New Project dialog:

Here's the source code you'll then have:

Run the above module, open a file with ".abc" as an extension (since the sample extends the File Type Integration Tutorial, which creates basic support for ".abc" files), and you'll have the multiview editor described here, which you can use as a starting point for your own multiview editors.


This is awesome and useful and all that, but an example that would far more useful to a lot of folks would be using the multiview editor with the crud application tutorial -- lots of peoples data objects are not backed by files and that integration is not entirely clear...

Posted by Liam Coughlin on May 04, 2010 at 12:18 AM PDT #

So what would the multiview editor do in the context of the crud application tutorial??? Without a file to back it, the multiview editor doesn't make sense, in my humble opinion, because that's the point of a multiview editor -- it provides multiple views on to do the same thing. If that thing isn't a file, what is it?

Posted by Geertjan Wielenga on May 04, 2010 at 02:25 PM PDT #

It's several things:
1) an XML document in a table structure backed by a clob.
2) A composite object built from the data structure
3) the results of a web-service call ( which could be either of the above ).
4) abstract data stored in a content repository.

Basically, your data can and will come from anywhere.

Posted by Liam Coughlin on May 05, 2010 at 08:14 PM PDT #

MultiView component is meant to display multiple views on top of a single file. Specifically, a file. Not data in some other form.

Posted by Geertjan on May 05, 2010 at 09:05 PM PDT #

Why is that the case that it's "Specifically, a file. Not data in some other form."

It would seem to me it's a way to have multiple views to a single model -- why does it matter what backs the model?

Posted by liam coughlin on May 10, 2010 at 07:04 PM PDT #

Nice example. Can you add comments to its source?

Posted by Eduardo Costa on May 30, 2010 at 08:04 AM PDT #

I found two bugs (using NB 6.9):
1. When we open an ABC file, TC's title starts empty. I solved by calling "setDisplayName(file.getNameExt)" after invoking MultiViewFactory on DataEditorSupport.createPane
2. Opened ABC windows aren't persisted when NB closes and raises exceptions when cloning. All MultiviewDescriptions must be serializable to make this work.

Posted by Eduardo Costa on June 10, 2010 at 02:08 AM PDT #

Awesome example ! Thank you !

I have a question, is it possible to get the content of the editor in an other window ?

Tank you

Posted by guest on June 19, 2011 at 11:57 PM PDT #

For anyone looking for the answer to Liam's question (MultiView editors backed by something other than a file):

Referenced by Geertjan in this post:

Posted by Galen Stevens on January 29, 2013 at 11:50 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016