Č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
APIDesign - Blogs (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Inspiration and Expression » Netbeans (feed)
Adam Bien (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
NetBeans Ruminations » NetBeans (feed)
NetBeans – Java PDF Blog (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)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Netbeans – Gualtiero Testa (feed)
netbeans – James Selvakumar’s Blog (feed)
NetBeans – nB gUru (feed)
netbeans – Newsintegrator Blog (feed)
NetBeans – Praxis LIVE (feed)
NetBeans – TechAshram (feed)
Netbeans – There's no place like 127.0.0.1 (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Neil's Dev Stuff (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
NetBeans – John O'Conner (feed)
Bistro! 2.0 (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (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)
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:
April 29, 2016 10:05 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - April 28, 2016 02:09 PM
MVC, MVP, IoC, DI or A Deeper Dive Into afterburner.fx

What is the difference between MVC and MVP? How does the Dependency Injection work? Is it possible to UI-designers in production? How to implement an extension mechanism with plain Java SE? In this late night session I answered most of the questions with code as well as explained the inner workings of afterburner.fx.

Thanks to Silicon Valley JavaFX User Group for hosting this event.

Any questions left? Then join the conversation at each first Monday of the month at 6 P.M. live. No registration or any other commitment required. Checkout also past shows.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 27, 2016 11:03 AM
afterburner.fx v1.7.0 "Branch Terminator" Released

afterburner.fx is an opinionated MVP framework with built-in, conventional Dependency Injection implemented by a single class.

The v1.7.0 release comes with swappable DI mechanism. An extensible DI enables the contributors to implement project-specific conventions and will so eliminate many open pull request. The release v1.7.0 also deprecates the "Top Gun" branch.

To create your own Injector:

  1. Implement the functional interface: com.airhacks.afterburner.injection.PresenterFactory
  2. Specify the fully qualified name of the implementation in the file: META-INF/services/com.airhacks.afterburner.injection.PresenterFactory

A no-op injector already ships with afterburner.fx as a part of the unit test:


public class DebuggingInjector implements PresenterFactory {

    @Override
    public <T> T instantiatePresenter(Class<T> clazz, Function<String, Object> injectionContext) {
        System.out.println("--- clazz " + clazz + " context " + injectionContext);
        return Injector.instantiatePresenter(clazz, injectionContext);
    }

}

Checkout github.com/AdamBien/afterburner.fx. The v1.7.0 is already available in maven central:

<dependency>
  <groupId>com.airhacks</groupId>
  <artifactId>afterburner.fx</artifactId>
  <version>1.7.0</version>
</dependency>

Also take a look at: github.com/Naoghuman/NetBeansIDE-AfterburnerFX-Plugin

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 26, 2016 08:02 AM
@Stateless As JAX-RS Resource?

@Stateless EJBs are an interesting component to be used as JAX-RS resource. They come with out-of-the-box method monitoring:

Are you interested in monitoring and microservices? Checkout javaeemicro.services

See you at HTML 5, JavaScript, Microservices and Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

NetBeans – Java PDF Blog - April 26, 2016 08:00 AM
How to setup the Red Hat OpenShift cloud

Whilst busy working away on various software at IDR Solutions it occurred to me its been a whilst since I wrote another cloud article, so you can guess what time it is. This time I have been playing around with Red Hat’s OpenShift Paas cloud. Best thing about this cloud? There is no 30 day free trial where you have to enter your card details and pray it doesn’t charge your account once the trial is up. You get allocated a small amount of resources and have the ability to create up to 3 web applications or gears as they are called on this cloud with 1GB storage each, making it perfect for you to explore and learn the ropes without feeling too rushed. You can learn more about the free plan here.

Last time I wrote about ‘How to use the Layershift Jelastic Cloud with the NetBeans IDE‘. This time I will show you how to to create a web application, test it locally and then deploy the application to the OpenShift cloud through NetBeans. I use a Windows system so some commands or steps may differ slightly for other operating systems.

What you will need before you start:

  • – Git installed and setup. You can check if you have git installed using git –version which will return your current git version if it exists. 11.checkGitVersion
  • Tomcat 7 Server installed locally and added to your NetBeans IDE – if you haven’t got this then I have explained how to carry this out in Step 5 and 6 of my Layershift cloud tutorial 

1. Sign up to an OpenShift account

Like I said before no credit cards are needed. Just pop your details into this OpenShift registration form and you will receive an email confirmation of your sign up. Now you will have access to your OpenShift Web Console where you can create and view applications. There are two ways to create applications. You could either create an application in the web console (where you can view all of your different options) or you can create one using the rhc command line tool if you already know which server you want. We will be carrying out the latter.

0.createFirstApp

2. Download ruby

The rhc command line tool can be installed through Ruby and the easiest way to download Ruby is using the appropriate installer. I am using a windows system for this tutorial so please bear in mind that some of the commands may be different depending on your operating system, but in that case you can follow OpenShift’s own tutorial to download the rhc tools as it caters for different operating systems.

You can get the ruby installer from here.  Make sure you get the Ruby 1.9.3 version as later versions do not work and will only bring you insurmountable grief. 

7.2 selectRubyInstaller

When the installer is executing accept the licensing agreement and make sure the “Add Ruby executable to PATH” check box is selected, so that you can access Ruby quickly and easily from the command prompt. Finally click install.

9.addRubyToPath

You can check that Ruby was installed properly using ruby -v command. Just as a reminder, the Windows command prompt cannot detect changes to your Environmental Variables when it is open so make sure your close any open instances of command prompt and re-open to test this command. If this does not work then Ruby wasn’t installed correctly and you will have to try again.

10.checkRubySetup

3. Download rhs client tools

Now that we have Ruby installed we can use the Windows command prompt to download the client tools with the command gem install rhc.

Once this has completed you need to run rhc setup. This command will connect your system to your web console and it will also generate an authorization token that will be used to authenticate your system to your web console. You also need this token when you want to clone your git repository to NetBeans.

Press enter when prompted for the server hostname, then enter your username and password that you used to sign up for your OpenShift account.

12.generateToken

When asked if you want to upload a public ssh key enter yes. This will generate a new key for your system which by default will be named id_rsa.pub and will be stored in C:\Users\yourUserName\.ssh

13.uploadssh

4. Create a domain

A domain is where we will store our applications. You can create a domain using: rhc domain create domainName. I have called my domain idrsolutions.

createDomain

5. Create an application

We want to create a Tomcat 7 application so we need to use rhc app-create testApp tomcat7 which will generate something similar to the below code. I have highlighted two bits of information that you should take an interest in. The first one is the URL where your application will be hosted. There is also the GIT remote ssh which you will use to clone, push, pull, etc your code for this application.

14.createAppHighlighted-shadedYou can get this information in your web console too. Just go to Applications and select your app.

testAppInConsole

6. Clone the application to NetBeans

Now that we have the application created we can clone the project into NetBeans. The menu’s in NetBeans are context sensitive so the clone menu item could be in either in Team -> Remote -> Clone  or  Team -> Git -> Clone

cloneProject

cloneProject2

 

Then you need to enter your ssh into the Repository URL section. NetBeans should then detect your username is part of the ssh you entered and cut and paste that section into the username bit.

In case NetBeans doesn’t pick this action up here is an example ssh, username and repository URL:
SSH: ssh://4386ggfnjdwtgbtrdvbet434@testapp2-idrsolutions.rhcloud.com/~/git/testapp2.git/
Username: 4386ggfnjdwtgbtrdvbet434
URL:  ssh://testapp2-idrsolutions.rhcloud.com/~/git/testapp2.git/

remoteRepos

Then set the private key to the key we created earlier to C:\Users\yourUserName\.ssh\id_rsa

Finally click NextNext and Finish and your application should be pulled. You will have to open it from where you saved the project. Your projects should look like this:

projectStructure

7. Edit the application

We are going to change the index.html file so that it displays the customary Hello, World! that everybody knows and loves. So open that file and change the contents to:

<!doctype html>
<html>
<body>
<p>Hello, World!<p>
</body>
</html>

Now that we have edited the application we want to make sure it works locally. Right click your top most project node (testApp) and select Run. You will be asked to select your deployment server. A prerequisite of this tutorial was to have your Tomcat server set up and running in NetBeans so you can just select that instance. Then select Remember Permanently so you do not have to repeat this step. Click OK  and you should receive a page like this:

worksLocally

8. Push your changes

Now that we have edited the application and confirmed that it works locally, we can push our change to the cloud. Firstly, right-click your top-most node (testApp) and select Git -> commit. Enter a useful message and click commit.

commitMessage

Then you need to push your commit by right-clicking your top-most node (testApp) again and selecting Git -> Remote -> Push to upstream.  

push

9. Open your application in your web browser

Your changes could take a few minutes to be retrieved and processed by the server. The server will show a Building status when it receives changes and a Started status when it is running again.

buildinApp

Once the Starting status has been reached you can open your application from the URL e.g. http://testapp-yourDomain.rhcloud.com/

romeoteWorkingAnd there you have it. How to setup and run an applications for the OpenShift cloud using the NetBeans IDE.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (TwitterFacebook and Google+) or the  Blog RSS.

  • Display your Documents
<>

The post How to setup the Red Hat OpenShift cloud appeared first on Java PDF Blog and was written by Georgia Ingham.

Geertjan's Blog - April 26, 2016 07:01 AM
Flexbox and Oracle JET (Part 2)

Following on from part 1, we're going to look at the CSS classes "oj-flex" and "oj-flex-item".

Here is the official documentation where you will see these CSS classes defined:

http://www.oracle.com/webfolder/technetwork/jet/stylingdoc.html

Also, the JET Developer's Guide also contains additional information about Oracle JET's flex layout and grid systems in the Designing Responsive Applications chapter at:

http://docs.oracle.com/middleware/jet201/jet/developer/GUID-67956274-4056-4D54-8BC7-18942DA7338A.htm#JETDG263

You might find the topics describing Oracle JET's use of media queries, flex layouts, and the grid system helpful in the above chapter.  

Spot "oj-flex" and "oj-flex-item" in the screenshot below, which is a slightly tweaked part of "index.html" in the "Oracle JET Quick Start Basic":

Here, in bold, is where they are: 

<div class="oj-web-applayout-max-width oj-web-applayout-content">
  <div class="oj-flex">
    <div class="oj-lg-9 oj-sm-12 oj-flex-item oj-flex">
      <div id="mainContent" role="main" class="oj-panel oj-margin oj-flex-item"
           data-bind="ojModule: router.moduleConfig">
      </div>
    </div>
    <div class="oj-lg-3 oj-sm-12 oj-flex-item">
      <div id="complementaryContent" role="complementary" class="oj-panel oj-margin oj-flex-item"
           data-bind="ojModule: {viewName: 'compContent'}">
      </div>
    </div>
  </div>
</div>

Now that you have spotted the places where "oj-flex" and "oj-flex-item" are used, let's hone in on one specific section, shown in bold below:

<div class="oj-web-applayout-max-width oj-web-applayout-content">
  <div class="oj-flex">
    <div class="oj-lg-9 oj-sm-12 oj-flex-item oj-flex">
      <div id="mainContent" role="main" class="oj-panel oj-margin oj-flex-item"
           data-bind="ojModule: router.moduleConfig">
      </div>
    </div>
    <div class="oj-lg-3 oj-sm-12 oj-flex-item">
      <div id="complementaryContent" role="complementary" class="oj-panel oj-margin oj-flex-item"
           data-bind="ojModule: {viewName: 'compContent'}">
      </div>
    </div>
  </div> 
</div> 

The above segment in bold is the place where the main content will be found. In the first line in bold above, notice the "oj-flex", which is set on the "div" that the main content modules will be put into. Anytime you have a container, inside that container you can nest in items. If you want to make something not only be an item within a container, via "oj-flex-item", but the start of a new container, then just add "oj-flex" along with "oj-flex-item".

Let's now take the view of the "people" module, i.e., "people.html", to experiment with "oj-flex" and "oj-flex-item". Go to people.html" and let's build something up from scratch. The first thing to think about is: "How many rows do I want?" If you think about rows first, or about how many vertical containers, that's the best way to start working with Flex Layout. Then, you can adjust items inside of those rows, i.e., these are the Flexbox containers, as you go along.

In "people.html", let's start simply like this:

<h1>People Layout</h1>
<div class="oj-flex-item">
</div>

Right now, what we've got is one "div", which has been set as an "oj-flex-item". It has nothing in it and you can't tell that it's there when you look in the page, which will just be blank, aside from the "h1" content. A good tip when doing layouting with Flex Layout, i.e., at least during development, is to add an "oj-panel":

<h1>People Layout</h1>
<div class="oj-flex-item oj-panel">
</div> 

In the browser, you now see a little border, and you can tell where things are at, roughly:

Therefore, the "oj-panel" is very useful when laying things out, to see where the containers and items are fitting within the page, regardless of whether you ultimately want to use "oj-panel" in the actual release of your product. It enables you to see what the padding is, while you can also use different colors in the background by using different alternate panels, too.

If that is our first row, let's put that in there: 

<h1>People Layout</h1>
<div class="oj-flex-item oj-panel"> 
   first row
</div>

Of course, the above will have this result:

Then copy that and put in a few of them, as follows: 

<h1>People Layout</h1>

<div class="oj-flex-item oj-panel">
    first row
</div>
<div class="oj-flex-item oj-panel">
    second row
</div>
<div class="oj-flex-item oj-panel">
    third row
</div>

From this point, let's just focus on the rendering of the "people.html", i.e., in this screenshot that's all you see, without all the content around it:

As you can see, the items are stacking up, they're looking OK, though they definitely don't have the padding around them that we would like, according to the Oracle Alta UI. Let's add a margin to each item, as follows:

<h1>People Layout</h1>

<div class="oj-flex-item oj-panel oj-margin">
    first row
</div>
<div class="oj-flex-item oj-panel oj-margin">
    second row
</div>
<div class="oj-flex-item oj-panel oj-margin">
    third row
</div>

Now we have some padding in there:

That's the default that "oj-margin" gives us, from the Oracle Alta UI spec. Rather than overriding it, if needed, the better approach is to create your own CSS margin class, since the various Oracle JET components also make use of "oj-margin" and hence if you change "oj-margin" itself, you may end up with unintended side effects.

Where we are now is that we have three "oj-flex-items", which are all contained by the "oj-flex" container in "index.html". Now, let's say that in the second row, i.e., the second "oj-flex-item", we want to put three or four other items:

Getting to the above point is as simple as nesting new "oj-flex-items", like this, i.e., below, only the items in bold have been added: 

<h1>People Layout</h1>

<div class="oj-flex-item oj-panel oj-margin">
    first row
</div>
<div class="oj-flex-item oj-panel oj-margin">
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 1
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 2
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 3
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 4
    </div>
</div>
<div class="oj-flex-item oj-panel oj-margin">
    third row
</div>

However, probably you don't need that whole border along the outside of the second level items. And maybe you want them to be side-by-side, instead. Right now, we have an "oj-flex-item", which contains other instances of "oj-flex-item". Since they're all "items", they're still children of the "container" item in the "index.html" page. Really, what you would like is for the second level items to be items for the "div" element that contains them. Therefore, let's add in an "oj-flex", which will turn that "div" element into a container:

<div class="oj-flex oj-flex-item oj-panel oj-margin">
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 1
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 2
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 3
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 4
    </div>
</div>

The above is the only change I have made and now I have the following layout:

Once you set a "div" as being a container, you enable it to control its own content. By default, containers flow in a row, as you can see above. The "flex-direction" property is, by default, set to "row". You can set that to "column", instead, as will be shown later in this article, as well as "reverse row" and "reverse column". The reverse classes probably might mess things up for RTL languages, which Oracle JET automatically incorporates. You can also mess with the order, overriding the DOM order, which might cause conflicts with accessibility requirements and RTL language support, though. Be aware that this flexibility exists, if needed, as well as the problems that might occur.

If you remove "oj-panel" and "oj-margin" from that "div" element, you will have a layout like this:

The inner items are now all in a row, without a panel around them. Once you set up a container, by default, the items inside it are going to resize to fit the container. So, if you remove one of the inner items, in "people.html", you will automatically have the resize effect and the result will be as follows:

Automatically, the inner items stretch across and take up the space in order to position the three items equally.

Let's now go a step further and add inner items to the third "div", after making that "div" a container, while removing its panel and margin. We'll also put back the fourth inner item in the second "div", as a starting point:

<h1>People Layout</h1>

<div class="oj-flex-item oj-panel oj-margin">
    first row
</div>
<div class="oj-flex oj-flex-item">
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 1
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 2
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 3
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 4
    </div>
</div>
<div class="oj-flex oj-flex-item">
    <div class="oj-flex-item oj-panel oj-margin">
        3 - 1
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        3 - 2
    </div>
</div>

The result is as follows:

There are now 4 columns in the middle and 2 across the bottom. As you resize this, the rows are maintained, becoming smaller and smaller as you make the browser smaller:

However, let's say that we want the items in the second row to stack as we move smaller, i.e., as we get to a phone-size resolution. Since items inherit from their container, we'll use the "flex-direction" property, mentioned earlier, to switch from the default "row" direction to "column", when the resolution is "small", i.e., on mobile devices. Take note of the addition below, in bold:

<div class="oj-sm-flex-direction-column oj-flex oj-flex-item">
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 1
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 2
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 3
    </div>
    <div class="oj-flex-item oj-panel oj-margin">
        2 - 4
    </div>
</div>

The above causes a problem immediately because even when you're not in a small resolution, the rows are now columns, while we only wanted that for small resolutions. Be aware that when you use these resolution-related breakpoints, the related CSS classes work from whatever size you tell them on up. In this particular case, we're telling the items in a container to be small, and on up. When I look in my page, of course it's going to drop into a columnar layout, even on large and extra large.

If we only want the columnar direction on small, there are classes for small only, notice the difference below:

<div class="oj-sm-only-flex-direction-column oj-flex oj-flex-item"> 

And now, only when the resolution is small, will you see the columnar layout:

Also notice that the container below the one we've been working with is still making use of the default "row" direction.

More will come in the next part of this series, with an increasing focus on overriding default behavior, though the above should give a clear overview of the usage and advantages of Flexbox in Oracle JET. Many thanks to JB Brock for all the info above.

Adam Bien - April 25, 2016 10:59 AM
Memory Footprint: Tomcat vs. TomEE WebProfile vs. TomEE Plus

How much memory can you save with plain servlet container, like Tomcat comparing to full-blown application server tomee.apache.org (Plus)? (it is a popular FAQ). In this screencast I launched Tomcat, TomEE WebProfile and TomEE Plus and measured the total footprint (docker image + Java + server):

All images used in this screencast are available from: docklands.

Note: a 16 GB Server ECC RAM is currently available for 100 USD

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 25, 2016 07:00 AM
Flexbox and Oracle JET (Part 1)

CSS Flexible Box Layout Module Level 1, a.k.a. Flexbox, is a new layout mode in CSS3, and is the recommended strategy for doing CSS layouting in Oracle JET applications. Here is the Oracle JET Cookbook item on Flex Layout in Oracle JET 2.0:

http://www.oracle.com/webfolder/technetwork/jet/uiComponents-flex-basics.html

Also take a look at the right column on the page above, where you'll find a heap of options to finetune the basic scenario. 

Flex Layout is the latest version of responsive CSS layout that is available starting in Oracle JET 2.0 and above, i.e., Oracle JET 2.0.1 is the most recent release of Oracle JET. The Cookbook lists quite a lot of options that Oracle JET provides, which are helper classes on top of Flexbox. All of the Flex Layout support in Oracle JET really just follows Flexbox itself. To that end, if you want to learn more about Flexbox, understand its background and functionality and things like that, you're recommend to read this:

https://css-tricks.com/snippets/css/a-guide-to-flexbox/

You'll learn about the background of Flexbox, as well as its terminology, from the above. The main two things that you need to know is that you'll be dealing with a "container" and then "items", which are inside a container. As long as you bear in mind that you're nesting items within containers, where some items may themselves be containers for other items, that's the main paradigm to get a handle on.

Let's take a look at some examples now. If you use the "Oracle JET Quick Start Basic", your user interface looks as follows:

The above three areas, i.e., Navigation, Main Content Area, and Complementary, are defined like this in the "index.html" file:

And here it is as copyable raw text:

<div class="oj-web-applayout-max-width oj-web-applayout-content">
  <div class="oj-flex">
    <div class="oj-xl-3 oj-lg-3 oj-sm-12 oj-flex-item oj-flex">
      <div id="navigationContent" role="navigation" class="oj-panel oj-margin oj-flex-item"
        data-bind="ojModule: {viewName: 'navContent'}">
      </div>
    </div>
    <div class="oj-xl-6 oj-lg-9 oj-sm-12 oj-flex-item oj-flex">
      <div id="mainContent" role="main" class="oj-panel oj-margin oj-flex-item"
        data-bind="ojModule: router.moduleConfig">
      </div>
    </div>
    <div class="oj-xl-3 oj-sm-12 oj-flex-item oj-flex">
      <div id="complementaryContent" role="complementary" class="oj-panel oj-margin oj-flex-item"
      data-bind="ojModule: {viewName: 'compContent'}">
      </div>
    </div>
  </div>
</div>

Now, let's say we want to modify the layout so that the navigation is not shown, while the main content area takes up that extra space left by the absent navigation area:

To do this, comment out the navigation section and tweak the numbering of the main content area section. The changes are in bold below

<div class="oj-web-applayout-max-width oj-web-applayout-content">
  <div class="oj-flex">
    <!--<div class="oj-xl-3 oj-lg-3 oj-sm-12 oj-flex-item oj-flex">
      <div id="navigationContent" role="navigation" class="oj-panel oj-margin oj-flex-item"
        data-bind="ojModule: {viewName: 'navContent'}">
      </div>
    </div>-->
    <div class="oj-xl-9 oj-lg-12 oj-sm-12 oj-flex-item oj-flex">
      <div id="mainContent" role="main" class="oj-panel oj-margin oj-flex-item"
        data-bind="ojModule: router.moduleConfig">
      </div>
    </div>
    <div class="oj-xl-3 oj-sm-12 oj-flex-item oj-flex">
      <div id="complementaryContent" role="complementary" class="oj-panel oj-margin oj-flex-item"
      data-bind="ojModule: {viewName: 'compContent'}">
      </div>
    </div>
  </div>
</div>

The column classes work in conjunction with the Flex Layout. Read all about them here:

http://www.oracle.com/webfolder/technetwork/jet/stylingdoc.html

Media query device relationships roughly align with the following:

  • sm = handheld device (phone)
  • md = iPad portrait mode
  • lg = iPad landscape
  • xl = desktop (larger than 1024px width)

When a size is used, it means that size and up. That's a key concept to get an understanding of. This is how all CSS-based grid systems work, by the way. Even Twitter Bootstrap works this way.

So, this...

<div class="oj-xl-3 oj-lg-3 oj-sm-12 oj-flex-item oj-flex">

...means this:

  • for small on up make this div take up 12 columns out of 12 possible (100%, in other words).
  • for large (iPad landscape) and up, override the small and make this div take up 3 columns out of 12 possible.
  • for extra large (desktop) and up, override small and and large and make this div take up 3 columns out of 12 possible.
  • (This doesn't really need to have the xl part in here since it's exactly the same as large.)
  • This div is a flex-item in a parent flex container.
  • This div is a flex container itself, as well.

The above info should give anyone a starting point, more entries coming in this series, i.e., this is the first of a series on Flexbox and Oracle JET. Many thanks to JB Brock for all the info above.

Now continue to part 2...

Geertjan's Blog - April 24, 2016 10:48 AM
Trip Report: NetBeans Day India 2016

NetBeans Day was held in India yesterday, on Saturday, 23 April, 2016. Hosted by the Hyderabad JUG, the event included a range of topics, including a hands on lab. Here's a view on part of the group, with Rajmahendra Hegde (Hyderabad JUG leader) talking about his favorite NetBeans features, e.g., the tight integration with technologies such as Maven and the many code generation features:

Before lunch, Rajmahendra introduced the event, followed by me—I talked about the history of NetBeans and its unique features, while I also did several demos, where I showed the Maven integration and the Chrome Connector plugin for NetBeans IDE, which you can see in action here, with JUG Hyderabad co-organizer Buddha Jyothiprasad:

After lunch, Gaurav Gupta showed his amazing JPA Modeler tools, which he has been working on for the past 4 years, which includes an MVC 1.0 code generator, while an AngularJS generator is also in the planning. It was great to meet Gaurav after many years of having corresponded about his plugin and also to see him demo all of its amazing features:

In fact, he's created several plugins, all of them really professional, all of them on the NetBeans Plugin Portal:

Next up was Vladimir Kvashin, from Oracle in Russia, who demoed a range of native C++ tools in NetBeans IDE for working with and debugging the Open JDK:

Next, I introduced Oracle JET and did several demos to show how easy it is to use this interesting new JavaScript toolkit, which is open sourced and available on GitHub. And the day ended with an Oracle JET workshop, using these instructions:

Some of the presentations were recorded and can be viewed here:

https://www.youtube.com/playlist?list=PL5vTNaFL-5C7rncQrEeOsv3ZND57kX0nD

From the NetBeans Dream Team, aside from Rajmahendre, Atul Palandurkar was in attendance too, it was great to meet him for the first time! Here you see him talking about NetCAT and about the NetBeans Dream Team:

It was a great event, many thanks to Rajmahendra and the Hyderabad JUG for hosting the first NetBeans Day India, there will be many more in the coming years! 

Geertjan's Blog - April 23, 2016 07:00 AM
Updated Tutorial: "Getting Started with Oracle JET Applications"

With the release of the 0.91 version of the Oracle JET Support plugin, the related tutorial, "Getting Started with Oracle JET Applications", needed to be updated. Today, during NetBeans Day India, where an Oracle JET workshop was held, several issues were found in the tutorial, which have now all been fixed.

The tutorial has been simplified a lot and many glitches have been fixed. 

New to the fun of Oracle JET? Go here to get started knowing everything's been tried, tested, and updated:

Getting Started with Oracle JET Applications

DukeScript - April 22, 2016 07:29 AM
Switching Views

For a Swing or JavaFX developer switching between views in Single Page Applications (SPAs) might be a little strange at first. “Single Page” seems to imply, that everything needs to be in one large HTML-File. But that would be ugly, especially as applications tend to grow over time. Let’s have a look how we can structure an application with separate views. Let’s start with how to switch between different views.

Switching Views with in-place templates

The easiest way to switch between two views is to hide or show either view only when a condition is met. As an example let’s take the viewmodel from this demo application:

https://github.com/dukescript/design-experiment

@Model(className = "TaskListViewModel", properties = {
    @Property(name = "input", type = String.class),
    @Property(name = "tasks", type = Task.class, array = true),
    @Property(name = "editing", type = Task.class)
}, targetId = "body")

With this model we can switch the view when someone is editing a Task. Here’s the code that switches the view for the editing row in a list:

<ul class="todo-list" >
    <!-- ko foreach: tasks -->    
    <li>
        <!-- ko ifnot: $root.editing()===$data -->
        <input type="checkbox" name="" class="toggle" data-bind="attr:{checked: complete}"/>
        <span data-bind="text: title"></span>
        <span class="btns">
            <img src="images/icon-edit.png" alt="" data-bind="click: $root.editTask"  />
            <img src="images/icon-delete.png" alt="" data-bind="click: $root.deleteTask" />                        
        </span>
        <!-- /ko -->  
        <!-- ko if: $root.editing()===$data -->
        <form data-bind="submit: $root.stopEditing">
            <input type="text" data-bind="textInput: title"/>
        </form>
        <!-- /ko -->
    </li>
    <!-- /ko -->
    <!-- code omitted -->
</ul>

If the current item ($data) in the foreach loop is the editing Task of the viewmodel, a textfield is displayed. We have defined two different templates for displaying a task and depending on the condition “$root.editing()===$data” we display one of them. This is called in-place templates, as the templates are defined where they are used. This approach is good for small templates, and it’s very easy to understand what is happening. But this approach has limitations:

If the templates are getting bigger, readability suffers. Also there’s no way to reuse an in-place template. That’s when we start to use the template binding.

Switching Views with Template Binding

First we simply move the in-place templates to a script tag and give them an id. At the original location we place a tag with a template binding. The name parameter references the template id:

<ul class="todo-list" >
    <!-- ko foreach: tasks -->    
    <li>
        <!-- ko template: { name:'showtask', if: !($root.editing()===$data)} -->
        <!-- /ko -->
        <!-- ko template: { name:'edittask', if: $root.editing()===$data} -->
        <!-- /ko -->
    </li>
    <!-- /ko -->
    <!-- code omitted -->
</ul>

<script id="showtask">
  <input type="checkbox" name="" class="toggle" data-bind="attr:{checked: complete}"/>
  <span data-bind="text: title"></span>
  <span class="btns">
      <img src="images/icon-edit.png" alt="" data-bind="click: $root.editTask"  />
      <img src="images/icon-delete.png" alt="" data-bind="click: $root.deleteTask" />                        
  </span>
</script>    
<script id="edittask">
  <form data-bind="submit: $root.stopEditing">
    <input type="text" data-bind="textInput: title"/>
  </form>
</script>

This increases readability for large templates and allows us to reuse the same template at different locations. As an example we might use the same template for editing an existing item and for adding a new one.

If the application grows larger, you might want to put the templates into an external file. This keeps the html files small and allows you to further structure the application. There are several ways of doing this. We suggest you try our dynamic templates.

Dynamic Templates

A while ago we’ve announced dynamic templates, a small helper project that allows you to register templates at runtime. The immediate benefit of this project is, that you can load templates lazily.

https://github.com/dukescript/dynamic-templates

The github repository contains an example app using the API. To register a template you will make a call to a Java API:

Closeable templ = TemplateRegistration.registerTemplate("a", "a.html");

The template will only be loaded from an external file, when you first use it in a template binding.

Routing

Switching templates is only one part of the story. If you have a DukeScript based webapp, you also want to allow users to use bookmarks and history to navigate your app. In this blog entry we’ve described how you can do some simple routing with a DataModel that holds the current page, and a special “route” binding.

The DataModel looks like this:

@Model(className = "Data", targetId="", properties = {
    @Property (name = "page", type = String.class)
})
final class DataModel {
// code omitted ...
}

If you combine that approach with dynamic templates you can store your templates in separate html files and control which page is active through the page property of your datamodel:

<!DOCTYPE html>
<html>
    <head>
        <title>Routing Demo</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body data-bind="route: page">
        <ul>
            <li><a href="#/home">Home</a></li>
            <li><a href="#/page1">Page 1</a></li>
            <li><a href="#/page2">Page 2</a></li>
        </ul>
        <div data-bind="template: { name: page }"></div>  
        <!-- ${browser.bootstrap} -->
    </body>
</html>

Please note how the template binding’s name attribute is bound to the page property of the DataModel.

I hope this gives you some ideas how you can use templates and switch between views.

Adam Bien - April 22, 2016 04:49 AM
JavaScript Fatique and Java EE -- An Interview At JAX 2016

@gabriela_motroc asked me some interesting questions at the the JAX conference in Frankfurt after my talk "Java EE 7 and Java 8 -- Feedback From Projects":

Still interested in JavaScript? :-) See you at JavaScript Bootstrap in MUC. Otherwise attend Java EE 7 Boostrap, or enjoy Java EE from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 20, 2016 08:32 AM
Converting Exceptions Into HTTP Status Codes

An exception thrown in an "exceptional" resource:


@Path("exceptions")
public class ExceptionalResource {

    @GET
    public String dontCallMe() {
        throw new IllegalStateException("Do NOT call me");
    }

}


can be easily converted into a HTTP Status code using the ExceptionMapper:


import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;


@Provider
public class IllegalStateExceptionMapper 
implements ExceptionMapper<IllegalStateException> {

    @Override
    public Response toResponse(IllegalStateException exception) {
        return Response.status(Response.Status.NOT_IMPLEMENTED).
                header("reason", exception.getMessage()).
                build();
    }

}


A curl -i http://localhost:8080/jaxrs-exceptionmapper/resources/exceptions outputs:


reason: Do NOT call me
Content-Language: 
Content-Type: text/html
Date: Wed, 20 Apr 2016 08:22:00 GMT
Connection: close
Content-Length: 1119

JPA OptimisticLockExceptions can be converted with the same mechanism.

Any questions left? See you at Java EE Workshops at Munich Airport, Terminal 2, particularly at: Effective Java EE 7 or at airhacks.io!


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 20, 2016 07:00 AM
Events Included in Oracle JET Code Completion

A big point of confusion for me, when getting started with Oracle JET, was that I didn't realize there were 'events', as well as 'properties', for each Oracle JET component. That was because the events were not included in the code completion of each of the components.

Now, since the latest release of the Oracle JET Support plugin, events are included, too. And they have a different icon to distinguish them from the properties in code completion. For example, here's the code completion for ojTable, where the elusive 'beforeCurrentRow' is included, as well as all the other events applicable to ojTable:

That's really helpful, I think! 

Geertjan's Blog - April 19, 2016 02:33 PM
India from Thursday 21 April to 1 May 2016

I'm off to India on Thursday morning, the 21st, arriving late that evening. The main purpose is GIDS, where I'll be speaking on Thursday the 28th in Bangalore and on Saturday the 30th in Pune:

http://www.developermarch.com/developersummit/schedule.html

Also, I'll be in Hyderabad on the 23rd for NetBeans Day India:

http://www.meetup.com/jughyderabad/events/229575675/

When I'm not in Hyderabad or in Pune, I'll be in Bangalore.

Happy to meet up with anyone during the time I'm in India, to chat, or to program, or for dinner or drinks.

Really looking forward to it, it's been several years since I've been in India!

DukeScript - April 19, 2016 07:29 AM
DukeScript for IntelliJ IDEA

Here are some instructions how to get started with DukeScript using IntelliJ IDEA. Miroslav Kopecky has volunteered to contribute a tutorial. Miro is a long time Java user and a very active member of the Java community, loves to speak at international conferences and share his knowledge, and he’s one of the founders of the GeeCon Conference.

He also is a happy user of the IntelliJ IDEA and we’re glad that he managed to setup the project and get it to run. Here are his instructions:

DukeScript for IntelliJ

DukeScript is a cool project following Java’s general idea : WORA (WODE) (‘Write once, run anywhere’). But it was sad to see DukeScript has forgotten about IntelliJ IDEA users. IntelliJ IDEA is almost an open source project too (JetBrains is offering a Community edition), and one of the most famous IDEs in the world. (together with its competitors VIM, NetBeans, Eclipse…). This blog post is devoted to them.

1. Step

Open IntelliJ IDE -> File -> New -> Project…

In this step you may run into trouble, when IDEA tries to load all archetypes. In such case you will see the following window. It means that the allocation pool for the MAVEN JVM is way too small.

Solution: Go to Preferences -> Build -> Build Tools -> Maven -> Importing and in the section VM option for importer increase the number from -Xmx512m (too small) to at least -Xmx2048m.

After this fast fix we are ready to add the proper archetypes to generate our first Duke Script project. You can find the currently available archetypes here:

http://mvnrepository.com/artifact/com.dukescript.archetype

2. Step

Now click ‘Add Archetype’.

Select the newly added knockout4j-archetype, click “next” and follow the project creation procedure. I’m adding images of this procedure that you can confirm the correct steps.

In last step you will choose the folder…

3. Step

Now the project is generated for us and we see the following window.

There is one more step we need to do because the newly generated project doesn’t look healthy. The Maven sub-modules don’t seem to be ready yet.

Solution: View -> Tool Windows -> Maven Projects :: here click Refresh

4. Step

Proceed command Install in Maven Projects tab -> project root -> Lifecycle -> Install

Kudos to Miro for contributing this fine tutorial!

Adam Bien - April 19, 2016 04:09 AM
Is It Your Special Jar?

A nice video about JARs:

Too many JARs? Take a look at Java EE :-)

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 18, 2016 05:08 AM
How To Replace Classes With Java EE--After The Fact

With Java EE you can replace all injected classes without using an interface, factory or any other creational pattern.

The class Greeter:


public class Greeter {

    public String getGreetings(){
        return "Hey duke";
    }
}


...is directly injected into the Index:


import javax.enterprise.inject.Model;
import javax.inject.Inject;

public class Index {
    
    @Inject
    Greeter greeter;
    
    
    public String getMessage() {
        return content;
    }

}


PoliteGreeter replaces the Greeter using inheritance and applying the annotation @Specializes


import javax.enterprise.inject.Specializes;

@Specializes
public class PoliteGreeter extends Greeter{

    @Override
    public String getGreetings() {
        return "Dear " + super.getGreetings();
    }
}


The @Specializes mechanism is used to provide custom behavior / configuration for the porcupine and breakr utils. This post is motivated by the following porcupine issue.

Any questions left? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Bootstrap Java EE 7 or airhacks.io.

[See also an in-depth discussion in the "Real World Java EE Patterns--Rethinking Best Practices" book (Second Iteration, "Green Book"), page 235 in, chapter "Plugins"]. Sample is based on the template flavor of the plugin pattern.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 15, 2016 07:11 AM
31 May: (Free) NetBeans Day UK!

Last year we had a great NetBeans Day in the UK, here's the trip report I wrote about it. And here's the announcement of it—29th May: (Free) NetBeans Day UK!.

Around about the same time this year, we'll have another NetBeans Day in the UK, at exactly the same location—the University of Greenwich. Here's the full program, with speakers coming from the UK, France, Germany, the Netherlands, and Tunisia:

  • 10:00 – 10:45 NetBeans Community News (Geertjan Wielenga, Oracle)
  • 10:45 – 11:30 Current State of Java & How to Get Involved (Ben Evans, JClarity, London JUG)
  • 11:30 – 12:15 News from Java EE 8 and Payara (Steve Millidge, Payara)
  • 12:15 – 13:00 Lunch
  • Track 1: Sessions
    • 13:00 – 13:45 Get Started with NetBeans IDE (Georgia Ingham/Mark Stephens, IDR Solutions)
    • 13:45 – 14:30 NetBeans, TypesScript and Angular2 (Karsten Sitterberg, Munster JUG)
    • 14:30 – 15:00 Tea
    • 15:00 – 15:45 Reactive Programming with NetBeans and Java 8 (Stefan Reuter, Munster JUG)
    • 15:45 – 16:30 Strategies for Live Coding Java (Neil C Smith, Praxis LIVE)
  • Track 2: Workshops
    • 13:00 – 14:30 Get Started with Oracle Open Source Solutions for Enterprise JavaScript (Geertjan Wielenga, Oracle, Thomas Kruse, Munster JUG)
    • 14:30 – 15:00 Tea
    • 15:00 – 16:30 Get Started Mixing AngularJS with Java EE (Nebrass Lamouchi, Davidson)
  • 16:30 – 17:00 Raffle, Prizes
  • 17:00 – 21:00 Dinner & Drinks

It promises to be another great event of fun and networking, while also being a continuation of the many NetBeans Days we've been celebrating over the past years.

Sign up here: http://www.eventbrite.co.uk/e/netbeans-day-uk-2016-tickets-22695970258

Geertjan's Blog - April 14, 2016 06:10 PM
Trip Report: IoT Tech Day 2016

Today I attended IoT Tech Day 2016 in Utrecht. I don't normally go to hardware conferences, though nowadays everything is "IoT", just like everything is "Cloud", so it seemed a good place to be today.

The turnout was great, I heard the number 1300 at some point, though I don't know for sure. Seemed to be heaps of people though in the keynotes, which were in a great round room setting, with the speaker in the middle:

On a slightly negative note, some people mentioned to me that a lot of the sessions were quite focused on promoting specific companies and solutions rather than being focused on deep content. I don't know to what extent that was true, though there were quite a few slides throughout similar to this:

On the other hand, in those same slide decks there were plenty of generic content that was applicable to anyone. I liked tips such as this one, for anyone getting started with IoT apps:

But the highlight was certainly Wienke from TheThingsNetwork, who shared info about a fantastic startup that's taking the world by storm around providing free connectivity, all over the world:

In fact, that keynote was so interesting that I spent most of the day in the related hands on lab, with instructions here on GitHub.

Some screenshots of the whole toolchain, which would ideally all be integrated into NetBeans IDE:

In the last screenshot above, you see messages coming via the light sensor connected to Arduino.

TheThingsNetwork even gave everyone an Arduino, which you see below together with the IoT Surfboard, which was the focus of the next workshop I attended, by Vinicius and Yara Senger from Brazil:

I have known Yara and Vinicius for many years and they're active in the NetBeans community (the bundle they provide for working with their IoT Surfboard includes installers for NetBeans IDE 8.1):

Their IoT Surfboard is pretty amazing, with heaps of features, which I learned a bit about during the workshop.

It even has a breathelizer, which Vinicius demonstrated after downing most of the beer he's holding here below:

In short, it was a great show and I learned a lot and am really interested in TheThingsNetwork, check it out, really inspiring.

Adam Bien - April 14, 2016 04:41 AM
New Docker Images For Java EE

github.com/AdamBien/docklands comes with Dockerfiles for the following servers:

  • WebLogic
  • WebSphere
  • TomEE
  • Payara Server
  • WildFly
  • nano (JDK HTTP server as reference)
  • Tomcat
  • DerbyDB
  • PostgreSQL

Docklands is used during the javaeemicro.services online workshop, sometimes during the airhacks.

I also used Docklands to measure the application server's overhead in the following screencasts: Memory Footprint Of Java EE Servers and Java EE 7 Application Servers vs. Plain "Hello World" screencasts.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 13, 2016 12:27 PM
Chart Client Generator for Oracle JET

Now that the REST Client Generator for Oracle JET is working exactly as I'd like, it's time to... work on a JET module generator for charts:

When you click Next above, the idea is that you'll be able to select one of the many Oracle JET charts, as shown below (currently working with a subset of them as a starting point for this generator):

Also, there'll be a way to import your data and then the screenshot you see above will be regenerated and shown within the wizard with all your data in it, i.e., you'll have a preview of your own data within each of the charts, and then be able to choose the chart that's most useful to you.

When you click Next above, you'll be able to specify where the JET module should be created in your project, i.e., where the HTML side and the JavaScript side will be generated by the wizard, as well as how you'd like your data to be connected into your JET module.

Ambitious, yet doable.

DukeScript - April 13, 2016 07:29 AM
(Auto)Release of J(ava)Query!

Today is a great day. With a huge delight the DukeScript project announces that it is now easy to use JQuery in your DukeScript applications. What is so great on that? Maybe you are thinking: “ooh well, just another library” and you might be right. However this time the situation is different: the Java APIs for the library haven’t been written manually, they have been auto-generated. This way it is possible to create Java APIs for any JavaScript library!

First of all, let’s look at the JavaQuery - e.g. Java APIs for JQuery: here is the package javadoc and here is the dependency to the Maven artifact which is now available on Maven Central and should be included in your pom.xml file:

<dependency>
    <groupId>com.dukescript.libraries</groupId>
    <artifactId>net.java.html.lib.jquery</artifactId>
    <version>0.2</version>
    <type>jar</type>
</dependency>

Once you include this library in your application (follow getting started tutorial to create an empty one), you can start using JQuery from Java. Create index.html:

<html>
    <body>
        <button id='b'>Click</button>
        <span id='s'>Text</span>
    </body>
</html>

and you can use following code to control it via JQuery for Java API:

import static net.java.html.lib.jquery.Exports.$;

final class DataModel {
    static void onPageLoad() throws Exception {
        $("#b").text("Please click on me!");
        $("#s").html("Waiting for a click!");
        $("#b").click((Object ev) -> {
            $("#s").text("Button was clicked!");
            return null;
        });
    }
}

Looks familiar? Yes, the code mimics the JavaScript one as closely as possible. However it brings all the Java benefits: strong type checks, proper code completion, all the goodies of Java tooling ecosystem.

Structure of the JQuery API

The JQuery API for Java as well as any other API produced this way follows the same pattern. The central place of the API is Exports class which contains all the global symbols and ways to invoke them the JavaScript library provides. In case of JQuery the exported symbols are $ and jQuery. The best way to use such library is to do a static import of the symbol(s):

import static net.java.html.lib.jquery.Exports.$;

At that moment one can use $ as an entry point into other JQuery library API classes. Using JavaScript libraries from Java has never been easier!

Testing

First of all thanks for all your support of DukeScript. However, would you mind to support the project a bit more? If so, please try to use the JQuery API for Java a bit and share your experience with us - either in the comments section, at the DukeScript forum or directly. While the current version 0.2 seems to work, testing it on more complex samples is important. Thank you for your help!

Adam Bien - April 12, 2016 07:53 AM
PHP, Java EE Structure, Concurrency, Long Running Tasks, Microservices, IDEs, Correlation, Angular 2 or 2 Years of airhacks.tv

The 2 years of airhacks.tv show. In 1h and 10 minutes about 30 questions were discussed (hopefully answered) during this show:

Any questions left? Ask now: https://gist.github.com/ and join the conversation at each first Monday of the month at 6 P.M. live. No registration or any other commitment required.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

NetBeans – Michael's blog - April 11, 2016 09:03 PM
Software conferences

Now it’s more than one month ago since I wrote my blog about jshell. Few days after that, I attended JavaLand. Sadly I had no time to blog or write except my German report about this conference [1]. Last week I talked about Java Concurrency – from foundations up to parallel streams – at the … Continue reading "Software conferences"

Geertjan's Blog - April 11, 2016 08:02 PM
JHipster in NetBeans IDE 8.1

Here's JHipster set up and deployed in NetBeans IDE 8.1:

And with Darcula: 

Now imagine we were to replace Angular in JHipster with Oracle JET. Maybe that would then be called "JETHipster"?

NetBeans – Java PDF Blog - April 11, 2016 12:50 PM
Announcing the schedule for the second free NetBeans UK Day (at Greenwich University) on 31st May

netbeans-logo

Will you be attending NetBeans day 2016?

We are running our second NetBeans UK day next month on Tuesday 31st May. Like the first, it is totally free to attend and features world class speakers. You even get a free lunch…

This year, we have expanded the event and added a second track in the afternoon to give you a greater choice.

Below is the planned agenda for our second NetBeans UK Day. You can book on EventBrite at http://www.eventbrite.co.uk/e/netbeans-day-uk-2016-tickets-22695970258 (tickets are free but limited in number).

10:00 – 10:45 NetBeans Community News (Geertjan Wielenga, Oracle)
10:45 – 11:30 Current State of Java & How to Get Involved (Ben Evans, London JUG)
11:30 – 12:15 News from Java EE and Payara (Steve Millidge, Payara)

12:15 – 13:00 Free Lunch

Track 1: Sessions (45 minutes each)
13:00 – 13:45 Get Started with NetBeans IDE (Georgia Ingham/Mark Stephens, IDR Solutions)
13:45 – 14:30 NetBeans, TypesScript and Angular2 (Karsten Sitterberg, Munster JUG)
14:30 – 15:00 Tea
15:00 – 15:45 Reactive Programming with NetBeans and Java 8 (Stefan Reuter, Munster JUG)
15:45 – 16:30 Strategies for Live Coding Java (Neil C Smith, Praxis LIVE)

Track 2: Workshops (1 1/2 hours each)
13:00 – 14:30 Get Started with Oracle Open Source Solutions for Enterprise JavaScript (Geertjan Wielenga, Oracle, Thomas Kruse, Munster JUG)
14:30 – 15:00 Tea
15:00 – 16:30 Get Started Mixing AngularJS with Java EE (Nebrass Lamouchi, Davidson)

16:30 – 17:00 Raffle, Prizes
17:00 – 21:00 Dinner & Drinks

We hope to see you there!

  • Display your Documents
<>

The post Announcing the schedule for the second free NetBeans UK Day (at Greenwich University) on 31st May appeared first on Java PDF Blog and was written by Mark Stephens.

Adam Bien - April 11, 2016 12:26 AM
25th Airhacks Q&A: EJB future, Java EE 8, Async JAX-RS, Angular2, JMX, Batch and PHP

2 years of airhacks.tv. This Monday, 15.4, at 6 pm CET I will discuss the following topics:

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks, or the built-in chat http://www.ustream.tv/channel/adambien. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.io or http://www.ustream.tv/channel/adambien

  1. Java EE 8 news
  2. EJB vs CDI. Or what is the future?
  3. BCE component visibility
  4. When to use @Suspended and ExecutorService?
  5. How to implement a long running task?
  6. JavaScript: ES2015, ES2016 or TypeScript. Angular or Angular2? Or how to start a Webproject.
  7. Transactions and consistency in Java EE Microservices
  8. Is JMX still useful?
  9. Service call concurrency and parallelization
  10. Partial responses with JAX-RS.
  11. Entities: rich or anemic?
  12. EntityListener problem in WildFly
  13. Staging the WARs
  14. CorrelationIds in JAX-RS
  15. Are EARs still available?
  16. MVC: is it too late in Java EE 8?
  17. DI in subresources
  18. Batch checkpoints and persistence
  19. What is the benefit of a thread pool?
  20. PHP to Java EE migration
  21. Sample Java EE projects.
  22. Java EE and SAML
  23. Are microservices only interesting for refactoring?
  24. Meta questions

Any questions left? See youtube.com/c/bienadam, airhacks.io, or see you at: workshops.adam-bien.com


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - April 09, 2016 06:13 AM
Giving Up on Apple AppStore

My MineSweeper application available from AppStore is gone. Apple wants me to pay remedies every year! For what!? Apple has no cost distributing my application. I am giving up. If somebody wants to distribute my MineSweeper, please go on, but I am giving up - giving up on Apple.

--JaroslavTulach 06:13, 9 April 2016 (UTC)

Geertjan's Blog - April 08, 2016 03:31 PM
REST Client Generator for Oracle JET

Let's say you've developed some Java EE RESTful Web Services in NetBeans IDE, which means you have an application that looks like this:

How do you get from the scenario above to an Oracle JET application that consumes those REST resources?

I've updated the Knockout Client Generator today, so that an Oracle JET module is generated from the selected REST resource, get it here:

http://plugins.netbeans.org/plugin/55971/knockout-client-generator

You'll find the generator here:

Click Next and then you can browse to one of the REST resources, from an open project in the IDE:

Click Next. Then specify where the two sides of your JET module will be generated:

Click Finish. You will then get something like this in a newly generated View:

<table id="table"
       data-bind="ojComponent: {
   component: 'ojTable',
      data: datasource,
      columns: [
            {headerText: 'CITY',  field: 'city'},
            {headerText: 'PHONE',  field: 'phone'},
            {headerText: 'NAME',  field: 'name'},
            {headerText: 'ADDRESSLINE2',  field: 'addressline2'},
            {headerText: 'CREDITLIMIT',  field: 'creditLimit'},
            {headerText: 'ADDRESSLINE1',  field: 'addressline1'},
            {headerText: 'STATE',  field: 'state'},
            {headerText: 'FAX',  field: 'fax'},
            {headerText: 'EMAIL',  field: 'email'},
]}">
</table>

And you will get this in a newly generated ViewModel:

define(['ojs/ojcore', 'knockout', 'ojs/ojtable'
], function (oj, ko) {
    function GeneratedContentViewModel() {
        var self = this;
        self.data = ko.observableArray();
        $.getJSON("http://localhost:8080/CustomerBackend/webresources/com.mycompany.customerbackend.customer/").
                then(function (customers) {
                    $.each(customers, function () {
                        self.data.push({
                            city: this.city,
                            phone: this.phone,
                            name: this.name,
                            addressline2: this.addressline2,
                            creditLimit: this.creditLimit,
                            addressline1: this.addressline1,
                            state: this.state,
                            fax: this.fax,
                            email: this.email,
                        });
                    });
                });
        self.datasource = new oj.ArrayTableDataSource(
                self.data,
                {idAttribute: 'id'}
        );

    }
    return GeneratedContentViewModel;
});

APIDesign - Blogs - April 08, 2016 03:33 AM
HTML/Java API 1.3 is Released!

I'd like to announce that the new version of HTML/Java API - e.g. 1.3 is ready for usage. The javadoc is at http://bits.netbeans.org/html+java/1.3/ - and the bits has been uploaded to Maven central.

HTML/Java 1.3 comes with many improvements that will make your life easier and enlarge the options you have when mixing Java and HTML. Let me quote the Javadoc:

Model classes can have per-instance private data. Model classes can generate builder-like construction methods if builder prefix is specified. Property.mutable() can be false to define a non-mutable (almost constant) property. That in case of Knockout bindings means: the property is represented by a plain value rather than an observable in the JavaScript object. The JavaFX presenter can be executed in headless mode - just specify -Dfxpresenter.headless=true when launching its virtual machine and no window will be shown. This is particularly useful for testing. OSGi headers are now enterprise OSGi ready. Switched to minified version 3.4.0 of knockout.js. Better support for recursive @Model definitions. New module org.netbeans.html:xhr4j provides implementation of Transfer with technology identifier xhr4j - this module can be used to workaround limitations of CORS by handling the OnReceive connections in Java.

--JaroslavTulach 03:33, 8 April 2016 (UTC)