Hi,
I went through the ForumPortlet and UserPortlet, both portlets have hardcoded some logic with the window states. E.x., in ForumPortlet:
Who can explain to me what is the purpose to hardcode such codes which make it difficult to reuse?
thanks
Yang
--------------------------------------------------------------------------
String op = req.getParameters().get(getOperationName(),
getDefaultOperation());
if (req.getWindowState() != WindowState.MAXIMIZED)
{
writer.write("<table width=\"100%\" cellpadding=\"2\" cellspacing=\"2\"><tr class=\"portlet-section-body\">");
// Window is is normal mode
// Check if the user is an administrator
boolean isAdmin = req.hasPermission("Admin");
if (isAdmin)
{
writer.write("<td width=\"50%\" align=\"center\" class=\"portlet-menu-item\">");
// Create a link to the administration interface
PortletURL adminURL = resp.createRenderURL();
adminURL.setParameter("op", "" + OP_SHOWADMINFORUMS);
adminURL.setWindowState(WindowState.MAXIMIZED);
writer.write("<a href=\"" + adminURL.toString() + "\">"
+ "<img border=\"0\" src=\"" + req.getContextPath() + "/subSilver/images/icon_forums_admin.gif\">"
+ bundle.getString("Admin_panel") + "");
writer.write("");
writer.write("<td width=\"50%\" align=\"center\" class=\"portlet-menu-item\">");
}
else
----------------------------------------------------------------------------
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884149#3884149
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884149
|