Author: haint
Date: 2011-11-30 23:42:41 -0500 (Wed, 30 Nov 2011)
New Revision: 8176
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java
Log:
GTNPORTAL-2309 MandatoryValidator is not triggered when UIFormStringInput is readonly
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-12-01
04:04:52 UTC (rev 8175)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/navigation/webui/component/UIPageNodeForm.java 2011-12-01
04:42:41 UTC (rev 8176)
@@ -134,7 +134,7 @@
initLanguageSelectBox(uiFormLanguagesSelectBox);
uiFormLanguagesSelectBox.setOnChange(LANGUAGES_ONCHANGE);
- uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI",
null).setReadOnly(true))
+ uiSettingSet.addUIFormInput(new UIFormStringInput("URI", "URI",
null).setDisabled(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))
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-12-01
04:04:52 UTC (rev 8175)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/bean/ReflectionDataMapping.java 2011-12-01
04:42:41 UTC (rev 8176)
@@ -124,7 +124,7 @@
if (uiFormInput instanceof UIFormInputBase)
{
UIFormInputBase uiStringBase = (UIFormInputBase)uiFormInput;
- if (uiStringBase.isReadOnly())
+ if (uiStringBase.isReadOnly() || uiStringBase.isDisabled())
{
return;
}
Modified:
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java
===================================================================
---
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2011-12-01
04:04:52 UTC (rev 8175)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/core/lifecycle/UIFormLifecycle.java 2011-12-01
04:42:41 UTC (rev 8176)
@@ -42,13 +42,8 @@
public void processDecode(UIForm uicomponent, WebuiRequestContext context) throws
Exception
{
- // HttpServletRequest httpRequest = (HttpServletRequest)context.getRequest() ;
uicomponent.setSubmitAction(null);
- // if(ServletFileUpload.isMultipartContent(new
ServletRequestContext(httpRequest))) {
- // processMultipartRequest(uiForm, context) ;
- // } else {
processNormalRequest(uicomponent, context);
- // }
List<UIComponent> children = uicomponent.getChildren();
for (UIComponent uiChild : children)
{
@@ -101,20 +96,6 @@
List<UIComponent> children = uicomponent.getChildren();
validateChildren(children, uiApp, context);
- /*List<Validator> validators = uiForm.getValidators() ;
- if(validators != null) {
- try {
- for(Validator validator : validators) validator.validate(uiForm) ;
- } catch (MessageException ex) {
- uiApp.addMessage(ex.getDetailMessage()) ;
- context.setProcessRender(true) ;
- } catch(Exception ex) {
- //TODO: This is a critical exception and should be handle in the
UIApplication
- uiApp.addMessage(new ApplicationMessage(ex.toString(), null)) ;
- context.setProcessRender(true) ;
- }
- }*/
-
if (context.getProcessRender())
{
return;
@@ -142,33 +123,6 @@
}
}
- /*private void processMultipartRequest(UIForm uiForm, RequestContext context) throws
Exception {
- HttpServletRequest httpRequest = (HttpServletRequest)context.getRequest() ;
- ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory());
- List items = upload.parseRequest(httpRequest);
- Iterator iter = items.iterator();
- while (iter.hasNext()) {
- FileItem item = (FileItem) iter.next();
- String fieldName = item.getFieldName();
- if (item.isFormField()) { //Normal inputs
- String inputValue = item.getString() ;
- if (UIForm.ACTION.equals(fieldName)) {
- uiForm.setSubmitAction(inputValue) ;
- continue;
- } else if(UIFormTabPane.RENDER_TAB.equals(fieldName)){
- ((UIFormTabPane)uiForm).setRenderTabId(inputValue);
- continue;
- }
- UIFormInputBase input = uiForm.findComponentById(fieldName) ;
- if(input != null) input.decode(inputValue, context) ;
- continue;
- }
- UIFormInputBase input = uiForm.findComponentById(fieldName) ; // File input
- if(input != null) input.decode(item, context) ;
- }
-
- }*/
-
@SuppressWarnings("unchecked")
private void validateChildren(List<UIComponent> children, UIApplication uiApp,
WebuiRequestContext context)
{
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-12-01
04:04:52 UTC (rev 8175)
+++
portal/trunk/webui/core/src/main/java/org/exoplatform/webui/form/UIFormInputBase.java 2011-12-01
04:42:41 UTC (rev 8176)
@@ -269,7 +269,7 @@
public boolean isValid()
{
- return (isRendered() && !isReadOnly() && !isDisabled());
+ return (isRendered() && !isDisabled());
}
public <E extends Validator> UIFormInputBase<T>
addValidator(Class<E> clazz, Object... params) throws Exception
Show replies by date