Class: JavaMappingGenericClass

Inherits:
JavaMapping show all
Defined in:
lib/ontomde-uml2-flex/Editor.mxml.rb,
lib/ontomde-uml2-flex/ValueObjectAS.rb,
lib/ontomde-uml2-flex/Editor.mxml.as.rb

Instance Method Summary collapse

Methods inherited from JavaMapping

#flex_writeMXML_MXvalidator

Instance Method Details

#flex_prefixObject



550
551
552
# File 'lib/ontomde-uml2-flex/Editor.mxml.rb', line 550

def flex_prefix
	return "cmb"
end

#flex_writeMXML_Form_item_property(prop) ⇒ Object

EXAMPLE: <mx:DataGrid height=“49” dataProvider=“JavaMappingGenericClass.modelmodel.adresse”> <mx:columns> <mx:DataGridColumn headerText=“Column 1” dataField=“ident”/> <mx:DataGridColumn headerText=“Column 2” dataField=“numero”/> <mx:DataGridColumn dataField=“ident” width=“30” headerText=“” editable=“false”> <mx:itemRenderer> <mx:Component > <mx:LinkButton label=“” click=“JavaMappingGenericClass.outerDocumentouterDocument.removeAndDeleteAdresse(dataouterDocument.removeAndDeleteAdresse(data.ident)”> </mx:LinkButton> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> <mx:DataGridColumn dataField=“ident” width=“30” headerText=“” editable=“false”> <mx:itemRenderer> <mx:Component > <mx:LinkButton label=“” click=“JavaMappingGenericClass.outerDocumentouterDocument.editAdresse(dataouterDocument.editAdresse(data.ident)” > </mx:LinkButton> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid> <mx:ComboBox id=“cmbAdresse” prompt=“Select one…” labelFunction=“myLabelFunction” dataProvider=“JavaMappingGenericClass.modelmodel.adressesSug” labelField=“value” change=“createAndAddAdresse(cmbAdresse.selectedItem.key)”> </mx:ComboBox>



587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
# File 'lib/ontomde-uml2-flex/Editor.mxml.rb', line 587

def flex_writeMXML_Form_item_property(prop)
	before= <<-END_BEFORE
<mx:HBox>
<mx:VBox>

#{ %{<mx:Button styleName="Add" width="32" height="32" click="{showSug(dg#{prop.java_NameBean},model.#{prop.java_Name}Sug,add#{prop.java_NameBean})}" buttonMode="true" useHandCursor="true" />
} if  !(prop.uml_isReadOnly?) && !(prop.umlx_isComposite?) }

#{ %{<mx:Button styleName="#{ prop.umlx_isComposite? ? "Delete" : "Remove" }" width="32" height="32" enabled="{dg#{prop.java_NameBean}.selectedItem}" click="removeAndDelete#{prop.java_NameBean}(dg#{prop.java_NameBean}.selectedItem.id)" buttonMode="true" useHandCursor="true" includeInLayout="{model.#{prop.java_Name}.length>0}" visible="{dg#{prop.java_NameBean}.visible}" />} if  !prop.uml_isReadOnly? }

<mx:Button styleName="Edit" width="32" height="32" enabled="{dg#{prop.java_NameBean}.selectedItem}" click="edit#{prop.java_NameBean}(dg#{prop.java_NameBean}.selectedItem.id)" includeInLayout="{model.#{prop.java_Name}.length>0}" buttonMode="true" useHandCursor="true" visible="{dg#{prop.java_NameBean}.visible}"/>
</mx:VBox>

<mx:VBox>
<components:AdvancedDatagrid id="dg#{prop.java_NameBean}" width="100%" horizontalScrollPolicy="auto" maxWidth="{this.width - dg#{prop.java_NameBean}.x -50}" dataProvider="{model.#{prop.java_Name}}" doubleClickEnabled="true" itemDoubleClick="edit#{prop.java_NameBean}(dg#{prop.java_NameBean}.selectedItem.id)" includeInLayout="{model.#{prop.java_Name}.length>0}" visible="{model.#{prop.java_Name}.length>0}">
<components:columns>
	END_BEFORE
	after= <<-END_AFTER
</components:columns>
</components:AdvancedDatagrid>
#{%{<mx:ComboBox id="#{flex_prefix}#{prop.java_NameBean}"
					prompt="Select one...(create)"
					labelFunction="myLabelFunction"
					dataProvider="{model.#{prop.java_Name}CreateAndAddSug}"
					labelField="value"
					change="createAndAdd#{prop.java_NameBean}(#{flex_prefix}#{prop.java_NameBean}.selectedItem.key)">
			</mx:ComboBox>} if !prop.uml_isReadOnly? && prop.umlx_isComposite?}
</mx:VBox>
</mx:HBox>
	END_AFTER

	prop.encloseWrite(before,after) {
		noId=true
		prop.uml_type_one.flex_ownedAttributeSet(noId).each { |pcol|
			tpl=JavaMapping.instance.getTemplate(pcol.uml_type_one)
			tpl.flex_writeMXML_Form_item_property_column(pcol)
		}
	}
end

#flex_writeMXML_Form_item_property_column(pcol) ⇒ Object

nop



693
694
695
# File 'lib/ontomde-uml2-flex/Editor.mxml.rb', line 693

def flex_writeMXML_Form_item_property_column(pcol)
	#nop
end

#flex_writeMXML_validate(prop) ⇒ Object



181
182
183
# File 'lib/ontomde-uml2-flex/Editor.mxml.as.rb', line 181

def flex_writeMXML_validate(prop)
	super
end

