X

Geertjan's Blog

  • September 20, 2006

WebFrameworkProvider and a New Tutorial in Progress

Geertjan Wielenga
Product Manager
I've got a bit further with the WebFrameworkProvider wizard that I talked about yesterday. Now, after creating a module project and adding a dependency on the Web APIs, you can go to the New File wizard, choose the WebFrameworkProvider template, and you will get this panel:

There's a handy list of framework names (totally random, from yesterday's blog entry) predefined for you. But it is a combobox, so you can add your own framework name. Also specify the name of a class and a package. Then click Finish and you will have exactly the code below, if you made the selections above:

/\*
\* __NAME__.java
\*
\* Created on __DATE__, __TIME__
\*
\* To change this template, choose Tools | Template Manager
\* and open the template in the editor.
\*/
package org.yourorghere.module31;
import java.io.File;
import java.util.Set;
import org.netbeans.modules.web.api.webmodule.WebModule;
import org.netbeans.modules.web.spi.webmodule.FrameworkConfigurationPanel;
import org.netbeans.modules.web.spi.webmodule.WebFrameworkProvider;
/\*\*
\*
\* @author __USER__
\*/
public class NewWebFrameworkProvider extends WebFrameworkProvider {
/\*\* Creates a new instance of __NAME__ \*/
public NewWebFrameworkProvider() {
super("Tapestry","Description");
}
//Empty for now, but this is where all the artifacts are created:
public Set extend(WebModule webModule) {
return null;
}
//If true, the Project Properties dialog box will
//show that the framework is selected.
public boolean isInWebModule(WebModule webModule) {
return true;
}
//Works with the framework's configuration files
public File[] getConfigurationFiles(WebModule webModule) {
return null;
}
//Returns the lower part of the New Project wizard
//or the Project Properties dialog
//box, where the user can specify settings that
//are specific to your framework.
//Here, nothing is returned:
public FrameworkConfigurationPanel getConfigurationPanel(WebModule webModule) {
return null;
}
}

So, the only impact of selecting the framework name is that it gets hardcoded in the Constructor. (Adding it to the Bundle.properties file is easy, using the Tools > Internationalization menu item.)

You then also need to register the frameworkprovider class in the layer.xml file, as shown yesterday, because I haven't worked out how to do that programmatically yet. (Ultimately, you shouldn't have to create the dependency on Web APIs either, because the wizard should do that for you.)

If you're interested in this wizard, you can download it here:

org-netbeans-modules-webframeworkkickstart2.nbm

In other news. I'm working on a tutorial that describes the Component Palette API in relation to custom components (i.e., TopComponents). Interesting issues such as DragGestureEvents and drag images are discussed as well, using a very concrete sample. Ultimately, this tutorial will form the basis of the chapter on this topic in the upcoming module development book. A lot of explanatory text needs still to be added, but especially if you're a code freak, you should give this tutorial a look... because there's lots and lots of code and you'll be able to get your hands really really dirty. Also screenshots for those who are visually inclined. Here it is: NetBeans Drag and Drop Tutorial.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.