Monday Apr 30, 2012

CyBy2: Store & Visualize Chemical & Biological Data

CyBy2 is a structure-based information management tool used to store and visualize structural data alongside additional information such as project assignment, physical information, spectroscopic data, biological activity, functional data and synthetic procedures.

The application consists of a database, an application server, used to query and update the database, and a client application with a rich graphical user interface used to interact with the server.

The GUI of the CyBy2 client as well as its update functionality and modular application layout are provided by the NetBeans Platform. The CyBy2 server runs on GlassFish. The application is created at the Zurich University of Applied Sciences.

Here's a screenshot:

Details:

Sunday Apr 29, 2012

Small Bowel Motility Imaging Software

Motasso by SOHARD AG in Switzerland is a medical imaging application for small bowel motility studies. Small bowel motility studies measure contractions of the stomach and small intestines when fasting and eating.

As discussed here, "measuring by hand is enormously time consuming and impedes implementing methods in clinical practice. A new program is being developed to semi-automatically analyze small bowel motility. By only setting the measuring point and defining the measuring direction the program can automatically assess small bowel diameter changes and display them as a plot over time."

Here's the application, clearly based on the NetBeans Platform:

Update: Got a better picture from Urs Bill, the lead developer of this project, above! Thanks Urs! Seems like NetBeans IDE for bowel movements. :-)

Saturday Apr 28, 2012

Fighting Hunger & Poverty via Java with the NetBeans Platform (Part 2)

In part 1, slightly over a year ago, I wrote about how developers at CIMMYT, the International Maize and Wheat Improvement Center in Mexico, were learning about the NetBeans Platform as an application framework for the basis of their new developments, especially its "Integrated Breeding FieldBook" tool, thanks primarily to the NetBeans Platform's pluggable system and windowing framework (neither of which are provided either by Swing or JavaFX).

Well, take a look at this cool announcement:

After many months of intensive development work, numerous testing sessions, invaluable feedback from potential users and several redesigns of structure and functionality, the Integrated Breeding FieldBook is here at long last – a tool that will in time greatly enhance the quality of phenotypic data on which critical breeding decisions are based.

This easy-to-use tool will help breeders electronically design field trials and generate fieldbooks and labels through simple wizard-assisted steps.  In conjunction with the Samsung Galaxy tablet recommended for field use, it will empower the breeders to efficiently and accurately capture phenotyping data and save it in a local crop database, before conveniently submitting the same for analysis.

More details here, which is where the text above comes from: 

https://www.integratedbreeding.net/news/ib-fieldbook-finally

Then go here to download the tool, which is available since the last few weeks in version 1.0.2: 

Many congratulations to Hector and Tito, and all the rest of the development team, in Mexico and the Philippines!

Friday Apr 27, 2012

Eclipse and NetBeans replacing embedded IDEs (part 1)

The recent release of the production version of Microchip’s MPLAB X integrated development tool suite continues the trend of embedded development tools adopting an open source platform to develop and manage an IDE (integrated development environment) – with a notable exception – Microchip’s MPLAB X is based on NetBeans rather than Eclipse. NetBeans and Eclipse are both open source projects that include tools, frameworks, and components for platforms and tools supporting software development. For the past seven years only the Eclipse IDE platform has been publicly adopted by embedded tool providers; with the release of MPLAB X, Microchip is arguably the first embedded microcontroller tool provider to publicly adopt NetBeans to date (PMC Sierra uses a NetBeans-based tool that was developed internally for validation tests).

Read more here, in an article published Wednesday, April 25th, 2012...

Thursday Apr 26, 2012

@NavigatorPanel.Registration

@NavigatorPanel.Registration is new in 7.2 and lets you register navigator panels for a MIME type. I.e., create a new module, use the annotation on a JPanel, and then your external module can enrich editor support for the MIME type of your choice, including existing MIME types, such as "text/x-java", for Java files, or "text/x-properties" for Properties files, as shown below.