#flex_writeMXML_vo_mapping(prop) ⇒ Object

def flex_writeMXML_Form_item_property(prop)

before=“”

before=before+ <<-ENDHEAD <mx:DataGrid id=“dg#JavaMappingGenericClass.propprop.java_NameBean” dataProvider=“JavaMappingGenericClass.model.model.#{propmodel.#{prop.java_Name}”> <mx:columns> ENDHEAD after=“” after= prop.uml_isReadOnly? ? “” : <<-ENDBOTTOM <mx:DataGridColumn dataField=“id” width=“30” headerText=“” editable=“false”> <mx:itemRenderer> <mx:Component > <mx:LinkButton label=“” click=“JavaMappingGenericClass.outerDocumentouterDocument.removeAndDeleteouterDocument.removeAndDelete#{propouterDocument.removeAndDelete#{prop.java_NameBean(data.id)}”> </mx:LinkButton> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> ENDBOTTOM after=after + <<-ENDBOTTOM <mx:DataGridColumn dataField=“id” width=“30” headerText=“” editable=“false”> <mx:itemRenderer> <mx:Component > <mx:LinkButton label=“” click=“JavaMappingGenericClass.outerDocumentouterDocument.editouterDocument.edit#{propouterDocument.edit#{prop.java_NameBean(data.id)}” > </mx:LinkButton> </mx:Component> </mx:itemRenderer> </mx:DataGridColumn> </mx:columns> </mx:DataGrid> ENDBOTTOM

prop.encloseWrite(before,after) { noId=true prop.uml_type_one.flex_ownedAttributeSet(noId).each { |pcol| tpl=JavaMapping.instance.getTemplate(pcol.uml_type_one) tpl.flex_writeMXML_Form_item_property_column(pcol) } }

# si composition if prop.uml_isReadOnly? #nop elsif prop.umlx_isComposite? prop.write <<-END <mx:ComboBox id=“##flex_prefix#JavaMappingGenericClass.propprop.java_NameBean” prompt=“Select one…(create)” labelFunction=“myLabelFunction” dataProvider=“JavaMappingGenericClass.model.model.#{propmodel.#{prop.java_NameCreateAndAddSug}” labelField=“value” change=“createAndAdd#JavaMappingGenericClass.propprop.java_NameBean(##flex_prefix#JavaMappingGenericClass.propprop.java_NameBean.selectedItem.key)”> </mx:ComboBox> END else #prop.write <<-END # <mx:Button label=“+” click=“JavaMappingGenericClass.showSug(dgshowSug(dg#{propshowSug(dg#{prop.java_NameBean,model.#JavaMappingGenericClass.propprop.java_NameSug,add#JavaMappingGenericClass.propprop.java_NameBean)}” /> #END

end end



690
691
692
# File 'lib/ontomde-uml2-flex/Editor.mxml.rb', line 690

def flex_writeMXML_vo_mapping(prop)
	#nop
end

#flex_writeVO_getParameter(prop) ⇒ Object



310
311
312
# File 'lib/ontomde-uml2-flex/ValueObjectAS.rb', line 310

def flex_writeVO_getParameter(prop)
	prop.write("// #{prop.java_Name}\n")
end

#flex_writeVO_initFromXML_mapping(prop) ⇒ Object

EXAMPLES: For a composition:

adresseSug = DeserializeXMLUtil.getFormAttributeAssignable(source, 'adresse');
adresse = DeserializeXMLUtil.getFormAttributSelection(source, 'adresse', AdresseVO);

for an association:

adresse = DeserializeXMLUtil.getFormAttributSelection(source, 'adresse', AdresseVO);
favorisSug = DeserializeXMLUtil.getFormAttributSug(source, 'favoris', ContratVO);


321
322
323
324
325
326
327
328
329
# File 'lib/ontomde-uml2-flex/ValueObjectAS.rb', line 321

def flex_writeVO_initFromXML_mapping(prop)

	if(prop.umlx_isComposite?)
		prop.write("#{prop.java_Name}CreateAndAddSug = DeserializeXMLUtil.getFormAttributeAssignable(source, '#{prop.java_Name}');\n")
	else
		prop.write("#{prop.java_Name}Sug = DeserializeXMLUtil.getFormAttributSug(source, '#{prop.java_Name}',#{prop.uml_type_one.java_Name}VO);\n")
	end
	prop.write("#{prop.java_Name} = DeserializeXMLUtil.getFormAttributSelection(source, '#{prop.java_Name}', #{prop.uml_type_one.java_Name}VO);\n")
end

#flex_writeVO_initItemFromXML_mapping(prop) ⇒ Object



331
332
333
# File 'lib/ontomde-uml2-flex/ValueObjectAS.rb', line 331

def flex_writeVO_initItemFromXML_mapping(prop)
	#nop
end

#flex_writeVO_vars_datatype(prop) ⇒ Object

EXAMPLES: public var adresse:ArrayCollection; public var adressesSug:ArrayCollection; public var dernierContrat:ArrayCollection; public var dernierContratSug:ArrayCollection;



301
302
303
304
305
306
307
308
309
# File 'lib/ontomde-uml2-flex/ValueObjectAS.rb', line 301

def flex_writeVO_vars_datatype(prop)
	prop.write("public var #{prop.java_Name}:ArrayCollection;\n")
	if(prop.umlx_isComposite?)
		prop.write("public var #{prop.java_Name}CreateAndAddSug:ArrayCollection;\n")
		prop.write("public var #{prop.java_Name}Sug:ArrayCollection;\n")
	else
		prop.write("public var #{prop.java_Name}Sug:ArrayCollection;\n")
	end
end