protected DecoratorAction createAction(RequestContext rc, PortletWindow pw, Decoration decoration,
DecoratorActionTemplate template)
{
String actionName = template.getAction();
PortalURL portalURL = rc.getPortalURL();
Boolean isAjaxRequest = (Boolean) rc
.getAttribute(DecorationValve.IS_AJAX_DECORATION_REQUEST);
WindowState ws;
PortletMode pm;
if (editMaximizesOption || configMaximizesOption || editDefaultsMaximizesOption)
{
if (editMaximizesOption && template.getAction().equals(JetspeedActions.EDIT))
{
ws = WindowState.MAXIMIZED;
pm = template.getCustomMode();
}
else if (configMaximizesOption && template.getAction().equals(JetspeedActions.CONFIG))
{
ws = WindowState.MAXIMIZED;
pm = template.getCustomMode();
}
else if (editDefaultsMaximizesOption && template.getAction().equals(JetspeedActions.EDIT_DEFAULTS))
{
ws = WindowState.MAXIMIZED;
pm = template.getCustomMode();
}
else if (template.getAction().equals(JetspeedActions.VIEW))
{
ws = WindowState.NORMAL;
pm = template.getCustomMode();
}
else if (template.getAction().equals(JetspeedActions.NORMAL))
{
pm = PortletMode.VIEW;
ws = template.getCustomState();
}
else
{
ws = template.getCustomState();
pm = template.getCustomMode();
}
}
else
{
ws = template.getCustomState();
pm = template.getCustomMode();
}
/////////////////////////////////////
String actionURL = rc.getResponse().encodeURL(
(isAjaxRequest == null) ? portalURL.createPortletURL(pw, pm, ws, portalURL.isSecure()).toString()
: portalURL.createNavigationalEncoding(pw, pm, ws));
String linkURL = decoration
.getResource("images/" + actionName + ".gif");
boolean customAction = (template.getMode() != null && !template