import java.awt.BorderLayout;
import java.io.IOException;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import org.netbeans.spi.navigator.NavigatorPanel;
import org.openide.loaders.DataObject;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.Lookup.Result;
import org.openide.util.LookupEvent;
import org.openide.util.LookupListener;

@NavigatorPanel.Registration(mimeType = "text/x-properties", displayName = "Property File Content")
public class PropsNavigatorPanel extends JPanel implements NavigatorPanel, LookupListener {

    JTextArea jta = new JTextArea();

    public PropsNavigatorPanel() {
        setLayout(new BorderLayout());
        JScrollPane pane = new JScrollPane(jta);
        jta.setEditable(false);
        add(pane, BorderLayout.CENTER);
    }

    Result<DataObject> dataobjectsInLookup;

    @Override
    public void panelActivated(Lookup lkp) {
        dataobjectsInLookup = lkp.lookupResult(DataObject.class);
        dataobjectsInLookup.addLookupListener(this);
    }

    @Override
    public void panelDeactivated() {
        dataobjectsInLookup.removeLookupListener(this);
    }

    @Override
    public void resultChanged(LookupEvent le) {
        jta.setText("");
        if (dataobjectsInLookup.allInstances().iterator().hasNext()) {
            DataObject dobj = dataobjectsInLookup.allInstances().iterator().next();
            try {
                for (String line : dobj.getPrimaryFile().asLines()) {
                    if (!line.startsWith("#") && line.length() > 0) {
                        jta.append(line);
                        jta.append("\n");
                    }
                }
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            };
        }
    }

    @Override
    public Lookup getLookup() {
        return Lookup.EMPTY;
    }

 
    @Override
    public String getDisplayName() {
        return "Property File Content";
    }

    @Override
    public String getDisplayHint() {
        return "Property File Content";
    }

    @Override
    public JComponent getComponent() {
        return this;
    }
 
}

Instead of Strings, would be better to have Nodes, which would be clicked to jump into the Properties editor onto the related line.

Wednesday Apr 25, 2012

Images in Navigator in Upcoming NetBeans IDE 7.2

Nowhere have I seen this mentioned! When browsing through files in 7.2 builds, the Navigator shows a thumbnail image of image files:

Not only that but, as you can see, you also see the dimensions of the image. No need to open image files in the IDE again. Just move through the explorer views (Projects, Files, or Favorites) and, when you get to an image, the Navigator will show a thumbnail view of it. Very cool.

Tuesday Apr 24, 2012

YouTube Movie: Taking FindBugs in NetBeans IDE for a Spin

Didn't know the first thing about FindBugs in NetBeans IDE when I started making this movie, as you'll see. Bear with me to the end and you'll learn what I did.

Monday Apr 23, 2012

CSS Styling for the NetBeans Platform

What's the difference between these two NetBeans Platform applications?

The difference between the two screenshots is that the second is styled by a stylesheet with this content:

.digital-clock {
    -fx-effect: dropshadow(two-pass-box , darkgray, 10, 0.0 , 4, 5);
}

The file containing the content above is named "digitalClock.css". The clock is a JavaFX component, in fact, one of the samples you get with NetBeans IDE. When the JavaFX Scene is created, the final line below sets the stylesheet above on the clock:

Platform.runLater(new Runnable() {
    @Override
    public void run() {
        Scene scene = new Scene(root);
        setScene(scene);
        scene.getStylesheets().add(DigitalClock.class.getResource("digitalClock.css").toExternalForm());
    }
});

Next, in the clock definition, notice the final statement below:

Clock clock = new Clock(Color.ORANGERED, Color.rgb(50, 50, 50));
clock.setLayoutX(45);
clock.setLayoutY(186);
clock.getTransforms().add(new Scale(0.83f, 0.83f, 0, 0));
clock.getStyleClass().setAll(DEFAULT_STYLE_CLASS);

The reference that you see above is defined as follows, pointing to the element you see in the CSS stylesheet above:

