Author: emuckenhuber
Date: 2007-11-27 05:59:43 -0500 (Tue, 27 Nov 2007)
New Revision: 9123
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/DirectoryResultFailure.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidget.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidgetPortlet.java
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
Log:
JBPORTAL-1534: default height param for NV widgets
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/AbstractWidgetProvider.java 2007-11-27
10:59:43 UTC (rev 9123)
@@ -216,7 +216,6 @@
if (w.isExpired())
{
entries.remove(url);
- System.out.println("removing entry: " + url.toString());
}
}
}
@@ -235,7 +234,6 @@
if (e.isExpired())
{
queries.remove(query);
- System.out.println("removing query: " + query.toString());
}
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/DirectoryResultFailure.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/DirectoryResultFailure.java 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/DirectoryResultFailure.java 2007-11-27
10:59:43 UTC (rev 9123)
@@ -73,7 +73,7 @@
public String getLocalizedErrorMessage(Locale locale)
{
- return "Directory lookup failed";
+ return "Directory lookup failed.";
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/exceptions/WidgetFailure.java 2007-11-27
10:59:43 UTC (rev 9123)
@@ -95,7 +95,7 @@
}
else
{
- return "Error getting widget: "+ urlString;
+ return "Error getting Widget: "+ urlString;
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidget.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidget.java 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidget.java 2007-11-27
10:59:43 UTC (rev 9123)
@@ -49,7 +49,7 @@
private final String id;
/** The default widget height */
- private final static String defaultHeight = "250";
+ private String defaultHeight = "250";
/** The netvibes widget info */
private final NetvibesWidgetInfo widgetInfo;
@@ -63,6 +63,11 @@
this.widgetInfo = widgetInfo;
}
+ public void setDefaultHeight(int defaultHeight)
+ {
+ this.defaultHeight = String.valueOf(defaultHeight);
+ }
+
public LocalizedString getDescription()
{
return this.widgetInfo.getMetaData().getDescription();
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidgetPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidgetPortlet.java 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/netvibes/NetvibesWidgetPortlet.java 2007-11-27
10:59:43 UTC (rev 9123)
@@ -30,6 +30,7 @@
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletSecurityException;
@@ -52,6 +53,12 @@
/** . */
private NetvibesProvider provider = new NetvibesProvider();
+
+ /** . */
+ private static final String INIT_PARAM_DEFAULT_HEIGHT = "defaultHeight";
+
+ /** . */
+ private int defaultHeight = 0;
protected WidgetProvider getProvider()
@@ -59,6 +66,27 @@
return provider;
}
+ @Override
+ public void init() throws PortletException
+ {
+ super.init();
+ PortletConfig config = getPortletConfig();
+ //
+ String height = config.getInitParameter(INIT_PARAM_DEFAULT_HEIGHT);
+ if (height != null && height.length() > 0)
+ {
+ try
+ {
+ this.defaultHeight = Integer.parseInt(height);
+ }
+ catch(NumberFormatException e)
+ {
+ log.error("Error parsing defaultHeight parameter", e);
+ }
+ }
+
+ }
+
public void processAction(ActionRequest req, ActionResponse resp) throws
PortletException, PortletSecurityException, IOException
{
if (req.getParameter("content.action.select") != null)
@@ -134,7 +162,11 @@
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
String uri = req.getParameter("uri");
- Widget widget = provider.getWidget(uri);
+ NetvibesWidget widget = (NetvibesWidget) provider.getWidget(uri);
+ if ( defaultHeight > 0)
+ {
+ widget.setDefaultHeight(defaultHeight);
+ }
if (widget != null)
{
if (widget.getTitle() != null)
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/portlet.xml 2007-11-27
10:59:43 UTC (rev 9123)
@@ -52,6 +52,11 @@
<name>fetchWidgetsOnDirectoryLookup</name>
<value>false</value>
</init-param>
+ <init-param>
+ <description>The default height of the widget if no height attribute is
defined by the widget itself.</description>
+ <name>defaultHeight</name>
+ <value>250</value>
+ </init-param>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>VIEW</portlet-mode>
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2007-11-27
10:57:31 UTC (rev 9122)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2007-11-27
10:59:43 UTC (rev 9123)
@@ -380,10 +380,10 @@
<%
break;
} // endof switch
- } // endof if != hidden
%>
</tr>
<%
+ } // endof if != hidden
} // for preferences
%>
<tr>
Show replies by date