[gatein-commits] gatein SVN: r6866 - in portal/trunk: webui/core/src/main/java/org/exoplatform/webui/form and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 12 23:43:03 EDT 2011


Author: trong.tran
Date: 2011-07-12 23:43:02 -0400 (Tue, 12 Jul 2011)
New Revision: 6866

Added:
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java
Removed:
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UIFormCheckBoxInput.java
Modified:
   portal/trunk/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleUIForm.java
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
   portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
Log:
GTNPORTAL-1916 Rename the new UIFormCheckBoxInput to UICheckBoxInput

Modified: portal/trunk/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleUIForm.java
===================================================================
--- portal/trunk/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleUIForm.java	2011-07-13 03:25:57 UTC (rev 6865)
+++ portal/trunk/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleUIForm.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -33,7 +33,7 @@
 import org.exoplatform.webui.event.Event;
 import org.exoplatform.webui.event.EventListener;
 import org.exoplatform.webui.form.UIForm;
-import org.exoplatform.webui.form.input.UIFormCheckBoxInput;
+import org.exoplatform.webui.form.input.UICheckBoxInput;
 import org.exoplatform.webui.form.UIFormDateTimeInput;
 import org.exoplatform.webui.form.UIFormInput;
 import org.exoplatform.webui.form.UIFormInputSet;
@@ -109,7 +109,7 @@
 
       List<SelectItemOption<String>> selectItemOptions = makeSelectItemOptions();
       inputSet.addUIFormInput(new UIFormSelectBox(POSITION, null, selectItemOptions));
-      inputSet.addUIFormInput(new UIFormCheckBoxInput(RECEIVE_EMAIL, null, false));
+      inputSet.addUIFormInput(new UICheckBoxInput(RECEIVE_EMAIL, null, false));
       
       List<SelectItemOption<String>> comboBoxItemOptions = new ArrayList<SelectItemOption<String>>();
       comboBoxItemOptions.add(new SelectItemOption<String>(("VI")));
@@ -220,7 +220,7 @@
          UISampleUIForm uiForm = event.getSource();
          String userName = uiForm.getUIStringInput(USERNAME).getValue();
          String password = uiForm.getUIStringInput(PASSWORD).getValue();
-         boolean receiveEmail = uiForm.<UIFormCheckBoxInput>getUIInput(RECEIVE_EMAIL).isChecked();
+         boolean receiveEmail = uiForm.getUICheckBoxInput(RECEIVE_EMAIL).isChecked();
          String favoriteColor = (String)uiForm.getUIInput(FAVORITE_COLOR).getValue();
          String position = (String)uiForm.getUIInput(POSITION).getValue();
          String gender = (String)uiForm.getUIInput(GENDER).getValue();

Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java	2011-07-13 03:25:57 UTC (rev 6865)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIForm.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -28,6 +28,7 @@
 import org.exoplatform.webui.config.Event;
 import org.exoplatform.webui.core.UIComponent;
 import org.exoplatform.webui.core.UIContainer;
+import org.exoplatform.webui.form.input.UICheckBoxInput;
 
 import java.io.Writer;
 import java.util.List;
@@ -115,6 +116,11 @@
       return findComponentById(name);
    }
 
+   public UICheckBoxInput getUICheckBoxInput(String name)
+   {
+      return findComponentById(name);
+   }
+   
    public UIFormSelectBox getUIFormSelectBox(String name)
    {
       return findComponentById(name);

Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java	2011-07-13 03:25:57 UTC (rev 6865)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -27,7 +27,7 @@
 /**
  * Represents a checkbox field.
  * @param <T> The type of value that is expected
- * @deprecated use {@link org.exoplatform.webui.form.input.UIFormCheckBoxInput} instead 
+ * @deprecated use {@link org.exoplatform.webui.form.input.UICheckBoxInput} instead 
  */
 @SuppressWarnings("hiding")
 @Serialized

Modified: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java	2011-07-13 03:25:57 UTC (rev 6865)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -138,7 +138,7 @@
       return value_;
    }
 