private static final String DEFAULT_STYLE_CLASS = "digital-clock";

Thanks to Toni for this article, which showed me the way to the code above. As a result, we can now style NetBeans Platform applications with CSS!

Sunday Apr 22, 2012

Include Reporting Features in a NetBeans Platform Application

Sometimes the question is asked: "Can I include reporting capabilities in my NetBeans Platform application?" Well, look at this application I created in a couple of minutes:

Here you see an application (which includes print and save features for the reports you create) on the NetBeans Platform that includes the 4 NBMs that can be downloaded from a ZIP file here:

http://plugins.netbeans.org/plugin/4425/ireport

The screenshot above is on top of NetBeans IDE 7.1.1, so the iReport plugin above fits into it without a problem. You'll need more than the plain NetBeans Platform, since the iReport plugin also makes use of the Component Palette and the Welcome Screen, for example, both of which are not part of the NetBeans Platform. But after a bit of figuring things out, you'll end up with a result similar to the above.

Friday Apr 20, 2012

Wanted: A Music Sheet Component in JavaFX!

There's a small xylophone sample in the JavaFX samples category in NetBeans IDE. When you run it, you see this:

When you click on the xylophone, javafx.scene.media.AudioClip is used to play a WAV file, a different file for each bar in the xylophone. That's nice. But this is better:

So, when you click on the xylophone, a new note is added to the currently selected music sheet, which means I've integrated the JavaFX xylophone sample as a new module in the JFugue Music NotePad:

Note: A modular architecture is really useful when you're tempted to use a new technology in production code. If, for whatever reason, the new technology doesn't end up delivering what you'd like or fails to be all that you'd hoped for, just exclude the module where you've encapsulated the new feature that makes use of that new technology. In a standard monolithic application, you'd have your implementation of a new technology so intertwined in your code that removing it would typically mean a big rewrite of the surrounding code. And that risk should logically prevent early adoption in production code of new technologies, such as JavaFX 2.0, meaning that a modular architecture is an enabler of early adoption of JavaFX 2.0 and all other new technologies.

Also, since I'm using the JFugue API, javafx.scene.media.AudioClip is now not being used at all anymore. I wonder what benefits that class has over the JFugue API. Special music effects, maybe?

But just imagine how great it would be if the music sheet itself would also be written in JavaFX? That would open the application up to a whole range of special effects and animations when notes are added to the music sheet. Does anyone know (or want to create) a music sheet in JavaFX? If a financial incentive would be needed to drive the creation of such a component, I would personally be very happy to shell out several dollars for it (since this feature would raise this application to a whole new level where Sibelius and other commercial music composer applications are found), so long as the code that is created would be open sourced and freely available for the whole world to use without any strings attached of any kind.

Thursday Apr 19, 2012

Maven: Not Building But Running

Vinicius Senger (one of the developers of jHome, which won a Duke's Choice Award at last year's JavaOne) asked this question on Twitter:

I asked Jesse Glick, who works on the NetBeans Maven support, the above question and he responded as follows: 

Assuming a jar-packaging project is being referred to, you can remove <goal>process-classes</goal> from the 'run' action in nbactions.xml. In my tests, this can shave around 500msec off the time to run a small project. Of course, then you are obliged to build before running, which is much slower than just clicking Run immediately after making your modifications and having it perform an incremental build during the same Maven process.

Having the IDE detect that you have done a build "recently enough" and omit certain goals from a subsequent Maven run would be complicated and probably never work reliably.

Much faster than any of these options is enabling Compile on Save mode for application run, which is the default in NetBeans 7.2; this bypasses Maven altogether for the basic edit/compile/run/debug workflow.

The question is also answered on the related mailing list:

http://netbeans.org/projects/projects/lists/maven-dev/archive/2012-04/message/88

JavaFX for Corporate Desktop Apps Too? (Not Just Games?)

In the screenshot below, each chart comes from a different plugin and all of them (except the scatter chart, which I included just for fun) react in an animated way, i.e., the lines in the charts visibly move up and down, when data is changed in the Swing JTable:

