blob: 1afef978550efe7047332b5301814cb9c4999af5 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- -*- xhtml -*- -->
<title>Meet a NetBeans Module Writer: Emilian Bold</title>
<link rel="stylesheet" type="text/css" href="https://netbeans.org/netbeans.css">
<meta name="AUDIENCE" content="NBUSER">
<meta name="TYPE" content="ARTICLE">
<meta name="EXPIRES" content="N">
<meta name="AUTHOR" content="Geertjan Wielenga">
<meta name="developer" content="gwielenga@netbeans.org">
<meta name="indexed" content="y">
<meta name="description"
content="">
<!-- Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. -->
<!-- Use is subject to license terms.-->
</head>
<body>
<h1>Meet a NetBeans Module Writer: Emilian Bold</h1>
<p><small><a href="mailto:nbdocs_feedback@usersguide.netbeans.org?subject=Feedback:%20Meet%20A%20NetBeans%20Module%20Writer:%20Emilian">Feedback</a></small></p>
<table width="210" border="1" cellspacing="0" cellpadding="5" align="right" class="ltblue">
<tbody>
<tr>
<td align="center"><img align="center" src="nbm_interviews/emilian/emilian.png" alt="Emilian's picture">
<br><b>Emilian Bold</b></td>
</tr>
<tr>
<td>Emilian's Hot Links:
<ul>
<li><a href="http://emilian-bold.blogspot.com/">EBJb: Emilian Bold Java blog</a>
<li><a href="http://web.info.uvt.ro/~fierarul/typo3/">My Homepage</a>
</ul>
</tr>
</tbody>
</table>
<p>Emilian Bold from Romania has been using NetBeans IDE and
the NetBeans Platform for many years. Recently he ported a
Swing application to the NetBeans Platform. Here, he shares
his general experiences with NetBeans, as well as some
pleasant discoveries made while porting his application. He
also talks about <a href="https://netbeans.org/download/dev/javadoc/">
NetBeans Javadoc</a> and how useful he has found it while
using the NetBeans APIs.</p>
<p><h3>Emilian... where in the world are you and what do you
do there?</h3>
<p>Hi! I live in Timisoara, Romania. (Click <a href="http://maps.google.com/maps?f=q&hl=en&q=timisoara,+romania&ie=UTF8&ll=45.756385,21.211681&spn=0.013145,0.043259&t=h&om=1">here</a>
for directions!) I work fulltime
as a Java programmer for Alcatel Timisoara and
I freelance once in a while.
<p><h3>Are you active in the Java community there?</h3>
<p>Sadly, there is no vibrant Java community in Timisoara.
There are lots of people programming in Java, to my knowledge,
both Java ME and Java EE, but we don't have anything formal,
like a Java User Group (JUG).
<p>I've talked to some people that have been planning to start a
JUG (more on the Java EE side) but I don't think it is wise to
make an estimate of when that will happen right now. It will
probably happen in the next year, with some investment from a
startup.
<p><h3>How did you first get acquainted with NetBeans IDE?</h3>
<p>It's actually quite a funny story. Initially I had a really
lousy PC and, because I had learned Java from some certification
books I found at our university's library, I used Notepad with
<tt>javac</tt> and after that <tt>JCreator</tt> for a
while.
<p>I later managed to get a "smuggled" copy of NetBeans on a CD
from some older guys working in a small startup. It was amazing.
I had no idea what "Bean Patterns" did but it was very nice...
and very slow on my PC. This is how I found out about the modular
structure of NetBeans, the fact that you can disable modules to
free some RAM, and thus I learned about the NetBeans Platform.
<p><h3>And what about the NetBeans Platform? How did you get
started with that and why?</h3>
<p>Initially the NetBeans Platform represented, to me, the core of NetBeans
that allowed me to "disable" the other memory hungry modules...
<p>However, since it was open-sourced, I started reading about it
and got to the Javadoc files. Those files are the lesser known
hidden gems in the docs! As a trainee, I started printing the
Javadoc HTML files one by one for each API... Nodes... Actions...
etc... For example, these ones are good:
<p><ul>
<li><a href="https://netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html">Modules API</a>
<li><a href="https://netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html">Utilities API</a>
<li><a href="https://netbeans.org/download/dev/javadoc/org-openide-nodes/org/openide/nodes/doc-files/api.html">Nodes API</a>
<li><a href="https://netbeans.org/download/dev/javadoc/org-openide-windows/org/openide/windows/doc-files/api.html ">Window System API</a>
</ul>
<p>I like the idea of having everything pluggable, with
dependecies among modules and integrated into a single tool.
<p>My first project was a report generator on top of the
Platform, the 3.6 release. After that, I skipped the 4.x release
and then returned with NetBeans 5.0. There is a huge difference
between the two. 5.0, and above, is much more friendly towards
module developers. It took me days years ago to do and learn
something that is automatically generated now with a simple wizard.
<p><h3>What are some of the things you've done with the
NetBeans Platform?</h3>
<p>One thing I did was... port a Swing application to the
NetBeans Platform! It is an image processing application.
Here is a screenshot of the ported application on the
NetBeans Platform:
<p><img border="1" align="center" src="nbm_interviews/emilian/gimage.png" alt="gimage">
<p><h3>What's the story behind this application?</h3>
<p>Well, during my re-introduction to 5.0, I needed a simple project
to play with. So I took a project I did with my
fellow student Mihaela Gander during
my university studies. Together, we had built an image processing
application. Now, to reacquaint myself with the NetBeans Platform,
I tried to port it over to the NetBeans Platform.
<p>It's not actually finished yet, since I want to give it to my
students to be enhanced further when school starts at the
university in October. I'll teach a class or two there, about Java,
and hopefully pitch the NetBeans Platform.
<div style="float: right;"><img src="nbm_interviews/emilian/quote2.png" alt="quote 2"></div>
<p>By the way, the fact that the
NetBeans Platform is modular makes it excellent
for this kind of job&#8212;each student or pair may do their
own module and at the end you get a full application with lots
of independent modules for different image operations.
<p><h3>How was it to port the application to the NetBeans Platform?</h3>
<p>Well, the porting was quite easy&#8212;I had
a JDesktop with some
JInternalFrames and I already had a home-made way of defining
actions with their own place in the menu etc, which is
a "poor man's platform", so to speak. So all I had to do was
convert JInternalFrame to TopComponent
and then use the NetBeans IDE wizards for the Actions.
<p>I took the easy way with a CallableSystemAction since there
are only two kinds of TopComponents&#8212;image or
histogram&#8212;but I would like to replace them with proper
CookieActions.
<p>Other than that, since it was pure Swing, nothing had to be
altered. I'm now using the <tt>META-INF/services</tt> to allow
outside modules to implement new operations and then rely on
the Lookup.
<p>Hopefully it will become a good teaching tool&#8212;with the
new scripting engines in JDK 6, students could make small scripts
to test the newly learned filters, etc. The scripting part is
not implemented yet, hopefully it will be done by October.
<p>And the new full screen mode really comes in handy for images!
<p><h3>Have you done anything else with the NetBeans Platform?</h3>
<p>The current project I'm slowly working on is a mind mapping
application, using the great <a href="http://graph.netbeans.org/">
NetBeans Visual Library</a>. Here's what the application looks
like right now:
<p><img border="1" align="center" src="nbm_interviews/emilian/eMind.png" alt="emind">
<p><h3>What is mind mapping and how does it relate to this
application?</h3>
<p>Mind mapping is just a simple way to present ideas by using
links between notions or words, using different colors, icons,
node sizes and shapes (go
<a href="http://en.wikipedia.org/wiki/Mind_mapping">here</a> for
details).
<p>Basically, I'm planning to heavily use the
<a href="http://graph.netbeans.org/">NetBeans Visual Library</a>,
but currently David Kaspar, the NetBeans engineer responsible for this
library, is still working on it, especially
the Javadoc side. So, I'm just going to wait a little. My code
uses pieces from the examples, so there isn't much worthy or
actually not that much that is mine or original. I use pieces
from the examples while waiting for some
docs or tutorial to learn more about how I can customize
the display of the nodes or links, to make them look better.
<p><h3>What do you enjoy about using the NetBeans Platform?</h3>
<p>I enjoy the fact that everything is already
made&#8212;menu items that enable/disable, toolbar buttons,
modules that can be updated from the web. For me, once a
desktop application gets an (auto)update
feature, it's in a whole other segment.
<div style="float: right;"><img src="nbm_interviews/emilian/quote3.png" alt="quote 3"></div>
<p>There is so much useful code there that it would have
taken ages to write it yourself. Of course, that also means
learning the APIs...
<p>By the way, I'm also a fan of dismantling
NetBeans! Lots of good code there, with no need
to be tied to a
particular platform or framework. For example,
I've extracted the Progress API to a standalone version and
open sourced it at <a href="http://progress-api.dev.java.net">progress-api.dev.java.net</a>.
I'm also glad someone extracted the
Window system. Something else: <tt>org-openide-util.jar</tt>
is also great with the Lookup in standalone applications.</p>
<p><h3>What are some of the problems you encountered while working
with NetBeans IDE or the NetBeans Platform?</h3>
<p>On the IDE side, I struggled a lot initially with my weak
PC and the fact that NetBeans was quite heavy for the RAM.
This looks like peanuts now, with 2GB RAM on my laptop,
but for lesser PCs, it's tough. Thinking back now, I think it
was wise not to dumb-down the IDE just the make it faster. The
feature list is impressive and the design
excellent, so some CPU cycles don't matter, in retrospect.
<p>On the NetBeans Platform side, 3.6 was quite hard to program even if
there was a freely-downloadable book written with 3.5 in mind. Of
course, that 3.6 made most of the examples unusable.
<p><h3>How did you solve these problems?</h3>
<p>Regarding NetBeans IDE, I just saved some money and bought a
new PC...
<p>For the NetBeans Platform, I've read many times the
Javadoc (damn that unfortunate "cookie" word!) and then the
book. In the end, it started making sense and I could read the
Javadoc with some ease. But I still learn new things as I read
the mailing list or a new tutorial.
<p><h3>Can you share some code snippets? Maybe some tips and tricks
of the APIs you've been working with? </h3>
<p>Well, a little thing I've blogged about
(<a href="http://emilian-bold.blogspot.com/2006/08/netbeans-platform-statuslineelementpro.html">here</a>)
is how to add your own status bar component in a NetBeans Platform application with the
help of <tt>StatusLineElementProvider</tt>. Basically, you just create the
<tt>META-INF/services</tt> folders in the <tt>src/</tt> folder and add the
<tt>org.openide.awt.StatusLineElementProvider</tt> file with the name of your
implementing class.
<p>Next, in your implementing class you just need to implement the
<tt>StatusLineElementProvider</tt> interface and return your Component in
<tt>getStatusLineElement()</tt>. It's easy as hell with a trick&#8212;how do you
determine the order of the items in the statusbar? Well, you rely on the
Lookup (described <a href="https://netbeans.org/download/dev/javadoc/org-openide-util/org/openide/util/doc-files/api.html#service-lookup">here</a>),
via the <tt>#position</tt> enhancement.
<p>Basically, the file will contain first your class and then a numeric position:
<p><pre class="examplecode">com.example.program.YourClass
#position=SomeNumber</pre>
<p>And then the NetBeans Platform will add components to the status bar/line starting
with the smallest number. Just keep in mind that the Progress API has
a component with position <tt>-13</tt> so usually you would use a smaller
(that is, negative) number.
<p><h3>Other tips?</h3>
<p>Well, this made me smile recently: How do you get rid of the build
number from a NetBeans Platform application's titlebar? Normally that
is a branding operation. So you would go to
<tt>org-netbeans-core-windows.jar</tt> in the module suite's
<tt>branding</tt> folder, edit the <tt>Bundle.properties</tt> file and play
with <tt>CTL_MainWindow_Title</tt> and <tt>CTL_MainWindow_Title_No_Project</tt>.
<p>However, I recently read about another solution&#8212;in your module installer's
<tt>restored()</tt> method, just put something like this:
<p><pre class="examplecode">System.setProperty("netbeans.buildnumber", "")</pre>
<p>This works! (Unless the user disables your module...) This shows that
sometimes there is more than one way to do the
branding. However, the person that discovered this trick must surely have grep-ed the source code
to discover it. Go open source!</p>
<p><h3>Anything else?</h3>
<p>A nice thing about the Options Dialog API is that it allows invalid
states via the <a href="https://netbeans.org/download/dev/javadoc/org-netbeans-modules-options-api/org/netbeans/spi/options/OptionsPanelController.html#isValid()">isValid</a>
method. This is a great way to signal to the user that something
isn't filled correctly. And the NetBeans Platform helps, by disabling the OK button
and providing only the Cancel. As soon as the Option panel gets into a
stable state, and isValid() returns true, the OK button is enabled again.
<p>If you use the Options Panel wizard, you basically have to call
<tt>controller.changed()</tt> once the valid-status has changed, which will
notify the listeners. Otherwise you have to fire a property change for
<tt>PROP_VALID</tt>.</p>
<p><h3>Have you tried to introduce the NetBeans Platform
at your workplace?</h3>
<p>I tried introducing the NetBeans Platform at work for the
tools we are developing. Sadly, it has a rather large code base
we're building on top of, so it is quite complicated to convince
people it would be a smart move.
<p>Also, Eclipse is the most widely used IDE here. People are
rather fond of their IDE, even if they see some of the benefits
of the NetBeans Platform.
<div style="float: left;"><img src="nbm_interviews/emilian/quote1.png" alt="quote 2"></div>
<p>Maybe this sounds like blasphemy but, once there is an Eclipse
plugin for NetBeans Platform development, you've struck gold!
Then, you'd have a clean migration path towards the
NetBeans Platform and, from there, to NetBeans IDE. Or at least
merge, somehow, the NetBeans module system with OSGI.
<p><h3>What are your favorite NetBeans features?</h3>
<p>The form editor (the Matisse GUI Builder) is getting rather
powerful! Initially, I liked writing things by hand, since it
felt a lot more professional, but nowadays I feel
no shame in using the IDE to make a Swing GUI!
<p>The wizards are also getting a lot more powerful. I only use
them on the module development side, but they are just great. They
allow you to focus on what's application-specific, without
necessarily learning an entire new NetBeans API for a simple
feature.
<p><h3>If you could change one thing in module development
features in NetBeans, what would it be?</h3>
<p>Remove cookies altogether and use just Lookup! Now it looks
to me like a hibrid state. I don't think it serves anyone.
Backwards-compatibility sounds nice but there has to be a
limit... or at least a bleeding-edge fork.
<p><h3>In your experience, if I am an Eclipse user&#8212;what
would be the main reasons for thinking about using NetBeans
instead?</h3>
<p>If you want to do Java EE development without shareware, edit
an XML file without installing some plugin for the syntax
highlighting, create a nice JFrame without writing any line of
code&#8212;take a look at NetBeans IDE. The fact that you can
take the ZIP release and unzip it on Linux and Windows
and have them both work is also a plus.
<p><h3>Any final thoughts?</h3>
<p>As a developer, I have to say I like the NetBeans Platform for
what it offers and because of the way I see things get done on
<a href="https://netbeans.org">http://www.netbeans.org</a>.
For example, the NetBeans Javadoc is extraordinary. The
<tt>api.html</tt> pages are a killer and to have the DTD's,
properties defined,
UIManager keys and more in the Javadoc really gives you a global
view of the module API. It just shows that lots of work has been
put into this.
<p>The specs or proposals also look way nicer and people seem to
be doing some great work. For example, the
<a href="http://ui.netbeans.org/docs/ui/floating_windows/floating_windows.html">floating
windows specification</a> is excellent. Other proposals are also
impressive, due to the professionalism involved and to the fact
that they are discussed first on the mailing list and refined.
<p>This kind of quality work gives me a lot of confidence about
the IDE and Platform and also an opportunity to learn from the best.
<p><h3>Thanks Emilian and continue having fun with NetBeans!</h3>
<p>
<!-- ======================================================================================== -->
<h2><a name="nextsteps"></a>Further reading</h2>
<p>For information about creating and developing plug-in modules and rich-client applications, see the following resources:
<ul>
<p><li><a href="https://platform.netbeans.org/tutorials/quickstart-nbm.html">Introduction to NetBeans Module Development</a></li>
<p><li><a href="https://platform.netbeans.org/tutorials/nbm-paintapp.html">Introduction to Rich-Client Application Development</a></li>
<p><li><a href="https://platform.netbeans.org/tutorials/index.html">NetBeans Modules and Rich-Client Applications Learning Trail</a></li>
<p><li><a href="https://netbeans.org/download/dev/javadoc/">NetBeans API Javadoc (Current Development Version)</a></li>
<p><li><a href="http://www.planetnetbeans.org">Blogs by NetBeans Engineers and NetBeans Users</a></li></ul>
</p>
<hr>
</body>
</html>