Č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)
Pandaconstantin (feed)
blogtrader - Blog (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
markiewb's blog (feed)
Michael's blog » NetBeans (feed)
Gualtiero Testa » Netbeans (feed)
James Selvakumar's Blog » netbeans (feed)
nB gUru » NetBeans (feed)
Newsintegrator Blog » netbeans (feed)
Praxis LIVE » NetBeans (feed)
ProNetBeans (feed)
TechAshram » NetBeans (feed)
There's no place like 127.0.0.1 » Netbeans (feed)
Paulo Canedo » NetBeans English (feed)
Anchialas' Java Blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Optonline Webmail (feed)
Allan Lykke Christensen » NetBeans (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)
mkleint (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary's Blog (feed)
Neil's Dev Stuff (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
Bistro! 2.0 (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Wade Chandler's Programming Blog (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)
Manikantan's Netbeans (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Welcome to my live... (feed)
Netbeans IDE Blog by Tushar Joshi, Nagpur (feed)
Devel Blog (feed)
diamond-powder (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
August 29, 2014 02:06 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - August 29, 2014 04:01 AM
New Pattern, Play, Broken EJB Proxies, Network Files, Huge Apps--Or The 6th Airhacks Q & A

  1. What do you think about play framework as compared to JavaEE ? I often heard that JavaEE is heavyweight in development and therefore internet-startups uses other framework stacks like play, rails, meteor etc
  2. What would be the proper approach to read a network file in a J2E environment?
  3. “Open Extended Persistence Context In View” - a new pattern?
  4. ID generation in a cluster.
  5. State computation (daily limits) and scalability vs. consistency.
  6. Is JSF compatible with Bootstrap?
  7. The JSP / HTML 5 drama: The Return Of JSPs in HTML 5
  8. “How are you going to structure your application if application is going to be really huge. Are you still going to keep it in one big war?” blog comment by Thomas
  9. Commercial vs. free tools: gist discussion
  10. Is “Mixing storage/transfer concerns is an antipattern”? Rafael Chaves, @abstratt
  11. Broken EJB proxies? Brad Davies, @bradsdavis

See also https://gist.github.com/AdamBien/8735518ee671d7edb778

The questions above are going to be answered during the next "Airhacks Q & A" http://airhacks.io live. You can subscribe to the channel and / or for the next event: http://www.ustream.tv/channel/adambien.

If you miss a question, write a comment on this post, tweet your question with the hashtag "#airhacks" or mention me https://twitter.com/AdamBien.

The best of all: you can ask the questions live, during the show using the chat: http://www.ustream.tv/channel/adambien, twitter (hashtag "#airhacks") or (the best option): using channel ##airhacks on http://freenode.net.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


Real World Java EE Workshops [Airport Munich]>

Adam Bien - August 28, 2014 03:33 AM
DTO: The Exceptions From The Rule

Most JavaEE applications do not need a Data Transfer Object at all. Built-in support for JSON and XML does the transport job already. However, DTOs are still useful for special case handling like:

  1. Transferring a custom subset, superset (multiple entities) of entity data at once
  2. Dedicated optimizations like sophisticated JAXB mapping, customization of binary transfer e.g. hooks in http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html
  3. Role-dependent dataset: specific roles are only allowed to see specific data attributes. However, a http://docs.oracle.com/javaee/7/api/javax/json/JsonObject.html would solve such a job perfectly as well.
  4. Client-dependent view: native clients may request a different view to data as it can be provided by stock entities. Client may require a DTO per view independently of the organization on the server.
  5. Client technology may expect different contents e.g. a JavaFX client may expect a http://docs.oracle.com/javafx/2/api/javafx/beans/property/StringProperty.html instead of a plain String.

DTOs do not have to be justified in all the use cases above. The reason for introduction is obvious: a DTO is significantly different to the persistent domain object, or the technology forces you to introduce a DTO.

[See also an in-depth discussion in the "Real World Java EE Patterns--Rethinking Best Practices" book (Second Iteration, "Green Book"), page 273 in, chapter "Data Transfer Object", particularly the strategies "Generic DTO", "Client-specific DTO"]

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - August 26, 2014 08:10 AM
Thomas Stütz: Why NetBeans IDE is Great for Teaching Java

We've now met several teachers using NetBeans IDE in the classroom: Michiel Noback (Netherlands), Zoran Sevarac (Serbia), Pieter van den Hombergh (Netherlands)

Adam Bien - August 25, 2014 08:38 AM
JavaEE 7 Retired The DTO

The classic DTO solves the following problem:

"You want to transfer multiple data elements over a tier."

Back in the days a DTO was implemented as a Serializable anemic Java class only equipped with field accessors.

In Java EE the https://jax-rs-spec.java.net became a de-facto standard for remoting, so the implementation of Serializable interface is no more required. To transfer data between tiers in Java EE 7 you get the following options for free:

  1. JAXB: the popular application servers offer JSON, XML serialization for "free".
    
    @Entity
    @XmlRootElement
    @XmlAccessorType(XmlAccessType.FIELD)
    @NamedQuery(name = Registration.findAll, query = "SELECT r FROM Registration r")
    public class Registration {
    
        private static final String PREFIX = "com.airhacks.workshops.business.registrations.entity.Registration.";
        public static final String findAll = PREFIX + "all";
    
    
        @Id
        @GeneratedValue
        @XmlTransient
        private long id;
    
        @XmlTransient
        @Transient
        private BiFunction<Boolean, Integer, Integer> taxCalculator;
    
        private int numberOfDays;
        private int numberOfAttendees;
        private boolean vatIdAvailable;
        
        //...
    
    }
    
    
    [Registration.java from https://github.com/AdamBien/javaee-bce-archetype]
  2. With the introduction of Java API for JSON Processing, you can also directly serialize parts of your objects into JSON:
    
    @Path("health")
    @Produces(MediaType.APPLICATION_JSON)
    public class HealthResource {
    
        @Inject
        ServerWatch watch;
    
    
        @GET
        @Path("/current-memory")
        public JsonObject availableHeap() {
     JsonObjectBuilder builder = Json.createObjectBuilder();
    	builder.add("Available memory in mb", this.watch.availableMemoryInMB()).
    	add("Used memory in mb", this.watch.usedMemoryInMb());
    	return builder.build();
        }
        
        //...
    }
    
    
    [HealthResource.java from project ping]

Both approaches transport the data without any binary coupling to the origin object. The decoupling is even higher, as it was the case with the "traditional" (=code duplication) DTO implementation.

[See also an in-depth discussion in the "Real World Java EE Night Hacks--Dissecting the Business Tier" book, page 273 in, chapter "Data Transfer Object"]

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - August 23, 2014 07:34 AM
Tim Boudreau: Frequently Undiscovered Features in NetBeans

Tim Boudreau is a noted technology consultant, evangelist and author. Most broadly known for his leadership in the NetBeans project while it was part of Sun Microsystems, those who’ve worked with him remark most on his technical chops, passion for a challenge, and rare gift of great communication. And, as a former troubadour, he’s pretty tough when it comes to bad 70s rock lyrics too. A real...

Adam Bien - August 23, 2014 05:56 AM
NetBeans Rocks: Installation and Setup

NetBeans installation is fast and easy: no plugins, no configuration:

Enjoy Java hacking!


Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - August 22, 2014 08:57 AM
Eirik Bakke: My Five Favorite NetBeans IDE Features!

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Eirik Bakke from MIT. -- NetBeans team. Preview Text:  Eirik Bakke from MIT in Boston considers the Java editor, Maven support, and the clean NetBeans user interface to be among his favorite NetBeans features. ...

Adam Bien - August 22, 2014 07:40 AM
Mocking JPA EntityManager with Query

EntityManager is an interface and can be easily mocked out with https://code.google.com/p/mockito/.

At the same time the EntityManager is also a factory, which creates Query instance, which in turn creates results. Mocking a query involves therefore a three step (=three lines process):


public class RegistrationsTest {

    Registrations cut;

    @Before
    public void init() {
        this.cut = new Registrations();
        this.cut.priceCalculator = mock(VatCalculator.class);

        this.cut.em = mock(EntityManager.class);

		//...
    }

    void mockQuery(String name, List<Registration> results) {

        Query mockedQuery = mock(Query.class);
        when(mockedQuery.getResultList()).thenReturn(results);
        when(this.cut.em.createNamedQuery(name)).thenReturn(mockedQuery);

    }

After this step you can easily return whatever results you like:


    @Test
    public void convertEmptyListToJson() {

        mockQuery(Registration.findAll, Collections.EMPTY_LIST);

        final JsonArray result = this.cut.allAsJson();
        assertNotNull(result);
        assertTrue(result.isEmpty());
    }

If you would like to ignore the parameters, or react to specific query parameters, the method Query::setParameter needs to be mocked as well:


  when(mockedQuery.setParameter(Matchers.anyString(), Matchers.anyObject())).thenReturn(mockedQuery);

See the entire unit test: RegistrationsTest.java. The whole example is available as maven archetype.

Usually complex queries are going to be encapsulated in dedicated controls, so it is easier to mock out the whole control instead.

Interested in Java EE Code Quality and Testing? See you at http://workshops.adam-bien.com/about-testing.htm or regular http://airhacks.com
Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - August 22, 2014 07:00 AM
Over 300 "NetBeans Platform for Beginners" Sold

I've noticed that the authors of "NetBeans Platform for Beginners" have started exposing the number of sales they have achieved. Below, notice the '304' (which will probably change quite quickly) at the lower left end of this screenshot:

That's pretty good since the book has only existed for a few months and developers tend to share books they buy in PDF format. That probably means there are 300 teams of software developers around the world who are using the book, which is pretty awesome. (Though it would help the authors significantly, I'm sure, if individual developers on teams would buy the book, rather than sharing one between them. Come on, let's support these great authors so that they'll write more books like this.)

Also note that there is a set of reviewer comments on the page above:

Plus, the book is updated at the end of each month, so it continues to grow and improve from month to month, for free for everyone who has bought it.

If you've read the book and want to contribute a review like the above, contact walternyland @ yahoo dot com.

Great work, guys!

For anyone out there who hasn't got it yet: https://leanpub.com/nbp4beginners

APIDesign - Blogs - August 21, 2014 03:29 PM
Develop in NetBeans and Deploy to AppStore

Minesweeper for iOS has been published. First iBrwsr powered DukeScript application has been deployed to AppStore. If you own an iPad or iPhone, give it a try: https://itunes.apple.com/us/app/fair-minesweeper/id903688146

And don't forget you can use NetBeans to develop such applications yourself! Install DukeScript NetBeans support.

--JaroslavTulach 15:29, 21 August 2014 (UTC)

Geertjan's Blog - August 21, 2014 01:43 PM
RequireJS: JavaScript for the Enterprise

I made a small introduction to RequireJS via some of the many cool new RequireJS features in NetBeans IDE. I believe RequireJS, and the modularity and encapsulation and loading solutions that it brings, provides the tools needed for creating large JavaScript applications, i.e., enterprise JavaScript applications.

&amp;amp;amp;lt;span id=&amp;amp;amp;quot;XinhaEditingPostion&amp;amp;amp;quot;&amp;amp;amp;gt;&amp;amp;amp;lt;/span&amp;amp;amp;gt;

(Sorry for the wobbly sound in the above.)

An interesting comment by my colleague John Brock on the above:

One other advantage that RequireJS brings, is called lazy loading of resources. In your first example, everyone one of those .js files is loaded when the first file is loaded in the browser. By using the require() call in your modules, your application will only load the javascript modules when they are actually needed. It makes for faster startup in large applications. You could show this by showing the libraries that are loaded in the Network Monitor window.

So I did as suggested:

Click the screenshot to enlarge it and notice how the Network Monitor is helpful in the context of RequireJS troubleshooting.

Adam Bien - August 21, 2014 08:23 AM
How To Deal With J2EE and Design Patterns

Patterns are clearly defined as:

"In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design."
[http://en.wikipedia.org/wiki/Software_design_pattern].

If you encounter a design challenge, you are supposed to search in a catalog for the description, compare the Motivation (Forces) or Applicability. If they match, you can apply the ideas from the pattern to solve your problem. Patterns are not a genius solution to a problem, rather than a standardized compromise. Usually you are going to implement flavors of the design patterns without even knowing it.

In Java Enterprise community patterns seem to have their own live. They are going to be applied regardless their problem definition or context. The most misused pattern in the Java Enterprise community is the DTO. DTO was clearly defined as a solution for a distribution problem. DTO was meant to be a coarse-grained data container which efficiently transports data between processes (tiers). In J2EE DTO was absolutely necessary, CMP Entity Beans were not serializable. Martin Fowler also defines defines DTO as:

"An object that carries data between processes in order to reduce the number of method calls."
According to the definitions DTOs were never meant to carry data within a JVM...

Even more suspicious is the popularity of the DAO pattern. The solution statement starts as:

"The DAO implements the access mechanism required to work with the data source. The data source could be a persistent store like an RDBMS, an external service like a B2B exchange, a repository like an LDAP database, or a business service accessed via CORBA Internet Inter-ORB Protocol (IIOP) or low-level sockets."

DAO was always meant as a procedural encapsulation of inconvenient or not standardized data sources. An object oriented flavor, the Domain Store pattern uses DAO to access JDBC and provides an object oriented access to the store. Interestingly the Domain Store looks like a slightly modified version of the ...JPA Entity Manager.

Some projects are wrapping Entity Manager with an empty delegate and call it "DAO". Such an approach is actually the opposite of the origin intention...

Java EE 5 killed the majority of the J2EE Patterns. Their "Problem" and "Forces" descriptions do not apply any more. Java EE 6 and 7 killed the remaining patterns, only the Application Service is still useful.

If you take the pattern definitions seriously and look at some "enterprise" projects you are not going to understand the design. Patterns are going to be applied without having a problem and are considered as future "insurance": "...in case JPA disappears, I only have to change the implementation of the DAO..."

How to deal with patterns? Apply them if you encounter a problem. Java EE design is "bottom-up" rather than "top-down", as it was the case in the old J2EE world.

[See also an in-depth discussion in the "Real World Java EE Night Hacks--Dissecting the Business Tier" book, page 259 in, chapter "Data Access Object"]

We spend some time to eliminate J2EE and GoF patterns one by one with Java EE 7 and Java 8 during the Java EE Architectures "airhacks" workshops at MUC airport.
Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - August 21, 2014 06:41 AM
Weekly NetBeans News in Chinese

Liang Ding is a programmer and a blogger from China. He has worked for Alibaba doing online payments related development and now works at EPICPaaS on architecting and implementing a PaaS software platform. Preview Text:  Meet NetBeans Dream Team member Liang Ding, who leads the team that translates the NetBeans Weekly Newsletter! ...

Geertjan's Blog - August 20, 2014 04:05 PM
Asciidoctor / NetBeans

With Jason Lee's NetBake plugin (https://bitbucket.org/jdlee/netbake), when you've installed JRuby and then the Asciidoctor gem, you're good to go to use Asciidoctor with NetBeans IDE.

New Asciidoc files can be created, which have a Source view...

...and a Visual view. The current content of the text editor is parsed by the Asciidoctor gem and the resulting HTML is displayed in a JEditorPane:

Awestruct support is also part of the NetBake plugin, with a new project type and other related features. An Options window is included for configuring the plugin:

I've been in touch with Jason and we're discussing separating the Asciidoctor parts from the Awestruct parts and then putting them seperately as plugins on the NetBeans Plugin Portal.

NetBeans Zone - The social network for developers - August 20, 2014 11:32 AM
Web Development with Java and JSF: Author Interview with Michael Müller

Software developer, blogger and active NetBeans user Michael Müller has been a frequent reviewer of technical books. Now he has taken the leap from book reviewer to book author. Preview Text:  Software developer and blogger Michael Müller discusses his new book “Web Development with Java and JSF ”, a practical guide for Java developers to...

NetBeans Zone - The social network for developers - August 20, 2014 08:36 AM
NASA Conjunction Assessment with JavaFX and the NetBeans Platform

The Tracking and Orbit Determination Quality (TODQ) Viewer is a collection of prototype 2D and 3D interactive visualizations for analysis software updates by NASA Robotic Conjunction Assessment Risk Analysis (CARA) using Java and JavaFX 8.   Preview Text:  The Tracking and Orbit Determination Quality (TODQ) Viewer is a collection of...

Adam Bien - August 20, 2014 02:40 AM
igniter.fx 1.9.2 released--The Java 8 Edition

A new version of igniter.fx -- the maven "wizard" which creates a sample Java FX MVP application is released.

The 1.9.2 edition demonstrates afterburner's 1.6.0 capabilities like asynchronous FXML loading and view-dependent object injection.


@FXML
Pane lightsBox;
//...
LightView view = new LightView((f) -> red);
view.getViewAsync(lightsBox.getChildren()::add);


A passed constructor parameter (an int in the example below) can be conveniently injected into the presenter. Each presenter instance receives its own value:

public class LightPresenter{

    @FXML
    Circle light;

    @Inject
    int red;


See the full code: DashboardPresenter.java

igniter.fx is open source: https://github.com/AdamBien/igniter.fx

To create a an igniter.fx 1.9.2 maven project execute the following command from the CLI:


mvn archetype:generate -Dfilter=com.airhacks:igniter

You can also clone the sample source code directly from: https://github.com/AdamBien/followme.fx.

followme screenshot

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


Real World Java EE Workshops [Airport Munich]>

Michael's blog » NetBeans - August 19, 2014 09:06 PM
Copy Static Resources on Save

Have you heard about the series “My top 5 NetBeans features”? NetBeans users report their favorite features. I just want to point out only one small (and almost hidden), but valuable feature, which is included in the upcoming version NetBeans … Continue reading

NetBeans Zone - The social network for developers - August 19, 2014 06:21 PM
NetBeans Weekly News (Issue #653 - Aug 19, 2014)

Project News NetBeans in the Enterprise: Boeing What's Boeing doing with NetBeans? And what are some daily development tips that you might find useful in your own coding tasks? Join Michelle Chamberlin and Bruce Shimel as they share their favorite NetBeans features. Preview Text:  In this issue: James Gosling and others share why they use...

NetBeans Zone - The social network for developers - August 19, 2014 03:06 PM
Michelle Chamberlin and Bruce Shimel: My Five Favorite NetBeans IDE Features!

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Michelle Chamberlin and Bruce Shimel at Boeing, whose history with NetBeans IDE goes back many years. -- NetBeans team. Preview Text:  What do engineers at Boeing like about NetBeans IDE? Michelle Chamberlin and Bruce...

Java Evangelist John Yeary's Blog - August 19, 2014 02:16 PM
JSF 2.1 Tip of the Day: Clearing the @ViewScope

Introduction

I was trying to solve an issue in our code where the @ViewScope beans were not being garbage collected. I spoke a number of times with Manfred Riem at Oracle about the weirdness of this issue. The issue simply put was that we were facing a memory leak where the instances of @ViewScope objects were not being removed from the view map. As a result, the pages were being kept in memory. The view map is limited to 32 views which helped to hide the issue. In most cases, it would not appear to normal users of our application. The issue was suddenly evident when the view contained tens of thousands of objects. 32 x 10k is REALLY BIG! It really never made it to 32, the system would stall and crash at about 6 instances.

The Culprit

We had implemented our own custom NavigationHandler. This was working quite well on JSF 2.0.x, but a couple of things happened. The JSF implementation was changed to handle another view scope issue, and our implementation of the NavigationHandler was changed from my original code. The new handler did not handle cleaning up the @ViewScope object view map which is stored in the session. Oh, yeah, the view map in the session was the change to the API too.

The Solution

The solution turned out to be something simple, re-implement the same mechanism in the default NavigationHandler to clear the @ViewScope objects from the view map in the session.

Interesting Observations

I was trying to come up with a mechanism to clear the view map data from the session, and came up with a SystemEventListener to test out some ideas. I thought I would share the code for people to see how the map is cleared. This is an approach to the issue, but as I noted, it was actually something missed in our NavigationHandler. I thought I should post the code for anyone who was looking for ideas on how to manipulate the map, or clear data in it. So without further hesitation. Here is the code.

ViewMapSystemEventListener.java


To implement the listener, you need to add an entry to the faces-config.xml file as shown below.

faces-config.xml


Geertjan's Blog - August 19, 2014 12:37 PM
Gesture Based NetBeans Tip Infrastructure

All/most/many gestures you make in NetBeans IDE are recorded in an XML file in your user directory, "var/log/uigestures", which is what makes the Key Promoter I outlined yesterday possible. The idea behind it is for analysis to be made possible, when you periodically pass the gestures data back to the NetBeans team. See http://statistics.netbeans.org for details.

Since the gestures in the 'uigestures' file are identifiable by distinct loggers and other parameters, there's no end to the interesting things that one is able to do with it. While the NetBeans team can see which gestures are done most frequently, e.g., which kinds of projects are created most often, thus helping in prioritizing new features and bugs, etc, you as the user can, depending on who and how the initiative is taken, directly benefit from your collected data, too.

Tim Boudreau, in a recent article, mentioned the usefulness of hippie completion. So, imagine that whenever you use code completion, a tip were to appear reminding you about hippie completion. And then you'd be able to choose whether you'd like to see the tip again or not, etc, i.e., customize the frequency of tips and the types of tips you'd like to be shown.

And then, it could be taken a step further. The tip plugin could be set up in such a way that anyone would be able to register new tips per gesture. For example, maybe you have something very interesting to share about code completion in NetBeans. So, you'd create your own plugin in which there'd be an HTML file containing the text you'd like to have displayed whenever you (or your team members, or your students, maybe?) use code completion. Then you'd register that HTML file in plugin's layer file, in a subfolder dedicated to the specific gesture that you're interested in commenting on.

The same is true, not just for NetBeans IDE, but for anyone creating their applications on top of the NetBeans Platform, of course.

Geertjan's Blog - August 18, 2014 03:17 PM
Key Promoter for NetBeans

Whenever a menu item or toolbar button is clicked, it would be handy if NetBeans were to tell you 'hey, did you know, you can actually do this via the following keyboard shortcut', if a keyboard shortcut exists for the invoked action.

After all, ultimately, a lot of developers would like to do everything with the keyboard and a key promoter feature of this kind is a helpful tool in learning the keyboard shortcuts related to the menu items and toolbar buttons you're clicking with your mouse.

Above, you see the balloon message that appears for each menu item and toolbar button that you click and, below, you can see a list of all the actions that have been logged in the Notifications window. That happens automatically when an action is invoked (assuming the plugin described in this blog entry is installed), showing the display name of the action, together with the keyboard shortcut, which is presented as a hyperlink which, when clicked, re-invokes the action (which might not always be relevant, especially for context-sensitive actions, though for others it is quite useful, e.g., reopen the New Project wizard).


And here's all the code. Notice that I'm hooking into the 'uigestures' functionality, which was suggested by Tim Boudreau, and I have added my own handler, which was suggested by Jaroslav Tulach, which gets a specific parameter from each new log entry handled by the 'org.netbeans.ui.actions' logger, makes sure that the parameter actually is an action, and then gets the relevant info from the action, if the relevant info exists:

@OnShowing
public class Startable implements Runnable {
    @Override
    public void run() {
        Logger logger = Logger.getLogger("org.netbeans.ui.actions");
        logger.addHandler(new StreamHandler() {
            @Override
            public void publish(LogRecord record) {
                Object[] parameters = record.getParameters();
                if (parameters[2] instanceof Action) {
                    Action a = (Action) parameters[2];
                    JMenuItem menu = new JMenuItem();
                    Mnemonics.setLocalizedText(
                            menu,
                            a.getValue(Action.NAME).toString());
                    String name = menu.getText();
                    if (a.getValue(Action.ACCELERATOR_KEY) != null) {
                        String accelerator = a.getValue(Action.ACCELERATOR_KEY).toString();
                        NotificationDisplayer.getDefault().notify(
                                name,
                                new ImageIcon("/org/nb/kp/car.png"),
                                accelerator,
                                new ActionListener() {
                            @Override
                            public void actionPerformed(ActionEvent e) {
                                a.actionPerformed(e);
                            }
                        });
                    }
                }
            }
        });
    }
}

Indeed, inspired by the Key Promoter in IntelliJ IDEA.

Interested in trying it out? If there's interest in it, I'll put it in the NetBeans Plugin Portal.

Update 08/19/14: OK, here it is -- http://plugins.netbeans.org/plugin/55751

NetBeans Zone - The social network for developers - August 18, 2014 06:24 AM
Universal Maven for Teaching Java Desktop Applications

Ken Fogel is the Program Coordinator and Chairperson of the Computer Science Technology program at Dawson College in Montreal, Canada. He is also a Program Consultant to and part-time instructor in the Computer Institute of Concordia University's School of Extended Learning. Preview Text:  Regular NetBeans education columnist Ken Fogel, the Program...

Michael's blog » NetBeans - August 17, 2014 08:37 PM
webdevelopment-java.info launched

Today I launched my new web site http://webdevelopment-java.info. This site is related with my book “Web Development with Java and JSF”, which is a superset of my “Tutorial web development (with JSF)”. In fact, this book contains much more info … Continue reading

Geertjan's Blog - August 17, 2014 07:00 AM
Removing Menu Items from Window Tabs

So you're working on your NetBeans Platform application and you notice that when you right-click on tabs in the predefined windows, e.g., the Projects window, you see a long list of popup menus.

For whatever the reason is, you decide you don't want those popup menus. You right-click the application and go to the Branding dialog. There you uncheck the checkboxes that are unchecked below:

As you can see above, you've removed three features, all of them related to closing the windows in your application. Therefore, "Close" and "Close Group" are now gone from the list of popup menus:

But that's not enough. You also don't want the popup menus that relate to maximizing and minimizing the predefined windows, so you uncheck those checkboxes that relate to that:


And, hey, now they're gone too:


Next, you decide to remove the feature for floating, i.e., undocking the windows from the main window:

And now they're gone too:

However, even when you uncheck all the remaining checkboxes, as shown here...

You're still left with those last few pesky popup menu items that just will not go away no matter what you do:

The reason for the above? Those actions are hardcoded into the action list, which is a bug. Until it is fixed, here's a handy workaround:

  1. Set an implementation dependency on "Core - Windows" (core.window). That is, set a dependency and then specify that it is an implementation dependency, i.e., that you'll be using an internal class, not one of the official APIs.

  2. In one of your existing modules, or in a new one, make sure you have (in addition to the above) a dependency on Lookup API and Window System API.

  3. And then, add the class below to the module:
    import javax.swing.Action;
    import org.netbeans.core.windows.actions.ActionsFactory;
    import org.openide.util.lookup.ServiceProvider;
    import org.openide.windows.Mode;
    import org.openide.windows.TopComponent;
    
    @ServiceProvider(service = ActionsFactory.class)
    public class EmptyActionsFactory extends ActionsFactory {
    
        @Override
        public Action[] createPopupActions(TopComponent tc, Action[] actions) {
            return new Action[]{};
        }
    
        @Override
        public Action[] createPopupActions(Mode mode, Action[] actions) {
            return new Action[]{};
        }
        
    }

Hurray. Farewell to superfluous popup menu items on your window tabs. In the screenshot below, the tab of the Projects window is being right-clicked and no popup menu items are shown, which is true for all the other windows, those that are predefined as well as those that you add afterwards:


Adam Bien - August 15, 2014 09:41 AM
Special Business Logic Treatment Considered Harmful in Java EE

Prior Java EE 5 (2006, see the whole history in: http://realworldpatterns.com) your application code had to realize J2EE interfaces and was forced to implement several infrastructural methods. The amount of plumbing was significant and the business logic was hard to understand.

With the introduction of annotations in JDK 1.5 and the introduction of Dependency Injection paired with Convention over Configuration in Java EE 5 your application code is only dependent on annotations which are comparable to the Marker Interface pattern. Java EE 6 went even further, so you can implement large portions of business logic without being even dependent on any Java EE annotations.

Also the main goal of the outdated http://www.corej2eepatterns.com was the separation of "clean" business logic and the "polluted" J2EE infrastructure. Now the majority of the J2EE patterns solves no more existing problems, mostly problems being already solved in the recent Java EE releases.

With Java EE 5+ any attempt to separate your business logic from Java EE infrastructure will result in empty delegates, parallel and identical object hierarchies, increased complexity and harder maintainability.

Stop plumbing, focus on business logic and added value to your customers :-)

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!


Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - August 15, 2014 07:44 AM
Simon Martinelli: My Five Favorite NetBeans IDE Features!

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Simon Martinelli. -- NetBeans team. Preview Text:  Polyglot language support, the myriad "out of the box" features, support for Maven and other build tools, "beginner friendliness", and JPQL code...

Geertjan's Blog - August 14, 2014 11:36 AM
Sin IDE: Best Of All Worlds

Sin IDE is... a super slick and snappy mashup of Sublime Text + IntelliJ IDEA + NetBeans IDE.

Click to get a fuller picture:

Featuring a firy brew of free and out of the box tools for seamless work with Git, Mercurial, Subversion, Maven, Gradle, Java, JUnit, TestNG, FindBugs, Java EE, JavaFX, Java Profiler, Tomcat, TomEE, GlassFish, WildFly, WebLogic, MySQL, Oracle DB, Java Derby, embedded JavaFX WebKit browser, AngularJS, KnockoutJS, RequireJS, NodeJS, Bower, Karma, Grunt, HTML5, CSS3, JavaScript, Chrome Developer Tools, PhoneGap/Cordova, IoT, Oracle Cloud, Raspberry Pi, PHP, C/C++ and much much more, the top ten of which are here.

Promo material consists of a t-shirt featuring a laughing demon on the front and the logo "So good, it's sinful" on the back in flames...

NetBeans Zone - The social network for developers - August 13, 2014 09:50 AM
Thorsten Marx: My Five Favorite NetBeans IDE Features!

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Thorsten Marx. -- NetBeans team. My name is Thorsten Marx and I’m working as product manager and developer at e-Spirit AG in Germany. Preview Text:  Maven, Bugzilla/JIRA, Profiler, project views, FindBugs, Sonar......