All the charts you see above are JavaFX components. And all the rest is Swing.

Note: Click to enlarge the image to get a better view. Apologies for the large view being very grainy; that's because there's some bug with enlarged PNG files on blogs.oracle.com, so I had to do a GIF instead.

At least two things are illustrated here that you don't get from JavaFX. Firstly, the docking framework, i.e., each chart can be undocked from the main frame, even moved to a different monitor. Handy if you're a stock trader, air traffic controler, defence force specialist, and, oh probably, just about every user of a large app would find this handy. Secondly, pluggability. The end user (or you, as the provider of the app) can decide which charts should be included in the app. All you need to do is go to Tools | Plugins and install a new chart provider, which is an implementation of an interface made available by the app for registering new charts. 

But the main thing illustrated here is that you can pick the JavaFX goodies that seem relevant to your existing Swing app and simply disregard all the rest. (Or, move to the other parts step by step over a number of releases of your app, i.e., it's not an "all or nothing" thing.)

Tuesday Apr 17, 2012

JavaOne Moscow

JavaOne Moscow has come and gone. I was one of the lucky people able to be there as a speaker, together with several others I've known for some years, including this guy:

It was a great conference, extremely well attended, people walking around everywhere, going to sessions, booths, and long lines at lunch. This is what the keynote room looked like, while there were 5 other rooms, as well as a hands on lab room, so lots going on all at the same time:

I did a session entitled "Unlocking the Java EE 6 Platform", which is a very nice overview of all the specifications that make up Java EE 6. Via a demo that I do in NetBeans IDE 7.1, the main specifications are introduced and put together into a simple application that showcases the highlights of Java EE 6, together with all the cool tools that NetBeans IDE provides to help you use the specifications efficiently.

I ended the session by announcing that part 2 of my talk was going to be held the next day, entitled "Migrating Spring to Java EE 6", by Bert Ertman and Paul Bakker from Luminis in the Netherlands, as well as being from the Dutch JUG. It was a fantastic session, very well done, very practical, with great slides, such as this one:

Read the two articles published yesterday by Bert and Paul here, to catch up on all the information they shared in the session, including instructions for porting the Spring Pet Clinic:

http://howtojboss.com/2012/04/17/article-series-migrating-spring-applications-to-java-ee-6-part-1/

http://howtojboss.com/2012/04/17/article-series-migrating-spring-applications-to-java-ee-6-part-2/

And, in my quest to become more familiar with ADF, I attended a session on creating a dashboard in ADF, presented by Juan Ruiz. It was very interesting to see all the cool tooling in JDeveloper, i.e., a great drag and drop designer that he used to compose a dashboard consisting of many complex graphs and other components:

In addition to the above, I also held a hands on lab entitled "Rapid Corporate Desktop Development". Here I pointed out that, unlike the world of web development and mobile development, the desktop development world is a bit hidden. But that doesn't mean it's not there; it's just that you're not likely to read blogs saying "wow, look at this cool air traffic control system that I created yesterday". I.e., the domain is just completely different, the developers working on these systems are hidden behind a corporate firewall, they're not allowed to blog even if they were to want to do so, the kind of applications they create are seen by some (e.g., Tim Bray) to be "boring" (well, these are all analyzers, monitors, management systems, etc, doing real heavy processing and visualization, which is what computers are for, right), and so these stories are a lot less well known. Still, when you start building up a list of examples, you end up talking to really interesting organizations such as NATO and Boeing, instead of small startups and retail-oriented web shops, as this page shows.

The hands on lab session went well, the group of about 30 managed to get their feet wet in corporate desktop development and had the start of a first NetBeans Platform based application up and running by the end of the session.

In between the above, I did a bit of sightseeing, given the time constraints I didn't get beyond Red Square, but that itself was pretty stunning:

On the right of the pic above, you see the entrance to Lenin's tomb. I lined up, it took a while, went through several security checks, and half an hour later, there I was, a few steps away from Lenin himself, who was wearing a nice suit and lying well preserved in a glass case on a well lit platform. An interesting experience.

Thanks for the great time in Moscow and it was great to talk to so many developers there.

Saturday Apr 14, 2012

Jaroslav Tulach's Report on NetBeans at OSGiCon

The latest NetBeans Podcast was recorded over the last few weeks and released yesterday.

Aside from the NetBeans news items and interviews (interesting stuff about Joel Murach's new Java book using NetBeans, as well as the new developments in the NetBeans Groovy editor), there is, as always an "API Design Tip" of the podcast. That's really worth listening to, always of course, but especially this time because here Jaroslav Tulach talks at some length about his recent trip to OSGiCon, as well as the history and status of OSGi support in NetBeans IDE.

Start listening from just before the 30th minute (i.e., the final segment) if you're interested in this particular topic:

https://blogs.oracle.com/nbpodcast/entry/netbeans_podcast_60

For example, hear about how JDeveloper got faster by switching from Equinox to Netbinox. And... will Eclipse find itself on the same OSGi container too?

Monday Apr 09, 2012

JavaOne Russia: Great Line Up

I'm (we're) in New York, a week of vacation. (Growing list of photos can be found here.) A week in Brooklyn, and around, flea markets, book stores, museums, music. One of several highlights will be seeing "Death of a Salesman" with Philip Seymour Hoffman in the main role, tomorrow.

However, mentally, at least partly, I'm in Moscow, at JavaOne Moscow, 17 & 18 April.

http://www.oracle.com/javaone/ru-en/index.html

I'm doing two items there, thankfully on the first day, I always think the sooner the better:

  • Tuesday 12:30 - 13:15 -- Unlocking the Java EE 6 Platform (in the Keynote Hall)
  • Tuesday 16:30 - 18:15 -- Rapid Corporate Desktop Development (in HOL Room)

Several speakers I'm looking forward to seeing there include Bert Ertman who will be talking about Spring/Java EE 6 migration, Dalibor Topic talking about Lambda expressions in JDK 8, Arun Gupta with his Java EE 6 HOL (appears to be a partial overlap with my session), and various others. And I hope I will make it to Angela Caicedo's HOL on JavaFX.

The whole program, which is available via the link above, indicates that many (dare I say "most"?) of the sessions will be using NetBeans in one way or another. Looks like it will be a great conference.

Thursday Apr 05, 2012

"That's cool. But it would be even better if..."

I recently talked to some NetBeans users who were interested in a demonstration of the features that will be part of NetBeans IDE 7.2. (See the 7.2 New and Noteworthy for the full list.)

One of the new features I demonstrated was this one. In an interface declaration, NetBeans IDE 7.2 will provide a hint, as can be seen in the sidebar below:

When the lightbulb is clicked, or Alt-Enter is pressed, this will be shown:

When the hint is invoked, the user will see this:

And then the user will be able to enter the name of a class, and the name of a package, and assuming the defaults above are taken, a class with this content will be generated:

package demo;

public class WordProcessorImpl implements WordProcessor {

    @Override
    public String process(String word) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 
}

When I demonstrated the above, the response from the audience was: "That's cool. But it would be even better if..."

  • it was possible to implement an interface into an existing class.

  • it was possible to select a class and specify the interfaces that it should implement.

  • it was possible, in the context of a NetBeans Platform application, to specify the module where the class should be implemented.

So I created some issues:

Sharing A Stage: JDeveloper/ADF & NetBeans/Java EE 6?

A highlight for me during last week's Oracle Developer Day in Romania (which I blogged about here) was meeting Jernej Kaše (who is from Slovenia, just like my philosopher hero Slavoj Žižek), who is an Oracle Fusion Middleware evangelist. At the conference, while I was presenting NetBeans and Java EE 6 in one room, Jernej was presenting JDeveloper and ADF in another room. The application he created looks as follows, i.e., a realistic CRUD app, with a master/detail view, a search feature, and validation:

In a conversation during a break, we started imagining a scenario where the two of us would be on the same stage, taking turns talking about NetBeans/Java EE and JDeveloper/ADF. In that way, attendees at a conference wouldn't need to choose which of the two topics to attend, because they'd be handled in the same session, with the session possibly being longer so that sufficient time could be spent on the respective technologies. (The JDeveloper/ADF session would then not be competing with the NetBeans/Java EE 6 session, since they'd be handled simultaneously.) The session would focus on the similarities/differences between the two respective tools/solutions, which would be extremely interesting and also unique.

The crucial question in making this kind of co-presentation possible is whether (and how quickly) an application such as the one created above with JDeveloper/ADF could be created with NetBeans/Java EE 6. The NetBeans/Java EE 6 story is extremely strong on the model and controler levels, but less strong on the view layer. Though there are choices between using PrimeFaces, RichFaces, and IceFaces, that support is quite limited in the absence of a visual designer or of other specific tools (e.g., code generators to generate snippets of PrimeFaces) connected to JSF component libraries.

However, it so happens that in recent months we at NetBeans have established really good connections with the PrimeFaces team (more about that another time). So I asked them what it would take to write the above UI in PrimeFaces. The PrimeFaces team were very helpful. They sent me the following screenshot, which is of the UI they created in PrimeFaces, reproducing the ADF screenshot above:

Of course, the above is purely the UI layer, there's no EJB and entity classes and data connection hooked into it yet. However, this is the Facelets file that the PrimeFaces team sent me, i.e., using the PrimeFaces component library, that produces the above result:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <f:view>

        <h:head>
            <style type="text/css">
                .alignRight {
                    text-align: right;
                }
                .alignLeft {
                    text-align: left;
                }
                .alignTop {
                    vertical-align: top;
                }
                .ui-validation-required {
                    color: red;
                    font-size: 14px;
                    margin-right: 5px;
                    position: relative;
                    vertical-align: top;
                }
                .ui-selectonemenu .ui-selectonemenu-trigger .ui-icon {
                    margin-top: 7px !important;
                }
            </style>
        </h:head>

        <h:body>

            <h:form prependId="false" id="form">

                <p:panel header="Employees">
                    
                    <h:panelGrid columns="4" id="searchPanel">
                        Search
                        <p:selectOneMenu>
                            <f:selectItem itemLabel="FirstName" itemValue="FirstName" />
                            <f:selectItem itemLabel="LastName" itemValue="LastName" />
                            <f:selectItem itemLabel="Email" itemValue="Email" />
                            <f:selectItem itemLabel="PhoneNumber" itemValue="PhoneNumber" />
                        </p:selectOneMenu>
                        <p:inputText />
                        <p:commandLink process="searchPanel" update="@form">
                            <h:graphicImage name="next.gif" library="img" />
                        </p:commandLink>
                    </h:panelGrid>

                    <h:panelGrid columns="3" columnClasses="alignTop,,alignTop"
                                 style="width:90%;margin-left:10%">
                        <h:panelGrid columns="2" columnClasses="alignRight,alignLeft">
                            <h:outputLabel for="firstName">FirstName</h:outputLabel>
                            <p:inputText id="firstName" />
                            <h:outputLabel for="lastName">
                                <sup class="ui-validation-required">*</sup>LastName
                            </h:outputLabel>
                            <p:inputText id="lastName" style="width:250px;" />
                            <h:outputLabel for="email">
                                <sup class="ui-validation-required">*</sup>Email
                            </h:outputLabel>
                            <p:inputText id="email" style="width:250px;" />
                            <h:outputLabel for="phoneNumber" value="PhoneNumber" />
                            <p:inputMask id="phoneNumber" mask="999.999.9999" />
                            <h:outputLabel for="hireDate">
                                <sup class="ui-validation-required">*</sup>HireDate</h:outputLabel>
                            <p:calendar id="hireDate" pattern="MM/dd/yyyy" showOn="button" />
                        </h:panelGrid>

                        <p:outputPanel style="min-width:40px;" />

                        <h:panelGrid columns="2" columnClasses="alignRight,alignLeft">
                            <h:outputLabel for="jobId">
                                <sup class="ui-validation-required">*</sup>JobId
                            </h:outputLabel>
                            <p:selectOneMenu id="jobId" >
                                <f:selectItem itemLabel="Administration Vice President" itemValue="Administration Vice President" />
                                <f:selectItem itemLabel="Vice President" itemValue="Vice President" />
                            </p:selectOneMenu>
                            <h:outputLabel for="salary">Salary</h:outputLabel>
                            <p:inputText id="salary" styleClass="alignRight" />
                            <h:outputLabel for="commissionPct">CommissionPct</h:outputLabel>
                            <p:inputText id="commissionPct" style="width:30px;" maxlength="3" />
                            <h:outputLabel for="manager">ManagerId</h:outputLabel>
                            <p:selectOneMenu id="manager">
                                <f:selectItem itemLabel="Steven King" itemValue="Steven" />
                                <f:selectItem itemLabel="Michael Cook" itemValue="Michael" />
                                <f:selectItem itemLabel="John Benjamin" itemValue="John" />
                                <f:selectItem itemLabel="Dav Glass" itemValue="Dav" />
                            </p:selectOneMenu>
                            <h:outputLabel for="department">DepartmentId</h:outputLabel>
                            <p:selectOneMenu id="department">
                                <f:selectItem itemLabel="90" itemValue="90" />
                                <f:selectItem itemLabel="80" itemValue="80" />
                                <f:selectItem itemLabel="70" itemValue="70" />
                                <f:selectItem itemLabel="60" itemValue="60" />
                                <f:selectItem itemLabel="50" itemValue="50" />
                                <f:selectItem itemLabel="40" itemValue="40" />
                                <f:selectItem itemLabel="30" itemValue="30" />
                                <f:selectItem itemLabel="20" itemValue="20" />
                            </p:selectOneMenu>
                        </h:panelGrid>
                    </h:panelGrid>

                    <p:outputPanel id="buttonPanel">
                        <p:commandButton value="First" process="@this" update="@form" />
                        <p:commandButton value="Previous" process="@this" update="@form"
                                         style="margin-left:15px;" />
                        <p:commandButton value="Next" process="@this" update="@form"
                                         style="margin-left:15px;" />
                        <p:commandButton value="Last" process="@this" update="@form"
                                         style="margin-left:15px;" />
                    </p:outputPanel>

                    <p:tabView style="margin-top:25px">
                        <p:tab title="Job History">
                            <p:dataTable var="history">
                                <p:column headerText="StartDate">
                                    <h:outputText value="#{history.startDate}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="EndDate">
                                    <h:outputText value="#{history.endDate}">
                                        <f:convertDateTime pattern="MM/dd/yyyy" />
                                    </h:outputText>
                                </p:column>
                                <p:column headerText="JobId">
                                    <h:outputText value="#{history.jobId}" />
                                </p:column>
                                <p:column headerText="DepartmentId">
                                    <h:outputText value="#{history.departmentIdId}" />
                                </p:column>
                            </p:dataTable>
                        </p:tab>
                    </p:tabView>

                </p:panel>

            </h:form>

        </h:body>

    </f:view>

</html>

Right now, NetBeans IDE only has code completion to create the above. So there's not much help for creating such a UI right now. I don't believe that a visual designer is mandatory to create the above. A few code generators and file templates could do the job too. And I'm looking forward to seeing those kinds of tools for PrimeFaces, as well as other JSF component libraries, appearing in NetBeans IDE in upcoming releases. A related option would be for the NetBeans generated CRUD app to include the option of having a master/detail view, as well as the option of having a search feature, i.e., the application generators would provide the option of having additional features typical in Java enterprise apps.

In the absence of such tools, there still is room, I believe, for NetBeans/Java EE and JDeveloper/ADF sharing a stage at a conference. The above file would have been prepared up front and the presenter would state that fact. The UI layer is only one aspect of a Java EE 6 application, so that the presenter would have ample other features to show (i.e., the entity class generation, the tools for working with servlets, with session beans, etc) prior to getting to the point where the statement would be made: "On the UI layer, I have prepared this Facelets file, which I will now show you can be connected to the lower layers of the application as follows." At that point, the session beans could be hooked into the Facelets file, the file would be saved, the browser refreshed, and then the whole application would work exactly as the ADF application does.

So, Jernej, let's share a stage soon!

Monday Apr 02, 2012

Programmatically Making the Selected OutlineView Cell Editable

When you're using the OutlineView and you use the Tab key to move through its cells, the cells are shown to be selected, as below:

However, until you press the Space key in the selected cell, or until you click the mouse within it, you cannot edit it.

That's extremely annoying when you're creating a data-entry application. Your user would like to begin editing a cell as soon as they have tabbed into it. Needing to press Space first, or click the mouse in the cell first, is a cumbersome additional step that completely destroys your work flow. Below, you can see that an editable cell looks very different to one that is merely selected:

I.e., now I can type and the text changes. How to set up the OutlineView so that the Tab key makes the selected cell editable? Here's the constructor of the TopComponent you see above:

public ViewerTopComponent() {

    initComponents();

    setName(Bundle.CTL_ViewerTopComponent());
    setToolTipText(Bundle.HINT_ViewerTopComponent());

    setLayout(new BorderLayout());

    OutlineView ov = new OutlineView();

    final Outline outline = ov.getOutline();

    outline.setRootVisible(false);

    //When column selection changes, e.g., via Tab key,
    //programmatically start editing the cell:
    ListSelectionListener listSelectionListener = new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            int row = outline.getSelectedRow();
            int column = outline.getSelectedColumn();
            //Ignore the node column:
            if (row > -1 && row > -1) {
                outline.editCellAt(row, column);
            }
        }
    };
    outline.getColumnModel().getSelectionModel().addListSelectionListener(listSelectionListener);

    ov.setPropertyColumns(
            "city", "City", "state", "State");

    add(ov, BorderLayout.CENTER);

    em.setRootContext(
            new AbstractNode(Children.create(new CustomerChildFactory(), true)));

    associateLookup(ExplorerUtils.createLookup(em, getActionMap()));

}

