Module: Muml_Property
- Defined in:
- lib/ontomde-uml2-struts/form.rb,
lib/ontomde-uml2-struts/jsp_edit.rb,
lib/ontomde-uml2-struts/validation.rb
Constant Summary collapse
- STRUTS_ENUM_AS_STRING =
true
Instance Method Summary collapse
- #nil_lvb(obj) ⇒ Object
- #struts_addActionFormAttribute!(form) ⇒ Object
-
#struts_addActionFormAttributeEnumeration!(form) ⇒ Object
Adds to the form class, a suggester operation corresponding to this attribute.
-
#struts_addActionFormAttributeReference!(form) ⇒ Object
suggester for a list of objects.
-
#struts_copyAsFormField!(form) ⇒ Object
adds a paginator field when cardinality >1.
-
#struts_edit_writeFieldProp(owner) ⇒ Object
writes java code for a property * labels * editing zones * security management * help zone.
-
#struts_edit_writeFieldPropCode(owner) ⇒ Object
writes java code for a property * labels * editing zones * help zone.
- #struts_edit_writeHelpMessage(owner) ⇒ Object
- #struts_edit_writeHelpToggle ⇒ Object
- #struts_edit_writeValidateErrorMessage ⇒ Object
- #struts_ignoreInForm?(ignoreDbId = true) ⇒ Boolean
- #struts_validation_writeField ⇒ Object
- #writeEnclose(before, after) ⇒ Object
Instance Method Details
#nil_lvb(obj) ⇒ Object
290 291 292 |
# File 'lib/ontomde-uml2-struts/form.rb', line 290 def nil_lvb(obj) return %{new #{STRUTS_LVB}("#{obj.java_qualifiedName}.#{NIL_LVB_RES_KEY}", "#{NIL_LVB_KEY}")} end |
#struts_addActionFormAttribute!(form) ⇒ Object
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/ontomde-uml2-struts/form.rb', line 270 def struts_addActionFormAttribute!(form) return if db_isTransient? return if uml_isStatic? if uml_type_one.kind_of?(Muml_Enumeration) struts_addActionFormAttributeEnumeration!(form) elsif uml_type_one.kind_of?(Muml_DataType) a2=struts_copyAsFormField!(form) #a2.uml_type=form.umlx_dataType_string tpl=JavaMapping.instance.getTemplate(uml_type_one) a2.uml_type=tpl.getFormType(form) else struts_addActionFormAttributeReference!(form) end #TODO: ajouter autres proprietes end |
#struts_addActionFormAttributeEnumeration!(form) ⇒ Object
Adds to the form class, a suggester operation corresponding to this attribute.
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/ontomde-uml2-struts/form.rb', line 297 def struts_addActionFormAttributeEnumeration!(form) return if uml_isReadOnly? a2=struts_copyAsFormField!(form) #a2.uml_type=form.umlx_dataType_integer a2.uml_type=form.umlx_dataType_string #a2.uml_type=form.umlx_getOrCreateClass("java.lang.Integer") sug=form.umlx_createAndAddOperation(form.rdf_uri+"_sug","get#{self.java_NameBean}Sug") ret=sug.umlx_createAndAddReturnParameter(sug.rdf_uri+"_return") ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}") ret.uml_upperValue=form.umlx_literal(-1) ret.uml_isOrdered=RDF_TRUE sug.java_code=%{ /* TPL:STRUTS 001 */ return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{self.uml_type_one.java_qualifiedName}.class,(#{self.uml_type_one.java_qualifiedName})null,getReference().get#{self.java_NameBean}Sug()); } end |
#struts_addActionFormAttributeReference!(form) ⇒ Object
suggester for a list of objects
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
# File 'lib/ontomde-uml2-struts/form.rb', line 316 def struts_addActionFormAttributeReference!(form) a2=struts_copyAsFormField!(form) a2.uml_type=form.umlx_dataType_string if ! uml_isReadOnly? sug=form.umlx_createAndAddOperation(form.rdf_uri+"_sug","get#{self.java_NameBean}Sug") ret=sug.umlx_createAndAddReturnParameter(sug.rdf_uri+"_return") ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}") ret.uml_upperValue=form.umlx_literal(-1) ret.uml_isOrdered=RDF_TRUE sug.java_code= <<ENDJAVA /* TPL:STRUTS 002 */ java.util.List<#{STRUTS_LVB}> ret=new java.util.ArrayList<#{STRUTS_LVB}>(); #{STRUTS_LVB} lvb=null; // // //#{self.umlx_manySide? ? "" : %{lvb=new #{STRUTS_LVB}("--","empty"); // //ret.add(lvb);} } // return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{self.uml_type_one.java_qualifiedName}.class,(#{self.uml_type_one.java_qualifiedName})null,getReference().get#{self.java_NameBean}Sug()); for (#{self.uml_type_one.java_qualifiedName} item : getReference().get#{self.java_NameBean}Sug()) { if(item!=null) { lvb=new #{STRUTS_LVB}("obj:"+item.getId(), Long.toString(item.getId())); } else { lvb=#{nil_lvb(self.uml_type_one)}; } ret.add(lvb); } return ret; ENDJAVA end if(umlx_isComposite?) m=java_createAndAddSuggester_one r=nil (m.uml_returnResult+m.uml_ownedParameter).each {|p| next unless p.uml_direction_one.isReturn? ; r=p.uml_type_one } sugC=form.umlx_createAndAddOperation(form.rdf_uri+"_sugC","#{m.java_Name}") ret=sugC.umlx_createAndAddReturnParameter("#{sugC.rdf_uri}_ret") ret.uml_type=form.umlx_getOrCreateClass("#{STRUTS_LVB}") ret.uml_upperValue=form.umlx_literal(-1) ret.uml_isOrdered=RDF_TRUE sugC.java_code=%{ /* TPL:STRUTS 001b */ return #{form.struts_getFormHelper.java_qualifiedName}.#{STRUTS_FORM_HELPER_ENUMTOLVB}(#{r.java_qualifiedName}.class,(#{r.java_qualifiedName})null,getReference().#{m.java_Name}(),true); } end end |
#struts_copyAsFormField!(form) ⇒ Object
adds a paginator field when cardinality >1
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/ontomde-uml2-struts/form.rb', line 252 def struts_copyAsFormField!(form) #log.debug { %{add form field #{self} to #{form}} } a2=form.umlx_createAndAddProperty(rdf_uri+"_ActionFormField") a2.uml_name=uml_name a2.uml_upperValue=uml_upperValue a2.uml_lowerValue=uml_lowerValue a2.java_use_Arrays=RDF_TRUE a2.struts_sourceProperty=self if ! umlx_upperValueIsOne? paginator=form.umlx_createAndAddProperty(rdf_uri+"_ActionFormField_page") paginator.uml_name=uml_name.to_s+"_strutsPage" paginator.uml_type=form.umlx_owner_one.umlx_dataType_integer a2.struts_paginatorProperty=paginator end return a2 end |
#struts_edit_writeFieldProp(owner) ⇒ Object
writes java code for a property
-
labels
-
editing zones
-
security management
-
help zone
750 751 752 753 754 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 750 def struts_edit_writeFieldProp(owner) write(%{<xmdas:SecureZoneTag name="#{owner.java_qualifiedName}.#{java_Name}">\n}) if context[:security] struts_edit_writeFieldPropCode(owner) write(%{</xmdas:SecureZoneTag>\n}) if context[:security] end |
#struts_edit_writeFieldPropCode(owner) ⇒ Object
writes java code for a property
-
labels
-
editing zones
-
help zone
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 760 def struts_edit_writeFieldPropCode(owner) write <<END <div class="row"> <span class="label"> #{struts_writeMsg("#{owner.java_qualifiedName}.#{java_Name}")} </span> END write %{<span class="formw"><table><tr><td>\n\n} struts_edit_writeHelpToggle write %{</td><td>\n\n} #Protected zone for edit area mtk_protected(Mrdf_Resource::NOREVERSE,"edit") { uml_type_one.struts_edit_writeField(self,owner) } write %{</td><td>\n\n} struts_edit_writeValidateErrorMessage write %{</td></tr></table>\n\n} write("</span>\n</div>") struts_edit_writeHelpMessage(owner) #write("</div>") end |
#struts_edit_writeHelpMessage(owner) ⇒ Object
799 800 801 802 803 804 805 806 807 808 809 810 811 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 799 def struts_edit_writeHelpMessage(owner) write %{ <div class="aidelongue" id='aide_#{java_Name}'> <span class="labelHelp"> <bean:message key="help.label"/> </span> <span class="contentHelp"> #{struts_writeMsg("#{owner.java_qualifiedName}.#{java_Name}.help")} </span> </div> } end |
#struts_edit_writeHelpToggle ⇒ Object
790 791 792 793 794 795 796 797 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 790 def struts_edit_writeHelpToggle if uml_ownedComment.empty? write %{<img src="#{css_path_model}/#{css_color_class}/image/vide.gif" width="25" height="25" border="0" alt="" />\n} else write %{<img src="#{css_path_model}/#{css_color_class}/image/btnHelp.gif" width="25" height="25" border="0" alt="help" onclick='togglehelp("#{java_Name}")' />\n} end end |
#struts_edit_writeValidateErrorMessage ⇒ Object
786 787 788 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 786 def struts_edit_writeValidateErrorMessage write %{<html:messages property="#{java_Name}" id="error"><bean:write name="error" /></html:messages>\n} end |
#struts_ignoreInForm?(ignoreDbId = true) ⇒ Boolean
233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/ontomde-uml2-struts/form.rb', line 233 def struts_ignoreInForm?(ignoreDbId=true) return true if uml_type_one.db_isTransient? && !uml_type_one.kind_of?(Muml_Enumeration) && !uml_type_one.kind_of?(Muml_DataType) return true if db_isTransient? return true if uml_isStatic? return true if java_ignoreMe? return true if ignoreDbId && uml_name_one=="id" return true if uml_name_one==Muml_Classifier::DB_OBJECT_VERSION_FIELD #return true if java_getter_property_inv.empty? #return true if java_setter_property_inv.empty? # a is a property added for compatibility return true unless umlx_stringMappingForEnum.empty? return false end |
#struts_validation_writeField ⇒ Object
59 60 61 |
# File 'lib/ontomde-uml2-struts/validation.rb', line 59 def struts_validation_writeField self.uml_type_one.struts_validation_writeField(self) end |
#writeEnclose(before, after) ⇒ Object
739 740 741 742 743 |
# File 'lib/ontomde-uml2-struts/jsp_edit.rb', line 739 def writeEnclose(before,after) write before yield write after end |