portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r771634 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets: prm/ prm/application/ prm/model/ prm/portlet/ wicket/component/editor/
Date Tue, 05 May 2009 09:14:22 GMT
Author: woonsan
Date: Tue May  5 09:14:22 2009
New Revision: 771634

URL: http://svn.apache.org/viewvc?rev=771634&view=rev
Log:
JS2-946: Adding security tab, content type tab for portlet management, 
improving application detail tab to allow set jetspeed security constraint

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SecurityRoleRefModel.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SupportsModel.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.java   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.html   (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.java   (with props)
Modified:
    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/application/DetailsPanel.html
    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.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.html
    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/LanguagesPanel.java
    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.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.html
    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.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.html
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.java

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=771634&r1=771633&r2=771634&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 Tue May  5 09:14:22 2009
@@ -51,6 +51,7 @@
     {
         super(id);
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     @Override

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.html?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/application/DetailsPanel.html Tue May  5 09:14:22 2009
@@ -21,6 +21,7 @@
 <head></head>
 <body>
 	<wicket:panel>
+    <form action="post" wicket:id="form">
 	<table style="border-collapse: collapse; width: 100%; margin-top: 8px; float: left;">
 		<thead>
 			<tr>
@@ -33,6 +34,16 @@
 			<td class="portlet-section-body"><span wicket:id="value"></span></td>
 		</tr>
 	</table>
+    <div>
+        Security Constraint: 
+        <select wicket:id="jetspeedConstraint">
+           <option value=""></option>
+           <option value="public-view">public-view</option>
+           <option value="public-edit">public-edit</option>
+        </select>
+        <input type="submit" wicket:id="jsecSave" value="Save" />
+    </div>
+    </form>	
 	</wicket:panel>
 </body>
 </html>
\ No newline at end of file

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=771634&r1=771633&r2=771634&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 Tue May  5 09:14:22 2009
@@ -17,18 +17,26 @@
 package org.apache.jetspeed.portlets.prm.application;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 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.page.SecurityConstraintsDef;
 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.page.PageManager;
 import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.KeyVal;
 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.form.Button;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.markup.repeater.RefreshingView;
@@ -36,14 +44,20 @@
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class DetailsPanel extends Panel
 {
     private static final long serialVersionUID = 1L;
     
+    static final Logger logger = LoggerFactory.getLogger(DetailsPanel.class);
+
     private transient List<KeyVal> detailList;
+    private String jetspeedSecurityConstraint;
+    private List<String> jetspeedSecurityContraintNames;
 
-    public DetailsPanel(String id, PortletApplicationNodeBean paNodeBean)
+    public DetailsPanel(String id, final PortletApplicationNodeBean paNodeBean)
     {
         super(id);
 
@@ -96,7 +110,45 @@
             }
         };
 
-        add(dataRepeater);
+        jetspeedSecurityContraintNames = new ArrayList<String>(Arrays.asList(""));
+        PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
+        try
+        {
+            for (Object secConstDefObj : pageManager.getPageSecurity().getSecurityConstraintsDefs())
+            {
+                SecurityConstraintsDef secConstDef = (SecurityConstraintsDef) secConstDefObj;
+                jetspeedSecurityContraintNames.add(secConstDef.getName());
+            }
+        }
+        catch (Exception e)
+        {
+            logger.error("Failed to retrieve jetspeed security constraint defs from page manager.", e);
+        }
+        
+        jetspeedSecurityConstraint = app.getJetspeedSecurityConstraint();
+
+        Form form = new Form("form");
+        form.add(dataRepeater);
+        form.add(new DropDownChoice<String>("jetspeedConstraint", new PropertyModel<String>(this, "jetspeedSecurityConstraint"), jetspeedSecurityContraintNames));
+        form.add(new Button("jsecSave")
+        {
+            @Override
+            public void onSubmit()
+            {
+                try
+                {
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    app.setJetspeedSecurityConstraint("".equals(jetspeedSecurityConstraint) ? null : jetspeedSecurityConstraint);
+                    registry.updatePortletApplication(app);
+                }
+                catch (RegistryException e)
+                {
+                    logger.error("Failed to update jetspeed security constraint defs of application.", e);
+                }
+            }
+        });
+        add(form);
     }
 
     private String getDescription(PortletApplication app)

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=771634&r1=771633&r2=771634&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 Tue May  5 09:14:22 2009
@@ -57,6 +57,7 @@
     {
         super(id);
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     @Override
@@ -80,7 +81,7 @@
         
         fragment.add(new TextField<String>("name", new PropertyModel<String>(new UserAttributeModel(locator, paNodeBean, userAttr), "name")));
         
-        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, userAttr.getName())
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, UserAttribute.class, userAttr.getName())
         {
 
             @Override

Modified: 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=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/DescriptionBeanModel.java Tue May  5 09:14:22 2009
@@ -22,6 +22,7 @@
 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.SecurityRoleRef;
 import org.apache.jetspeed.om.portlet.UserAttribute;
 import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.DescriptionBean;
@@ -34,14 +35,16 @@
     
     private JetspeedServiceLocator locator;
     private PortletApplicationNodeBean paNodeBean;
+    private Class type;
     private String name;
     private Locale locale;
 
-    public DescriptionBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, String name, DescriptionBean descriptionBean)
+    public DescriptionBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, Class type, String name, DescriptionBean descriptionBean)
     {
         super(descriptionBean);
         this.locator = locator;
         this.paNodeBean = paNodeBean;
+        this.type = type;
         this.name = name;
         this.locale = descriptionBean.getLocale();
     }
