[gatein-commits] gatein SVN: r1272 - in portal/trunk: portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component and 2 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Jan 13 21:56:11 EST 2010


Author: chris.laprun at jboss.com
Date: 2010-01-13 21:56:10 -0500 (Wed, 13 Jan 2010)
New Revision: 1272

Modified:
   portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
   portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
   portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
   portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
Log:
- Removed key field in registration details and use name as id field. Added getBeanIdFor method on UIGrid that calls toString on the id field to make sure
  we get a String for further processing (in particular, UIForm.event methods).
- Re-worked toggle mechanism to work with the new organization of elements.
- Events on properties don't currently work. :/


Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java	2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpProducerEditor.java	2010-01-14 02:56:10 UTC (rev 1272)
@@ -44,7 +44,8 @@
    lifecycle = UIFormLifecycle.class,
    template = "app:/groovy/wsrp/webui/component/UIWsrpProducerEditor.gtmpl",
    events = {
-      @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class)
+      @EventConfig(listeners = UIWsrpProducerEditor.SaveActionListener.class),
+      @EventConfig(listeners = UIWsrpProducerEditor.RegistrationOnChangeActionListener.class)
    }
 )
 public class UIWsrpProducerEditor extends UIForm
@@ -79,9 +80,9 @@
 
       // registration details
       // form set to gather registration information
-      registrationDetails = addChild(UIWsrpRegistrationDetails.class,null,null);
+      registrationDetails = addChild(UIWsrpRegistrationDetails.class, null, null);
 
-      init();
+      init(false);
    }
 
    ProducerConfigurationService getService()
@@ -89,7 +90,7 @@
       return configService;
    }
 
-   private void init() throws Exception
+   private void init(boolean getRegistrationRequiredFromCheckBox) throws Exception
    {
       ProducerConfiguration configuration = configService.getConfiguration();
 
@@ -97,7 +98,9 @@
       regReqForDesc.setValue(registrationRequirements.isRegistrationRequiredForFullDescription());
       strictMode.setValue(configuration.isUsingStrictMode());
 
-      boolean registrationRequired = registrationRequirements.isRegistrationRequired();
+      boolean registrationRequired = getRegistrationRequiredFromCheckBox ?
+         regRequired.getValue() :
+         registrationRequirements.isRegistrationRequired();
       regRequired.setValue(registrationRequired);
 
       // if registration is required then we display more information
@@ -142,11 +145,11 @@
             e.printStackTrace();
          }
 
-         source.init();
+         source.init(false);
       }
    }
 
-   public static class RegistrationOnChangeActionListener extends EventListener<UIFormCheckBoxInput>
+   /*public static class RegistrationOnChangeActionListener extends EventListener<UIFormCheckBoxInput>
    {
       public void execute(Event<UIFormCheckBoxInput> event) throws Exception
       {
@@ -157,6 +160,18 @@
          //update only the parent, avoid updating the full portlet
          event.getRequestContext().addUIComponentToUpdateByAjax(parent);
       }
+   }*/
+
+   public static class RegistrationOnChangeActionListener extends EventListener<UIWsrpProducerEditor>
+   {
+      public void execute(Event<UIWsrpProducerEditor> event) throws Exception
+      {
+         UIWsrpProducerEditor source = event.getSource();
+         source.init(true);
+
+         //update only the parent, avoid updating the full portlet
+         event.getRequestContext().addUIComponentToUpdateByAjax(source);
+      }
    }
 
 }

Modified: portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java	2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/UIWsrpRegistrationDetails.java	2010-01-14 02:56:10 UTC (rev 1272)
@@ -35,8 +35,7 @@
 import org.exoplatform.webui.core.UIComponent;
 import org.exoplatform.webui.core.UIGrid;
 import org.exoplatform.webui.core.UIPopupWindow;
-import org.exoplatform.webui.core.lifecycle.UIApplicationLifecycle;
-import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
+import org.exoplatform.webui.core.lifecycle.UIContainerLifecycle;
 import org.exoplatform.webui.core.renderers.ValueRenderer;
 import org.exoplatform.webui.event.Event;
 import org.exoplatform.webui.event.EventListener;