-   public UIFormInput setValue(T value)
+   public UIFormInput<T> setValue(T value)
    {
       this.value_ = value;
       return this;

Copied: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java (from rev 6864, portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UIFormCheckBoxInput.java)
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java	                        (rev 0)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2011 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
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.webui.form.input;
+
+import java.io.Writer;
+
+import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.webui.application.WebuiRequestContext;
+import org.exoplatform.webui.form.UIForm;
+import org.exoplatform.webui.form.UIFormInput;
+import org.exoplatform.webui.form.UIFormInputBase;
+
+/**
+ *  <p>Represent an html checkbox input <br/> 
+ * This class is a replacement for {@link org.exoplatform.webui.form.UIFormCheckBoxInput} <br/>
+ * Still support raising event when user click the checkbox, but now we only accept boolean value. </p>
+ *  
+ * @author <a href="mailto:phuong.vu at exoplatform.com">Vu Viet Phuong</a>
+ * @version $Id$
+ */
+ at Serialized
+public class UICheckBoxInput extends UIFormInputBase<Boolean>
+{
+   /**
+    * Name of {@link org.exoplatform.webui.event.EventListener} that will be fired when checkbox state is changed 
+    */
+   private String onchange_;
+
+   /**
+    * Id of {@link org.exoplatform.webui.core.UIComponent} that is configured with the fired event 
+    * This component must be in the same form with the checkbox
+    * If this field is null, event of the UIForm will be fire instead
+    */
+   private String componentEvent_ = null;
+
+   public UICheckBoxInput()
+   {
+      this(null, null, false);
+   }
+
+   public UICheckBoxInput(String name, String bindingExpression, Boolean value)
+   {
+      super(name, bindingExpression, Boolean.class);
+      setValue(value);
+   }
+
+   public UIFormInput<Boolean> setValue(Boolean value)
+   {
+      if (value == null)
+      {
+         value = false;
+      }
+         
+      return super.setValue(value);
+   }
+   
+   /**
+    * This method is used to make the action more meaning in the context of a checkbox
+    */
+   public boolean isChecked()
+   {
+      return getValue();
+   }
+
+   /**
+    * This method is used to make the action more meaning in the context of a checkbox
+    */
+   public UICheckBoxInput setChecked(boolean check)
+   {
+      return (UICheckBoxInput)setValue(check);
+   }
+
+   public void setOnChange(String onchange)
+   {
+      onchange_ = onchange;
+   }
+
+   public void setComponentEvent(String com)
+   {
+      componentEvent_ = com;
+   }
+
+   public void setOnChange(String event, String com)
+   {
+      this.onchange_ = event;
+      this.componentEvent_ = com;
+   }
+
+   public String renderOnChangeEvent(UIForm uiForm) throws Exception
+   {
+      if (componentEvent_ == null)
+         return uiForm.event(onchange_, null);
+      return uiForm.event(onchange_, componentEvent_, (String)null);
+   }
+
+   public void decode(Object input, WebuiRequestContext context) throws Exception
+   {
+      if (!isEnable())
+         return;
+      
+      if (input == null || "false".equals(input.toString()))
+      {
+         setValue(false);
+      }
+      else 
+      {
+         setValue(true);
+      }
+   }
+
+   public void processRender(WebuiRequestContext context) throws Exception
+   {
+      Writer w = context.getWriter();
+      w.write("<input type='checkbox' name='");
+      w.write(name);
+      w.write("'");
+      if (onchange_ != null)
+      {
+         UIForm uiForm = getAncestorOfType(UIForm.class);
+         w.append(" onclick=\"").append(renderOnChangeEvent(uiForm)).append("\"");
+      }
+      if (isChecked())
+         w.write(" checked");
+      if (!enable_)
+         w.write(" disabled");
+      w.write(" class='checkbox'/>");
+      if (this.isMandatory())
+         w.write(" *");
+   }
+
+}
\ No newline at end of file

Deleted: portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UIFormCheckBoxInput.java
===================================================================
--- portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UIFormCheckBoxInput.java	2011-07-13 03:25:57 UTC (rev 6865)
+++ portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UIFormCheckBoxInput.java	2011-07-13 03:43:02 UTC (rev 6866)
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2011 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
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.webui.form.input;
-
-import java.io.Writer;
-
-import org.exoplatform.commons.serialization.api.annotations.Serialized;
-import org.exoplatform.webui.application.WebuiRequestContext;
-import org.exoplatform.webui.form.UIForm;
-import org.exoplatform.webui.form.UIFormInput;
-import org.exoplatform.webui.form.UIFormInputBase;
-
-/**
- * @author <a href="mailto:phuong.vu at exoplatform.com">Vu Viet Phuong</a>
- * @version $Id$
- *
- *  <p>Represent an html checkbox input <br/> 
- * This class is a replacement for {@link org.exoplatform.webui.form.UIFormCheckBoxInput} <br/>
- * Still support raising event when user click the checkbox, but now we only accept boolean value. </p> 
- */
- at Serialized
-public class UIFormCheckBoxInput extends UIFormInputBase<Boolean>
-{
-   /**
-    * Name of {@link org.exoplatform.webui.event.EventListener} that will be fired when checkbox state is changed 
-    */
-   private String onchange_;
-
-   /**
-    * Id of {@link org.exoplatform.webui.core.UIComponent} that is configured with the fired event 
-    * This component must be in the same form with the checkbox
-    * If this field is null, event of the UIForm will be fire instead
-    */
-   private String componentEvent_ = null;
-
-   public UIFormCheckBoxInput()
-   {
-      this(null, null, false);
-   }
-
-   public UIFormCheckBoxInput(String name, String bindingExpression, Boolean value)
-   {
-      super(name, bindingExpression, Boolean.class);
-      setValue(value);
-   }
-
-   public UIFormInput setValue(Boolean value)
-   {
-      if (value == null)
-      {
-         value = false;
-      }
-         
-      return super.setValue(value);
-   }
-   
-   /**
-    * This method is used to make the action more meaning in the context of a checkbox
-    */
-   public boolean isChecked()
-   {
-      return getValue();
-   }
-
-   /**
-    * This method is used to make the action more meaning in the context of a checkbox
-    */
-   public UIFormCheckBoxInput setChecked(boolean check)
-   {
-      return (UIFormCheckBoxInput)setValue(check);
-   }
-
-   public void setOnChange(String onchange)
-   {
-      onchange_ = onchange;
-   }
-
-   public void setComponentEvent(String com)
-   {
-      componentEvent_ = com;
-   }
-
-   public void setOnChange(String event, String com)
-   {
-      this.onchange_ = event;
-      this.componentEvent_ = com;
-   }
-
-   public String renderOnChangeEvent(UIForm uiForm) throws Exception
-   {
-      if (componentEvent_ == null)
-         return uiForm.event(onchange_, null);
-      return uiForm.event(onchange_, componentEvent_, (String)null);
-   }
-
-   public void decode(Object input, WebuiRequestContext context) throws Exception
-   {
-      if (!isEnable())
-         return;
-      
-      if (input == null || "false".equals(input.toString()))
-      {
-         setValue(false);
-      }
-      else 
-      {
-         setValue(true);
-      }
-   }
-
-   public void processRender(WebuiRequestContext context) throws Exception
-   {
-      Writer w = context.getWriter();
-      w.write("<input type='checkbox' name='");
-      w.write(name);
-      w.write("'");
-      if (onchange_ != null)
-      {
-         UIForm uiForm = getAncestorOfType(UIForm.class);
-         w.append(" onclick=\"").append(renderOnChangeEvent(uiForm)).append("\"");
-      }
-      if (isChecked())
-         w.write(" checked");
-      if (!enable_)
-         w.write(" disabled");
-      w.write(" class='checkbox'/>");
-      if (this.isMandatory())
-         w.write(" *");
-   }
-
-}
\ No newline at end of file



More information about the gatein-commits mailing list