You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2009/04/29 20:26:21 UTC

svn commit: r769862 [1/2] - in /portals/jetspeed-2/applications/j2-admin/trunk/src: main/java/org/apache/jetspeed/portlets/ main/java/org/apache/jetspeed/portlets/prm/ main/java/org/apache/jetspeed/portlets/prm/application/ main/java/org/apache/jetspee...

Author: woonsan
Date: Wed Apr 29 18:26:19 2009
New Revision: 769862

URL: http://svn.apache.org/viewvc?rev=769862&view=rev
Log:
JS2-946: Fixing the followings:
- Changed pam.psml to use new Wicket based portlets.
- Fixed adding/updating/removing on portlet application's user attributes and metadata.
- Fixed adding/updating/removing on portlet init parameters.
  (Locale/Description still does not work.)
- Fixed adding/updating/removing on portlet metadata.
- Some changes on wicket model usage.
  The basic idea is that I believe the model object inside LoadableDetachableModel should be a simple bean.
  So I added simple beans wrapping portal management objects and dedicated LodableDetachableModel implements for those.
  I believe this make those simpler.

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java   (with props)
Removed:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/ApplicationModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/PortletModel.java
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/AdminPortletWebPage.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationBean.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationDataProvider.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletDefinitionBean.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationDetailsView.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/AbstractAdminWebApplication.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/EditorTemplate.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/webapp/WEB-INF/portlet.xml

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/AdminPortletWebPage.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/AdminPortletWebPage.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/AdminPortletWebPage.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/AdminPortletWebPage.java Wed Apr 29 18:26:19 2009
@@ -17,206 +17,237 @@
 
 package org.apache.jetspeed.portlets;
 
-import java.security.Principal;
 import java.util.HashMap;
-import java.util.Map;
 
-import javax.portlet.GenericPortlet;
 import javax.portlet.PortletRequest;
 import javax.portlet.PortletResponse;
-import javax.portlet.RenderResponse;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
 
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.portlets.wicket.AdminWicketPortlet;
-import org.apache.wicket.RequestContext;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
+import org.apache.wicket.IPageMap;
+import org.apache.wicket.PageParameters;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
-import org.apache.wicket.protocol.http.portlet.PortletRequestContext;
 
 
 /**
- * General Portlet functionality provided to Admin Portlets via inheritance in an abstract class
+ * General Portlet functionality provided to Admin Portlets via inheritance in an abstract class.
+ * <P>
+ * <em>Note that some utility methods for portlet environment defined here 
+ * can be unavailable in a sub component.</em> 
+ * </P>
+ * <P>
+ * For example, if a panel in a web page has an event handler which uses the following example code:
+ * <CODE><PRE>
+ * String param = ((AdminPortletWebPage) getWebPage()).getInitParam("ViewPage");
+ * </PRE></CODE>
+ * The above code will work in this case. However, if the above code is included in the constructor of
+ * the panel and the page should contain the panel at the initial time, the above code will fail.
+ * It is simply because the web page object is not accessible during constructing the web page itself.
+ * For that reason, developers should pay caution to use the utility methods defined here.
+ * </P>
+ * <P>
+ * <EM>Note that it is desirable to use the utility methods defined in {@link AbstractAdminWebApplication}
+ * instead of using this class. For example, you can code like the following example:
+ * <CODE><PRE>
+ * String param = ((AbstractAdminWebApplication) getApplication()).getInitParam("ViewPage");
+ * </PRE></CODE>
+ * The above code will work in the case mentioned earlier.
+ * </P>
  * 
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
 public abstract class AdminPortletWebPage extends WebPage
 {
-    protected Map<String, String> initParams = null;
-    protected JetspeedServiceLocator serviceLocator;
-    public static final String USER_ADMINISTRATION = "J2 User Administration";
+    public static final String USER_ADMINISTRATION = AbstractAdminWebApplication.USER_ADMINISTRATION;
     
-    public AdminPortletWebPage()
+    protected AdminPortletWebPage()
     {
-        initParams = (Map<String, String>) getPortletRequest().getAttribute(AdminWicketPortlet.INIT_PARAMS);
-        serviceLocator = new JetspeedServiceLocator();
+        super();
     }
 
+    protected AdminPortletWebPage(final IModel<?> model)
+    {
+        super(model);
+    }
+
+    protected AdminPortletWebPage(final IPageMap pageMap)
+    {
+        super(pageMap);
+    }
+
+    protected AdminPortletWebPage(final IPageMap pageMap, final IModel<?> model)
+    {
+        super(pageMap, model);
+    }
+
+    protected AdminPortletWebPage(final PageParameters parameters)
+    {
+        super(parameters);
+    }
+
+    protected AdminPortletWebPage(final IPageMap pageMap, final PageParameters parameters)
+    {
+        super(pageMap, parameters);
+    }
+
+    public String messageSubstition(String resource, String[]keys, Object[]values)
+    {
+        HashMap<String, Object> vars  = new HashMap<String, Object>(keys.length);
+        for (int ix = 0; ix < keys.length; ix++)
+        {
+            if (values[ix] == null)
+                vars.put(keys[ix], "");
+            else
+                vars.put(keys[ix], values[ix]);
+        }
+        return getString(resource, new Model<HashMap<String, Object>>(vars));
+    }
+ 
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getServiceLocator()}.
+     */
     public JetspeedServiceLocator getServiceLocator()
     {
-        return serviceLocator;
+        return ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
     }
     
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getInitParam(String)}.
+     */
     public String getInitParam(String paramKey)
     {
-        String paramValue = null;
-        if (initParams.containsKey(paramKey))
-        {
-            paramValue = (String) initParams.get(paramKey);
-        }
-        return paramValue;
+        return ((AbstractAdminWebApplication) getApplication()).getInitParam(paramKey);
     }
 
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getInitParamAsInteger(String)}.
+     */
     public int getInitParamAsInteger(String paramKey)
     {
-        int result = 0;
-        if (initParams.containsKey(paramKey))
-        {
-            String paramValue = (String) initParams.get(paramKey);
-            result = Integer.parseInt(paramValue);
-        }
-        return result;
+        return ((AbstractAdminWebApplication) getApplication()).getInitParamAsInteger(paramKey);
     }
 
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getInitParamAsBoolean(String)}.
+     */
     public boolean getInitParamAsBoolean(String paramKey)
     {
-        boolean result = false;
-        if (initParams.containsKey(paramKey))
-        {
-            String paramValue = (String) initParams.get(paramKey);
-            result = Boolean.parseBoolean(paramValue);
-        }
-        return result;
+        return ((AbstractAdminWebApplication) getApplication()).getInitParamAsBoolean(paramKey);
     }
     
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPreference(String)}.
+     */
     public String getPreference(String key)
     {
-        String preferenceValue = null;
-        if( getPortletRequest().getPreferences().getMap().containsKey(key))
-        {
-            preferenceValue = getPortletRequest().getPreferences().getValue(key, null);
-        }
-        return preferenceValue;
+        return ((AbstractAdminWebApplication) getApplication()).getPreference(key);
     }
     
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPreferenceAsInteger(String)}.
+     */
     public int getPreferenceAsInteger(String key)
     {
-        int result = 0;
-        if (getPortletRequest().getPreferences().getMap().containsKey(key))
-        {
-            String preferenceValue = getPortletRequest().getPreferences().getValue(key, null);
-            if (preferenceValue != null)
-            {
-                result = Integer.parseInt(preferenceValue);
-            }
-        }
-        return result;
+        return ((AbstractAdminWebApplication) getApplication()).getPreferenceAsInteger(key);
     }
 
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPreferenceAsBoolean(String)}.
+     */
     public boolean getPreferenceAsBoolean(String key)
     {
-        boolean result = false;
-        if (getPortletRequest().getPreferences().getMap().containsKey(key))
-        {
-            String preferenceValue = getPortletRequest().getPreferences().getValue(key, null);
-            if (preferenceValue != null)
-            {
-                result = Boolean.parseBoolean(preferenceValue);
-            }
-        }
-        return result;
+        return ((AbstractAdminWebApplication) getApplication()).getPreferenceAsBoolean(key);
     }
     
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPreference(String, String)}.
+     */
     public String getPreference(String key,String defaultValue)
     {
-        String preferenceValue=null;;
-        if(getPortletRequest().getPreferences().getMap().containsKey(key))
-        {
-            preferenceValue = getPortletRequest().getPreferences().getValue(key, defaultValue);
-        }
-        return preferenceValue;
+        return ((AbstractAdminWebApplication) getApplication()).getPreference(key, defaultValue);
     }
     
