Re: [Rife-users] Rife-crud: not edible property also not visible
Geert, When a property is constrained with editable to false, it is not shown. But there are cases where it is needed to see such data even if it must not be changed. May I suggest a new constrain "visible" that will be false by default if editable is false. That constraint might be handy, but I wonder if another name wouldn't be better since properties are visible by default. I took a name that imo is unambiguous. But it's just a proposition. About default behavior, true by default. It seems to me that it's like with editable constraint: when no such constraint is specified, then a property is editable. It's only really needed when a property must not be editable. However, I don't agree with your implementation for EditTemplateTransformer in RIFE/ Crud, the editable and visible semantics aren't the same. If a property is editable, the form field should be shown, if it's not editable but visible, the current value of the field should be shown and not the form field. If I understand rightly the semantic above: - if editable at true (or unspecified): field is always shown , even if visible is at false - if editable at false: field is visible only if visible is specified at true (and then visible is false by default?) My proposition was: - if no visible constrain then see editable behavior (i.e. the actual behavior) - if visible at true: field is always shown and then it's possible to change the value only if editable is true or unspecified - if visible at false: field is not shown even if editable and then the isVisible test in place of the isEditable one in EditTemplateTransformer is coherent with this. The only difference between the two semantics is editable at true (or unspecified) and visible at false: - first one: field is shown - second one: field is not shown To set explicitly visble to false and editabled to true has no much meaning. But as soon as visible is at false, imo no fieldis expected to be shown, whatever editable value. And especialy if no editable constraint is specified. The rule is: visible > editable. This need to replace the editable test in Edit/Add/ DeleteTemplateTransformer.java of Rife-crud. A step further: when a value is non editable, to be able to give a first value, automatically or manually. I can't find a trace of this. This is done in: - Submission: a property is added to the parameter lists as soon as it is visible, even if not editable - ElementContext: as soon as a parameter not editable is without error, then it is removed from the Submission list. Could you also explain why you made changes related to the error reporting in FormBuilderXhtml? In the "manuelly" case, where a field is not editable but you want that a user enters the initial value, if there are other constraints, then as far as this initial value doesn't respect these constraint, the erroneous value must be shown to the user to be changed. So the "input" tag must not be desabled. Regards Pierre ___ Rife-users mailing list Rife-users@uwyn.com http://www.uwyn.com/mailman/listinfo/rife-users
Re: [Rife-users] Rife-crud: not edible property also not visible
Hi Pierre, When a property is constrained with editable to false, it is not shown. But there are cases where it is needed to see such data even if it must not be changed. May I suggest a new constrain "visible" that will be false by default if editable is false. That constraint might be handy, but I wonder if another name wouldn't be better since properties are visible by default. However, I don't agree with your implementation for EditTemplateTransformer in RIFE/ Crud, the editable and visible semantics aren't the same. If a property is editable, the form field should be shown, if it's not editable but visible, the current value of the field should be shown and not the form field. This need to replace the editable test in Edit/Add/ DeleteTemplateTransformer.java of Rife-crud. A step further: when a value is non editable, to be able to give a first value, automatically or manually. I can't find a trace of this. Could you also explain why you made changes related to the error reporting in FormBuilderXhtml? Also, please, respect the syntax formatting of the framework. I find several locations in your patch where nothing has been changed besides the source code formatting. Best regards, Geert -- Geert Bevin Uwyn bvba "Use what you need" Avenue de Scailmont 34 http://www.uwyn.com 7170 Manage, Belgium gbevin[remove] at uwyn dot comTel +32 64 84 80 03 PGP Fingerprint : 4E21 6399 CD9E A384 6619 719A C8F4 D40D 309F D6A9 Public PGP key : available at servers pgp.mit.edu, wwwkeys.pgp.net ___ Rife-users mailing list Rife-users@uwyn.com http://www.uwyn.com/mailman/listinfo/rife-users
[Rife-users] Rife-crud: not edible property also not visible
Geert, When a property is constrained with editable to false, it is not shown. But there are cases where it is needed to see such data even if it must not be changed. May I suggest a new constrain "visible" that will be false by default if editable is false. This need to replace the editable test in Edit/Add/DeleteTemplateTransformer.java of Rife-crud. A step further: when a value is non editable, to be able to give a first value, automatically or manually. Herewith proposition patches about this two points. Happy new year (with some hours in advance...) Pierre Index: C:/DEV/Rife/rife-svn/src/framework/com/uwyn/rife/engine/ElementContext.java === --- C:/DEV/Rife/rife-svn/src/framework/com/uwyn/rife/engine/ElementContext.java (revision 2808) +++ C:/DEV/Rife/rife-svn/src/framework/com/uwyn/rife/engine/ElementContext.java (working copy) @@ -7,24 +7,6 @@ */ package com.uwyn.rife.engine; -import com.uwyn.rife.engine.exceptions.*; -import com.uwyn.rife.template.*; -import com.uwyn.rife.tools.*; -import java.util.*; - -import com.uwyn.rife.authentication.credentialsmanagers.RoleUserAttributes; -import com.uwyn.rife.authentication.credentialsmanagers.RoleUserIdentity; -import com.uwyn.rife.authentication.elements.Identified; -import com.uwyn.rife.config.RifeConfig; -import com.uwyn.rife.engine.ContinuationContext; -import com.uwyn.rife.site.Constrained; -import com.uwyn.rife.site.ConstrainedProperty; -import com.uwyn.rife.site.ConstrainedUtils; -import com.uwyn.rife.site.FormBuilder; -import com.uwyn.rife.template.exceptions.TemplateException; -import com.uwyn.rife.tools.exceptions.BeanUtilsException; -import com.uwyn.rife.tools.exceptions.ConversionException; -import com.uwyn.rife.tools.exceptions.SerializationUtilsErrorException; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; @@ -34,12 +16,31 @@ import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.servlet.RequestDispatcher; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; +import com.uwyn.rife.authentication.credentialsmanagers.RoleUserAttributes; +import com.uwyn.rife.authentication.credentialsmanagers.RoleUserIdentity; +import com.uwyn.rife.authentication.elements.Identified; +import com.uwyn.rife.config.RifeConfig; +import com.uwyn.rife.engine.exceptions.*; +import com.uwyn.rife.i18n.Encoder; +import com.uwyn.rife.site.Constrained; +import com.uwyn.rife.site.ConstrainedProperty; +import com.uwyn.rife.site.ConstrainedUtils; +import com.uwyn.rife.site.FormBuilder; +import com.uwyn.rife.template.*; +import com.uwyn.rife.template.exceptions.TemplateException; +import com.uwyn.rife.tools.*; +import com.uwyn.rife.tools.exceptions.BeanUtilsException; +import com.uwyn.rife.tools.exceptions.ConversionException; +import com.uwyn.rife.tools.exceptions.SerializationUtilsErrorException; + public class ElementContext { public static final String PREFIX_EXIT_QUERY = "EXIT:QUERY:"; @@ -67,6 +68,7 @@ public static final String TAG_JANINO_ROLEUSER = "(?s)^("+PREFIX_JANINO_ROLEUSER+".*):\\s*\\[\\[\\s*(.*)\\s*\\]\\]\\s*$"; public static final String TAG_GROOVY_ROLEUSER = "(?s)^("+PREFIX_GROOVY_ROLEUSER+".*):\\s*\\[\\[\\s*(.*)\\s*\\]\\]\\s*$"; + protected final static String EMPTY_STRING = ""; //$NON-NLS-1$ private static ThreadLocal sActiveElements = new ThreadLocal(); private ElementSupport mElement = null; @@ -1090,14 +1092,14 @@ { return mOutputs; } - + Template getHtmlTemplate(String name, String encoding, TemplateTransformer transformer) throws TemplateException { if (null == name) throw new IllegalArgumentException("name can't be null."); if (0 == name.length()) throw new IllegalArgumentException("name can't be empty."); - return TemplateFactory.ENGINEHTML.get(name, encoding, transformer); + return mElement.getTemplate(TemplateFactory.ENGINEHTML, name, encoding, transformer); } Template getXhtmlTemplate(String name, String encoding, TemplateTransformer transformer) @@ -1106,7 +1108,7 @@ if (null == name) throw new IllegalArgumentException("name can't be null."); if (0 == name.length()) throw new IllegalArgumentException("name can't be empty."); - return TemplateFactory.ENGINEXHTML.get(name, encoding, transformer); +