@@ -66,21 +65,22 @@
  * @version $Revision$
  */
 @ComponentConfigs({
-   @ComponentConfig(id = "RegistrationPropertySelector", type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
+   @ComponentConfig(id = UIWsrpRegistrationDetails.REGISTRATION_PROPERTIES, type = UIGrid.class, template = "system:/groovy/webui/core/UIGrid.gtmpl"),
    @ComponentConfig(
-      lifecycle = UIFormLifecycle.class,
+      lifecycle = UIContainerLifecycle.class,
       events = {
          @EventConfig(listeners = UIWsrpRegistrationDetails.AddPropertyActionListener.class),
          @EventConfig(listeners = UIWsrpRegistrationDetails.EditPropertyActionListener.class),
          @EventConfig(listeners = UIWsrpRegistrationDetails.DeletePropertyActionListener.class)
       })
 })
-public class UIWsrpRegistrationDetails extends UIForm
+public class UIWsrpRegistrationDetails extends UIFormInputSet
 {
    private UIFormInputBase<String> policy;
    private UIFormInputBase<String> validator;
    private UIGrid registrationProperties;
-   static String[] FIELDS = {"key", "name", "description", "label", "hint"};
+   private static final String NAME = "name";
+   static String[] FIELDS = {NAME, "description", "label", "hint"};
    static String[] SELECT_ACTIONS = {"EditProperty", "DeleteProperty"};
    static final String POLICY_CLASS = "policyClassName";
    static final String VALIDATOR_CLASS = "validatorClassName";
@@ -114,7 +114,7 @@
       registrationProperties.registerRendererFor(renderer, LocalizedString.class);
 
       //configure the edit and delete buttons based on an id from the data list - this will also be passed as param to listener
-      registrationProperties.configure("key", FIELDS, SELECT_ACTIONS);
+      registrationProperties.configure(NAME, FIELDS, SELECT_ACTIONS);
       registrationProperties.getUIPageIterator().setId(REGISTRATION_PROPERTIES_ITERATOR);
       registrationProperties.getUIPageIterator().setRendered(false);
       addChild(registrationProperties.getUIPageIterator());
@@ -216,11 +216,11 @@
    @Override
    public void processRender(WebuiRequestContext context) throws Exception
    {
-      if (getComponentConfig() != null)
+      /*if (getComponentConfig() != null)
       {
          super.processRender(context);
          return;
-      }
+      }*/
 
       Writer w = context.getWriter();
       w.write("<div class=\"UIFormInputSet\">");

Modified: portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css
===================================================================
--- portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css	2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/portlet/exoadmin/src/main/webapp/skin/wsrp/webui/component/DefaultStylesheet.css	2010-01-14 02:56:10 UTC (rev 1272)
@@ -18,72 +18,82 @@
  */
 
 .UIWsrpPortlet {
-	padding:10px;
+   padding: 10px;
 }
 
 img.RefreshIcon {
-    width: 16px; height: 16px;
-    background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/RefreshIcon.gif') no-repeat;
+   width: 16px;
+   height: 16px;
+   background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/RefreshIcon.gif') no-repeat;
 }
 
 img.DeactivateIcon {
-    width: 16px; height: 16px;
-    background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/Cancel.gif') no-repeat;
+   width: 16px;
+   height: 16px;
+   background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/Cancel.gif') no-repeat;
 }
 
-img.StopIcon {
-    width: 16px; height: 16px;
-    background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinClickButton.gif') no-repeat;
+img.ActivateIcon {
+   width: 16px;
+   height: 16px;
+   background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif') no-repeat;
 }
 
-img.ActivateIcon {
-    width: 16px; height: 16px;
-    background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/SelectIcon.gif') no-repeat;
+img.EditPropertyIcon {
+   width: 16px;
+   height: 16px;
+   background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/EditIcon.gif') no-repeat;
 }
 
+img.DeletePropertyIcon {
+   width: 16px;
+   height: 16px;
+   background: url('/eXoResources/skin/DefaultSkin/skinIcons/16x16/icons/DustBinIcon.gif') no-repeat;
+}
+
 .UIWsrpPortlet .UITabPane {
-    margin: 10px
+   margin: 10px
 }
 
 .UIWsrpPortlet .UIHorizontalTabs .TabsContainer {
-    border-bottom:1px solid #DDDDDD;
-    height:24px;
+   border-bottom: 1px solid #DDDDDD;
+   height: 24px;
 }
 
 .UIWsrpPortlet .UIAction .ActionContainer {
-    margin:0;
-    width:auto;
+   margin: 0;
+   width: auto;
 }
 
 .UIWsrpPortlet .form-row {
-    /*border-bottom: 1px solid #ddd;*/
-    padding: 3px;
-    clear:both;
+/*border-bottom: 1px solid #ddd;*/
+   padding: 3px;
+   clear: both;
 }
 
 .UIWsrpPortlet .form-row label {
-    float:left;
-    width: 100%;
+   float: left;
+   width: 100%;
 }
 
 .UIWsrpPortlet .form-row label span {
-    display:block;
-    float:left;
-    width: 26%;
+   display: block;
+   float: left;
+   width: 26%;
 }
 
 .UIWsrpPortlet .form-row label input {
-    float:left;
-    width: 69%;
+   float: left;
+   width: 69%;
 }
 
 .UIWsrpPortlet .UILoginForm .UIAction {
-    clear:both;
-    padding: 8px 0;
+   clear: both;
+   padding: 8px 0;
 }
 
 .UIWsrpPortlet .UILoginForm .ActionContainer {
-    float:right;
-    margin:0;
+   float: right;
+   margin: 0;
 }
 

Modified: portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl
===================================================================
--- portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl	2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/web/portal/src/main/webapp/groovy/webui/core/UIGrid.gtmpl	2010-01-14 02:56:10 UTC (rev 1272)
@@ -70,22 +70,22 @@
             <div class="ActionContainer">
                <%
                      def beanIdField = uicomponent.getBeanIdField();
+                     def beanId = uicomponent.getBeanIdFor(bean);
                      for (action in beanActions)
                      {
-                        def beanId = uicomponent.getFieldValue(bean, beanIdField);
                         if (action == null) continue;
-                        String title = _ctx.appRes(uicomponent.getParent().getName() + ".action.title." + action);
+                        String title = _ctx.appRes(uiParent.getName() + ".action.title." + action);
                         String actionLink = "";
                         if (uiForm != null)
                         {
-                           actionLink = uiForm.event(action, uicomponent.getParent().getId(), beanId);
+                           actionLink = uiForm.event(action, uiParent.getId(), beanId);
                         }
                         else
                         {
                            actionLink = uiParent.event(action, beanId);
                         }
                %>
-               <img onclick="$actionLink" alt="" title="$title" src="/eXoResources/skin/sharedImages/Blank.gif" class="${action}Icon"/>
+               <img onclick="$actionLink" alt="$action" title="$title" src="/eXoResources/skin/sharedImages/Blank.gif" class="${action}Icon"/>
                <% } %>
             </div>
          </td>

Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java	2010-01-14 01:45:49 UTC (rev 1271)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/UIGrid.java	2010-01-14 02:56:10 UTC (rev 1272)
@@ -1,16 +1,16 @@
 /**
  * Copyright (C) 2009 eXo Platform SAS.
- * 
+ *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
- * 
+ *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -26,35 +26,25 @@
 import java.util.List;
 
 /**
- * Created by The eXo Platform SARL
- * Author : Tuan Nguyen
- *          tuan08 at users.sourceforge.net
- * May 7, 2006
- * 
+ * Created by The eXo Platform SARL Author : Tuan Nguyen tuan08 at users.sourceforge.net May 7, 2006
+ * <p/>
  * A grid element (represented by an HTML table) that can be paginated with a UIPageIterator
+ *
  * @see UIPageIterator
  */
 @ComponentConfig(template = "system:/groovy/webui/core/UIGrid.gtmpl")
 public class UIGrid extends UIComponent
 {
-   /**
-    * The page iterator
-    */
+   /** The page iterator */
    protected UIPageIterator uiIterator_;
 
-   /**
-    * The bean field that holds the id of this bean
-    */
+   /** The bean field that holds the id of this bean */
    protected String beanIdField_;
 
-   /**
-    * An array of String representing the fields in each bean
-    */
+   /** An array of String representing the fields in each bean */
    protected String[] beanField_;
 
-   /**
-    * An array of String representing the actions on each bean
-    */
+   /** An array of String representing the actions on each bean */
    protected String[] action_;
 
    protected String classname_;
@@ -125,11 +115,18 @@
       return method.invoke(bean, ReflectionUtil.EMPTY_ARGS);
    }
 
+   public String getBeanIdFor(Object bean) throws Exception
+   {
+      return getFieldValue(bean, beanIdField_).toString();
+   }
+
    @SuppressWarnings("unchecked")
    public UIComponent findComponentById(String lookupId)
    {
       if (uiIterator_.getId().equals(lookupId))
+      {
          return uiIterator_;
+      }
       return super.findComponentById(lookupId);
    }
 



More information about the gatein-commits mailing list