Purpose
This is the overly simplistic example from the documentation. All it does is provide a shell to return a String.
Screenshots
public class HelloWorld
{
public HelloWorld()
{
}
public String getText(String restrictTo,boolean showHeaders,String loginName)
{
String s = "";
s = "<div id=\"helloWorld\">\n";
if (showHeaders)
{
s += " <div style=\"text-align:right; width:100%; float:right;\">\n" +
" <img src=\"images/information_sm.png\" onmouseover=\"MyTip('com.wmpnj.bugz.widgets.HelloWorld')\" onmouseout=\"UnTip()\"> " +
" <a href=\"javascript:var contents = escape(document.getElementById('helloWorldPrint').innerHTML);newWin=window.open('print?pcWhich=pdf&pcOutput=' + contents + '','Print Hello World');newWin.focus();\"><img src=\"images/famfam/page_white_acrobat.png\" border=\"0\"></a> \n" +
" <a href=\"javascript:var contents = escape(document.getElementById('helloWorldPrint').innerHTML);newWin=window.open('print?pcWhich=html&pcOutput=' + contents + '','Print Hello World');newWin.focus();\"><img src=\"images/famfam/printer.png\" border=\"0\"></a> \n" +
" <a href=\"javascript:refresh('hello_world','" + restrictTo + "');\"><img src=\"images/famfam/arrow_refresh.png\" border=\"0\"></a><p>" +
" </div>\n";
}
s += " <div style=\"text-align:left; width:100%;\" id=\"helloWorldPrint\">\n" +
" Hello World!" +
" </div>\n" +
"</div>\n";
return s;
}
}
Installation
Note: This version will only work with Bugs Dashboard v3.0 and up due to the use of the parameter to restrict this widget to a specific product if desired. Although Hello World is not specific to any one product, all widgets under v3.0 require the ability to accept two new parameters.
To use the HelloWorld Widget, do the following:
- Copy the HelloWorld.class file at com/wmpnj/bugz/portlets into the deployed web application directory; i.e. /webapps/bugs/WEB-INF/classes/com/wmpnj/bugz/portlets. This may require that you also copy the directory “portlets” if this is the first portlet you’re deploying.
- Update the dwr.xml file in the deployed web application WEB-INF directory; i.e. /webapps/bugs/WEB-INF. Edit the file with a text editor and add the following after the last </create> statement:
<create creator="new" javascript="Hello_World"> <param name="class" value="com.wmpnj.bugz.portlets.HelloWorld" /> </create>
- Update the portlets.properties file in the deployed web application classes directory; i.e. /webapps/bugs/WEB-INF/classes:
- Update the first line by incrementing the count of portlets by 1
- Add the following in the position that you want the portlet to appear within your desired column. For example, if you want the HelloWorld to appear at the top of the right-most column, you must insert this ahead of any other portlet whose column is “2″. After adding the following block, you MUST then renumber the portlets appropriately, beginning with 0, i.e. “portlet0″, “portlet1″.
portlet0.title=Hello World portlet0.column=2 portlet0.package=com.wmpnj.bugz.portlets.HelloWorld portlet0.className=HelloWorld portlet0.method=getText portlet0.stylesheet= portlet0.javascript= portlet0.desc= portlet0.call= portlet0.restrictTo=
You may change the title and column, but do NOT change the package, className, or method!

