Over a million developers have joined DZone.

How to Contribute Samples to the NetBeans Wicket Plugin

· Java Zone

Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience, brought to you in partnership with JetBrains

The sources of the NetBeans Wicket plugin are found here:

http://java.net/projects/nbwicketsupport

With Subversion, you can check out the sources:

http://java.net/projects/nbwicketsupport/sources/nbwicketsupport/show

When you've checked out the sources, you'll have these folders and files on disk:

The structure of the NetBeans Wicket plugin has been put together to make it as simple as possible to contribute code to it. One aim of the plugin is to provide a collection of samples demonstrating best practices. You can see that there are already three there, 'Authentications', 'Pizzas', and 'Tabs'. Each of these three is a Wicket application created in NetBeans IDE via the Wicket plugin.

So, this is an appeal for everyone out there to contribute samples to the NetBeans Wicket plugin! Here's how.

  1. Drop your sample application into the 'templates' folder above. So, now there will be 'Authentications', 'Pizzas', 'Tabs', and 'MySample'. (PLEASE make the name as short, succinct, and descriptive as possible.) Each of these are applications that can be opened in NetBeans IDE and that should be the place where they were created in the first place, since then you'll have the right project structure.

  2. Now let's ZIP up the new sample into the plugin. That's done inside the 'WicketCore' folder that you see above. Inside WicketCore/build.xml, you'll find the following content:
    <?xml version="1.0" encoding="UTF-8"?>
    <project name="org.netbeans.modules.web.wicket" default="netbeans" basedir=".">
        <description>Builds, tests, and runs the Wicket core module, while including the samples.</description>
        <import file="nbproject/build-impl.xml"/>
        <property name="pizza-zip" value="src/org/netbeans/modules/web/wicket/resources/Pizzas.zip"/>
        <property name="login-zip" value="src/org/netbeans/modules/web/wicket/resources/Authentications.zip"/>
        <property name="tabs-zip" value="src/org/netbeans/modules/web/wicket/resources/Tabs.zip"/>
        <target name="jar-prep" depends="projectized-common.jar-prep">
            <delete file="${pizza-zip}"/>
            <zip zipfile="${pizza-zip}" encoding="UTF-8">
                <fileset dir="../templates/Pizzas">
                    <exclude name="**/CVS/"/>
                    <exclude name="**/.svn/"/>
                    <exclude name="nbproject/private/"/>
                    <exclude name="dist/"/>
                    <exclude name="build/"/>
                </fileset>
            </zip>
            <delete file="${login-zip}"/>
            <zip zipfile="${login-zip}" encoding="UTF-8">
                <fileset dir="../templates/Authentications">
                    <exclude name="**/CVS/"/>
                    <exclude name="**/.svn/"/>
                    <exclude name="nbproject/private/"/>
                    <exclude name="build/"/>
                    <exclude name="dist/"/>
                </fileset>
            </zip>
            <delete file="${tabs-zip}"/>
            <zip zipfile="${tabs-zip}" encoding="UTF-8">
                <fileset dir="../templates/Tabs">
                    <exclude name="**/CVS/"/>
                    <exclude name="**/.svn/"/>
                    <exclude name="nbproject/private/"/>
                    <exclude name="build/"/>
                    <exclude name="dist/"/>
                </fileset>
            </zip>
        </target>
    </project>

    So, add a new item above for your own sample! You'll start by defining a new property at the top of the file, exactly as done for the other samples, pointing to the location of where your sample will be found. Just do this by copying the property of one of the other ones and replacing the name with your own. Then copy one of the sections in the main section of the file and create yours for your sample, i.e., these are for wrapping the sample from the 'templates' folder into a ZIP file in the plugin. To check that you've done this correctly, build the module, which should result in a new ZIP file being created in WicketCore, within the folder src/org/netbeans/modules/web/wicket/resources, where you should also see 'Authentications.zip', 'Pizzas.zip', and 'Tabs.zip'.

  3. Now we'll register our new sample into the New Project dialog. Go to src/org/netbeans/modules/web/wicket/resources in WicketCore. There you'll find a layer.xml file that will register your sample. Take note of this section:
    <folder name="Templates">
        <attr name="displayName" bundlevalue="org.netbeans.modules.web.wicket.template.filelevel.Bundle#Templates"/>
        <folder name="Project">
            <folder name="Samples">
                <folder name="Wicket">
                    <attr name="position" intvalue="50"/>
                    <file name="Pizzas.zip" url="Pizzas.zip">
                        <attr name="displayName" bundlevalue="org.netbeans.modules.web.wicket.resources.Bundle#Templates/Project/Samples/Wicket/Pizzas.zip"/>
                        <attr name="iconBase" stringvalue="org/netbeans/modules/web/wicket/resources/wicket.gif"/>
                        <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.web.wicket.samples.SampleApplicationWizardIterator.createIterator"/>
                        <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/web/wicket/samples/PizzaApplicationDescription.html"/>
                        <attr name="template" boolvalue="true"/>
                        <attr name="position" intvalue="1000"/>
                    </file>
                    <file name="Authentications.zip" url="Authentications.zip">
                        <attr name="displayName" bundlevalue="org.netbeans.modules.web.wicket.resources.Bundle#Templates/Project/Samples/Wicket/Authentications.zip"/>
                        <attr name="iconBase" stringvalue="org/netbeans/modules/web/wicket/resources/wicket.gif"/>
                        <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.web.wicket.samples.SampleApplicationWizardIterator.createIterator"/>
                        <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/web/wicket/samples/LoginApplicationDescription.html"/>
                        <attr name="template" boolvalue="true"/>
                        <attr name="position" intvalue="1100"/>
                    </file>
                    <file name="Tabs.zip" url="Tabs.zip">
                        <attr name="displayName" bundlevalue="org.netbeans.modules.web.wicket.resources.Bundle#Templates/Project/Samples/Wicket/Tabs.zip"/>
                        <attr name="iconBase" stringvalue="org/netbeans/modules/web/wicket/resources/wicket.gif"/>
                        <attr name="instantiatingIterator" methodvalue="org.netbeans.modules.web.wicket.samples.SampleApplicationWizardIterator.createIterator"/>
                        <attr name="instantiatingWizardURL" urlvalue="nbresloc:/org/netbeans/modules/web/wicket/samples/TabbedApplicationDescription.html"/>
                        <attr name="template" boolvalue="true"/>
                        <attr name="position" intvalue="1200"/>
                    </file>
                </folder>
            </folder>
        </folder>
    </folder>

    In the above, register your new sample application. So, start by copying one of the other sections, e.g., the one for "Tabs.zip". Replace those names with the name of the ZIP of your own sample. Then take note of the "displayName" attribute and the "instantiatingWizardURL" attribute. These both need to be modified for your own sample. The "displayname" attribute points to a key in the Bundle.properties file, which is within the same folder as where the "layer.xml" is found. Add a new key there for your own sample. For the "instantiatingWizardURL", copy one of the existing HTML documents, rename it to your own name, rewrite the content, and register it in your own section above. Finally, make sure to set the "position" attribute for your sample, let's try to keep increments of 100, as indicated above.

  4. Now run the whole WicketSuite from NetBeans IDE. A new instance of NetBeans IDE starts up, including the three modules constituting the WicketSuite. In the New Project dialog (Ctrl-Shift-N), you should see your sample, added to the list of Wicket samples:

  5. Once you're able to successfully run through the wizard above for your own sample, go ahead and simply commit it to the Subversion repository. No need to ask anyone, just go ahead and do it, assuming you're part of the project and thus have commit rights.

So, now that you now how easy it is to do so, please contribute some nice Wicket samples to the plugin! Once we have a few new ones, we'll release a new version of the plugin and thereby make the samples available to a wider audience.

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}