Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Starting with the Pivot Starter Kit in NetBeans IDE

DZone's Guide to

Starting with the Pivot Starter Kit in NetBeans IDE

· Java Zone ·
Free Resource

The CMS developers love. Open Source, API-first and Enterprise-grade. Try BloomReach CMS for free.

The Pivot Starter Kit that was announced today is really a cool thing. A complete demo application for newbies to Pivot. I downloaded it and imported it into the IDE (a.k.a. 'I opened it as a free-form project'):

Note: The code in the two files shown above is listed in the Pivot Starter Kit announcement on Javalobby.

I used a free-form project because the demo application comes with its own build.xml file. (A different approach would have been to open the demo application as a 'Java Project with Existing Sources' and to then copy the demo's build.xml over the one created by the IDE.) Here's the free-form project template:

When you're clicking through the wizard and selecting your sources, you can also map project commands to Ant targets from the demo's build.xml file:

To be able to use the IDE's editor features, you also need to register the demo app's libraries in the project's Properties dialog:

Then add a run target, which the demo app's build.xml doesn't provide:

<target name="run" depends="build">
    <java classpathref="project.class.path" classname="pivot.wtk.DesktopApplicationContext">
        <arg value="pivot.starter.StarterApplication"/>
    </java>
</target>

You can now right-click the project and choose 'Clean', 'Build', and 'Run', which will call the Ant targets in the build.xml file.

Finally, run the application and you'll have this:

Or run the application as an applet (note the 'draggable' parameter below, for JDK 6 Update 10, in a browser to which that applies, such as FireFox 3):

<html>
<head>
<title>Pivot Starter Application</title>
</head>
<body style="margin:0px; padding:0px">
<applet code="pivot.wtk.BrowserApplicationContext$HostApplet"
archive="lib/pivot-core.jar,lib/pivot-web.jar,lib/pivot-wtk.jar,
lib/pivot-wtk.terra.jar,lib/stax-api-1.0.jar,lib/stax-1.2.0.jar,pivot-starter.jar"
width="100%" height="100%">
<param name="applicationClassName" value="pivot.starter.StarterApplication">
<param name="image" value="spinner3-bluey.gif">
<param name="centerimage" value="true">
<param name="boxborder" value="false">
<param name="draggable" value="true">
</applet>
</body>
</html>

In both cases, when you click the button, you get this response (below in an applet):

Then, now that you have your sample up and running, continue your journey into Pivot by taking the Pivot tutorial!

BloomReach CMS: the API-first CMS of the future. Open-source & enterprise-grade. - As a Java developer, you will feel at home using Maven builds and your favorite IDE (e.g. Eclipse or IntelliJ) and continuous integration server (e.g. Jenkins). Manage your Java objects using Spring Framework, write your templates in JSP or Freemarker. Try for free.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}