From: Chad B. <cwb...@us...> - 2008-03-07 16:48:44
|
User: cwbrandon Date: 08/03/07 08:48:50 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms/crud Form.java.vsl SearchForm.java.vsl andromda-jsf2/src/main/resources/META-INF/andromda cartridge.xml andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Log: get rid of unneeded collection sorter (this was for the old myfaces tables) Revision Changes Path 1.5 +21 -40 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl Index: Form.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/Form.java.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- Form.java.vsl 2 Mar 2008 20:59:16 -0000 1.4 +++ Form.java.vsl 7 Mar 2008 16:48:49 -0000 1.5 @@ -121,24 +121,6 @@ */ public $fieldTypeName ${field.getterName}() { -#if ($field.type.collectionType || $field.type.arrayType) -#set ($upperCaseFieldName = $stringUtils.capitalize($field.name)) - if (this.$field.name != null) - { -#if ($field.type.arrayType) - this.$field.name = ($field.type.fullyQualifiedName)${managedBeansPackage}.CollectionSorter.sort( - java.util.Arrays.asList(this.$field.name), - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()).toArray(new ${field.type.fullyQualifiedName}{}); -#else - this.$field.name = ${managedBeansPackage}.CollectionSorter.sort( - this.$field.name, - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()); -#end - } - return this.$field.name; -#else #if ($field.complex) if (this.$field.name == null) { @@ -146,7 +128,6 @@ } #end return this.${field.name}; -#end } /** 1.4 +7 -20 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/SearchForm.java.vsl Index: SearchForm.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/crud/SearchForm.java.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- SearchForm.java.vsl 2 Mar 2008 20:59:16 -0000 1.3 +++ SearchForm.java.vsl 7 Mar 2008 16:48:49 -0000 1.4 @@ -33,26 +33,13 @@ public $fieldTypeName ${field.getterName}() { -#if ($field.type.collectionType || $field.type.arrayType) -#set ($upperCaseFieldName = $stringUtils.capitalize($field.name)) - if (this.$field.name != null) +#if ($field.complex) + if (this.$field.name == null) { -#if ($field.type.arrayType) - this.$field.name = ($field.type.fullyQualifiedName)${managedBeansPackage}.CollectionSorter.sort( - java.util.Arrays.asList(this.$field.name), - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()).toArray(new ${field.type.fullyQualifiedName}{}); -#else - this.$field.name = ${managedBeansPackage}.CollectionSorter.sort( - this.$field.name, - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()); -#end + this.$field.name = new ${field.type.fullyQualifiedName}(); } - return this.$field.name; -#else - return this.${field.name}; #end + return this.${field.name}; } public void ${field.setterName}($fieldTypeName $field.name) 1.13 +0 -6 cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- cartridge.xml 2 Mar 2008 20:59:17 -0000 1.12 +++ cartridge.xml 7 Mar 2008 16:48:49 -0000 1.13 @@ -464,12 +464,6 @@ overwrite="true"/> <template - path="templates/jsf2/utils/CollectionSorter.java.vsl" - outputPattern="$stringUtils.replace($managedBeansPackage, '.', '/')/${className}.java" - outlet="managed-beans" - overwrite="true"/> - - <template path="templates/jsf2/utils/AdfFacesContextWrapper.java.vsl" outputPattern="$stringUtils.replace($managedBeansPackage, '.', '/')/${className}.java" outlet="managed-beans" 1.2 +37 -87 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- FormImpl.java.vsl 5 Dec 2006 19:39:26 -0000 1.1 +++ FormImpl.java.vsl 7 Mar 2008 16:48:49 -0000 1.2 @@ -12,7 +12,7 @@ public ${action.formImplementationName}() { #foreach ($field in $action.formFields) -#if (!$field.complex || $field.type.enumeration) +#if (!$field.complex) #renderDateTimeFormatters($field "") #end #foreach ($attribute in $field.attributes) @@ -26,7 +26,9 @@ } #foreach ($field in $action.formFields) -#if ($field.type.collectionType) +#if ($field.pageableTable) +#set ($fieldTypeName = "javax.faces.model.DataModel") +#elseif ($field.type.collectionType) #set ($fieldTypeName = "java.util.List") #elseif ($field.type.fileType) #set ($fieldTypeName = "$fileTypeName") @@ -40,32 +42,13 @@ */ public $fieldTypeName ${field.getterName}() { -#if ($field.type.collectionType || $field.type.arrayType) -#set ($upperCaseFieldName = $stringUtils.capitalize($field.name)) - if (this.$field.name != null) - { -#if ($field.type.arrayType) - this.$field.name = ($field.type.fullyQualifiedName)${managedBeansPackage}.CollectionSorter.sort( - java.util.Arrays.asList(this.$field.name), - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()).toArray(new ${field.type.fullyQualifiedName}{}); -#else - this.$field.name = ${managedBeansPackage}.CollectionSorter.sort( - this.$field.name, - this.get${stringUtils.capitalize($field.tableSortColumnProperty)}(), - this.is${upperCaseFieldName}SortAscending()); -#end - } - return this.$field.name; -#else -#if ($field.complex && !$field.type.enumeration) +#if ($field.complex) if (this.$field.name == null) { this.$field.name = new ${field.type.fullyQualifiedName}(); } #end return this.${field.name}; -#end } /** @@ -93,69 +76,12 @@ this.$field.name = $field.name; this.$field.formAttributeSetProperty = true; } -#if ($field.type.collectionType || $field.type.arrayType) - - /** - * The name of the sort column for the {@link #${field.name}} collection. - */ - private String $field.tableSortColumnProperty; - - /** - * Gets the name of the sort column for the {@link #${field.name}} collection. - * - * @return the name of the sort column. - */ - public String get${stringUtils.capitalize($field.tableSortColumnProperty)}() - { - return this.$field.tableSortColumnProperty; - } - - /** - * Sets the name of the {@link #${field.name}} sort column. - * - * @param $field.tableSortColumnProperty the name of the column by which {@link #${field.name}} - * are sorted by. - */ - public void set${stringUtils.capitalize($field.tableSortColumnProperty)}(final String $field.tableSortColumnProperty) - { - this.$field.tableSortColumnProperty = $field.tableSortColumnProperty; - } - - /** - * The flag indicating whether or not {@link #${field.name}} should be sorted - * ascending. - */ - private boolean $field.tableSortAscendingProperty = false; - - /** - * Indicates whether or not {@link #${field.name}} should be sorted ascending - * or not. - * - * @return true/false - */ - public boolean is${stringUtils.capitalize($field.tableSortAscendingProperty)}() - { - return this.$field.tableSortAscendingProperty; - } - - /** - * Sets whether or not {@link #${field.name}} should be sorted ascending. - * - * @param $field.tableSortAscendingProperty true/false - */ - public void set${stringUtils.capitalize($field.tableSortAscendingProperty)}(final boolean $field.tableSortAscendingProperty) - { - this.$field.tableSortAscendingProperty = $field.tableSortAscendingProperty; - } -#end -#if ( (!$field.complex || $field.type.enumeration) && !$field.defaultValuePresent) +#if (!$field.complex && !$field.defaultValuePresent) #renderBackingListImplSupport($field "") #end -#if (!$field.type.enumeration) #foreach ($attribute in $field.attributes) #renderBackingListImplSupport($attribute $field) #end -#end #end #if ($action.formResetRequired) @@ -168,6 +94,12 @@ #foreach($field in $action.parameters) #if ($field.reset) this.$field.name = $field.type.javaNullString; +#elseif ($field.complex) +#foreach ($attribute in $field.type.getAttributes(true)) +#if ($attribute.reset) + this.${field.name}.${attribute.setterName}($attribute.type.javaNullString); +#end +#end #end #end } @@ -220,6 +152,24 @@ } /** + * Sets the current {@link javax.faces.application.FacesMessage} message + * instances stored within this form. + * + * @param messages a collection of the current Faces messages. + */ + public void set${stringUtils.capitalize($formMessagesProperty)}(final java.util.Collection messages) + { + if (messages != null) + { + for (final java.util.Iterator iterator = messages.iterator(); iterator.hasNext();) + { + javax.faces.application.FacesMessage jsfMessage = (javax.faces.application.FacesMessage)iterator.next(); + this.${formMessagesProperty}.put(jsfMessage.getDetail(), jsfMessage); + } + } + } + + /** * Clear the current {@link javax.faces.application.FacesMessage} message * instances stored within this form. * |
From: Chad B. <cwb...@us...> - 2008-04-03 22:26:20
|
User: cwbrandon Date: 08/04/03 15:26:26 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Log: more cleanup Revision Changes Path 1.3 +3 -1 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- FormImpl.java.vsl 7 Mar 2008 16:48:49 -0000 1.2 +++ FormImpl.java.vsl 3 Apr 2008 22:26:26 -0000 1.3 @@ -124,7 +124,9 @@ /** * The current collection of messages stored within this form. */ - private java.util.Map $formMessagesProperty = new java.util.LinkedHashMap(); + private java.util.Map<java.lang.String, javax.faces.application.FacesMessage> $formMessagesProperty = + new java.util.LinkedHashMap<java.lang.String, javax.faces.application.FacesMessage>(); + /** * Adds a {@link javax.faces.application.FacesMessage} message to the current messages |
From: Chad B. <cwb...@us...> - 2008-08-26 17:42:49
|
User: cwbrandon Date: 08/08/26 10:42:59 Modified: andromda-jsf2/src/main/resources/templates/jsf2/forms FormImpl.java.vsl Log: Add back code to always render backing lists for attributes (and add comment about why) Revision Changes Path 1.11 +3 -2 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl Index: FormImpl.java.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/forms/FormImpl.java.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- FormImpl.java.vsl 4 Aug 2008 16:58:10 -0000 1.10 +++ FormImpl.java.vsl 26 Aug 2008 17:42:59 -0000 1.11 @@ -82,11 +82,12 @@ #end #if (!$field.type.enumeration) #foreach ($attribute in $field.attributes) -#if ($attribute.isSelectable($field) || $attribute.type.enumeration || $attribute.isBackingValueRequired($field)) +## - Chad Brandon - we ALWAYS render the backing list for attributes in the form +## impl (because there are complex conditions where they might not show up and cause +## uncompilable code; if we always render, we don't need to figure out what they are) #renderBackingListImplSupport($attribute $field) #end #end -#end #end #if ($action.formResetRequired) |