portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gonzalo Aguilar Delgado <gagui...@aguilardelgado.com>
Subject Re: [jira] Created: (JS2-1120) Portlet icon to be shown on toolbox should be loaded from application context
Date Sun, 07 Mar 2010 00:11:27 GMT
Hi,

I implemented this by doing what follows:

        I changed PortletDefinitionBean to add needed information.
        	private String applicationContextPath;
        	private String portletIconPath;
        and getters/setters.
        
        Why both? Because we will want to do context oriented javascript
        actions in the future for sure.
        
        I implemented portletIconPath using application context but I
        found
        one problem. I don't know how to check if file exists from
        there.
        
        Other way to do it is to let clientside rendering take care of
        what icon to show. In this case this attribute will be not
        needed but we have to implement a way to check if the image
        exists in javascript.
        
        Do you have this already implemented in a utils script or
        something?
        
What do you think it's best. Clientside validation or serverside. 

What is best for server side is that everything is returned tested to
the client. But I don't know how to get the application context from the
context path inside that bean...

Piece of code... (PortletDefinitionBean.java - line 118):

			if ("portlet-icon".equals(initParam.getParamName()))
			{
				portletIcon = initParam.getParamValue();
				// Check if file exist in main context (Portal) or application
context
				File iconFile=null;
				// Portal context
				iconFile = new File(applicationContextPath + "/images/portlets/" +
portletIcon);
				// How to check if file exists? Need application context absolute
path
//				if(iconFile.exists())
//				{
//					portletIconPath = iconFile.getPath();
//				}
//				else
//					portletIconPath = new String();
				portletIconPath = iconFile.getPath();
			}


Best regards,





El sáb, 06-03-2010 a las 21:04 +0000, Gonzalo Aguilar (JIRA) escribió:
> Portlet icon to be shown on toolbox should be loaded from application context
> -----------------------------------------------------------------------------
> 
>                  Key: JS2-1120
>                  URL: https://issues.apache.org/jira/browse/JS2-1120
>              Project: Jetspeed 2
>           Issue Type: Improvement
>     Affects Versions: 2.2.1
>             Reporter: Gonzalo Aguilar
>             Priority: Minor
>              Fix For: 2.2.2
> 
> 
> Portlet icons are currently loaded from Portal context. 
> 
> It makes difficult to update individual Portlet icons because they must be deployed to
the Portal Application. 
> 
> Proposed change is to make Portal to lookup the resource on Portlet context if the icon
is not found in the main Portal location.
> 
> This will help developers update Portlet icons with application.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message