Author: thomas.heute(a)jboss.com
Date: 2007-10-10 05:14:51 -0400 (Wed, 10 Oct 2007)
New Revision: 8580
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
docs/trunk/referenceGuide/en/modules/xmldescriptors.xml
Log:
Automatically add the correct web context to the icon relative link
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoFactory.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -22,6 +22,7 @@
******************************************************************************/
package org.jboss.portal.core.impl.portlet.info;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -35,10 +36,11 @@
public class CorePortletInfoFactory implements PortletInfoFactory
{
public PortletInfo createPortletInfo(
+ PortletApplicationContext portletApplicationContext,
PortletMetaData portletMD,
JBossPortletMetaData jbossPortletMD,
ResourceBundleManager resourceBundleManager)
{
- return new CorePortletInfoImpl(portletMD, jbossPortletMD, resourceBundleManager);
+ return new CorePortletInfoImpl(portletApplicationContext, portletMD,
jbossPortletMD, resourceBundleManager);
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/CorePortletInfoImpl.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -30,6 +30,7 @@
import org.jboss.portal.core.metadata.portlet.AjaxMetaData;
import org.jboss.portal.core.metadata.portlet.HeaderContentMetaData;
import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.impl.jsr168.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.jsr168.metadata.PortletMetaData;
import org.jboss.portal.common.i18n.ResourceBundleManager;
@@ -54,21 +55,21 @@
/** . */
private final PortletInfoInfoImpl portletInfo;
- public CorePortletInfoImpl(PortletMetaData portletMD,
org.jboss.portal.portlet.metadata.JBossPortletMetaData jbossPortletMD,
ResourceBundleManager bundleMgr)
+ public CorePortletInfoImpl(PortletApplicationContext portletApplicationContext,
PortletMetaData portletMD, org.jboss.portal.portlet.metadata.JBossPortletMetaData
jbossPortletMD, ResourceBundleManager bundleMgr)
{
- super(portletMD, jbossPortletMD, bundleMgr);
+ super(portletApplicationContext, portletMD, jbossPortletMD, bundleMgr);
//
AjaxMetaData ajaxMD = ((JBossPortletMetaData)jbossPortletMD).getAjax();
HeaderContentMetaData headerContentMD =
((JBossPortletMetaData)jbossPortletMD).getHeaderContent();
PortletInfoMetaData portletInfoMD =
((JBossPortletMetaData)jbossPortletMD).getPortletInfo();
-
+
//
this.txType = jbossPortletMD.getTxType();
this.ajax = ajaxMD != null ? new AjaxInfoImpl(ajaxMD) : null;
this.markupHeader = headerContentMD != null ? new
MarkupHeaderInfoImpl(headerContentMD) : null;
- this.portletInfo = portletInfoMD != null ? new PortletInfoInfoImpl(portletInfoMD) :
null;
- }
+ this.portletInfo = portletInfoMD != null ? new
PortletInfoInfoImpl(portletApplicationContext, portletInfoMD) : null;
+ }
public Transactions.Type getTxType()
{
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletIconInfoImpl.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -26,7 +26,7 @@
import org.jboss.portal.core.metadata.portlet.PortletIconMetaData;
import org.jboss.portal.core.portlet.info.PortletIconInfo;
-import org.jboss.portal.core.portlet.info.PortletInfoInfo;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -36,15 +36,19 @@
{
/** . */
private Map icons;
+
+ /** . */
+ private PortletApplicationContext portletApplicationContext;
- public PortletIconInfoImpl(PortletIconMetaData portletIconMetaData)
+ public PortletIconInfoImpl(PortletApplicationContext portletApplicationContext,
PortletIconMetaData portletIconMetaData)
{
icons = portletIconMetaData.getIcons();
+ this.portletApplicationContext = portletApplicationContext;
}
public String getIconLocation(String size)
{
- return (String)icons.get(size);
+ return portletApplicationContext.getContextPath() + (String)icons.get(size);
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/info/PortletInfoInfoImpl.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -25,6 +25,7 @@
import org.jboss.portal.core.metadata.portlet.PortletInfoMetaData;
import org.jboss.portal.core.portlet.info.PortletIconInfo;
import org.jboss.portal.core.portlet.info.PortletInfoInfo;
+import org.jboss.portal.portlet.container.PortletApplicationContext;
/**
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -34,15 +35,19 @@
{
/** . */
private PortletInfoMetaData portletInfoMetaData;
+
+ /** . */
+ private PortletApplicationContext portletApplicationContext;
- public PortletInfoInfoImpl(PortletInfoMetaData portletInfoMetaData)
+ public PortletInfoInfoImpl(PortletApplicationContext portletApplicationContext,
PortletInfoMetaData portletInfoMetaData)
{
+ this.portletApplicationContext = portletApplicationContext;
this.portletInfoMetaData = portletInfoMetaData;
}
public PortletIconInfo getPortletIconInfo()
{
- return new PortletIconInfoImpl(portletInfoMetaData.getPortletIcon());
+ return new PortletIconInfoImpl(portletApplicationContext,
portletInfoMetaData.getPortletIcon());
}
}
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/dtd/jboss-portlet_2_6.dtd 2007-10-10
09:14:51 UTC (rev 8580)
@@ -107,17 +107,17 @@
<!--
A small icon image, usually 16x16, gif, jpg and png are usually supported.
-An absolute URL or a URL starting with the context are accepted:
+An absolute URL or a URL starting with a '/' in the context of the webapp are
accepted:
eg.
http://www.example.com/images/smallIcon.png
-eg. /myWebAppContext/images/smallIcon.png
+eg. /images/smallIcon.png
-->
<!ELEMENT small-icon (#PCDATA)>
<!--
A large icon image, usually 32x32, gif, jpg and png are usually supported.
-An absolute URL or a URL starting with the context are accepted:
+An absolute URL or a URL starting with a '/' in the context of the webapp are
accepted:
eg.
http://www.example.com/images/smallIcon.png
-eg. /myWebAppContext/images/smallIcon.png
+eg. /images/smallIcon.png
-->
<!ELEMENT large-icon (#PCDATA)>
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -32,6 +32,9 @@
import org.jboss.portal.core.model.portal.PortalObject;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.core.portlet.info.CorePortletInfo;
+import org.jboss.portal.core.portlet.info.PortletIconInfo;
+import org.jboss.portal.core.portlet.info.PortletInfoInfo;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
@@ -187,6 +190,40 @@
return new ArrayList(portlet.getInfo().getCapabilities().getAllLocales());
}
});
+ portletDecorator.setProperty("smallIconLocation", new
AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ CorePortletInfo cInfo = (CorePortletInfo)portlet.getInfo();
+ PortletInfoInfo portletInfo = cInfo.getPortletInfo();
+ if (portletInfo != null && portletInfo.getPortletIconInfo() != null
&& portletInfo.getPortletIconInfo().getIconLocation(PortletIconInfo.SMALL) !=
null)
+ {
+ return
portletInfo.getPortletIconInfo().getIconLocation(PortletIconInfo.SMALL);
+ }
+ else
+ {
+ return "";
+ }
+ }
+ });
+ portletDecorator.setProperty("largeIconLocation", new
AbstractPropertyDecorator(String.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ Portlet portlet = (Portlet)bean;
+ CorePortletInfo cInfo = (CorePortletInfo)portlet.getInfo();
+ PortletInfoInfo portletInfo = cInfo.getPortletInfo();
+ if (portletInfo != null && portletInfo.getPortletIconInfo() != null
&& portletInfo.getPortletIconInfo().getIconLocation(PortletIconInfo.LARGE) !=
null)
+ {
+ return
portletInfo.getPortletIconInfo().getIconLocation(PortletIconInfo.LARGE);
+ }
+ else
+ {
+ return "";
+ }
+ }
+ });
registerDecorator(Portlet.class, portletDecorator);
//
Modified:
branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-10-09
22:30:12 UTC (rev 8579)
+++
branches/JBoss_Portal_Branch_2_6/portlet-server/src/main/org/jboss/portal/portlet/deployment/jboss/PortletAppDeployment.java 2007-10-10
09:14:51 UTC (rev 8580)
@@ -143,7 +143,8 @@
portletAppMD,
jbossAppMD,
pwa.getServletContext(),
- pwa.getClassLoader()
+ pwa.getClassLoader(),
+ pwa.getContextPath()
);
// Install portlet containers
Modified: docs/trunk/referenceGuide/en/modules/xmldescriptors.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/xmldescriptors.xml 2007-10-09 22:30:12 UTC (rev
8579)
+++ docs/trunk/referenceGuide/en/modules/xmldescriptors.xml 2007-10-10 09:14:51 UTC (rev
8580)
@@ -965,12 +965,14 @@
<portlet-name>ManagementPortlet</portlet-name>
<portlet-info>
<icon>
-
<small-icon>/myPortetAppContext/images/smallIcon.png</small-icon>
-
<large-icon>/myPortetAppContext/images/largeIcon.png</small-icon>
+ <small-icon>/images/smallIcon.png</small-icon>
+ <large-icon>/images/largeIcon.png</small-icon>
</icon>
</portlet-info>
</portlet>
</portlet-app>]]></programlisting>
+ The reference can be absolute (
http://www.example.com/images/smallIcon.png) or
relative to the
+ webapp context if starting with a '/'.
Those icons can be used by different part of the portal User Interface.
</para>
</sect3>