Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
PlanetNetbeans
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
Feeds
[RSS 1.0 Feed] [RSS 2.0 Feed]
[FOAF Subscriptions] [OPML Subscriptions]
Do you blog about NetBeans ? Add your blog to PlanetNetBeans.
Feed Subscriptions
NetBeans Zone - The social network for developers (feed)
APIDesign - Blogs (feed)
ludo's blog (feed)
pandaconstantin's blog (feed)
hansmuller's blog (feed)
pkeegan's blog (feed)
richunger's blog (feed)
tball's blog (feed)
timboudreau's blog (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
Need to find a title (feed)
Roger Searjeant's blog (feed)
Michael's blog » NetBeans (feed)
DukeScript (feed)
ProNetBeans (feed)
Tim Boudreau (feed)
Paulo Canedo » NetBeans English (feed)
Bistro! 2.0 (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Java, business and... NetBeans ! [[ Jonathan Lermitage ]] - NetBeans IDE (feed)
Neil's Dev Stuff (feed)
Category: NetBeans | Software and Science (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
Inspiration and Expression » Netbeans (feed)
John O'Conner » NetBeans (feed)
Adam Bien (feed)
Ignacio Sánchez Ginés » NetBeans (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
NetBeans Ruminations » NetBeans (feed)
Tiplite » netbeans (feed)
Arun Gupta, Miles to go ... (feed)
Geertjan's Blog (feed)
.JARa's Bilingual Weblog (feed)
JavaFX Composer (feed)
The Java Jungle (feed)
Jesse Glick (feed)
Martin Grebac (feed)
The NetBeans Community Podcast (feed)
NetBeans Profiler (feed)
NetBeans for PHP (feed)
NetBeans Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
My First Blog - Satyajit Tripathi (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Gualtiero Testa » Netbeans (feed)
James Selvakumar's Blog » netbeans (feed)
nB gUru » NetBeans (feed)
Newsintegrator Blog » netbeans (feed)
Praxis LIVE » NetBeans (feed)
TechAshram » NetBeans (feed)
There's no place like 127.0.0.1 » Netbeans (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Wade Chandler's Programming Blog (feed)
Devlin's Lab (feed)
Big Al's Blog (feed)
Code Snakes (feed)
In perfect (spherical) shape (feed)
Van Couvering Is Not a Verb (feed)
Diego Torres Milano's blog (feed)
Vroom Framework (feed)
Messages from mrhaki (feed)
Jeff's Blog (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Welcome to my live... (feed)
Netbeans IDE Blog by Tushar Joshi, Nagpur (feed)
Devel Blog (feed)
diamond-powder (feed)
Manikantan's Netbeans (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
July 31, 2015 06:05 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - July 31, 2015 05:41 AM
Classpath conflicts, 50MB WARs, Scaling, Kafka, Threading and JSF, Or Questions for 17th Airhacks Q&A

Questions for the 17th airhacks.tv at August, 3rd 2015 at 6.PM. CET: http://www.ustream.tv/channel/adambien (no reqistration required, no obligations, just ask questions and watch :-)):

  1. Blog posts are not best practices, or Annotation less JPA discussion.
  2. How to deal with classpath conflicts on an application server (e.g. GlassFish)?
  3. Which application server to choose?
  4. How to scale up an application server? To cluster or not to cluster, stale caches and not single singletons...
  5. What about Apache Kafka?
  6. How to choose a database?
  7. Threading in Java and Java EE and what about akka.io?
  8. Is a 50MB WAR worth migration to a Java EE server?
  9. Is it a good idea to combine @EntityListener and WebSockets to implement notifications?
  10. How to structure JSF code?
  11. How to begin with Java EE and JSF?

This list is a digest of the questions gathered at github's gist.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 29, 2015 06:52 PM
Selenium for Java in NetBeans IDE

Selenium is a popular browser automation framework. There's a good introduction and examples here. Let's see how to use it in NetBeans IDE, for Java applications, without installing plugins. 

In the upcoming NetBeans IDE 8.1 (already available as development builds), create your Maven Java EE project, which will give you this:

In the New File dialog, you'll find Selenium test files:

When you select the Selenium Test Case above and click Next and complete the wizard, you'll have the new Selenium test file, as well as all the dependencies you'll need (click to enlarge the image below):

Right-click the application, choose test file, the rest runs, the browser opens, and the results are shown in the Test Results window.

pandaconstantin's blog - July 29, 2015 08:41 AM
NetBeans Day in Burkina Faso report

Ecole Supérieure D'Informatique of Université Polytechnique de Bobo-Dioulasso has got an extraordinary chance to stand the first NetBeans Day in Burkina Faso by the 25th july 2015. This event has been successfully thank to rock stars Geertjan Wielenga, Jiri Kovalsky and Bruno Souza.
Through the talk "This is NetBeans", Geertjan presented the NetBeans as tool and community. After that Jiri offered us the overview of the NetCat program and all the opportunity it offers to contributors. The intervention of Bruno was about the "Future developer" where he motivated us to contributed in opensource project such as NetBeans, GlassFish, Java, Apache, etc. I end the meeting by showing a small tutorial on how to develop a professional application with NetBeans IDE.
This has been a wonderful day for us and we wish to have it more often. The final lesson was "Contribute to NetBeans !"
You can find here the vibrant speech of Bruno remotely from DevConf in Brazil.

Here the agenda of the day ....

... and some pictures of the attendees and talks

See you for the next session !

Geertjan's Blog - July 28, 2015 10:04 PM
YouTube: Crossroads.js for Enterprise JavaScript Applications

A common routing solution for JavaScript applications is Crossroads.js. Using this blog entry, here's how to understand and get started with Crossroads.js:

Watch more NetBeans videos here: https://www.youtube.com/user/NetBeansVideos

Michael's blog » NetBeans - July 28, 2015 07:00 PM
NetBeans Task Repository Editor

In my last blog, I showed the configuration file, which stores  the properties of the Task Repositories. And I stated, NetBeans sadly offers the new-editor only. But there is an task repository editor! I used it once, few years ago. … Weiterlesen

Geertjan's Blog - July 27, 2015 08:27 PM
Cassandra Meets NetBeans IDE

Initial support for Cassandra in NetBeans IDE 8.0.2 is available. Get it here:

http://plugins.netbeans.org/plugin/59444

Install into NetBeans IDE 8.0.2, open the Services window (Ctrl-5), right-click the Cassandra node, fill in a host (127.0.0.1 is the default), and a port (9042 is the default), and then browse the Cluster.

In the screenshot above "Explore From Here" opens the Cassandra node in a separate window, i.e., giving you more space, if you don't want to work in the Services window.

Double-click a table in a user keyspace (or right-click on it) to view its values in a table, as shown below. Choose "Dump Data" to print values into the Output window (Ctrl-4). Tables in system keyspaces are locked, i.e., data cannot be viewed.

In a future release of the plugin, the Cassandra node will be within the Databases node in the Services window, also Cassandra QL will be supported.

Sources are here, please fork and enhance: https://github.com/GeertjanWielenga/NetCassandraBeans

NetBeans for PHP - July 27, 2015 06:32 AM
Codeception support added

<p> <em>This blog post has been contributed by our NetBeans PHP user&nbsp;<strong>Junichi Yamamoto</strong>&nbsp;who has created support for&nbsp;<a href="http://http://codeception.com/" target="_blank" title="Codeception homepage">Codeception</a>&nbsp;in&nbsp;<strong>NetBeans 8.1</strong>.&nbsp;He would like to tell you a few words about this new PHP unit testing framework and its support in NetBeans. Thanks, a lot Junichi!</em></p><hr /> <p> Hi all, today we will show you <a href="http://codeception.com/" target="_blank" title="Codeception homepage">Codeception</a> support which has been added in <strong>NetBeans 8.1</strong> as another PHP testing framework. If you have used PHPUnit, atoum or Nette Tester in NetBeans IDE, you can use this support the same way as them. </p> <h4>Requirements</h4> <p>Codeception 2.1 or newer.</p> <h4>Configurations</h4> <p>At first, let's set the Options for Codeception.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-options.png" alt="Options for Codeception" /> <p>Next, to enable the Codeception, please select it and your test directories in your project properties.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-project-properties-1.png" alt="Enable Codeception" /> <p> You can also set some configurations per project.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-project-properties-2.png" alt="Configurations for Codeception per Project" /> <h4>Run tests</h4> <p>Your tests are run from a context menu of your project and you can review the results using in the Test Results window:</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-run-tests.png" alt="Test Results" /> <h4>Code Coverage</h4> <p>To enable code coverage, you have to add a bit configurations to your configuration file (e.g. <em>codeception.yml</em>, <em>unit.suite.yml</em>). Please refer to the <a href="http://codeception.com/docs/11-Codecoverage" target="_blank" title="Codeception: Code Coverage">Codeception's web site</a> for details.</p> <p>Enable code coverage for project.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-enable-code-coverage.png" alt="Enable Code Coverage" /> <p>Show report for code coverage. Right-click the project node and select <em>Code Coverage &gt; Show Report...</em></p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-code-coverage-show-report.png" alt="Show Report for Code Coverage" /><br /> <p>See tested lines in files.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-code-coverage-tested-lines.png" alt="Tested Lines for Code Coverage" /> <h4>Debugging</h4> <p>Before start with it, you should check the following: <a href="http://wiki.netbeans.org/HowToConfigureXDebug" target="_blank" title="How to Configure XDebug">How to configure XDebug.</a></p> <p>If you are ready, please put breakpoint(s) to your code.Then, open the context menu in the editor for a test file and select <em>Debug file</em>.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-debugging.png" alt="Debugging" /> <h4>Create Tests</h4> <p>Create a test using a <em>generate</em> command (e.g. <em>generate:test</em>).</p> <p>Open your PHP file in the editor and select <em>Tools &gt; Create/Update Tests</em>. Then, select a command (e.g. <em>test</em>) and a suite (e.g. <em>unit</em>) in the Create Test dialog.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-create-tests.png" alt="Create Tests Dialog" /><br /> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-create-test.png" alt="Create Test Dialog" /> <h4>Run Commands</h4> <p>Run a few commands for Codeception. Supported commands are <em>bootstrap</em>, <em>build</em> and <em>clean</em>.</p> <p><strong>NOTE:</strong> The other commands are currently not supported.</p> <p>These commands will be available in the project context menu if you enable Codeception in your project.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-commands.png" alt="Run Commands" /> <h4>Additional Parameters</h4> <p>You can use this option if you want to specify the group(s) and the env(s) when you run tests.</p> <img src="https://blogs.oracle.com/netbeansphp/resource/article_images/nb-codeception-additional-parameters.png" alt="Additional Parameters for Run Tests" /> <h4>Issues</h4> <p>The support is already available in <a href="http://bits.netbeans.org/download/trunk/nightly/latest/" target="_blank" title="Download Page">NetBeans development version</a>. Please test it. If you find some issues or enhancements, please report them to <a href="http://netbeans.org/community/issues.html" target="_blank" title="NetBeans Bugzilla">NetBeans Bugzilla</a> <em>(component php, subcomponent Codeception)</em>.</p> <p>Finally, thanks a lot, Tomas! He helped me and gave me some advices when we had some issues.</p> <p> </p>

Geertjan's Blog - July 26, 2015 09:45 PM
Viewing Cassandra Data in NetBeans IDE

Here's the latest status of Cassandra integration in NetBeans IDEyou can now open data into a sortable table or dump it into the Output window:

Source code is here for anyone who wants to contribute:

https://github.com/GeertjanWielenga/NetCassandraBeans

Adam Bien - July 25, 2015 10:31 AM
JAX-RS, DI, Maven and GlassFish Or The 10 Most Popular Videos Of "bienadam" Youtube Channel

  1. "A Little REST with JAX-RS 2.0 and Java EE 7"

    Views: 16839 Likes: 101
  2. "Lightweight Java EE"

    Views: 12588 Likes: 86
  3. "Structuring Java EE 7 Applications"

    Views: 11740 Likes: 64
  4. "How To Tackle JavaEE"

    Views: 10098 Likes: 75
  5. "Project LightFish--Java EE Telemetry For GlassFish"

    Views: 9515 Likes: 18
  6. "Creating Java EE 6 Projects With Maven 3"

    Views: 8639 Likes: 28
  7. "Hello JavaEE 7 with JAX-RS 2.0 + JSON"

    Views: 8359 Likes: 43
  8. "Hello JAX-RS"

    Views: 8046 Likes: 41
  9. "Dependency Injection, Inversion of Control and Convention over Configuration ...with JavaFX 8"

    Views: 7155 Likes: 20
  10. "Dependency Injection ...and there is no magic"

    Views: 6905 Likes: 54

See also other screencasts at: tv.adam-bien.com or subscribe to youtube.com/c/bienadam.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 25, 2015 07:09 AM
Setting Up an Environment for Cassandra/NetBeans Integration Development

After JCrete, a problem in continuing to work on the NetBeans/Cassandra plugin was that I didn't have Sven Reimers sitting next to me with his Cassandra cluster to which I connected for test data. So I had to set up a Cassandra cluster myself. Not a big problem with these instructions. Then I used the Cassandra Shell to create a keyspace, as described here. I liked the video data that Sven had available, so I used these Cassandra query scripts to recreate those, again via the Cassandra shell.

I also found the DataStax OpsCenter handy for taking a look at the structures I had created at this point:

Since I now had a running Cassandra cluster with live data, I was able to continue developing the plugin for NetBeans. As you can see, I can see the various structures from Cassandra in NetBeans, with some enhancements from last time, such as that the system keyspaces are separated from the user keyspaces (which will enable separate functionality for the user keyspaces) and that the data types are shown on the column nodes:

Next step is to find a nicer way to display the data from the user keyspaces. As you can see above, right now, everything is printed (neatly) into the Output window, ultimately some kind of grid is needed, maybe some kind of JavaFX component.

But the main win for the moment is that I now have a Cassandra cluster set up, with real data, that can be used while I continue developing the NetBeans plugin for Cassandra.

All the code for the plugin is available here: https://github.com/GeertjanWielenga/NetCassandraBeans

Michael's blog » NetBeans - July 24, 2015 09:09 PM
NetBeans Task Repository

With NetBeans, you are able to find or report task. To do such, you need to add a repository first. If you choose „Team, Find tasks…“ or „Team, Report Tasks…“ you may define a new repository. For example, if you … Weiterlesen

Geertjan's Blog - July 24, 2015 09:06 AM
Reverting Deleted Files

While checking the sources of the Cassandra/NetBeans integration into GitHub yesterday, something went very badly wrong and ALL the source files in my Maven project disappeared! Luckily I still had the Maven 'target' folder, which was untouched, I frantically searched for a Java decompiler online, decompiled the Java classes from the 'target' folder and then recreated my Maven project and eventually checked that in.

When I told Sven Reimers about this, he pointed out that in the IDE you can use the handy "Revert Deleted" feature. Let's say this is your project:

Now delete the Java source file you see above and right-click on the package (or anywhere in the ex-file's hierarchy) and choose History | Revert Deleted:

Hurray... there's the file again, the IDE still knows that the file existed:

Click OK above and your file is neatly returned to you, with all the content, and in the place, it originally had. Even after restarting the IDE, you'll still be able to do the above. Where is all this information stored? In the NetBeans cache directory (which is different to the NetBeans user directory), so, if you delete that directory, the information of deleted files will be lost and you'll not be able to revert again.

As a final step, go to the Options window and map "Revert Deleted" to a keyboard shortcut to make it an even faster process.

Of course, you should check things into a repository, e.g., GitHub. But normally, as in my case, you only put your GitHub repository together after you have created something significant enough to commit. If something, whatever it is, goes wrong during that initial process, the above procedure is extremely powerful, of course, and absolutely essential in these kinds of dire circumstances.

Geertjan's Blog - July 23, 2015 01:53 PM
Cassandra in NetBeans IDE at #jcrete

Here at JCrete in a hacker session with Pierre Laporte (@pingtimeout), Sven Reimers (@svennb), and Thomas Darimont (@thomasdarimont) we managed to put together the start of Cassandra integration in NetBeans IDE.

The Cassandra Driver Core API is really cool and simple to use and in almost no time at all we were able to connect to a Cassandra cluster on Pierre's machine, to which Sven and Thomas were connected as hosts. Look in the Services window below and you'll see the Cassandra node, with one connected host listed, together with tables made available by the cluster, as well as the possibility of displaying data. The data visualization is the next part to work on, probably in an OutlineView.

Source code is here:

https://github.com/GeertjanWielenga/NetCassandraBeans

A potential next feature after that is syntax coloring for Cassandra Query Language, here's the ANTLR for that:

https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/cql3/Cql.g

Geertjan's Blog - July 22, 2015 07:00 AM
Complex Node Hierarchies

When you're using the Nodes API, things can become a bit tricky, especially when you want to visualize different Node types on the same level within a hierarchy.

As an example, let's imagine our domain model represents music bands, e.g., 'Oasis', etc. Here's a very simple node hierarchy that simply lists the names of the bands, i.e., each Node below visualizes an underlying Band object that is defined by a name:

After you've done the above, you want to show the members of the band. So, now the Band object is defined by a name and a list of Members:

However, let's say each Band has a list of Members, as well as one Manager. Here things start getting a bit tricky. The ChildFactory class has a 'createNodesForKey' method that returns multiple Nodes, so your inclination would be to use that, something like this:

@Override
protected Node[] createNodesForKey(Band key) {
    int size = key.getMembers().size() + 1;
    Node[] nodes = new Node[size];
    for (int i = 0; i < key.getMembers().size(); i++) {
        try {
            nodes[i] = new MemberNode(key.getMembers().get(i));
        } catch (IntrospectionException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    try {
        nodes[size-1] = new ManagerNode(key.getManager());
    } catch (IntrospectionException ex) {
        Exceptions.printStackTrace(ex);
    }
    return nodes;
}

What the above gets you is a structure like this:

However, you're more likely to want the structure below instead, i.e., a container Node for all the Members, together with a leaf Node for the Manager, of which there will always be one:

To achieve the above, I learned this approach from Sven Reimers during JCrete:

public class MusicBandContainerChildFactory extends 
    ChildFactory<MusicBandContainerChildFactory.Container> {
    
    private final Band band;

    public enum Container {
        MEMBERS, MANAGER
    }
    
    public MusicBandContainerChildFactory(Band band) {
        this.band = band;
    }

    @Override
    protected boolean createKeys(List<Container> list) {
        list.add(Container.MEMBERS);
        list.add(Container.MANAGER);
        return true;
    }
    
    @Override
    protected Node createNodeForKey(Container key) {
        switch (key) {
            case MEMBERS: {
                try {
                    return new MemberContainerNode(key);
                } catch (IntrospectionException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
            case MANAGER: {
                try {
                    return new ManagerNode(key);
                } catch (IntrospectionException ex) {
                    Exceptions.printStackTrace(ex);
                }
            }
        }
        return null;
    }
    
    private class ManagerNode extends BeanNode {
        public ManagerNode(Container key) throws IntrospectionException {
            super(key);
            setDisplayName("Manager: "+band.getManager().getName());
        }
    }
    
    private class MemberContainerNode extends BeanNode {
        public MemberContainerNode(Container key) throws IntrospectionException {
            super(key, Children.create(new BandMemberChildFactory(band), true));
            setDisplayName("Members");
        }
    }
    
    private class BandMemberChildFactory extends ChildFactory<Member> {
        private final Band bean;
        public BandMemberChildFactory(Band bean) {
            this.bean = bean;
        }
        @Override
        protected boolean createKeys(List<Member> list) {
            list.addAll(bean.getMembers());
            return true;
        }
        @Override
        protected Node createNodeForKey(Member key) {
            BandMemberNode node = null;
            try {
                node = new BandMemberNode(key);
            } catch (IntrospectionException ex) {
                Exceptions.printStackTrace(ex);
            }
            return node;
        }
    }

    private class BandMemberNode extends BeanNode<Member> {
        public BandMemberNode(Member bean) throws IntrospectionException {
            super(bean, Children.LEAF);
            setDisplayName(bean.getName());
        }
    }
    
}

Thanks, Sven!

Geertjan's Blog - July 21, 2015 07:00 AM
Empty Node Populated On The Fly

Sometimes you need to create a Node that initially has no Children:

Later, when something has happened, e.g., as above, a menu item is clicked and a dialog is filled out, you want to populate the Node hierarchy:

How to achieve this?

Start by creating this class, to centrally manage changes:

import javax.swing.event.ChangeListener;
import org.openide.util.ChangeSupport;

public class PropertiesNotifier {
    private static final ChangeSupport cs = 
            new ChangeSupport(PropertiesNotifier.class);
    public static void addChangeListener(ChangeListener listener) {
        cs.addChangeListener(listener);
    }
    public static void removeChangeListener(ChangeListener listener) {
        cs.removeChangeListener(listener);
    }
    public static void changed() {
        cs.fireChange();
    }
}

Next, make sure that your Children are created only when a property change is received:

import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.nodes.BeanNode;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import org.openide.util.NbPreferences;

class MusicBandChildFactory extends ChildFactory.Detachable<String> {
    private final List<String> bandNames;
    private ChangeListener listener;
    public MusicBandChildFactory() {
        this.bandNames = new ArrayList<String>();
    }
    @Override
    protected void addNotify() {
        PropertiesNotifier.addChangeListener(listener = new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent ev) {
                String bandName = 
                        NbPreferences.forModule(MusicBandsNode.class).
                                get("bandName", "error!");
                bandNames.add(bandName);
                refresh(true);
            }
        });
    }
    @Override
    protected void removeNotify() {
        if (listener != null) {
            PropertiesNotifier.removeChangeListener(listener);
            listener = null;
        }
    }
    @Override
    protected boolean createKeys(List<String> list) {
        list.addAll(bandNames);
        return true;
    }
    @Override
    protected Node createNodeForKey(String key) {
        BeanNode node = null;
        try {
            node = new BeanNode(key);
            node.setDisplayName(key);
        } catch (IntrospectionException ex) {
            Exceptions.printStackTrace(ex);
        }
        return node;
    }
}

Finally, fire a property change at an appropriate moment, such as when the user has entered something into a dialog:

import java.io.IOException;
import javax.swing.Action;
import org.netbeans.api.core.ide.ServicesTabNodeRegistration;
import org.openide.*;
import org.openide.actions.NewAction;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
import org.openide.util.actions.SystemAction;
import org.openide.util.datatransfer.NewType;

@ServicesTabNodeRegistration(
        displayName = "#LBL_Bands",
        iconResource = "org/demo/enpotf/band.gif",
        name = "#LBL_Bands")
@NbBundle.Messages({"LBL_Bands=Music Bands"})
public class MusicBandsNode extends AbstractNode {
    public MusicBandsNode() {
        super(Children.create(new MusicBandChildFactory(), true));
        setDisplayName(Bundle.LBL_Bands());
        setShortDescription(Bundle.LBL_Bands());
        setIconBaseWithExtension("org/demo/enpotf/band.gif");
    }
    @Override
    public Action[] getActions(boolean context) {
        return new Action[]{SystemAction.get(NewAction.class)};
    }
    @NbBundle.Messages({
        "LBL_Title=Band Name Definition",
        "LBL_Text=Enter Band Name:"})
    @Override
    public NewType[] getNewTypes() {
        return new NewType[]{
            new NewType() {
                @Override
                public String getName() {
                    return Bundle.LBL_Title();
                }
                @Override
                public void create() throws IOException {
                    NotifyDescriptor.InputLine msg = new NotifyDescriptor.InputLine(
                            Bundle.LBL_Text(),
                            Bundle.LBL_Title());
                    Object result = DialogDisplayer.getDefault().notify(msg);
                    if (result == NotifyDescriptor.OK_OPTION) {
                        String bandName = msg.getInputText();
                        NbPreferences.forModule(MusicBandsNode.class).
                                put("bandName", bandName);
                        PropertiesNotifier.changed();
                    }
                }
            }
        };
    }
}

Adam Bien - July 20, 2015 04:45 AM
JPA: XML overrides Annotations

Java EE APIs operate in the "Convention over Configuration" or "Configuration by Exception" mode:

  1. APIs ship with suitable defaults
  2. Defaults can be overridden / supplemented via annotations
  3. Annotations can be overridden / supplemented via XML descriptors
  4. XML descriptors can be overridden via dedicated extension points, hooks (not available for all APIs)

JPA entities in particular can be deployed with minimalistic set (@Entity / @ID) of annotations first and overridden on demand:

"XML metadata may be used as an alternative to these annotations, or to override or augment annotations (...)"
[Chapter 11, Page 421, JSR-388: Java Persistence 2.1]

In JPA, supplementing, or even replacing annotations with orm.xml eases realization of following use cases:

  1. Product development: generic mappings can be partially adjusted during installation without recompiling the code
  2. Data migrations: entities are read from one persistence unit fully relying on annotations and writing to a persistence unit augmented by orm.xml
  3. Integration of external libraries / third party code: JavaBeans without existing source code can be augmented with orm.xml and turned into entities
  4. Separated read / write databases: a dedicated EntityManager is used for reading, another for writing. The database instances used behind the EntityManager may require mapping adjustments

However: premature configuration is the root of (all) evil. Most of the Java EE projects come without any configuration or XML and they fully rely on conventions "salted" with only a few annotations.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 19, 2015 09:48 AM
JMeter, Maven, and NetBeans IDE

Register the JMeter Maven plugin in your POM:

http://jmeter.lazerycode.com/

https://wiki.apache.org/jmeter/JMeterMavenPlugin

Then create a folder 'src/test/jmeter' in your Maven project. Install the JMeter plugin from Tools | Plugins and create a new JMeter Plan in the New File dialog (Ctr-N), in the 'src/test/jmeter' folder.

Build the project and notice that the JMeter Plan is run (click to enlarge the image below):

That's it. You can now run JMeter Plans during your Maven processes in NetBeans IDE.

Geertjan's Blog - July 18, 2015 07:00 AM
FAQ: JMeter and NetBeans IDE

I've been looking at JMeter in NetBeans IDE, there's some great documents available on this combination:

While setting up JMeter in NetBeans IDE, I encountered two problems that are both easy to resolve when you know about these solutions.

  1. The plugin takes a long time to install. Unpacking hangs at 67%, during the unpacking of 'org-netbeans-modules-loadgenerator.nbm'. When this happens, don't worry, just wait a bit longer, for me it took about 10 minutes and then the installation succeeded. See here for this insight.

  2. The "External Edit" menu item fails to work. I.e, it's very convenient that you don't need to install JMeter yourself, but very inconvenient that the JMeter installation that the NetBeans JMeter plugin installs for you doesn't start up. Following these instructions, I ran the 'jmeter.bat' in the NetBeans user directory, found on the command prompt what the problem was, and then opened jmeter.bat and deleted the line 'set EVACUATION=-XX:MaxLiveObjectEvacuationRatio=20%'.

That's it. Now you're ready to use JMeter in NetBeans IDE.

Geertjan's Blog - July 17, 2015 04:30 PM
Getting Started with Arquillian in NetBeans IDE

Arquillian is JUnit for Java EE applications. (Plus more.) Read all about its features here. Markus Eisele wrote an article about the usage of Arquillian with NetBeans, sometime ago, here:

http://blog.eisele.net/2012/01/arquillian-with-netbeans-glassfish.html

I took a look at Arquillian today, via a new Maven project that Aslak Knutsen from Arquillian has made available here:

https://github.com/aslakknutsen/arquillian-example-helloworld

Simply git the above and then go to File | Open Project in NetBeans and point to the folder that contains the POM. Because NetBeans is smart and able to recognize and parse the POM, it will open the Maven project and visualize its structure automatically, no import process of any kind is needed. Play around with the test class in the Maven project, i.e, add some new tests to it for the simple CDI sample or change the existing test, and then right-click the project and choose Test (Alt-F6). You'll see the integration of Arquillian with NetBeans IDE, i.e., the tests are run and the results are shown, as you can see here (click to enlarge the image):


Next, you can integrate with JaCoCo, to see your code coverage, as described here.

On Windows, I encountered the problem described here, which I resolved as described there, i.e., I set 'jbossHome' in the 'arquillian.xml' file. Then the first time the tests are run, there's a failure because WildFly cannot be found because it hasn't been downloaded yet. Next time you run the tests, the server is downloaded, thanks to Chameleon, and the 'jbossHome' property points to the correct location, i.e., in the 'target' folder and is then able to run the tests.

pandaconstantin's blog - July 17, 2015 01:46 AM
Developing professional Java application with NetBeans IDE at university

Last saturday, 11th july 2015, I was at Ecole Supérieure d'Informatique de Bobo Dioulasso for a training session on how to build a professional Java application with NetBeans IDE.
During five hours I did an overview of the editor and developed with attendees a small Java web application mixing PrimeFaces, JPA and Mysql as database.
The experience was a success since the students where very happy to learn the power of NetBeans and all the possibilities it offers to them. They found it very easy to use to build a sophisticated application and very fast as ever. This session has been also an opportunity to show that NetBean is not only Java editor, but a tool to build several kind of projects ( HTML5, PHP, Groovy, C/C++, etc). One of them was too enthusiastic and decided to move to NetBeans IDE for his Zend framework based project.

We NetBeans :)

This is a screenshot of the frontend of our application !

Adam Bien - July 16, 2015 09:42 AM
Java EE 7 + Thin WARs + Docker = Great Productivity

Java EE application servers separate the stable infrastructure from application code. Running Java EE applications (WildFly in the following screencast) on docker containers can significantly speed-up your build and start times. You only have to build what varies and not the whole infrastructure.

In the following screencast I'm running docker and the IDE on the same machine. In practice the server and development environments are separated what should result in even more dramatic results:

Thank you for watching, feedback is highly welcome!

See also other screencasts at:http://www.youtube.com/user/bienadam.

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 16, 2015 07:00 AM
New Book: Learn Java with NetBeans IDE

"We chose NetBeans because we think it's the best IDE for beginners and because it will help you to learn faster. It's also easy to use, free, and runs on all operating systems."

In the latest big fat (660 pages) Murach book, NetBeans IDE plays a key role:


The cover features NetBeans quite prominently:


Get it here: https://www.murach.com/shop/murachs-beginning-java-with-netbeans-detail

Geertjan's Blog - July 15, 2015 07:00 AM
New JavaScript Formatting Features in NetBeans IDE 8.1 (Part 3)

Here's the new Braces formatting feature for JavaScript files in NetBeans IDE 8.1:

Geertjan's Blog - July 14, 2015 07:00 AM
New JavaScript Formatting Features in NetBeans IDE 8.1 (Part 2)

Here's the new Alignment formatting feature for JavaScript files in NetBeans IDE 8.1:

Geertjan's Blog - July 13, 2015 07:00 AM
New JavaScript Formatting Features in NetBeans IDE 8.1 (Part 1)

In NetBeans IDE 8.0.2, these are the Formatting options that relate to JavaScript files:

Notice that in NetBeans IDE 8.1, new features have been added here:

In the next two blog entries, we'll look at the new features added above.

Michael's blog » NetBeans - July 12, 2015 08:53 PM
NetBeans and Java EE: Rename

As most of other modern IDEs, NetBeans supports a rename refactoring. Focus the variable, methods, class etc. you want to rename and press Ctrl+R. Alternatively you may open a context menu and choose „Refactor, Rename“. The rename not only affects … Weiterlesen

Adam Bien - July 12, 2015 12:52 AM
The Inevitability of Microservices With Java EE--An Interview At Devoxx.pl

Either you are lucky and you don't need them, or they just occur. A 7 mins interview about microservices at devoxx.pl:

Big thanks to lucy for the nice interview and great questions!

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE 7 Microservices.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 10, 2015 07:00 AM
Refactoring Java in NetBeans IDE 8.1 vs. 8.0.2

It may seem small, but it can be very powerful, once you learn the new keyboard shortcuts... refactoring in the next release of NetBeans:

Compare that to the current release of NetBeans, where the majority of the keyboard shortcuts above are not present:

Adam Bien - July 10, 2015 04:56 AM
Persisting An Annotation-Less POJO With JPA

To persist an annotation-less POJO with JPA:


public class Workshop {

    private long id;
    private String name;

    public Workshop() {
    }

    public Workshop(long id, String name) {
        this.id = id;
        this.name = name;
    }
}


you will have to provide the lacking metadata in a XML descriptor instead of annotations:

<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd"
                 version="2.0">
    <entity class="com.airhacks.jpa.orm.Workshop">
        <table name="T_WORKSHOP"/>
        <attributes>
            <id name="id">
                <generated-value strategy="AUTO"/>
            </id>
            <basic name="name">
                <column name="w_name" length="100"/>
            </basic>
        </attributes>
    </entity>
</entity-mappings>

The persistence.xml file has to point to the location of the orm.xml:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
                http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="it" transaction-type="RESOURCE_LOCAL">

        <mapping-file>META-INF/orm.xml</mapping-file>

        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="javax.persistence.jdbc.url"
                      value="jdbc:derby:./airhacksDB;create=true"/>
            <property name="javax.persistence.jdbc.driver"
                      value="org.apache.derby.jdbc.EmbeddedDriver"/>
            <property name="javax.persistence.schema-generation.database.action"
                      value="drop-and-create"/>
        </properties>
    </persistence-unit>
</persistence>

Now an annotation-less POJO can be stored using JPA:


import com.airhacks.rulz.em.EntityManagerProvider;
import org.junit.Rule;
import org.junit.Test;

public class WorkshopIT {

    @Rule
    public EntityManagerProvider provider = EntityManagerProvider.persistenceUnit("it");

    @Test
    public void crud() {
        provider.tx().begin();
        provider.em().merge(new Workshop());
        provider.tx().commit();
    }

}

The idea for this post came from 16th airhacks.tv Q&A. Big thanks to Eddy Young for asking this question.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - July 09, 2015 07:00 AM
Android Release APK via Cordova in NetBeans IDE (Part 2)

Got some notes from my colleague JB Brock on yesterday's blog entry:

  • The process you describe will build the release apk, but if you click on the Run icon in NB, it will use the sim-android ant target and that is still defaulted to debug.  It does not run the release apk on your device unless you add the --release to the sim-android target as well.

  • When you set the --release to the sim-android target, it does indeed create the release apk, but it fails to launch on the device if you don't have the proper certificates installed.

    ERROR: Failed to launch application on device: ERROR: Failed to install apk to device:     pkg: /data/local/tmp/android-release-unsigned.apk
    Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]


    So, while you can build it with --release, you cannot deploy it unless you have the proper keys setup.  That is another thing to look into.