@@ -60,8 +63,16 @@
         
         if (def != null)
         {
-            InitParam param = def.getInitParam(name);
-            description = param.getDescription(locale);
+            if (type == InitParam.class)
+            {
+                InitParam param = def.getInitParam(name);
+                description = param.getDescription(locale);
+            }
+            else if (type == SecurityRoleRef.class)
+            {
+                SecurityRoleRef securityRoleRef = def.getSecurityRoleRef(name);
+                description = securityRoleRef.getDescription(locale);
+            }
         }
         else
         {

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SecurityRoleRefModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SecurityRoleRefModel.java?rev=771634&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SecurityRoleRefModel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SecurityRoleRefModel.java Tue May  5 09:14:22 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class SecurityRoleRefModel extends LoadableDetachableModel<SecurityRoleRef>
+{
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private String roleName;
+
+    public SecurityRoleRefModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, SecurityRoleRef securityRoleRef)
+    {
+        super(securityRoleRef);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.roleName = securityRoleRef.getRoleName();
+    }
+    
+    @Override
+    protected SecurityRoleRef load()
+    {
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        SecurityRoleRef securityRoleRef = def.getSecurityRoleRef(roleName);
+        return securityRoleRef;
+    }
+    
+}
\ No newline at end of file

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

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

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

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SupportsModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SupportsModel.java?rev=771634&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SupportsModel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/SupportsModel.java Tue May  5 09:14:22 2009
@@ -0,0 +1,52 @@
+/*
+ * 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.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Supports;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class SupportsModel extends LoadableDetachableModel<Supports>
+{
+    
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private String mimeType;
+
+    public SupportsModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, Supports supports)
+    {
+        super(supports);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.mimeType = supports.getMimeType();
+    }
+    
+    @Override
+    protected Supports load()
+    {
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        Supports supports = def.getSupports(mimeType);
+        return supports;
+    }
+    
+}
\ No newline at end of file

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

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

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

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.html?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/DetailsPanel.html Tue May  5 09:14:22 2009
@@ -37,6 +37,10 @@
 			<td class="portlet-section-body">Unique Name</td>
 			<td class="portlet-section-body"><span wicket:id="uniqueName"></span></td>
 		</tr>
+        <tr>
+            <td class="portlet-section-body">Preference Validator</td>
+            <td class="portlet-section-body"><span wicket:id="preferenceValidator"></span></td>
+        </tr>
 		<tr>
 			<td class="portlet-section-body">Class Name</td>
 			<td class="portlet-section-body"><span wicket:id="className"></span></td>

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=771634&r1=771633&r2=771634&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 Tue May  5 09:14:22 2009
@@ -67,6 +67,7 @@
         Form form = new Form("form");
         form.add(new TextField<Integer>("expirationCache", new PropertyModel<Integer>(this, "expirationCache")));
         form.add(new Label("uniqueName", definition.getUniqueName()));
+        form.add(new Label("preferenceValidator", definition.getPreferenceValidatorClassname()));
         form.add(new Label("className", definition.getPortletClass()));
         
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
@@ -207,24 +208,4 @@
         return expirationCache;
     }
     
-//    public void setNewLocale(String newLocale)
-//    {
-//        this.newLocale = newLocale;
-//    }
-//    
-//    public String getNewLocale()
-//    {
-//        return newLocale;
-//    }
-//    
-//    public void setNewDisplayName(String newDisplayName)
-//    {
-//        this.newDisplayName = newDisplayName;
-//    }
-//    
-//    public String getNewDisplayName()
-//    {
-//        return newDisplayName;
-//    }
-    
 }

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java Tue May  5 09:14:22 2009
@@ -53,6 +53,7 @@
     {
         super(id);
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     @Override

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/ParameterPanel.java Tue May  5 09:14:22 2009
@@ -61,6 +61,7 @@
     {
         super(id);
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     @Override
@@ -86,7 +87,7 @@
         fragment.add(new TextField<String>("name", new PropertyModel<String>(new InitParamModel(locator, paNodeBean, initParam), "paramName")));
         fragment.add(new TextField<String>("value", new PropertyModel<String>(new InitParamModel(locator, paNodeBean, initParam), "paramValue")));
 
-        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, initParam.getParamName())
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, InitParam.class, initParam.getParamName())
         {
 
             @Override

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java Tue May  5 09:14:22 2009
@@ -129,6 +129,24 @@
             };
             tabs.add(parametersTab);
 
+            ITab securityTab = new AbstractTab(new Model("Security"))
+            {
+                public Panel getPanel(String panelId)
+                {
+                    return new SecurityPanel(panelId, paNodeBean);
+                }
+            };
+            tabs.add(securityTab);
+            
+            ITab supportsTab = new AbstractTab(new Model("Content Type"))
+            {
+                public Panel getPanel(String panelId)
+                {
+                    return new SupportsPanel(panelId, paNodeBean);
+                }
+            };
+            tabs.add(supportsTab);
+            
             TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
             if (get("tabs") == null)
             {

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PreferencePanel.java Tue May  5 09:14:22 2009
@@ -56,6 +56,7 @@
     {
         super(id);
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     /**

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.html?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.html Tue May  5 09:14:22 2009
@@ -37,6 +37,16 @@
 			<td style="border-top:1px dashed #000;"><input wicket:id="newRoleLink" style="margin-top:10px;" type="text"/></td>
 			<td style="border-top:1px dashed #000;"><input wicket:id="newLocale" style="margin-top:10px;" type="text"/><input wicket:id="newDescription" style="margin-top:10px;" type="text"/></td>
 		</wicket:fragment>
+	    <div>
+	       Security Constraint: 
+	       <select wicket:id="jetspeedConstraint">
+	          <option value=""></option>
+	          <option value="public-view">public-view</option>
+	          <option value="public-edit">public-edit</option>
+	       </select>
+	       <input type="submit" wicket:id="jsecSave" value="Save" />
+	    </div>
 	</wicket:extend>
+	
 </body>
 </html>
\ No newline at end of file

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.java?rev=771634&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SecurityPanel.java Tue May  5 09:14:22 2009
@@ -0,0 +1,361 @@
+/*
+ * 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.portlet;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.jetspeed.components.portletregistry.FailedToStorePortletDefinitionException;
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.SecurityRoleRef;
+import org.apache.jetspeed.page.PageManager;
+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.prm.model.SecurityRoleRefModel;
+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;
+import org.apache.wicket.markup.html.form.DropDownChoice;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.Fragment;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.markup.repeater.data.IDataProvider;
+import org.apache.wicket.markup.repeater.data.ListDataProvider;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SecurityPanel extends EditorTemplate<SecurityRoleRef>
+{
+    private static final long serialVersionUID = 1L;
+    
+    static final Logger logger = LoggerFactory.getLogger(SecurityPanel.class);
+    
+    private PortletApplicationNodeBean paNodeBean;
+    private String newRoleName;
+    private String newRoleLink;
+    private String newLocale;
+    private String newDescription;
+    private String jetspeedSecurityConstraint;
+    private List<String> jetspeedSecurityContraintNames;
+
+    public SecurityPanel(String id, final PortletApplicationNodeBean paNodeBean)
+    {
+        super(id);
+        this.paNodeBean = paNodeBean;
+        Panel panel = initLayout();
+        
+        jetspeedSecurityContraintNames = new ArrayList<String>(Arrays.asList(""));
+        PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
+        try
+        {
+            for (Object secConstDefObj : pageManager.getPageSecurity().getSecurityConstraintsDefs())
+            {
+                SecurityConstraintsDef secConstDef = (SecurityConstraintsDef) secConstDefObj;
+                jetspeedSecurityContraintNames.add(secConstDef.getName());
+            }
+        }
+        catch (Exception e)
+        {
+            logger.error("Failed to retrieve jetspeed security constraint defs from page manager.", e);
+        }
+        
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        jetspeedSecurityConstraint = def.getJetspeedSecurityConstraint();
+        
+        Form form = (Form) panel.get("form");
+        form.add(new DropDownChoice<String>("jetspeedConstraint", new PropertyModel<String>(this, "jetspeedSecurityConstraint"), jetspeedSecurityContraintNames));
+        form.add(new Button("jsecSave")
+        {
+            @Override
+            public void onSubmit()
+            {
+                try
+                {
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
+                    def.setJetspeedSecurityConstraint("".equals(jetspeedSecurityConstraint) ? null : jetspeedSecurityConstraint);
+                    registry.savePortletDefinition(def);
+                }
+                catch (FailedToStorePortletDefinitionException e)
+                {
+                    logger.error("Failed to retrieve jetspeed security constraint defs of portlet definition.", e);
+                }
+            }
+        });
+    }
+    
+    public String getJetspeedSecurityConstraint()
+    {
+        return jetspeedSecurityConstraint;
+    }
+    
+    public void setJetspeedSecurityConstraint(String jetspeedSecurityConstraint)
+    {
+        this.jetspeedSecurityConstraint = jetspeedSecurityConstraint;
+    }
+
+    @Override
+    public void buildNew(Fragment fragment)
+    {
+        fragment.add(new TextField<String>("newRoleName", new PropertyModel<String>(this, "newRoleName")));
+        fragment.add(new TextField<String>("newRoleLink", new PropertyModel<String>(this, "newRoleLink")));
+        fragment.add(new TextField<String>("newLocale", new PropertyModel<String>(this, "newLocale")));
+        fragment.add(new TextField<String>("newDescription", new PropertyModel<String>(this, "newDescription")));
+    }
+
+    @Override
+    public int getColumnCount()
+    {
+        return 3;
+    }
+
+    @Override
+    public void buildItems(Fragment fragment, final SecurityRoleRef securityRoleRef)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+
+        fragment.add(new TextField<String>("roleName", new PropertyModel<String>(new SecurityRoleRefModel(locator, paNodeBean, securityRoleRef), "roleName")));
+        fragment.add(new TextField<String>("roleLink", new PropertyModel<String>(new SecurityRoleRefModel(locator, paNodeBean, securityRoleRef), "roleLink")));
+
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean, SecurityRoleRef.class, securityRoleRef.getRoleName())
+        {
+
+            @Override
+            public IDataProvider<DescriptionBean> getDataProvider()
+            {
+                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                PortletDefinition def = app.getPortlet(paNodeBean.getName());
+
+                final SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
+
+                List<DescriptionBean> list = new ArrayList<DescriptionBean>();
+
+                for (Description description : secRoleRef.getDescriptions())
+                {
+                    list.add(new DescriptionBean(description));
+                }
+
+                return new ListDataProvider<DescriptionBean>(list);
+            }
+            
+            @Override
+            protected Button saveButton(String componentId)
+            {
+                return new Button(componentId)
+                {
+
+                    @Override
+                    public void onSubmit()
+                    {
+                        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+                        
+                        if (newLocale != null && newDescription != null)
+                        {
+                            SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
+                            Locale locale = new Locale(newLocale);
+                            Description targetDescription = null;
+                            
+                            for (Description description : secRoleRef.getDescriptions())
+                            {
+                                if (description.getLocale().equals(locale))
+                                {
+                                    targetDescription = description;
+                                    break;
+                                }
+                            }
+                            
+                            if (targetDescription == null)
+                            {
+                                targetDescription = securityRoleRef.addDescription(newLocale);
+                            }
+                            
+                            targetDescription.setDescription(newDescription);
+                            
+                            newLocale = null;
+                            newDescription = null;
+                        }
+
+                        try
+                        {
+                            registry.savePortletDefinition(def);
+                        }
+                        catch (RegistryException e)
+                        {
+                            logger.error("Failed to save portlet definition.", e);
+                        }
+                    }
+                };
+            }
+
+            @Override
+            public void delete(IModel<DescriptionBean>[] fields)
+            {
+                try
+                {
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
+                    SecurityRoleRef secRoleRef = def.getSecurityRoleRef(securityRoleRef.getRoleName());
+                    
+                    if (secRoleRef != null)
+                    {
+                        for (Iterator<Description> it = secRoleRef.getDescriptions().iterator(); it.hasNext(); )
+                        {
+                            Description description = it.next();
+                            
+                            for (IModel<DescriptionBean> descriptionBeanModel : fields)
+                            {
+                                if (descriptionBeanModel.getObject().getLocale().equals(description.getLocale()))
+                                {
+                                    it.remove();
+                                    break;
+                                }
+                            }
+                        }
+                    
+                        registry.savePortletDefinition(def);
+                    }
+                }
+                catch (FailedToStorePortletDefinitionException e)
+                {
+                    logger.error("Failed to save portlet definition.", e);
+                }
+            }
+        });
+
+    }
+
+    @Override
+    public void delete(IModel<SecurityRoleRef>[] fields)
+    {
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+
+        Iterator<SecurityRoleRef> it = def.getSecurityRoleRefs().iterator();
+        while (it.hasNext())
+        {
+            SecurityRoleRef securityRoleRef = it.next();
+            String roleName = securityRoleRef.getRoleName();
+            
+            for (IModel<SecurityRoleRef> field : fields)
+            {
+                if (field.getObject().getRoleName().equals(roleName))
+                {
+                    it.remove();
+                    break;
+                }
+            }
+        }
+
+        try
+        {
+            registry.savePortletDefinition(def);
+        }
+        catch (RegistryException e)
+        {
+            logger.error("Failed to save portlet definition.", e);
+        }
+
+    }
+
+    @Override
+    public Iterator<IModel<SecurityRoleRef>> getItemModels()
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletRegistry registry = locator.getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        
+        List<IModel<SecurityRoleRef>> securityRoleRefModels = new ArrayList<IModel<SecurityRoleRef>>();
+        
+        for (SecurityRoleRef securityRoleRef : def.getSecurityRoleRefs())
+        {
+            securityRoleRefModels.add(new SecurityRoleRefModel(locator, paNodeBean, securityRoleRef));
+        }
+        
+        return securityRoleRefModels.iterator();
+    }
+
+    @Override
+    public IModel<SecurityRoleRef> getNewRowModel(SecurityRoleRef securityRoleRef)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        return new SecurityRoleRefModel(locator, paNodeBean, securityRoleRef);
+    }
+
+    @Override
+    protected Button saveButton(String componentId)
+    {
+        return new Button(componentId)
+        {
+            @Override
+            public void onSubmit()
+            {
+                PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                PortletDefinition def = app.getPortlet(paNodeBean.getName());
+
+                if (newRoleName != null && newRoleLink != null)
+                {
+                    SecurityRoleRef securityRoleRef = def.addSecurityRoleRef(newRoleName);
+                    securityRoleRef.setRoleLink(newRoleLink);
+
+                    if (newLocale != null && newDescription != null)
+                    {
+                        Description desc = securityRoleRef.addDescription(newLocale);
+                        desc.setDescription(newDescription);
+                    }
+                    
+                    newRoleName = null;
+                    newRoleLink = null;
+                    newLocale = null;
+                    newDescription = null;
+                }
+
+                try
+                {
+                    registry.savePortletDefinition(def);
+                }
+                catch (RegistryException e)
+                {
+                    logger.error("Failed to save portlet definition.", e);
+                }
+            }
+        };
+    }
+
+}

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

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

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

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.html?rev=771634&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.html (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.html Tue May  5 09:14:22 2009
@@ -0,0 +1,51 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
+<!-- 
+  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.
+-->
+<html 
+    xmlns="http://www.w3.org/1999/xhtml" 
+    xmlns:wicket="http://wicket.sourceforge.net/" 
+    xml:lang="en" 
+    lang="en">
+<head></head>
+<body>
+    <wicket:extend>
+        <th class="portlet-section-subheader">Mime Type</th>
+        <th class="portlet-section-subheader">Portlet Modes</th>
+        <wicket:fragment wicket:id="itemFragment">
+            <td class="portlet-section-body"><input type="text" wicket:id="mimeType" readonly="true"/></td>
+            <td class="portlet-section-body">
+                <span valign="top" wicket:id="portletModes">
+                    <input type="checkbox">view</input>
+                    <input type="checkbox">edit</input>
+                    <input type="checkbox">help</input>
+                </span>
+            </td>
+        </wicket:fragment>
+        <wicket:fragment wicket:id="newFragment">
+            <td style="border-top:1px dashed #000;"><input wicket:id="newMimeType" style="margin-top:10px;" type="text"/></td>
+            <td style="border-top:1px dashed #000;">
+                <span valign="top" wicket:id="newPortletModes">
+                    <input type="checkbox">view</input>
+                    <input type="checkbox">edit</input>
+                    <input type="checkbox">help</input>
+                </span>
+            </td>
+        </wicket:fragment>
+    </wicket:extend>
+</body>
+</html>
\ No newline at end of file

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

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

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

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.java?rev=771634&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.java (added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/SupportsPanel.java Tue May  5 09:14:22 2009
@@ -0,0 +1,189 @@
+/*
+ * 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.portlet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.portlet.PortletMode;
+
+import org.apache.jetspeed.components.portletregistry.PortletRegistry;
+import org.apache.jetspeed.components.portletregistry.RegistryException;
+import org.apache.jetspeed.om.portlet.PortletApplication;
+import org.apache.jetspeed.om.portlet.PortletDefinition;
+import org.apache.jetspeed.om.portlet.Supports;
+import org.apache.jetspeed.portlets.JetspeedServiceLocator;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.prm.model.SupportsModel;
+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.CheckBoxMultipleChoice;
+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.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SupportsPanel extends EditorTemplate<Supports>
+{
+    private static final long serialVersionUID = 1L;
+    
+    static final Logger logger = LoggerFactory.getLogger(SupportsPanel.class);
+
+    private PortletApplicationNodeBean paNodeBean;
+    private String newMimeType;
+    private List<String> newPortletModes;
+    private List<String> availablePortletModes;
+
+    public SupportsPanel(String id, final PortletApplicationNodeBean paNodeBean)
+    {
+        super(id);
+        
+        this.paNodeBean = paNodeBean;
+        newPortletModes = new ArrayList<String>();
+        availablePortletModes = new ArrayList<String>();
+        
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        
+        for (PortletMode mode : app.getSupportedPortletModes())
+        {
+            availablePortletModes.add(mode.toString());
+        }
+        
+        initLayout();
+    }
+    
+    @Override
+    protected Button saveButton(String componentId)
+    {
+        return new Button(componentId)
+        {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public void onSubmit()
+            {
+                try
+                {
+                    PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+                    PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+                    PortletDefinition def = app.getPortlet(paNodeBean.getName());
+                    
+                    if (newMimeType != null && !newPortletModes.isEmpty())
+                    {
+                        Supports supports = def.addSupports(newMimeType);
+                        
+                        for (String portletMode : newPortletModes)
+                        {
+                            supports.addPortletMode(portletMode);
+                        }
+                            
+                        newMimeType = null;
+                        newPortletModes.clear();
+                    }
+
+                    registry.savePortletDefinition(def);
+                }
+                catch (RegistryException e)
+                {
+                    logger.error("Exception occurred during updating portlet application or saving portlet definition.", e);
+                }
+            }
+        };
+    }
+
+    @Override
+    public void buildNew(Fragment fragment)
+    {
+        fragment.add(new TextField<String>("newMimeType", new PropertyModel<String>(this, "newMimeType")));
+        fragment.add(new CheckBoxMultipleChoice("newPortletModes", new PropertyModel(this, "newPortletModes"), availablePortletModes));
+    }
+
+    @Override
+    public int getColumnCount()
+    {
+        return 4;
+    }
+
+    @Override
+    public void buildItems(Fragment fragment, final Supports field)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        fragment.add(new TextField<String>("mimeType", new PropertyModel(new SupportsModel(locator, paNodeBean, field), "mimeType")));
+        fragment.add(new CheckBoxMultipleChoice("portletModes", new PropertyModel(new SupportsModel(locator, paNodeBean, field), "portletModes"), availablePortletModes));
+    }
+
+    @Override
+    public void delete(IModel<Supports>[] fieldBeans)
+    {
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        
+        for (Iterator<Supports> it = def.getSupports().iterator(); it.hasNext(); )
+        {
+            Supports tempSupports = it.next();
+            
+            for (IModel<Supports> fieldBean : fieldBeans)
+            {
+                if (tempSupports.getMimeType().equals(fieldBean.getObject().getMimeType()))
+                {
+                    it.remove();
+                    break;
+                }
+            }
+        }
+
+        try
+        {
+            registry.savePortletDefinition(def);
+        }
+        catch (RegistryException e)
+        {
+            logger.error("Exception occurred during updating portlet application or saving portlet definition.", e);
+        }
+    }
+
+    @Override
+    public Iterator<IModel<Supports>> getItemModels()
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        List<IModel<Supports>> list = new LinkedList<IModel<Supports>>();
+        
+        for (Supports field : def.getSupports())
+        {
+            list.add(new SupportsModel(locator, paNodeBean, field));
+        }
+
+        return list.iterator();
+    }
+
+    @Override
+    public IModel<Supports> getNewRowModel(Supports fieldBean)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        return new SupportsModel(locator, paNodeBean, fieldBean);
+    }
+
+}

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

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

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

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/EditorTemplate.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/EditorTemplate.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/EditorTemplate.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/EditorTemplate.java Tue May  5 09:14:22 2009
@@ -53,7 +53,10 @@
     public EditorTemplate(String id)
     {
         super(id);
-        
+    }
+    
+    public EditorTemplate initLayout()
+    {
         rows = new ArrayList<SelectableModel<T>>();
         
         RefreshingView<T> data = new RefreshingView<T>("data") 
@@ -119,6 +122,8 @@
         
         form.add(footer);
         add(form);
+        
+        return this;
     }
     
     protected Button deleteButton(String componentId)

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDescriptionEditor.java Tue May  5 09:14:22 2009
@@ -41,16 +41,19 @@
     
     protected JetspeedServiceLocator locator = null;
     protected PortletApplicationNodeBean paNodeBean = null;
+    protected Class type;
     protected String name = null;
 
     protected String newLocale, newDescription;
     
-    public LocalizedDescriptionEditor(String id, JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, String name)
+    public LocalizedDescriptionEditor(String id, JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean, Class type, String name)
     {
         super(id);
         this.locator = locator;
         this.paNodeBean = paNodeBean;
+        this.type = type;
         this.name = name;
+        initLayout();
     }
 
     @Override
@@ -63,8 +66,8 @@
     public void buildItems(Fragment fragment, final DescriptionBean descriptionBean)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
-        fragment.add(new TextField<String>("locale", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, name, descriptionBean), "localeString"))); 
-        fragment.add(new TextField<String>("description", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, name, descriptionBean), "description")));
+        fragment.add(new TextField<String>("locale", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean), "localeString"))); 
+        fragment.add(new TextField<String>("description", new PropertyModel(new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean), "description")));
     }
     
     @Override
@@ -88,7 +91,7 @@
         while(it.hasNext()) 
         {
             DescriptionBean descriptionBean = it.next();
-            list.add(new DescriptionBeanModel(locator, paNodeBean, name, descriptionBean));
+            list.add(new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean));
         }
         
         return list.iterator();
@@ -97,7 +100,7 @@
     @Override
     public IModel<DescriptionBean> getNewRowModel(DescriptionBean descriptionBean)
     {
-        return new DescriptionBeanModel(locator, paNodeBean, name, descriptionBean);
+        return new DescriptionBeanModel(locator, paNodeBean, type, name, descriptionBean);
     }
     
     public abstract IDataProvider<DescriptionBean> getDataProvider();

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.html?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.html Tue May  5 09:14:22 2009
@@ -31,10 +31,8 @@
 			<td class="portlet-section-body"><input type="text" wicket:id="displayName"/></td>
 		</wicket:fragment>
 		<wicket:fragment wicket:id="newFragment">
-		    <!-- FIXME:
 			<td style="border-top:1px dashed #000;"><input wicket:id="newLocale" style="margin-top:10px;" type="text"/></td>
 			<td style="border-top:1px dashed #000;"><input wicket:id="newDisplayName" style="margin-top:10px;" type="text"/></td>
-		    -->
 		</wicket:fragment>
 	</wicket:extend>
 </body>

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.java?rev=771634&r1=771633&r2=771634&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/wicket/component/editor/LocalizedDisplayNameEditor.java Tue May  5 09:14:22 2009
@@ -49,6 +49,7 @@
         super(id);
         this.locator = locator;
         this.paNodeBean = paNodeBean;
+        initLayout();
     }
 
     @Override
@@ -68,9 +69,8 @@
     @Override
     public void buildNew(Fragment fragment)
     {
-        // FIXME:
-//        fragment.add(new TextField<String>("newLocale", new PropertyModel<String>(this, "newLocale")));
-//        fragment.add(new TextField<String>("newDescription", new PropertyModel<String>(this, "newDescription")));
+        fragment.add(new TextField<String>("newLocale", new PropertyModel<String>(this, "newLocale")));
+        fragment.add(new TextField<String>("newDisplayName", new PropertyModel<String>(this, "newDisplayName")));
     }
     
     @Override



---------------------------------------------------------------------
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