-    public String [] getPreference(String key,String values [])
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPreference(String, String[])}.
+     */
+    public String [] getPreference(String key,String [] values)
     {
-        String preferenceValue[]=null;;
-        if(getPortletRequest().getPreferences().getMap().containsKey(key))
-        {
-            preferenceValue = getPortletRequest().getPreferences().getValues(key, null);
-        }
-        return preferenceValue;
+        return ((AbstractAdminWebApplication) getApplication()).getPreference(key, values);
     }
     
-    protected PortletRequest getPortletRequest()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPortletRequest()}.
+     */
+    public PortletRequest getPortletRequest()
     {
-        return ((PortletRequestContext) RequestContext.get()).getPortletRequest();
+        return ((AbstractAdminWebApplication) getApplication()).getPortletRequest();
     }
     
-    protected void setTitle(String title)
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#setTitle(String)}.
+     */
+    public void setTitle(String title)
     {
-        PortletResponse pr = getPortletResponse();
-        if (pr instanceof RenderResponse) {
-            RenderResponse rr = (RenderResponse) pr;
-            rr.setTitle(title);
-        }
+        ((AbstractAdminWebApplication) getApplication()).setTitle(title);
     }
     
-    protected String getTitle()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getTitle()}.
+     */
+    public String getTitle()
     {
-        return (String)getPortletRequest().getAttribute(AdminWicketPortlet.PORTLET_TITLE);
+        return ((AbstractAdminWebApplication) getApplication()).getTitle();
     }
     
-    protected String getPortletName()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPortletName()}.
+     */
+    public String getPortletName()
     {
-        GenericPortlet portlet = (GenericPortlet) getPortletRequest().getAttribute(AdminWicketPortlet.PORTLET);
-        return portlet.getPortletName();
+        return ((AbstractAdminWebApplication) getApplication()).getPortletName();
     }
     
-    protected PortletResponse getPortletResponse()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getPortletResponse()}.
+     */
+    public PortletResponse getPortletResponse()
     {
-        return ((PortletRequestContext) RequestContext.get()).getPortletResponse();
+        return ((AbstractAdminWebApplication) getApplication()).getPortletResponse();
     }
     
-    protected HttpServletRequest getServletRequest(PortletRequest request)
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getServletRequest(PortletRequest)}.
+     */
+    public HttpServletRequest getServletRequest(PortletRequest request)
     {
-        HttpServletRequest realRequest = (HttpServletRequest)((HttpServletRequestWrapper) request).getRequest();
-        return realRequest;
+        return ((AbstractAdminWebApplication) getApplication()).getServletRequest(request);
     }
     
-    protected HttpServletRequest getServletRequest()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getServletRequest()}.
+     */
+    public HttpServletRequest getServletRequest()
     {
-        HttpServletRequest realRequest = (HttpServletRequest)((HttpServletRequestWrapper) getPortletRequest()).getRequest();
-        return realRequest;
+        return ((AbstractAdminWebApplication) getApplication()).getServletRequest();
     }
  
-    protected String getIPAddress()
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getIPAddress()}.
+     */
+    public String getIPAddress()
     {
-        org.apache.jetspeed.request.RequestContext context = (org.apache.jetspeed.request.RequestContext) getPortletRequest().getAttribute(
-                PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-        return (context == null ? "" : context.getRequest().getRemoteAddr());
+        return ((AbstractAdminWebApplication) getApplication()).getIPAddress();
     }
  
-    protected String messageSubstition(String resource, String[]keys, Object[]values)
+    /**
+     * Delegates the invocation to {@link AbstractAdminWebApplication#getAuthenticatedUsername()}.
+     */
+    public String getAuthenticatedUsername()
     {
-        HashMap<String, Object> vars  = new HashMap<String, Object>(keys.length);
-        for (int ix = 0; ix < keys.length; ix++)
-        {
-            if (values[ix] == null)
-                vars.put(keys[ix], "");
-            else
-                vars.put(keys[ix], values[ix]);
-        }
-        return getString(resource, new Model<HashMap<String, Object>>(vars));
+       return ((AbstractAdminWebApplication) getApplication()).getAuthenticatedUsername();
     }
- 
-    protected String getAuthenticatedUsername()
-    {
-        Principal p = getPortletRequest().getUserPrincipal();
-        if (p == null)
-            return "";
-        else
-            return p.getName();
-    }    
+    
 }