Sunday Apr 01, 2012

Update Your NetBeans Plugin's "Supported NetBeans Versions" In The Next Two Weeks!

For each NetBeans plugin uploaded to the NetBeans Plugin Portal, the registration page starts like this:

Note how the "Supported NetBeans Versions" field is empty, i.e., no checkbox is checked, for the plugin above.

As you can also see, there is a red asterisk next to this field, which means it is mandatory. It is mandatory for the latest version of the NetBeans Plugin Portal, while it wasn't mandatory before, so that several plugins were registered without their supported version being set.

Therefore, since the version is now mandatory, anyone who doesn't want their plugin to be hidden for the rest of this year, and removed on 1 January 2013 if no one complains about their absence, needs to go to their plugin's registration page and set a NetBeans Version.

E-mails have been sent to plugin developers of unversioned plugins already, over the last weeks. Currently there are 91 plugins that still need to have their NetBeans Version set. Probably at least 1/3 of those are my own plugins, so this is as much a reminder to myself as anyone else!

Whether or not you have received an e-mail asking you to set a NetBeans Version for your plugins, please take a quick look anyway and maybe this is a good opportunity to update other information relating to your plugin.

You (and I) have two weeks: on Monday 16 April, any NetBeans plugin in the Plugin Portal without a NetBeans Version will be hidden. And then removed, at the start of next year, if no one complains.

About

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.

Search

Archives
« April 2012 »
SunMonTueWedThuFriSat
3
4
6
7
8
10
11
12
13
15
16
18
21
     
       
Today