How to add webpart for java module | adam | 2012-04-30 13:34 |
Status: Closed | ||
Your module class needs to return a collection of WebPartFactories that create your web parts, see the createWebPartFactories() method. The web part names defined by your factories will then appear in the <Select Web Part> drop-down of any folder where your module is enabled. The create_module template does not include any sample webparts or factories, but just about every other module does, so there are plenty of examples. A trivial one: protected Collection<WebPartFactory> createWebPartFactories() { return Collections.<WebPartFactory>singleton(new BaseWebPartFactory("Hello World") { public WebPartView getWebPartView(ViewContext portalCtx, Portal.WebPart webPart) throws IllegalAccessException, InvocationTargetException { HtmlView view = new HtmlView("I'm a webpart!"); view.setTitle("Hello World"); return view; } }); } Adam |
||