\ No newline at end of file

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationBean.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationBean.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationBean.java Wed Apr 29 18:26:19 2009
@@ -17,7 +17,6 @@
 package org.apache.jetspeed.portlets.prm;
 
 import org.apache.jetspeed.om.portlet.PortletApplication;
-import org.apache.wicket.IClusterable;
 
 /**
  * Represents a portlet application in the wicket widget
@@ -25,26 +24,27 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id$
  */
-public class ApplicationBean implements IClusterable
+public class ApplicationBean extends PortletApplicationNodeBean
 {   
-    protected String name;
+    private static final long serialVersionUID = 1L;
+    
     protected String path;
     protected String version;
     protected boolean local;
     protected boolean running;
-    private static final long serialVersionUID = 1L;
            
-    public ApplicationBean(PortletApplication app)
+    public ApplicationBean(PortletApplication pa)
     {
-        this(app, false);
+        this(pa, false);
     }
 
     public ApplicationBean(PortletApplication pa, boolean running)
     {
-        super();
-        this.name = pa.getName();
+        super(pa.getName(), null);
+
         this.version = pa.getVersion();
         this.local = pa.getApplicationType() == PortletApplication.LOCAL;
+        
         if (local)
         {
             this.path = "<local>";
@@ -53,12 +53,13 @@
         {
             this.path = pa.getContextPath();
         }
+        
         this.running = running;        
     }
     
     public String toString()
     {
-        return getName();
+        return getApplicationName();
     }
         
     public String getPath()
@@ -71,11 +72,6 @@
         return local;
     }
     
-    public String getName()
-    {
-        return name;
-    }
-    
     public boolean isRunning()
     {
         return running;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationDataProvider.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationDataProvider.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationDataProvider.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationDataProvider.java Wed Apr 29 18:26:19 2009
@@ -195,13 +195,13 @@
             String p2 = "";
             if (orderBy == AppOrderBy.NAME_ASC)
             {
-                p1 = app1.getName();
-                p2 = app2.getName();
+                p1 = app1.getApplicationName();
+                p2 = app2.getApplicationName();
             }
             else if (orderBy == AppOrderBy.NAME_DESC)
             {
-                p2 = app1.getName();
-                p1 = app2.getName();
+                p2 = app1.getApplicationName();
+                p1 = app2.getApplicationName();
             }
             else if (orderBy == AppOrderBy.VERSION_ASC)
             {

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/ApplicationsListHome.java Wed Apr 29 18:26:19 2009
@@ -109,7 +109,7 @@
                         }
                     }
                 };
-                nameLink.add(new Label("nameLabel", pa.getName()));
+                nameLink.add(new Label("nameLabel", pa.getApplicationName()));
                 item.add(nameLink);
                 item.add(new Label("version", pa.getVersion()));
                 item.add(new Label("path", pa.getPath()));
@@ -261,7 +261,7 @@
             ApplicationsListHome home = ApplicationsListHome.this;
             ApplicationBean pab = (ApplicationBean) model.getObject();
             PortletApplication pa = home.getServiceLocator()
-                    .getPortletRegistry().getPortletApplication(pab.getName());
+                    .getPortletRegistry().getPortletApplication(pab.getApplicationName());
             ApplicationServerManager asm = home.getServiceLocator()
                     .getApplicationServerManager();
             boolean isLocal = pa.getApplicationType() == PortletApplication.LOCAL;
@@ -277,7 +277,7 @@
                     ApplicationBean pab = (ApplicationBean) model.getObject();
                     PortletApplication pa = home.getServiceLocator()
                             .getPortletRegistry().getPortletApplication(
-                                    pab.getName());
+                                    pab.getApplicationName());
                     ApplicationServerManager asm = home.getServiceLocator()
                             .getApplicationServerManager();
                     FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
@@ -326,7 +326,7 @@
                     ApplicationBean pab = (ApplicationBean) model.getObject();
                     PortletApplication pa = home.getServiceLocator()
                             .getPortletRegistry().getPortletApplication(
-                                    pab.getName());
+                                    pab.getApplicationName());
                     ApplicationServerManager asm = home.getServiceLocator()
                             .getApplicationServerManager();
                     FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
@@ -375,7 +375,7 @@
                     ApplicationBean pab = (ApplicationBean) model.getObject();
                     PortletApplication pa = home.getServiceLocator()
                             .getPortletRegistry().getPortletApplication(
-                                    pab.getName());
+                                    pab.getApplicationName());
                     ApplicationServerManager asm = home.getServiceLocator()
                             .getApplicationServerManager();
                     FeedbackPanel feed = (FeedbackPanel) home.get("feedback");
