Author: trong.tran
Date: 2011-11-02 00:56:04 -0400 (Wed, 02 Nov 2011)
New Revision: 7923
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIAccountEditInputSet.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIMembershipTypeForm.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.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/UIFormDateTimeInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormHiddenInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/account/UIAccountProfiles.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIChangePassword.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIResetPassword.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
Log:
GTNPORTAL-2245 Set of improvements in Form input components
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIApplicationForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -73,10 +73,10 @@
application_ = app;
if (application_ == null)
{
- getUIStringInput("applicationName").setEditable(true);
+ getUIStringInput("applicationName").setReadOnly(false);
return;
}
- getUIStringInput("applicationName").setEditable(false);
+ getUIStringInput("applicationName").setReadOnly(true);
invokeGetBindingBean(app);
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategoryForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -99,11 +99,11 @@
if (category == null)
{
category_ = null;
- uiSetting.getUIStringInput(FIELD_NAME).setEditable(true);
+ uiSetting.getUIStringInput(FIELD_NAME).setReadOnly(false);
return;
}
category_ = category;
-
uiSetting.getUIStringInput(FIELD_NAME).setEditable(false).setValue(category_.getName());
+
uiSetting.getUIStringInput(FIELD_NAME).setReadOnly(true).setValue(category_.getName());
uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).setValue(category_.getDisplayName());
uiSetting.getUIFormTextAreaInput(FIELD_DESCRIPTION).setValue(category_.getDescription());
List<String> accessPermissions = category_.getAccessPermissions();
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIGadgetEditor.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -122,7 +122,7 @@
UIFormStringInput uiInputName = getUIStringInput(FIELD_NAME);
uiInputSource.setValue(uiInputSource.getValue());
if(this.isEdit()) {
- uiInputName.setEditable(false);
+ uiInputName.setReadOnly(true);
}
super.processRender(context);
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -136,7 +136,7 @@
initLanguageSelectBox(uiFormLanguagesSelectBox);
uiFormLanguagesSelectBox.setOnChange(LANGUAGES_ONCHANGE);
- uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI",
null).setEditable(false))
+ uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI",
null).setReadOnly(true))
.addUIFormInput(new UIFormStringInput("name", "name",
null).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class))
.addUIFormInput(uiSwitchLabelMode)
.addUIFormInput(new UIFormStringInput(LABEL, LABEL,
null).addValidator(StringLengthValidator.class, 3, 120))
@@ -171,13 +171,13 @@
cachedLabels = new HashMap<String, Described.State>();
if (pageNode == null)
{
- getUIStringInput("name").setEditable(UIFormStringInput.ENABLE);
+ getUIStringInput("name").setReadOnly(false);
getChild(UIFormInputIconSelector.class).setSelectedIcon("Default");
setShowPublicationDate(false);
switchLabelMode(true);
return;
}
- getUIStringInput("name").setEditable(UIFormStringInput.DISABLE);
+ getUIStringInput("name").setReadOnly(true);
invokeGetBindingBean(pageNode_);
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIAccountEditInputSet.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIAccountEditInputSet.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIAccountEditInputSet.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -61,7 +61,7 @@
public UIAccountEditInputSet(String name) throws Exception
{
super(name);
- addUIFormInput(new UIFormStringInput(USERNAME, "userName",
null).setEditable(false).addValidator(
+ addUIFormInput(new UIFormStringInput(USERNAME, "userName",
null).setReadOnly(true).addValidator(
MandatoryValidator.class).addValidator(StringLengthValidator.class, 3,
30).addValidator(
ResourceValidator.class).addValidator(ExpressionValidator.class,
Utils.USER_NAME_VALIDATOR_REGEX,
"ResourceValidator.msg.Invalid-char"));
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupEditMembershipForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -68,7 +68,7 @@
public UIGroupEditMembershipForm() throws Exception
{
- addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setEditable(false));
+ addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setReadOnly(true));
addUIFormInput(new UIFormSelectBox(MEMBER_SHIP, MEMBER_SHIP,
listOption).setSize(1));
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIGroupForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -74,13 +74,13 @@
if (group != null)
{
this.groupId = group.getId();
- getUIStringInput(GROUP_NAME).setEditable(UIFormStringInput.DISABLE);
+ getUIStringInput(GROUP_NAME).setReadOnly(true);
invokeGetBindingBean(group);
}
else
{
this.groupId = null;
- getUIStringInput(GROUP_NAME).setEditable(UIFormStringInput.ENABLE);
+ getUIStringInput(GROUP_NAME).setReadOnly(false);
reset();
}
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIMembershipTypeForm.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIMembershipTypeForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/organization/webui/component/UIMembershipTypeForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -51,9 +51,9 @@
public UIMembershipTypeForm() throws Exception
{
- addUIFormInput(new UIFormStringInput(MEMBERSHIP_TYPE_NAME, MEMBERSHIP_TYPE_NAME,
null).setEditable(
-
UIFormStringInput.ENABLE).addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,
3,
-
30).addValidator(NameValidator.class).addValidator(SpecialCharacterValidator.class));
+ addUIFormInput(new UIFormStringInput(MEMBERSHIP_TYPE_NAME, MEMBERSHIP_TYPE_NAME,
null).setReadOnly(false)
+
.addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class, 3, 30)
+
.addValidator(NameValidator.class).addValidator(SpecialCharacterValidator.class));
addUIFormInput(new UIFormTextAreaInput(DESCRIPTION, DESCRIPTION, null));
}
@@ -63,13 +63,13 @@
if (membershipType == null)
{
membershipTypeName = null;
- getUIStringInput(MEMBERSHIP_TYPE_NAME).setEditable(UIFormStringInput.ENABLE);
+ getUIStringInput(MEMBERSHIP_TYPE_NAME).setReadOnly(false);
return;
}
else
{
membershipTypeName = membershipType.getName();
- getUIStringInput(MEMBERSHIP_TYPE_NAME).setEditable(UIFormStringInput.DISABLE);
+ getUIStringInput(MEMBERSHIP_TYPE_NAME).setReadOnly(true);
}
invokeGetBindingBean(membershipType);
}
@@ -121,7 +121,7 @@
}
uiMembershipManagement.getChild(UIListMembershipType.class).loadData();
-
uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).setEditable(UIFormStringInput.ENABLE);
+ uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).setReadOnly(false);
uiForm.setMembershipType(null);
uiForm.reset();
}
@@ -132,7 +132,7 @@
public void execute(Event<UIMembershipTypeForm> event) throws Exception
{
UIMembershipTypeForm uiForm = event.getSource();
-
uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).setEditable(UIFormStringInput.ENABLE);
+ uiForm.getUIStringInput(MEMBERSHIP_TYPE_NAME).setReadOnly(false);
uiForm.setMembershipType(null);
uiForm.reset();
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -124,7 +124,7 @@
if (uiFormInput instanceof UIFormInputBase)
{
UIFormInputBase uiStringBase = (UIFormInputBase)uiFormInput;
- if (!uiStringBase.isEditable())
+ if (uiStringBase.isReadOnly())
{
return;
}
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-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormCheckBoxInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -118,7 +118,7 @@
@SuppressWarnings("unused")
public void decode(Object input, WebuiRequestContext context) throws Exception
{
- if (!isEnable())
+ if (isDisabled())
return;
if (input != null) {
if(input.equals("true"))
@@ -149,8 +149,11 @@
}
if (checked)
w.write(" checked ");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
+
+ renderHTMLAttributes(w);
+
w.write(" class='checkbox'/>");
if (this.isMandatory())
w.write(" *");
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormDateTimeInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -242,14 +242,13 @@
w.write(value);
w.write('\"');
w.write(" onclick='event.cancelBubble = true'
onkeydown='eXo.webui.UICalendar.onTabOut(event)'");
- if(!isEditable())
+ if(isReadOnly())
{
w.write(" readonly ");
}
- if(hasHTMLAttribute())
- {
- renderHTMLAttribute(w);
- }
+
+ renderHTMLAttributes(w);
+
w.write("/>");
}
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormHiddenInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormHiddenInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormHiddenInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -56,21 +56,24 @@
public void processRender(WebuiRequestContext context) throws Exception
{
- Writer print = context.getWriter();
- print.write("<input name='");
- print.write(getName());
- print.write("' type='hidden'");
- print.write(" id='");
- print.write(getId());
- print.write("'");
+ Writer w = context.getWriter();
+ w.write("<input name='");
+ w.write(getName());
+ w.write("' type='hidden'");
+ w.write(" id='");
+ w.write(getId());
+ w.write("'");
String value = getValue();
if (value != null && value.length() > 0)
{
- print.write(" value='");
+ w.write(" value='");
value = HTMLEntityEncoder.getInstance().encodeHTMLAttribute(value);
- print.write(value);
- print.write("'");
+ w.write(value);
+ w.write("'");
}
- print.write(" />");
+
+ renderHTMLAttributes(w);
+
+ w.write(" />");
}
}
\ No newline at end of file
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-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -48,7 +48,10 @@
@Serialized
abstract public class UIFormInputBase<T> extends UIContainer implements
UIFormInput<T>
{
-
+ /**
+ * @deprecated According to deprecation of the {@link #setEditable(boolean)} and
{@link #setEnable(boolean)} methods
+ */
+ @Deprecated
final static public boolean ENABLE = true, DISABLE = false;
/**
@@ -87,9 +90,17 @@
protected Class<T> typeValue_;
/**
+ * @deprecated According to the deprecation of the {@link #setEnable(boolean)} method
+ *
* Whether this field is enabled
*/
+ @Deprecated
protected boolean enable_ = true;
+
+ /**
+ * Whether this field is disabled.
+ */
+ protected boolean disabled = false;
/**
* Whether this field is in read only mode
@@ -99,7 +110,7 @@
/**
* A map of HTML attribute
*/
- private Map<String, String> attribute;
+ private Map<String, String> attributes;
public UIFormInputBase(String name, String bindingField, Class<T> typeValue)
{
@@ -164,31 +175,101 @@
value_ = defaultValue_;
}
+ /**
+ * @deprecated Use {@link #isDisabled()} instead
+ * @return
+ */
+ @Deprecated
public boolean isEnable()
{
- return enable_;
+ return !isDisabled();
}
+ /**
+ * @deprecated Use {@link #setDisabled(boolean)} instead
+ *
+ * @param enable
+ * @return
+ */
+ @Deprecated
public UIFormInputBase<T> setEnable(boolean enable)
{
- enable_ = enable;
+ return setDisabled(!enable);
+ }
+
+ /**
+ * Return <code>true</code> if this input field is disabled.
+ * Otherwise, return <code>false</code>.
+ *
+ * @return True if this input field is disabled. Otherwise, return false.
+ */
+ public boolean isDisabled()
+ {
+ return disabled;
+ }
+
+ /**
+ * Specifies that this input field should be disabled OR NOT.
+ *
+ * @param disabled
+ * @return
+ */
+ public UIFormInputBase<T> setDisabled(boolean disabled)
+ {
+ this.disabled = disabled;
+ enable_ = !disabled; // for compatibility
return this;
}
+ /**
+ * @deprecated Use {@link #isReadOnly()} instead
+ *
+ * @return True if the input is read only. Otherwise, return false.
+ */
+ @Deprecated
public boolean isEditable()
{
- return !readonly_;
+ return !isReadOnly();
}
+ /**
+ * @deprecated Use {@link #setReadOnly(boolean)} instead
+ *
+ * @param editable
+ * @return
+ */
+ @Deprecated
public UIFormInputBase<T> setEditable(boolean editable)
{
- readonly_ = !editable;
+ return setReadOnly(!editable);
+ }
+
+ /**
+ * Return <code>true</code> if this input field is read only.
+ * Otherwise, return <code>false</code>.
+ *
+ * @return True if the input is read only. Otherwise, return false.
+ */
+ public boolean isReadOnly()
+ {
+ return readonly_;
+ }
+
+ /**
+ * Specifies that this input field should be read-only OR NOT.
+ *
+ * @param readonly
+ * @return
+ */
+ public UIFormInputBase<T> setReadOnly(boolean readonly)
+ {
+ readonly_ = readonly;
return this;
}
public boolean isValid()
{
- return (isRendered() && isEditable() && isEnable());
+ return (isRendered() && !isReadOnly() && !isDisabled());
}
public <E extends Validator> UIFormInputBase<T>
addValidator(Class<E> clazz, Object... params) throws Exception
@@ -250,42 +331,33 @@
public String getHTMLAttribute(String name)
{
- if (attribute != null)
+ if (attributes != null)
{
- return attribute.get(name);
+ return attributes.get(name);
}
return null;
}
public void setHTMLAttribute(String name, String value)
{
- if (attribute == null)
+ if (attributes == null)
{
- attribute = new HashMap<String, String>();
+ attributes = new HashMap<String, String>();
}
- attribute.put(name, value);
+ attributes.put(name, value);
}
- public boolean hasHTMLAttribute()
+ protected void renderHTMLAttributes(Writer w) throws IOException
{
- if(attribute == null)
+ if (attributes != null)
{
- return false;
- }
- return attribute.size() > 0 ;
- }
-
- protected void renderHTMLAttribute(Writer w) throws IOException
- {
- if (attribute != null)
- {
- w.write(" ");
- for (String name : attribute.keySet())
+ w.append(" ");
+ for (String name : attributes.keySet())
{
- String value =
HTMLEntityEncoder.getInstance().encodeHTMLAttribute(attribute.get(name));
- w.write(name + "=\"" + value + "\"");
+ String value =
HTMLEntityEncoder.getInstance().encodeHTMLAttribute(attributes.get(name));
+ w.append(name + "=\"" + value + "\"");
}
- w.write(" ");
+ w.append(" ");
}
}
}
\ No newline at end of file
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputSet.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -27,6 +27,7 @@
import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
+import org.exoplatform.webui.form.input.UICheckBoxInput;
import java.io.Writer;
import java.util.MissingResourceException;
@@ -105,6 +106,11 @@
return (UIFormCheckBoxInput)findComponentById(name);
}
+ public UICheckBoxInput getUICheckBoxInput(String name)
+ {
+ return (UICheckBoxInput)findComponentById(name);
+ }
+
public UIFormSelectBox getUIFormSelectBox(String name)
{
return (UIFormSelectBox)findComponentById(name);
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormMultiValueInputSet.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -220,8 +220,8 @@
UIFormInputBase uiInput = getChild(i);
writer.append("<div class=\"MultiValueContainer\">");
- uiInput.setEditable(!readonly_);
- uiInput.setEnable(enable_);
+ uiInput.setReadOnly(readonly_);
+ uiInput.setDisabled(!enable_);
uiInput.processRender(context);
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormRadioBoxInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -100,7 +100,7 @@
@SuppressWarnings("unused")
public void decode(Object input, WebuiRequestContext context) throws Exception
{
- if (!enable_)
+ if (isDisabled())
return;
if (input != null)
value_ = (String)input;
@@ -132,7 +132,7 @@
w.write("<input class='radio' type='radio'");
if (readonly_)
w.write(" readonly ");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
w.write(checked);
w.write(" name='");
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBox.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -170,8 +170,7 @@
@SuppressWarnings("deprecation")
public UIFormSelectBox setDisabled(boolean disabled)
{
- setEnable(!disabled);
- return this;
+ return (UIFormSelectBox)super.setDisabled(disabled);
}
@SuppressWarnings("unused")
@@ -239,9 +238,11 @@
if (size_ > 1)
w.write(" size=\"" + size_ + "\"");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
+ renderHTMLAttributes(w);
+
w.write(">\n");
for (SelectItemOption<String> item : options_)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormSelectBoxWithGroups.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -213,8 +213,7 @@
@SuppressWarnings("deprecation")
public UIFormSelectBoxWithGroups setDisabled(boolean disabled)
{
- setEnable(!disabled);
- return this;
+ return (UIFormSelectBoxWithGroups)super.setDisabled(disabled);
}
@SuppressWarnings("unused")
@@ -314,9 +313,11 @@
if (size_ > 1)
w.write(" size=\"" + size_ + "\"");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
+ renderHTMLAttributes(w);
+
w.write(">\n");
for (SelectItem item : options_)
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormStringInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -103,31 +103,31 @@
{
String value = getValue();
Writer w = context.getWriter();
- w.write("<input name='");
+ w.write("<input name=\"");
w.write(getName());
- w.write('\'');
+ w.write("\"");
if (type_ == PASSWORD_TYPE)
- w.write(" type='password'");
+ w.write(" type=\"password\"");
else
- w.write(" type='text'");
- w.write(" id='");
+ w.write(" type=\"text\"");
+ w.write(" id=\"");
w.write(getId());
- w.write('\'');
+ w.write("\"");
if (value != null && value.length() > 0)
{
value = HTMLEntityEncoder.getInstance().encodeHTMLAttribute(value);
- w.write(" value='");
+ w.write(" value=\"");
w.write(value);
- w.write('\'');
+ w.write("\"");
}
if (maxLength > 0)
- w.write(" maxlength='" + maxLength + "'");
+ w.write(" maxlength=\"" + maxLength + "\"");
if (readonly_)
w.write(" readonly ");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
- renderHTMLAttribute(w);
+ renderHTMLAttributes(w);
w.write("/>");
if (this.isMandatory())
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormTextAreaInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -63,13 +63,16 @@
String value = getValue();
if (value == null)
value = getDefaultValue();
- w.append("<textarea class='textarea'
name='").append(getName()).append("'
id='").append(getId()).append("'");
+ w.append("<textarea class=\"textarea\"
name=\"").append(getName()).append("\"
id=\"").append(getId()).append("\"");
if (readonly_)
w.write(" readonly ");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled ");
w.append("
rows=\"").append(String.valueOf(rows)).append("\"");
w.append("
cols=\"").append(String.valueOf(columns)).append("\"");
+
+ renderHTMLAttributes(w);
+
w.write(">");
if (value != null)
{
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/input/UICheckBoxInput.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -112,7 +112,7 @@
public void decode(Object input, WebuiRequestContext context) throws Exception
{
- if (!isEnable())
+ if (isDisabled())
return;
if (input == null || "false".equals(input.toString()))
@@ -128,9 +128,9 @@
public void processRender(WebuiRequestContext context) throws Exception
{
Writer w = context.getWriter();
- w.write("<input type='checkbox' name='");
+ w.write("<input type=\"checkbox\" class=\"checkbox\"
name=\"");
w.write(name);
- w.write("'");
+ w.write("\"");
if (onchange_ != null)
{
UIForm uiForm = getAncestorOfType(UIForm.class);
@@ -138,9 +138,12 @@
}
if (isChecked())
w.write(" checked");
- if (!enable_)
+ if (isDisabled())
w.write(" disabled");
- w.write(" class='checkbox'/>");
+
+ renderHTMLAttributes(w);
+
+ w.write("/>");
if (this.isMandatory())
w.write(" *");
}
Modified:
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java
===================================================================
---
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/eXo/src/main/java/org/exoplatform/webui/organization/UIAccountInputSet.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -90,7 +90,7 @@
if (user == null)
return;
invokeGetBindingField(user);
- getUIStringInput(USERNAME).setEditable(false);
+ getUIStringInput(USERNAME).setReadOnly(true);
}
public boolean save(OrganizationService service, boolean newUser) throws Exception
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/account/UIAccountProfiles.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/account/UIAccountProfiles.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/account/UIAccountProfiles.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -65,7 +65,7 @@
User useraccount = service.getUserHandler().findUserByName(username);
UIFormStringInput userName = new UIFormStringInput("userName",
"userName", username);
- userName.setEditable(false);
+ userName.setReadOnly(true);
addUIFormInput(userName.addValidator(MandatoryValidator.class).addValidator(StringLengthValidator.class,
3, 30)
.addValidator(ResourceValidator.class).addValidator(ExpressionValidator.class,
Utils.USER_NAME_VALIDATOR_REGEX,
"ResourceValidator.msg.Invalid-char"));
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/container/UIContainerForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -108,7 +108,7 @@
{
uiContainer_ = uiContainer;
Container container = (Container)PortalDataMapper.buildModelObject(uiContainer);
- getUIStringInput("id").setEditable(false);
+ getUIStringInput("id").setReadOnly(true);
invokeGetBindingBean(container);
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIChangePassword.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIChangePassword.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIChangePassword.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -61,7 +61,7 @@
public UIChangePassword() throws Exception
{
- addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setEditable(false));
+ addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setReadOnly(true));
addUIFormInput(new UIFormStringInput(PASSWORD, PASSWORD,
null).setType(UIFormStringInput.PASSWORD_TYPE)
.addValidator(MandatoryValidator.class));
addUIFormInput(((UIFormStringInput)new UIFormStringInput(NEW_PASSWORD,
NEW_PASSWORD, null)).setType(
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIResetPassword.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIResetPassword.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/login/UIResetPassword.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -62,7 +62,7 @@
public UIResetPassword() throws Exception
{
- addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setEditable(false));
+ addUIFormInput(new UIFormStringInput(USER_NAME, USER_NAME,
null).setReadOnly(true));
addUIFormInput(((UIFormStringInput)new UIFormStringInput(NEW_PASSWORD,
NEW_PASSWORD, null)).setType(
UIFormStringInput.PASSWORD_TYPE).addValidator(MandatoryValidator.class).addValidator(
StringLengthValidator.class, 6, 30));
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/navigation/UIPageNavigationForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -80,8 +80,8 @@
{
priorties.add(new SelectItemOption<String>(String.valueOf(i),
String.valueOf(i)));
}
- addUIFormInput(new UIFormStringInput("ownerType", "ownerType",
getOwnerType()).setEditable(false))
- .addUIFormInput(new UIFormStringInput("ownerId", "ownerId",
ownerId).setEditable(false)).addUIFormInput(
+ addUIFormInput(new UIFormStringInput("ownerType", "ownerType",
getOwnerType()).setReadOnly(true))
+ .addUIFormInput(new UIFormStringInput("ownerId", "ownerId",
ownerId).setReadOnly(true)).addUIFormInput(
new UIFormSelectBox("priority", null,
priorties).setValue(getPriority()));
}
@@ -91,7 +91,7 @@
invokeGetBindingBean(userNavigation);
removeChildById("ownerId");
UIFormStringInput ownerId = new UIFormStringInput("ownerId",
"ownerId", userNavigation.getKey().getName());
- ownerId.setEditable(false);
+ ownerId.setReadOnly(true);
ownerId.setParent(this);
getChildren().add(1, ownerId);
UIFormSelectBox uiSelectBox = findComponentById("priority");
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -199,7 +199,7 @@
UserACL acl = (UserACL)container.getComponentInstanceOfType(UserACL.class);
UIFormInputSet uiSettingSet = new UIFormInputSet("PageSetting");
- uiSettingSet.addUIFormInput(new UIFormStringInput("pageId",
"pageId", null).setEditable(false));
+ uiSettingSet.addUIFormInput(new UIFormStringInput("pageId",
"pageId", null).setReadOnly(true));
List<SelectItemOption<String>> ownerTypes = new
ArrayList<SelectItemOption<String>>();
if (pConfig != null && acl.hasEditPermission(pConfig))
@@ -213,7 +213,7 @@
uiSettingSet.addUIFormInput(uiSelectBoxOwnerType);
ownerIdInput = new UIFormStringInput(OWNER_ID, OWNER_ID, null);
- ownerIdInput.setEditable(false).setValue(pcontext.getRemoteUser());
+ ownerIdInput.setReadOnly(true).setValue(pcontext.getRemoteUser());
uiSettingSet.addUIFormInput(ownerIdInput);
uiSettingSet.addUIFormInput(
@@ -258,11 +258,11 @@
uiPage_ = uiPage;
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
invokeGetBindingBean(page);
- getUIStringInput("name").setEditable(false);
+ getUIStringInput("name").setReadOnly(true);
getUIStringInput("pageId").setValue(uiPage.getPageId());
getUIStringInput("title").setValue(uiPage.getTitle());
getUIFormCheckBoxInput("showMaxWindow").setValue(uiPage.isShowMaxWindow());
-
getUIFormSelectBox(OWNER_TYPE).setEnable(false).setValue(uiPage.getSiteKey().getTypeName());
+
getUIFormSelectBox(OWNER_TYPE).setDisabled(true).setValue(uiPage.getSiteKey().getTypeName());
}
}
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIWizardPageSetInfo.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -159,7 +159,7 @@
{
isEditMode = true;
UIFormStringInput uiNameInput = getChildById(PAGE_NAME);
- uiNameInput.setEditable(false);
+ uiNameInput.setReadOnly(true);
}
public boolean isEditMode()
@@ -181,9 +181,9 @@
{
UIFormStringInput nameTextBox = getUIStringInput(PAGE_NAME);
//this help to ignore name textbox
- nameTextBox.setEditable(false);
+ nameTextBox.setReadOnly(true);
super.invokeSetBindingBean(bean);
- nameTextBox.setEditable(true);
+ nameTextBox.setReadOnly(false);
UserNode node = (UserNode)bean;
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-11-02
04:50:37 UTC (rev 7922)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/portal/UIPortalForm.java 2011-11-02
04:56:04 UTC (rev 7923)
@@ -114,7 +114,7 @@
UIFormInputSet uiPortalSetting = this.<UIFormInputSet>
getChildById("PortalSetting");
UIFormStringInput uiNameInput = uiPortalSetting.getUIStringInput(FIELD_NAME);
- uiNameInput.setEditable(true);
+ uiNameInput.setReadOnly(false);
setSelectedTab(uiPortalSetting.getId());
@@ -235,7 +235,7 @@
UIFormInputSet uiPropertiesSet = new UIFormInputSet("Properties");
uiSettingSet.addUIFormInput(
new UIFormStringInput(FIELD_NAME, FIELD_NAME,
null).addValidator(MandatoryValidator.class).addValidator(
- StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class).setEditable(false));
+ StringLengthValidator.class, 3,
30).addValidator(IdentifierValidator.class).setReadOnly(true));
uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_LABEL, FIELD_LABEL,
null).addValidator(SpecialCharacterValidator.class));
uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_DESCRIPTION,
FIELD_DESCRIPTION, null));