portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r771314 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm: ./ application/ model/ portlet/
Date Mon, 04 May 2009 14:21:26 GMT
Author: woonsan
Date: Mon May  4 14:21:26 2009
New Revision: 771314

URL: http://svn.apache.org/viewvc?rev=771314&view=rev
Log:
JS2-946: Adding language tab for portlet management.

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LanguageBean.java
  (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamModel.java
  (contents, props changed)
      - copied, changed from r771219, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamBeanModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LanguageBeanModel.java
  (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeModel.java
  (contents, props changed)
      - copied, changed from r771219, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeBeanModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.html
  (with props)
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java
  (with props)
Removed:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/InitParamBean.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/UserAttributeBean.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamBeanModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeBeanModel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/InitParameterPanel.html
Modified:
    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/ParameterPanel.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/PortletDetailsView.java

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LanguageBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LanguageBean.java?rev=771314&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LanguageBean.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/LanguageBean.java
Mon May  4 14:21:26 2009
@@ -0,0 +1,108 @@
+/* 
+ * 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.Language;
+import org.apache.wicket.IClusterable;
+
+public class LanguageBean implements IClusterable
+{
+    private static final long serialVersionUID = 1L;
+    
+    private transient Language language;
+    private Locale locale;
+    
+    public LanguageBean(Language language)
+    {
+        this.language = language;
+        this.locale = language.getLocale();
+    }
+    
+    public String getTitle()
+    {
+        return language.getTitle();
+    }
+    
+    public void setTitle(String title)
+    {
+        language.setTitle(title);
+    }
+
+    public String getShortTitle()
+    {
+        return language.getShortTitle();
+    }
+    
+    public void setShortTitle(String shortTitle)
+    {
+        language.setShortTitle(shortTitle);
+    }
+
+    public boolean isSupportedLocale()
+    {
+        return language.isSupportedLocale();
+    }
+    
+    public void setSupportedLocale(boolean supportedLocale)
+    {
+        language.setSupportedLocale(supportedLocale);
+    }
+    
+    public String getKeywords()
+    {
+        return language.getKeywords();
+    }
+    
+    public void setKeywords(String keywords)
+    {
+        language.setKeywords(keywords);
+    }
+    
+    public String getLocaleString()
+    {
+        return locale.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 = (country == null ? new Locale(language) : new Locale(language, country));
+    }
+    
+    public Locale getLocale()
+    {
+        return locale;
+    }
+    
+}

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

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

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

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=771314&r1=771313&r2=771314&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
Mon May  4 14:21:26 2009
@@ -18,6 +18,7 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 
@@ -29,8 +30,7 @@
 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.UserAttributeBean;
-import org.apache.jetspeed.portlets.prm.model.UserAttributeBeanModel;
+import org.apache.jetspeed.portlets.prm.model.UserAttributeModel;
 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;
@@ -44,7 +44,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class UserAttributePanel extends EditorTemplate<UserAttributeBean>
+public class UserAttributePanel extends EditorTemplate<UserAttribute>
 {
     private static final long serialVersionUID = 1L;
     
@@ -74,11 +74,11 @@
     }
 
     @Override
-    public void buildItems(Fragment fragment, final UserAttributeBean userAttr)
+    public void buildItems(Fragment fragment, final UserAttribute userAttr)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
         
-        fragment.add(new TextField<String>("name", new PropertyModel<String>(new
UserAttributeBeanModel(locator, paNodeBean, userAttr), "name")));
+        fragment.add(new TextField<String>("name", new PropertyModel<String>(new
UserAttributeModel(locator, paNodeBean, userAttr), "name")));
         
         fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean,
userAttr.getName())
         {
@@ -188,7 +188,7 @@
     }
 
     @Override
-    public void delete(IModel<UserAttributeBean>[] fields)
+    public void delete(IModel<UserAttribute>[] fields)
     {
         PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
         PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
@@ -197,7 +197,7 @@
         {
             String id = it.next().getName();
             
-            for (IModel<UserAttributeBean> field : fields)
+            for (IModel<UserAttribute> field : fields)
             {
                 if (field.getObject().getName().equals(id))
                 {
@@ -218,25 +218,25 @@
     }
 
     @Override
-    public Iterator<IModel<UserAttributeBean>> getItemModels()
+    public Iterator<IModel<UserAttribute>> getItemModels()
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
         PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
-        List<IModel<UserAttributeBean>> userAttributeBeans = new ArrayList<IModel<UserAttributeBean>>();
+        List<IModel<UserAttribute>> userAttributeBeans = new LinkedList<IModel<UserAttribute>>();
         
         for (UserAttribute userAttribute : app.getUserAttributes())
         {
-            userAttributeBeans.add(new UserAttributeBeanModel(locator, paNodeBean, new UserAttributeBean(userAttribute)));
+            userAttributeBeans.add(new UserAttributeModel(locator, paNodeBean, userAttribute));
         }
         
         return userAttributeBeans.iterator();
     }
 
     @Override
-    public IModel<UserAttributeBean> getNewRowModel(UserAttributeBean userAttribute)
+    public IModel<UserAttribute> getNewRowModel(UserAttribute userAttribute)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
-        return new UserAttributeBeanModel(locator, paNodeBean, userAttribute);
+        return new UserAttributeModel(locator, paNodeBean, userAttribute);
     }
 
     @Override

Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamModel.java
(from r771219, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamBeanModel.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamModel.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamModel.java&p1=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamBeanModel.java&r1=771219&r2=771314&rev=771314&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamBeanModel.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/InitParamModel.java
Mon May  4 14:21:26 2009
@@ -20,11 +20,10 @@
 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.InitParamBean;
 import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
 import org.apache.wicket.model.LoadableDetachableModel;
 
-public class InitParamBeanModel extends LoadableDetachableModel<InitParamBean>
+public class InitParamModel extends LoadableDetachableModel<InitParam>
 {
     private static final long serialVersionUID = 1L;
     
@@ -32,21 +31,21 @@
     private PortletApplicationNodeBean paNodeBean;
     private String paramName;
 
-    public InitParamBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean
paNodeBean, InitParamBean initParamBean)
+    public InitParamModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean,
InitParam initParam)
     {
-        super(initParamBean);
+        super(initParam);
         this.locator = locator;
         this.paNodeBean = paNodeBean;
-        this.paramName = initParamBean.getParamName();
+        this.paramName = initParam.getParamName();
     }
     
     @Override
-    protected InitParamBean load()
+    protected InitParam load()
     {
         PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
         PortletDefinition def = app.getPortlet(paNodeBean.getName());
         InitParam initParam = def.getInitParam(paramName);
-        return new InitParamBean(initParam);
+        return initParam;
     }
     
 }
\ No newline at end of file

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

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

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

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LanguageBeanModel.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LanguageBeanModel.java?rev=771314&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LanguageBeanModel.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/LanguageBeanModel.java
Mon May  4 14:21:26 2009
@@ -0,0 +1,54 @@
+/*
+ * 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.Language;
+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.LanguageBean;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.wicket.model.LoadableDetachableModel;
+
+public class LanguageBeanModel extends LoadableDetachableModel<LanguageBean>
+{
+    private static final long serialVersionUID = 1L;
+    
+    private JetspeedServiceLocator locator;
+    private PortletApplicationNodeBean paNodeBean;
+    private Locale locale;
+
+    public LanguageBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean paNodeBean,
LanguageBean languageBean)
+    {
+        super(languageBean);
+        this.locator = locator;
+        this.paNodeBean = paNodeBean;
+        this.locale = languageBean.getLocale();
+    }
+    
+    @Override
+    protected LanguageBean load()
+    {
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        Language language = def.getLanguage(locale);
+        return new LanguageBean(language);
+    }
+    
+}
\ No newline at end of file

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

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

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

Copied: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeModel.java
(from r771219, portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeBeanModel.java)
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeModel.java?p2=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeModel.java&p1=portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeBeanModel.java&r1=771219&r2=771314&rev=771314&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeBeanModel.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/model/UserAttributeModel.java
Mon May  4 14:21:26 2009
@@ -20,10 +20,9 @@
 import org.apache.jetspeed.om.portlet.UserAttribute;
 import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
-import org.apache.jetspeed.portlets.prm.UserAttributeBean;
 import org.apache.wicket.model.LoadableDetachableModel;
 
-public class UserAttributeBeanModel extends LoadableDetachableModel<UserAttributeBean>
+public class UserAttributeModel extends LoadableDetachableModel<UserAttribute>
 {
     private static final long serialVersionUID = 1L;
     
@@ -31,20 +30,20 @@
     private PortletApplicationNodeBean paNodeBean;
     private String name;
 
-    public UserAttributeBeanModel(JetspeedServiceLocator locator, PortletApplicationNodeBean
paNodeBean, UserAttributeBean userAttributeBean)
+    public UserAttributeModel(JetspeedServiceLocator locator, PortletApplicationNodeBean
paNodeBean, UserAttribute userAttribute)
     {
-        super(userAttributeBean);
+        super(userAttribute);
         this.locator = locator;
         this.paNodeBean = paNodeBean;
-        this.name = userAttributeBean.getName();
+        this.name = userAttribute.getName();
     }
     
     @Override
-    protected UserAttributeBean load()
+    protected UserAttribute load()
     {
         PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
         UserAttribute userAttribute = app.getUserAttribute(name);
-        return new UserAttributeBean(userAttribute);
+        return userAttribute;
     }
     
 }
\ No newline at end of file

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

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

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

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.html?rev=771314&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.html
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.html
Mon May  4 14:21:26 2009
@@ -0,0 +1,45 @@
+<!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">Locale</th>
+        <th class="portlet-section-subheader">Title</th>
+        <th class="portlet-section-subheader">Short Title</th>
+        <th class="portlet-section-subheader">Keywords</th>
+        <wicket:fragment wicket:id="itemFragment">
+            <td class="portlet-section-body"><input type="text" wicket:id="locale"
readonly="true"/></td>
+            <td class="portlet-section-body"><input type="text" wicket:id="title"/></td>
+            <td class="portlet-section-body"><input type="text" wicket:id="shortTitle"/></td>
+            <td class="portlet-section-body"><input type="text" wicket:id="keywords"/></td>
+        </wicket:fragment>
+        <wicket:fragment wicket:id="newFragment">
+            <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="newTitle"
style="margin-top:10px;" type="text"/></td>
+            <td style="border-top:1px dashed #000;"><input wicket:id="newShortTitle"
style="margin-top:10px;" type="text"/></td>
+            <td style="border-top:1px dashed #000;"><input wicket:id="newKeywords"
style="margin-top:10px;" type="text"/></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/LanguagesPanel.html
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: 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=771314&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/prm/portlet/LanguagesPanel.java
Mon May  4 14:21:26 2009
@@ -0,0 +1,177 @@
+/*
+ * 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.Iterator;
+import java.util.LinkedList;
+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.Language;
+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.LanguageBean;
+import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
+import org.apache.jetspeed.portlets.prm.model.LanguageBeanModel;
+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.PropertyModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LanguagesPanel extends EditorTemplate<LanguageBean>
+{
+    private static final long serialVersionUID = 1L;
+    
+    static final Logger logger = LoggerFactory.getLogger(LanguagesPanel.class);
+
+    private PortletApplicationNodeBean paNodeBean;
+    private String newTitle, newShortTitle, newKeywords, newLocale;
+
+    public LanguagesPanel(String id, final PortletApplicationNodeBean paNodeBean)
+    {
+        super(id);
+        this.paNodeBean = paNodeBean;
+    }
+
+    @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 (newTitle != null && newShortTitle != null && newKeywords
!= null && newLocale != null)
+                    {
+                        Locale locale = new Locale(newLocale);
+                        Language newLanguage = def.addLanguage(locale);
+                        newLanguage.setTitle(newTitle);
+                        newLanguage.setShortTitle(newShortTitle);
+                        newLanguage.setKeywords(newKeywords);
+
+                        newTitle = null;
+                        newShortTitle = null;
+                        newKeywords = null;
+                        newLocale = null;
+                    }
+
+                    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>("newTitle", new PropertyModel<String>(this,
"newTitle")));
+        fragment.add(new TextField<String>("newShortTitle", new PropertyModel<String>(this,
"newShortTitle")));
+        fragment.add(new TextField<String>("newKeywords", new PropertyModel<String>(this,
"newKeywords")));
+        fragment.add(new TextField<String>("newLocale", new PropertyModel<String>(this,
"newLocale")));
+    }
+
+    @Override
+    public int getColumnCount()
+    {
+        return 5;
+    }
+
+    @Override
+    public void buildItems(Fragment fragment, final LanguageBean field)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        fragment.add(new TextField<String>("title", new PropertyModel(new LanguageBeanModel(locator,
paNodeBean, field), "title")));
+        fragment.add(new TextField<String>("shortTitle", new PropertyModel(new LanguageBeanModel(locator,
paNodeBean, field), "shortTitle")));
+        fragment.add(new TextField<String>("keywords", new PropertyModel(new LanguageBeanModel(locator,
paNodeBean, field), "keywords")));
+        fragment.add(new TextField<String>("locale", new PropertyModel(new LanguageBeanModel(locator,
paNodeBean, field), "localeString")));
+    }
+
+    @Override
+    public void delete(IModel<LanguageBean>[] fieldBeans)
+    {
+        PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
+        PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        
+        for (Iterator<Language> it = def.getLanguages().iterator(); it.hasNext(); )
+        {
+            LanguageBean tempBean = new LanguageBean(it.next());
+            
+            for (IModel<LanguageBean> fieldBean : fieldBeans)
+            {
+                if (tempBean.getLocale().equals(fieldBean.getObject().getLocale()))
+                {
+                    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<LanguageBean>> getItemModels()
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        PortletApplication app = locator.getPortletRegistry().getPortletApplication(paNodeBean.getApplicationName());
+        PortletDefinition def = app.getPortlet(paNodeBean.getName());
+        List<IModel<LanguageBean>> list = new LinkedList<IModel<LanguageBean>>();
+        
+        for (Language field : def.getLanguages())
+        {
+            list.add(new LanguageBeanModel(locator, paNodeBean, new LanguageBean(field)));
+        }
+
+        return list.iterator();
+    }
+
+    @Override
+    public IModel<LanguageBean> getNewRowModel(LanguageBean fieldBean)
+    {
+        JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
+        return new LanguageBeanModel(locator, paNodeBean, fieldBean);
+    }
+
+}

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

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

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

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=771314&r1=771313&r2=771314&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
Mon May  4 14:21:26 2009
@@ -30,9 +30,8 @@
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.portlets.JetspeedServiceLocator;
 import org.apache.jetspeed.portlets.prm.DescriptionBean;
-import org.apache.jetspeed.portlets.prm.InitParamBean;
 import org.apache.jetspeed.portlets.prm.PortletApplicationNodeBean;
-import org.apache.jetspeed.portlets.prm.model.InitParamBeanModel;
+import org.apache.jetspeed.portlets.prm.model.InitParamModel;
 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;
@@ -46,7 +45,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ParameterPanel extends EditorTemplate<InitParamBean>
+public class ParameterPanel extends EditorTemplate<InitParam>
 {
     private static final long serialVersionUID = 1L;
     
@@ -80,14 +79,14 @@
     }
 
     @Override
-    public void buildItems(Fragment fragment, final InitParamBean initParamBean)
+    public void buildItems(Fragment fragment, final InitParam initParam)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
 
-        fragment.add(new TextField<String>("name", new PropertyModel<String>(new
InitParamBeanModel(locator, paNodeBean, initParamBean), "paramName")));
-        fragment.add(new TextField<String>("value", new PropertyModel<String>(new
InitParamBeanModel(locator, paNodeBean, initParamBean), "paramValue")));
+        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,
initParamBean.getParamName())
+        fragment.add(new LocalizedDescriptionEditor("localizationEditor", locator, paNodeBean,
initParam.getParamName())
         {
 
             @Override
@@ -97,7 +96,7 @@
                 PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
                 PortletDefinition def = app.getPortlet(paNodeBean.getName());
 
-                final InitParam param = def.getInitParam(initParamBean.getParamName());
+                final InitParam param = def.getInitParam(initParam.getParamName());
 
                 List<DescriptionBean> list = new ArrayList<DescriptionBean>();
 
@@ -124,11 +123,11 @@
                         
                         if (newLocale != null && newDescription != null)
                         {
-                            InitParam initParam = def.getInitParam(initParamBean.getParamName());
+                            InitParam param = def.getInitParam(initParam.getParamName());
                             Locale locale = new Locale(newLocale);
                             Description targetDescription = null;
                             
-                            for (Description description : initParam.getDescriptions())
+                            for (Description description : param.getDescriptions())
                             {
                                 if (description.getLocale().equals(locale))
                                 {
@@ -139,7 +138,7 @@
                             
                             if (targetDescription == null)
                             {
-                                targetDescription = initParam.addDescription(newLocale);
+                                targetDescription = param.addDescription(newLocale);
                             }
                             
                             targetDescription.setDescription(newDescription);
@@ -199,7 +198,7 @@
     }
 
     @Override
-    public void delete(IModel<InitParamBean>[] fields)
+    public void delete(IModel<InitParam>[] fields)
     {
         PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
         PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
@@ -211,7 +210,7 @@
             InitParam initParam = it.next();
             String paramName = initParam.getParamName();
             
-            for (IModel<InitParamBean> field : fields)
+            for (IModel<InitParam> field : fields)
             {
                 if (field.getObject().getParamName().equals(paramName))
                 {
@@ -233,28 +232,28 @@
     }
 
     @Override
-    public Iterator<IModel<InitParamBean>> getItemModels()
+    public Iterator<IModel<InitParam>> getItemModels()
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
         PortletRegistry registry = locator.getPortletRegistry();
         PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
         PortletDefinition def = app.getPortlet(paNodeBean.getName());
         
-        List<IModel<InitParamBean>> initParamBeanModels = new ArrayList<IModel<InitParamBean>>();
+        List<IModel<InitParam>> initParamBeanModels = new ArrayList<IModel<InitParam>>();
         
         for (InitParam initParam : def.getInitParams())
         {
-            initParamBeanModels.add(new InitParamBeanModel(locator, paNodeBean, new InitParamBean(initParam)));
+            initParamBeanModels.add(new InitParamModel(locator, paNodeBean, initParam));
         }
         
         return initParamBeanModels.iterator();
     }
 
     @Override
-    public IModel<InitParamBean> getNewRowModel(InitParamBean initParamBean)
+    public IModel<InitParam> getNewRowModel(InitParam initParam)
     {
         JetspeedServiceLocator locator = ((AbstractAdminWebApplication) getApplication()).getServiceLocator();
-        return new InitParamBeanModel(locator, paNodeBean, initParamBean);
+        return new InitParamModel(locator, paNodeBean, initParam);
     }
 
     @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=771314&r1=771313&r2=771314&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
Mon May  4 14:21:26 2009
@@ -90,15 +90,15 @@
             };
             tabs.add(detailsTab);
 
-            ITab parametersTab = new AbstractTab(new Model("Parameters"))
+            ITab metadataTab = new AbstractTab(new Model("Metadata"))
             {
 
                 public Panel getPanel(String panelId)
                 {
-                    return new ParameterPanel(panelId, paNodeBean);
+                    return new MetadataPanel(panelId, paNodeBean);
                 }
             };
-            tabs.add(parametersTab);
+            tabs.add(metadataTab);
 
             ITab preferencesTab = new AbstractTab(new Model("Preferences"))
             {
@@ -109,16 +109,25 @@
                 }
             };
             tabs.add(preferencesTab);
+            
+            ITab languagesTab = new AbstractTab(new Model("Languages"))
+            {
+                public Panel getPanel(String panelId)
+                {
+                    return new LanguagesPanel(panelId, paNodeBean);
+                }
+            };
+            tabs.add(languagesTab);
 
-            ITab metadataTab = new AbstractTab(new Model("Metadata"))
+            ITab parametersTab = new AbstractTab(new Model("Parameters"))
             {
 
                 public Panel getPanel(String panelId)
                 {
-                    return new MetadataPanel(panelId, paNodeBean);
+                    return new ParameterPanel(panelId, paNodeBean);
                 }
             };
-            tabs.add(metadataTab);
+            tabs.add(parametersTab);
 
             TabbedPanel tabbedPanel = new TabbedPanel("tabs", tabs);
             if (get("tabs") == null)



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