@@ -426,7 +426,7 @@
                     ApplicationBean pab = (ApplicationBean) model.getObject();
                     PortletApplication pa = home.getServiceLocator()
                             .getPortletRegistry().getPortletApplication(
-                                    pab.getName());
+                                    pab.getApplicationName());
                     ApplicationServerManager asm = home.getServiceLocator()
                             .getApplicationServerManager();
                     PortletApplicationManagement pam = home.getServiceLocator()

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java?rev=769862&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java Wed Apr 29 18:26:19 2009
@@ -0,0 +1,71 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+import org.apache.jetspeed.om.portlet.Description;
+
+public class DescriptionBean implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+    
+    private Description description;
+    
+    public DescriptionBean(Description description)
+    {
+        this.description = description;
+    }
+    
+    public String getLocaleString()
+    {
+        return description.getLocale().toString();
+    }
+    
+    public Locale getLocale()
+    {
+        return description.getLocale();
+    }
+    
+    public String getDescription()
+    {
+        return description.getDescription();
+    }
+
+    public void setDescription(String desc)
+    {
+        description.setDescription(desc);
+    }
+    
+    @Override
+    public boolean equals(Object object)
+    {
+        if (object instanceof DescriptionBean)
+        {
+            DescriptionBean other = (DescriptionBean) object;
+            
+            if (getLocaleString().equals(other.getLocaleString()))
+            {
+                return true;
+            }
+        }   
+    
+        return false;
+    }
+    
+}

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/DescriptionBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java?rev=769862&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java Wed Apr 29 18:26:19 2009
@@ -0,0 +1,100 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm;
+
+import java.util.Locale;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+
+public class LocalizedFieldBean
+{
+    private LocalizedField field;
+    
+    public LocalizedFieldBean(LocalizedField field)
+    {
+        this.field = field;
+    }
+    
+    public String getName()
+    {
+        return field.getName();
+    }
+    
+    public void setName(String name)
+    {
+        field.setName(name);
+    }
+    
+    public String getLocaleString()
+    {
+        return field.getLocale().toString();
+    }
+    
+    public void setLocaleString(String localeString)
+    {
+        String language = null;
+        String country = null;
+        
+        String [] tokens = StringUtils.splitPreserveAllTokens(localeString, '_');
+        
+        if (tokens.length > 0)
+        {
+            language = tokens[0];
+        }
+        
+        if (tokens.length > 1)
+        {
+            country = tokens[1];
+        }
+        
+        Locale locale = (country == null ? new Locale(language) : new Locale(language, country));
+        field.setLocale(locale);
+    }
+    
+    public String getValue()
+    {
+        return field.getValue();
+    }
+
+    public void setValue(String value)
+    {
+        field.setValue(value);
+    }
+    
+    public LocalizedField getLocalizedField()
+    {
+        return this.field;
+    }
+    
+    @Override
+    public boolean equals(Object object)
+    {
+        if (object instanceof LocalizedFieldBean)
+        {
+            LocalizedFieldBean other = (LocalizedFieldBean) object;
+            
+            if (getName().equals(other.getName()) && getLocaleString().equals(other.getLocaleString()))
+            {
+                return true;
+            }
+        }   
+    
+        return false;
+    }
+    
+}

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LocalizedFieldBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.html?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.html Wed Apr 29 18:26:19 2009
@@ -28,8 +28,8 @@
 		<th class="portlet-section-subheader">Locale</th>
 		<th class="portlet-section-subheader">Value</th>
 		<wicket:fragment wicket:id="itemFragment">
-			<td class="portlet-section-body"><input type="text" wicket:id="name"/></td>
-			<td class="portlet-section-body"><input type="text" wicket:id="locale"/></td>
+			<td class="portlet-section-body"><input type="text" wicket:id="name" readonly="true"/></td>
+			<td class="portlet-section-body"><input type="text" wicket:id="locale" readonly="true"/></td>
 			<td class="portlet-section-body"><input type="text" wicket:id="value"/></td>
 		</wicket:fragment>
 		<wicket:fragment wicket:id="newFragment">

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/MetadataPanel.java Wed Apr 29 18:26:19 2009
@@ -16,95 +16,37 @@
  */
 package org.apache.jetspeed.portlets.prm;
 
-import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Locale;
 
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.components.portletregistry.RegistryException;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.LocalizedField;
-import org.apache.jetspeed.portlets.prm.model.ApplicationModel;
-import org.apache.jetspeed.portlets.prm.model.LocalizedFieldModel;
-import org.apache.jetspeed.portlets.prm.model.PortletModel;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.model.LocalizedFieldBeanModel;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.jetspeed.portlets.wicket.component.editor.EditorTemplate;
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.TextField;
 import org.apache.wicket.markup.html.panel.Fragment;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 
