Module: Muml_DataType
- Defined in:
- lib/ontomde-uml2-struts/jsp_edit.rb,
lib/ontomde-uml2-struts/validation.rb
Constant Summary collapse
- STRUTS_ERROR_STYLE =
error style used for form fields
%{errorStyle="background-color: yellow"}
Instance Method Summary collapse
- #java_isInteger? ⇒ Boolean
- #struts_edit_writeField(field, owner) ⇒ Object
- #struts_validation_writeField(field) ⇒ Object
Instance Method Details
#java_isInteger? ⇒ Boolean
65 66 67 68 |
# File 'lib/ontomde-uml2-struts/validation.rb', line 65 def java_isInteger? a=self return a.kind_of?(Muml_DataType) && (a.java_qualifiedName.downcase=="java.lang.Integer" || a.java_qualifiedName=="int") end |
#struts_edit_writeField(field, owner) ⇒ Object
466 467 468 469 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 466 def struts_edit_writeField(field,owner) tpl=JavaMapping.instance.getTemplate(self) write tpl.getJSP(self,field,owner) end |
#struts_validation_writeField(field) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ontomde-uml2-struts/validation.rb', line 69 def struts_validation_writeField(field) #return if self.kind_of?(Muml_Enumeration) re=JavaMapping.instance.getTemplate(field.uml_type_one).getValidationRegexp return if re.nil? #re=STRUTS_PRIMITIVE_TYPE_REGEXP[self.uml_name_one] #n=java_qualifiedName.downcase #n=n.gsub("_","") if "_".include?(n[0,1]) #if self.kind_of?(Muml_Enumeration) # # validation is not necessary #elsif !re.nil? write %{ <field property="#{field.java_Name}" depends="mask"> <arg key="defaultForm.string.displayname" /> <var><var-name>mask</var-name><var-value>#{re.source}</var-value></var> </field> } #elsif java_isInteger? # n="integer" # log.error("struts validator #{n} is not registered.") unless rdf_model.struts_validatorExists?(n) # write %{ # <field property="#{field.java_Name}" depends="required,#{n}"> # <arg key="defaultForm.#{n}.displayname" /> # </field> #} #else # log.warn{ "no validation for field: #{field}" } #end #if n=="long" #write %{ # <field property="#{field.java_Name}" depends="required,#{n}"> # <arg key="defaultForm.#{n}.displayname" /> # </field> #} # end end |