-public class MetadataPanel extends EditorTemplate<LocalizedFieldModel>
+public class MetadataPanel extends EditorTemplate<LocalizedFieldBean>
 {
-    private String newName, newValue, newLocale;
-    private MetadataHandler handler;
-
-    private abstract class MetadataHandler implements Serializable
-    {
-
-        public abstract GenericMetadata getMetadata();
-
-        public abstract void save() throws RegistryException;
-
-        public abstract LocalizedFieldModel newLocalizedFieldModel(LocalizedField field);
-    }
-
-    public MetadataPanel(String id, final ApplicationModel application)
-    {
-        super(id, application);
-
-        this.handler = new MetadataHandler()
-        {
-
-            @Override
-            public GenericMetadata getMetadata()
-            {
-                return application.getObject().getMetadata();
-            }
-
-            @Override
-            public void save() throws RegistryException
-            {
-                application.getServiceLocator().getPortletRegistry().updatePortletApplication(application.getObject());
-            }
-
-            @Override
-            public LocalizedFieldModel newLocalizedFieldModel(LocalizedField field)
-            {
-                return new LocalizedFieldModel(application, field);
-            }
+    private static final long serialVersionUID = 1L;
 
-        };
-    }
+    private PortletApplicationNodeBean paNodeBean;
+    private String newName, newValue, newLocale;
 
-    public MetadataPanel(String id, final PortletModel portlet)
+    public MetadataPanel(String id, final PortletApplicationNodeBean paNodeBean)
     {
-        super(id, portlet);
-
-        this.handler = new MetadataHandler()
-        {
-
-            @Override
-            public GenericMetadata getMetadata()
-            {
-                return portlet.getObject().getMetadata();
-            }
-
-            @Override
-            public void save() throws RegistryException
-            {
-                portlet.getParent().getServiceLocator().getPortletRegistry().savePortletDefinition(portlet.getObject());
-            }
-
-            @Override
-            public LocalizedFieldModel newLocalizedFieldModel(LocalizedField field)
-            {
-                return new LocalizedFieldModel(portlet, field);
-            }
-
-        };
+        super(id);
+        this.paNodeBean = paNodeBean;
     }
 
     @Override
@@ -112,22 +54,44 @@
     {
         return new Button(componentId)
         {
+            private static final long serialVersionUID = 1L;
 
             @Override
             public void onSubmit()
             {
-                if (newName != null && newValue != null && newLocale != null)
-                {
-                    LocalizedField field = handler.getMetadata().createLocalizedField();
-                    field.setLocale(new Locale(newLocale));
-                    field.setName(newName);
-                    field.setValue(newValue);
-                    handler.getMetadata().addField(field);
-                }
-
                 try
                 {
-                    handler.save();
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    PortletDefinition def = null;
+                    
+                    if (paNodeBean.getName() != null)
+                    {
+                        def = app.getPortlet(paNodeBean.getName());
+                    }
+                    
+                    if (newName != null && newValue != null && newLocale != null)
+                    {
+                        GenericMetadata metadata = (def == null ? app.getMetadata() : def.getMetadata());
+                        LocalizedFieldBean fieldBean = new LocalizedFieldBean(metadata.createLocalizedField());
+                        fieldBean.setName(newName);
+                        fieldBean.setLocaleString(newLocale);
+                        fieldBean.setValue(newValue);
+                        metadata.addField(fieldBean.getLocalizedField());
+
+                        newName = null;
+                        newValue = null;
+                        newLocale = null;
+                    }
+
+                    if (def == null)
+                    {
+                        registry.updatePortletApplication(app);
+                    }
+                    else
+                    {
+                        registry.savePortletDefinition(def);
+                    }
                 }
                 catch (RegistryException e)
                 {
@@ -153,65 +117,35 @@
     }
 
     @Override
-    public void buildItems(Fragment fragment, final LocalizedFieldModel model)
+    public void buildItems(Fragment fragment, final LocalizedFieldBean field)
     {
-        fragment.add(new TextField<String>("name", new Model<String>()
-        {
-
-            @Override
-            public String getObject()
-            {
-                return model.getName();
-            }
-
-            @Override
-            public void setObject(String object)
-            {
-                model.setName(object);
-            }
-        }));
-        fragment.add(new TextField<String>("value", new Model<String>()
-        {
-
-            @Override
-            public String getObject()
-            {
-                return model.getValue();
-            }
-
-            @Override
-            public void setObject(String object)
-            {
-                model.setValue(object);
-            }
-        }));
-        fragment.add(new TextField<String>("locale", new Model<String>()
-        {
-
-            @Override
-            public String getObject()
-            {
-                return model.getLocale();
-            }
-
-            @Override
-            public void setObject(String object)
-            {
-                model.setLocale(object);
-            }
-        }));
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        fragment.add(new TextField<String>("name", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "name")));
+        fragment.add(new TextField<String>("locale", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "localeString")));
+        fragment.add(new TextField<String>("value", new PropertyModel(new LocalizedFieldBeanModel(locator, paNodeBean, field), "value")));
     }
 
     @Override
-    public void delete(IModel<LocalizedFieldModel>[] fields)
+    public void delete(IModel<LocalizedFieldBean>[] fieldBeans)
     {
-        Iterator<LocalizedField> it = handler.getMetadata().getFields().iterator();
-        while (it.hasNext())
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = null;
+        
+        if (paNodeBean.getName() != null)
+        {
+            def = app.getPortlet(paNodeBean.getName());
+        }
+        
+        GenericMetadata metadata = (def == null ? app.getMetadata() : def.getMetadata());
+
+        for (Iterator<LocalizedField> it = metadata.getFields().iterator(); it.hasNext(); )
         {
-            String id = it.next().getName();
-            for (IModel<LocalizedFieldModel> field : fields)
+            LocalizedFieldBean tempBean = new LocalizedFieldBean(it.next());
+            
+            for (IModel<LocalizedFieldBean> fieldBean : fieldBeans)
             {
-                if (field.getObject().getName().equals(id))
+                if (tempBean.equals(fieldBean.getObject()))
                 {
                     it.remove();
                     break;
@@ -221,7 +155,14 @@
 
         try
         {
-            handler.save();
+            if (def == null)
+            {
+                registry.updatePortletApplication(app);
+            }
+            else
+            {
+                registry.savePortletDefinition(def);
+            }
         }
         catch (RegistryException e)
         {
@@ -231,20 +172,33 @@
     }
 
     @Override
-    public Iterator<IModel<LocalizedFieldModel>> getItemModels()
+    public Iterator<IModel<LocalizedFieldBean>> getItemModels()
     {
-        List<IModel<LocalizedFieldModel>> list = new ArrayList<IModel<LocalizedFieldModel>>();
-        for (LocalizedField field : handler.getMetadata().getFields())
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = null;
+        
+        if (paNodeBean.getName() != null)
         {
-            list.add(new Model<LocalizedFieldModel>(handler.newLocalizedFieldModel(field)));
+            def = app.getPortlet(paNodeBean.getName());
+        }
+        
+        List<IModel<LocalizedFieldBean>> list = new ArrayList<IModel<LocalizedFieldBean>>();
+        GenericMetadata metadata = (def == null ? app.getMetadata() : def.getMetadata());
+
+        for (LocalizedField field : metadata.getFields())
+        {
+            list.add(new LocalizedFieldBeanModel(locator, paNodeBean, new LocalizedFieldBean(field)));
         }
 
         return list.iterator();
     }
 
     @Override
-    public IModel<LocalizedFieldModel> getNewRowModel(LocalizedFieldModel object)
+    public IModel<LocalizedFieldBean> getNewRowModel(LocalizedFieldBean fieldBean)
     {
-        return new Model<LocalizedFieldModel>(object);
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        return new LocalizedFieldBeanModel(locator, paNodeBean, fieldBean);
     }
+
 }

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java?rev=769862&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java Wed Apr 29 18:26:19 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm;
+
+import org.apache.wicket.IClusterable;
+
+public class PortletApplicationNodeBean implements IClusterable
+{
+    private static final long serialVersionUID = 1L;
+    
+    protected String applicationName;
+    protected String name;
+        
+    public PortletApplicationNodeBean(String applicationName, String name)
+    {
+        this.applicationName = applicationName;
+        this.name = name;
+    }
+    
+    public String getApplicationName()
+    {
+        return applicationName;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+
+}

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletApplicationNodeBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletDefinitionBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletDefinitionBean.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletDefinitionBean.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/PortletDefinitionBean.java Wed Apr 29 18:26:19 2009
@@ -20,20 +20,17 @@
 
 import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.wicket.IClusterable;
 
-public class PortletDefinitionBean implements IClusterable
+public class PortletDefinitionBean extends PortletApplicationNodeBean
 {
-    protected String name;
+    private static final long serialVersionUID = 1L;
+    
     protected String uniqueName;
     protected String displayName;
-    protected String appName;
-    private static final long serialVersionUID = 1L;    
         
     public PortletDefinitionBean(PortletDefinition portlet, String appName, Locale locale)
     {
-        this.name = portlet.getPortletName();
-        this.appName = appName;
+        super(appName, portlet.getPortletName());
         this.uniqueName = portlet.getUniqueName();
         DisplayName dn = portlet.getDisplayName(locale);
         if (dn == null)
@@ -57,14 +54,4 @@
         return displayName;
     }
     
-    public String getName()
-    {
-        return name;
-    }
-
-    public String getAppName()
-    {
-        return appName;
-    }
-    
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationDetailsView.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationDetailsView.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationDetailsView.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationDetailsView.java Wed Apr 29 18:26:19 2009
@@ -16,15 +16,14 @@
  */
 package org.apache.jetspeed.portlets.prm.application;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.jetspeed.portlets.AdminPortletWebPage;
-import org.apache.jetspeed.portlets.prm.MetadataPanel;
 import org.apache.jetspeed.portlets.prm.ApplicationBean;
 import org.apache.jetspeed.portlets.prm.ApplicationsListApplication;
-import org.apache.jetspeed.portlets.prm.model.ApplicationModel;
+import org.apache.jetspeed.portlets.prm.MetadataPanel;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
 import org.apache.portals.messaging.PortletMessaging;
 import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
 import org.apache.wicket.extensions.markup.html.tabs.ITab;
@@ -35,20 +34,18 @@
 
 public class ApplicationDetailsView extends AdminPortletWebPage
 {
-    private ApplicationModel applicationModel;
-    private Map<String, ITab> tabs;
+    private PortletApplicationNodeBean paNodeBean;
     private boolean dirty = true;
     private String title;
 
     public ApplicationDetailsView()
     {
-        tabs = new HashMap<String, ITab>();
         this.title = getPortletName();
     }
 
     void constructLayout()
     {
-        if (applicationModel == null)
+        if (paNodeBean == null)
         {
             removeAll();
             add(new Label("status", "No application selected"));
@@ -56,44 +53,41 @@
         }
         else
         {
+            addOrReplace(new Label("status", ""));
 
-            if (get("status") != null)
-            {
-                remove("status");
-            }
-            add(new Label("status", ""));
-
-            ITab metadataTab = new AbstractTab(new Model("Metadata"))
+            List<ITab> tabs = new ArrayList<ITab>();
+            
+            ITab detailsTab = new AbstractTab(new Model("Details"))
             {
 
                 public Panel getPanel(String panelId)
                 {
-                    return new MetadataPanel(panelId, applicationModel);
+                    return new DetailsPanel(panelId, paNodeBean);
                 }
             };
-            tabs.put("metadata", metadataTab);
+            tabs.add(detailsTab);
 
-            ITab detailsTab = new AbstractTab(new Model("Details"))
+            ITab userAttributesTab = new AbstractTab(new Model("User Attributes"))
             {
 
                 public Panel getPanel(String panelId)
                 {
-                    return new DetailsPanel(panelId, applicationModel);
+                    return new UserAttributePanel(panelId, paNodeBean);
                 }
             };
-            tabs.put("details", detailsTab);
+            tabs.add(userAttributesTab);
 
-            ITab userAttributesTab = new AbstractTab(new Model("User Attributes"))
+            ITab metadataTab = new AbstractTab(new Model("Metadata"))
             {
 
                 public Panel getPanel(String panelId)
                 {
-                    return new UserAttributePanel(panelId, applicationModel);
+                    return new MetadataPanel(panelId, paNodeBean);
                 }
             };
-            tabs.put("userattributes", userAttributesTab);
+            tabs.add(metadataTab);
 
-            TabbedPanel tabbedPanel = new TabbedPanel("tabs", Arrays.asList(tabs.values().toArray(new ITab[tabs.values().size()])));
+            TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
             if (get("tabs") == null)
             {
                 tabbedPanel.setSelectedTab(0);
@@ -109,20 +103,20 @@
                 }
             }
 
-            add(tabbedPanel);
+            addOrReplace(tabbedPanel);
         }
     }
 
     @Override
     protected void onBeforeRender()
     {
-        ApplicationBean applicationBean = (ApplicationBean) PortletMessaging.consume(getPortletRequest(), ApplicationsListApplication.PRM_TOPIC,
+        PortletApplicationNodeBean receivedPANodeBean = (ApplicationBean) PortletMessaging.consume(getPortletRequest(), ApplicationsListApplication.PRM_TOPIC,
                 ApplicationsListApplication.SELECTED_APPLICATION_EVENT);
 
-        if (applicationBean != null)
+        if (receivedPANodeBean != null)
         {
-            this.applicationModel = new ApplicationModel(getServiceLocator(), applicationBean.getName());
-            this.title = getPortletName() + " - " + applicationBean.getName();
+            this.paNodeBean = receivedPANodeBean;
+            this.title = getPortletName() + " - " + paNodeBean.getApplicationName();
             this.dirty = true;
         }
 

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationModel.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationModel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/ApplicationModel.java Wed Apr 29 18:26:19 2009
@@ -43,7 +43,7 @@
      */
     public int hashCode()
     {
-        return pa.getName().hashCode();
+        return pa.getApplicationName().hashCode();
     }
 
     /**
@@ -65,7 +65,7 @@
         else if (obj instanceof ApplicationModel)
         {
             ApplicationModel other = (ApplicationModel) obj;
-            return pa.getName().equals(other.getModelBean().getName());
+            return pa.getApplicationName().equals(other.getModelBean().getApplicationName());
         }
         return false;
     }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.java Wed Apr 29 18:26:19 2009
@@ -24,8 +24,10 @@
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.JetspeedServiceReference;
 import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.KeyVal;
-import org.apache.jetspeed.portlets.prm.model.ApplicationModel;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.markup.repeater.Item;
@@ -37,14 +39,18 @@
 
 public class DetailsPanel extends Panel
 {
+    private static final long serialVersionUID = 1L;
+    
     private transient List<KeyVal> detailList;
 
-    public DetailsPanel(String id, ApplicationModel model)
+    public DetailsPanel(String id, PortletApplicationNodeBean paNodeBean)
     {
-        super(id, model);
+        super(id);
 
         detailList = new ArrayList<KeyVal>();
-        PortletApplication app = model.getObject();
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        
         detailList.add(new KeyVal("Name", app.getName()));
         detailList.add(new KeyVal("Version", app.getVersion()));
         detailList.add(new KeyVal("Description", getDescription(app)));

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.html?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.html Wed Apr 29 18:26:19 2009
@@ -27,7 +27,7 @@
 		<th class="portlet-section-subheader">Name</th>
 		<th class="portlet-section-subheader">Locale/Description</th>
 		<wicket:fragment wicket:id="itemFragment">
-			<td class="portlet-section-body"><input type="text" wicket:id="name"/></td>
+			<td class="portlet-section-body"><input type="text" wicket:id="name" readonly="true"/></td>
 			<td class="portlet-section-body"><span wicket:id="localizationEditor"/></td>
 		</wicket:fragment>
 		<wicket:fragment wicket:id="newFragment">

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/UserAttributePanel.java Wed Apr 29 18:26:19 2009
@@ -19,13 +19,17 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.components.portletregistry.RegistryException;
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.UserAttribute;
-import org.apache.jetspeed.portlets.prm.model.ApplicationModel;
-import org.apache.jetspeed.portlets.prm.model.DescriptionModel;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.DescriptionBean;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.jetspeed.portlets.wicket.component.editor.EditorTemplate;
 import org.apache.jetspeed.portlets.wicket.component.editor.LocalizedDescriptionEditor;
 import org.apache.wicket.markup.html.form.Button;
@@ -40,11 +44,15 @@
 
 public class UserAttributePanel extends EditorTemplate<UserAttribute>
 {
+    private static final long serialVersionUID = 1L;
+    
+    private PortletApplicationNodeBean paNodeBean;
     private String newName, newLocale, newDescription;
 
-    public UserAttributePanel(String id, ApplicationModel model)
+    public UserAttributePanel(String id, PortletApplicationNodeBean paNodeBean)
     {
-        super(id, model);
+        super(id);
+        this.paNodeBean = paNodeBean;
     }
 
     @Override
@@ -62,33 +70,34 @@
     }
 
     @Override
-    public void buildItems(Fragment fragment, final UserAttribute model)
+    public void buildItems(Fragment fragment, final UserAttribute userAttr)
     {
-        fragment.add(new TextField<String>("name", new PropertyModel<String>(model, "name")));
-        fragment.add(new LocalizedDescriptionEditor("localizationEditor", getDefaultModel())
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        
+        fragment.add(new TextField<String>("name", new PropertyModel<String>(userAttr, "name")));
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, userAttr.getName())
         {
 
             @Override
-            public IDataProvider<DescriptionModel> getDataProvider()
+            public IDataProvider<DescriptionBean> getDataProvider()
             {
-                PortletApplication portletApplication = (PortletApplication) getDefaultModelObject();
-                final UserAttribute attribute = portletApplication.getUserAttribute(model.getName());
+                JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+                final UserAttribute attribute = app.getUserAttribute(userAttr.getName());
 
-                List<DescriptionModel> list = new ArrayList<DescriptionModel>();
+                List<DescriptionBean> list = new ArrayList<DescriptionBean>();
 
-                Iterator<Description> desc = attribute.getDescriptions().iterator();
-                while (desc.hasNext())
+                for (Description description : attribute.getDescriptions())
                 {
-                    list.add(new DescriptionModel(attribute, desc.next()));
+                    list.add(new DescriptionBean(description));
                 }
 
-                return new ListDataProvider<DescriptionModel>(list);
+                return new ListDataProvider<DescriptionBean>(list);
             }
 
             @Override
             protected Button saveButton(String componentId)
             {
-                final ApplicationModel applicationModel = (ApplicationModel) getDefaultModel();
                 return new Button(componentId)
                 {
 
@@ -97,12 +106,25 @@
                     {
                         if (newLocale != null && newDescription != null)
                         {
-                            model.addDescription(newLocale).setDescription(newDescription);
+                            Locale locale = new Locale(newLocale);
+                            Description description = userAttr.getDescription(locale);
+                            
+                            if (description == null)
+                            {
+                                description = userAttr.addDescription(newLocale);
+                            }
+                            
+                            description.setDescription(newDescription);
+                            
+                            newLocale = null;
+                            newDescription = null;
                         }
 
                         try
                         {
-                            applicationModel.getServiceLocator().getPortletRegistry().updatePortletApplication(applicationModel.getObject());
+                            JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                            PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+                            locator.getPortletRegistry().updatePortletApplication(app);
                         }
                         catch (RegistryException e)
                         {
@@ -114,11 +136,37 @@
             }
 
             @Override
-            public void delete(IModel<DescriptionModel>[] fields)
+            public void delete(IModel<DescriptionBean>[] fields)
             {
-                for (IModel<DescriptionModel> field : fields)
+                try
                 {
-                    field.getObject().remove();
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    UserAttribute attr = app.getUserAttribute(name);
+                    
+                    if (attr != null)
+                    {
+                        for (Iterator<Description> it = attr.getDescriptions().iterator(); it.hasNext(); )
+                        {
+                            Description description = it.next();
+                            
+                            for (IModel<DescriptionBean> descriptionBeanModel : fields)
+                            {
+                                if (descriptionBeanModel.getObject().getLocale().equals(description.getLocale()))
+                                {
+                                    it.remove();
+                                    break;
+                                }
+                            }
+                        }
+                        
+                        registry.updatePortletApplication(app);
+                    }
+                }
+                catch (RegistryException e)
+                {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
                 }
             }
         });
@@ -128,12 +176,13 @@
     @Override
     public void delete(IModel<UserAttribute>[] fields)
     {
-        ApplicationModel applicationModel = (ApplicationModel) getDefaultModel();
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
 
-        Iterator<UserAttribute> it = applicationModel.getObject().getUserAttributes().iterator();
-        while (it.hasNext())
+        for (Iterator<UserAttribute> it = app.getUserAttributes().iterator(); it.hasNext(); )
         {
             String id = it.next().getName();
+            
             for (IModel<UserAttribute> field : fields)
             {
                 if (field.getObject().getName().equals(id))
@@ -146,7 +195,7 @@
 
         try
         {
-            applicationModel.getServiceLocator().getPortletRegistry().updatePortletApplication(applicationModel.getObject());
+            locator.getPortletRegistry().updatePortletApplication(app);
         }
         catch (RegistryException e)
         {
@@ -159,10 +208,11 @@
     @Override
     public Iterator<IModel<UserAttribute>> getItemModels()
     {
-        PortletApplication def = (PortletApplication) getDefaultModelObject();
-        return new ModelIteratorAdapter<UserAttribute>(def.getUserAttributes().iterator())
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        
+        return new ModelIteratorAdapter<UserAttribute>(app.getUserAttributes().iterator())
         {
-
             @Override
             protected IModel<UserAttribute> model(UserAttribute object)
             {
@@ -181,22 +231,27 @@
     @Override
     protected Button saveButton(String componentId)
     {
-        final ApplicationModel applicationModel = (ApplicationModel) getDefaultModel();
         return new Button(componentId)
         {
-
             @Override
             public void onSubmit()
             {
-                if (newName != null && newDescription != null && newLocale != null)
-                {
-                    UserAttribute attribute = applicationModel.getObject().addUserAttribute(newName);
-                    attribute.addDescription(newLocale).setDescription(newDescription);
-                }
-
                 try
                 {
-                    applicationModel.getServiceLocator().getPortletRegistry().updatePortletApplication(applicationModel.getObject());
+                    JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+                    PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+
+                    if (newName != null && newDescription != null && newLocale != null)
+                    {
+                        UserAttribute attribute = app.addUserAttribute(newName);
+                        attribute.addDescription(newLocale).setDescription(newDescription);
+                        
+                        newName = null;
+                        newDescription = null;
+                        newLocale = null;
+                    }
+                    
+                    locator.getPortletRegistry().updatePortletApplication(app);
                 }
                 catch (RegistryException e)
                 {

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java?rev=769862&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java Wed Apr 29 18:26:19 2009
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm.model;
+
+import java.util.Locale;
+
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.InitParam;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.UserAttribute;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.DescriptionBean;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class DescriptionBeanModel extends LoadableDetachableModel<DescriptionBean>
+{
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private String name;
+    private Locale locale;
+
+    public DescriptionBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, String name, DescriptionBean descriptionBean)
+    {
+        super(descriptionBean);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.name = name;
+        this.locale = descriptionBean.getLocale();
+    }
+    
+    @Override
+    protected DescriptionBean load()
+    {
+        Description description = null;
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = null;
+        
+        if (paNodeBean.getName() != null)
+        {
+            def = app.getPortlet(paNodeBean.getName());
+        }
+        
+        if (def != null)
+        {
+            InitParam param = def.getInitParam(name);
+            description = param.getDescription(locale);
+        }
+        else
+        {
+            UserAttribute attr = app.getUserAttribute(name);
+            description = attr.getDescription(locale);
+        }
+        
+        return new DescriptionBean(description);
+    }
+    
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java?rev=769862&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java Wed Apr 29 18:26:19 2009
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.prm.model;
+
+import org.apache.jetspeed.om.portlet.GenericMetadata;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.LocalizedFieldBean;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class LocalizedFieldBeanModel extends LoadableDetachableModel<LocalizedFieldBean>
+{
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private String name;
+    private String localeString;
+
+    public LocalizedFieldBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, LocalizedFieldBean fieldBean)
+    {
+        super(fieldBean);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.name = fieldBean.getName();
+        this.localeString = fieldBean.getLocaleString();
+    }
+    
+    @Override
+    protected LocalizedFieldBean load()
+    {
+        LocalizedFieldBean fieldBean = null;
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = null;
+        
+        if (paNodeBean.getName() != null)
+        {
+            def = app.getPortlet(paNodeBean.getName());
+        }
+
+        GenericMetadata metadata = (def == null ? app.getMetadata() : def.getMetadata());
+        
+        for (LocalizedField field : metadata.getFields())
+        {
+            LocalizedFieldBean tempBean = new LocalizedFieldBean(field);
+            
+            if (name.equals(tempBean.getName()) && localeString.equals(tempBean.getLocaleString()))
+            {
+                fieldBean = tempBean;
+                break;
+            }
+        }
+        
+        return fieldBean;
+    }
+    
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LocalizedFieldBeanModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.java?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.java Wed Apr 29 18:26:19 2009
@@ -16,19 +16,27 @@
  */
 package org.apache.jetspeed.portlets.prm.portlet;
 
+import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
-import org.apache.jetspeed.portlets.prm.model.PortletModel;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.wicket.AbstractAdminWebApplication;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.panel.Panel;
 
 
 public class DetailsPanel extends Panel
-{  
-    public DetailsPanel(String id, PortletModel model)
+{
+    private static final long serialVersionUID = 1L;
+    
+    private PortletApplicationNodeBean paNodeBean;
+    
+    public DetailsPanel(String id, PortletApplicationNodeBean paNodeBean)
     {
-        super(id, model);
+        super(id);
+        this.paNodeBean = paNodeBean;
         
-        PortletDefinition definition = model.getObject();
+        PortletApplication app = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry().getPortletApplication(this.paNodeBean.getApplicationName());
+        PortletDefinition definition = app.getPortlet(this.paNodeBean.getName());
         add(new Label("expirationCache", Integer.toString(definition.getExpirationCache())));
         add(new Label("uniqueName", definition.getUniqueName()));
         add(new Label("className", definition.getPortletClass()));

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.html?rev=769862&r1=769861&r2=769862&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.html Wed Apr 29 18:26:19 2009
@@ -28,7 +28,7 @@
 		<th class="portlet-section-subheader">Value</th>
 		<th class="portlet-section-subheader">Locale/Description</th>
 		<wicket:fragment wicket:id="itemFragment">
-			<td class="portlet-section-body"><input type="text" wicket:id="name"/></td>
+			<td class="portlet-section-body"><input type="text" wicket:id="name" readonly="true"/></td>
 			<td class="portlet-section-body"><input type="text" wicket:id="value"/></td>
 			<td class="portlet-section-body"><span wicket:id="localizationEditor"/></td>
 		</wicket:fragment>



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