ontomde-uml2-flex 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,5 @@
1
+ == 1.0.0 / 2007-10-29
2
+
3
+ * 1 major enhancement
4
+ * Birthday!
5
+
data/Manifest.txt ADDED
@@ -0,0 +1,12 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/ontomde-uml2-flex.rb
6
+ lib/ontomde-uml2-flex/version.rb
7
+ lib/ontomde-uml2-flex/Editor.mxml.as.rb
8
+ lib/ontomde-uml2-flex/ValueObjectAS.rb
9
+ lib/ontomde-uml2-flex/ImportationAS.rb
10
+ lib/ontomde-uml2-flex/main.rb
11
+ lib/ontomde-uml2-flex/Editor.mxml.rb
12
+ lib/ontomde-uml2-flex/fileTypes.rb
data/README.txt ADDED
@@ -0,0 +1,40 @@
1
+ ontomde-uml2-flex
2
+ by Stephane (Pierre) Carrie - Eric Goueffon
3
+ http://ontomde.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+ ontomde-uml2-flex is a FLEX generator with a J2EE/struts backend.
7
+
8
+ == FEATURES/PROBLEMS:
9
+
10
+ == SYNOPSIS:
11
+
12
+ == REQUIREMENTS:
13
+
14
+ * flex sdk must be downloaded from http://flex.org
15
+
16
+ == INSTALL:
17
+
18
+ * (unix) sudo gem install ontomde-uml2-flex
19
+ * (windows) sudo gem install ontomde-uml2-flex
20
+
21
+ Additional information is available on ontoMDE web site :
22
+ http://ontomde.rubyforge.org/website/download.html
23
+ == LICENSE:
24
+
25
+ Copyright (C) 2008 Orange-labs
26
+ 38 rue General Leclerc
27
+ 92130 ISSY LES MOULINEAUX, France
28
+
29
+ This program is free software: you can redistribute it and/or modify
30
+ it under the terms of the GNU Affero General Public License as
31
+ published by the Free Software Foundation, either version 3 of the
32
+ License, or (at your option) any later version.
33
+
34
+ This program is distributed in the hope that it will be useful,
35
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
36
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37
+ GNU Affero General Public License for more details.
38
+
39
+ You should have received a copy of the GNU Affero General Public License
40
+ along with this program. If not, see http://www.gnu.org/licenses/.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/ontomde-uml2-flex/version.rb'
6
+
7
+ Hoe.new('ontomde-uml2-flex', Ontomde::Uml2::Flex::VERSION) do |p|
8
+ p.rubyforge_name = 'ontomde'
9
+ p.author = 'Stephane (Pierre) Carrie'
10
+ p.email = 'stephanepierre.carrie@orange-ftgroup.com'
11
+ p.summary = 'OntoMDE Flex generator cartridge'
12
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
13
+ p.url="http://ontomde.rubyforge.org"
14
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
15
+ p.extra_deps=[
16
+ [ 'ontomde-uml2-struts', "= #{Ontomde::Uml2::Flex::VERSION}" ]
17
+ ]
18
+ p.spec_extras={ :required_ruby_version => '>=1.8.6' ,:required_rubygems_version => '>=1.0.0'}
19
+ end
20
+
21
+ # vim: syntax=Ruby
@@ -0,0 +1,184 @@
1
+ class Crdf_Resource
2
+ def flex_localizeMsg(msg)
3
+ #TODO
4
+ return("localized #{msg}")
5
+ end
6
+ end
7
+
8
+ module Muml_Class
9
+
10
+
11
+ def flex_mxml_as_generateAs
12
+ #flex_mxml_as_generateAs_jspHeader
13
+ flex_mxml_as_generateAs_commun
14
+ flex_mxml_as_generateAs_operations
15
+ flex_mxml_as_generateAs_edit_remove_add
16
+ flex_mxml_as_generateAs_validateForm
17
+ flex_mxml_as_generateAs_createAndAdd
18
+ end
19
+
20
+
21
+ def flex_mxml_as_generateAs_createAndAdd
22
+ flex_ownedAttributeSet.each { |a|
23
+ next unless a.umlx_isComposite?
24
+ #next if a.umlx_oneSide?
25
+ f="createAndAdd#{a.java_NameBean}"
26
+ write %{
27
+ public function #{f}(reqTypeParam:String):void {
28
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{f}";
29
+ this.#{STRUTS_REQUESTED_CREATION_TYPE_FIELD_NAME}=reqTypeParam;
30
+ submit();
31
+ }
32
+ }}
33
+ end
34
+
35
+ def flex_mxml_as_generateAs_validateForm
36
+ head=<<-ENDHEAD
37
+ public function validForm():Boolean{
38
+ ENDHEAD
39
+
40
+ foot=<<-ENDFOOT
41
+ return true;
42
+ }
43
+ ENDFOOT
44
+
45
+ encloseWrite(head,foot){ flex_ownedAttributeSet.each { |prop|
46
+ tpl=JavaMapping.instance.getTemplate(prop.uml_type_one)
47
+ tpl.flex_writeMXML_validate(prop)
48
+ }}
49
+
50
+ end
51
+
52
+ def flex_mxml_as_generateAs_operations
53
+ uml_ownedOperation.each {|biz|
54
+ next unless biz.umlx_businessMethod?
55
+ f=biz.java_Name
56
+ write <<-ENDMETH
57
+ public function #{f}() :void{
58
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{f}";
59
+ submit();
60
+ }
61
+ ENDMETH
62
+ }
63
+ end
64
+
65
+ def flex_mxml_as_generateAs_commun
66
+ #//TODO this.#{Muml_Class::STRUTS_REQUESTED_TAB}=model.id.toString();
67
+ write <<-END_SCRIPT
68
+ public function #{STRUTS_REFRESH_ACTION}() :void{
69
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{STRUTS_REFRESH_ACTION}";
70
+ submit();
71
+ }
72
+ public function #{STRUTS_RETURN_ACTION}() :void{
73
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{STRUTS_RETURN_ACTION}";
74
+ submit();
75
+ }
76
+ public function #{STRUTS_PROCEED_ACTION}() :void{
77
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{STRUTS_PROCEED_ACTION}";
78
+ submit();
79
+ }
80
+ END_SCRIPT
81
+ end
82
+
83
+ def flex_mxml_as_generateAs_edit_remove_add
84
+ flex_ownedAttributeSet.each { |a|
85
+ #next unless a.umlx_isComposite?
86
+ #next unless a.umlx_isAssociation?
87
+ #next if a.umlx_oneSide?
88
+ li=a.uml_isReadOnly? ? ["edit"] : ["edit","removeAndDelete"]
89
+ li.each {|meth|
90
+ f="#{meth}#{a.java_NameBean}"
91
+ write <<-END
92
+ public function #{f}(objidParam:String) :void{
93
+ if("_"+objidParam != "_empty") {
94
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{f}";
95
+ this.#{Muml_Class::STRUTS_REQUESTED_TAB}=objidParam;
96
+ submit();
97
+ } else {
98
+ ExtendedAlert.error("no element selected for \\n#{flex_localizeMsg("#{self.java_qualifiedName}.#{a.java_Name}")}");
99
+ }
100
+ }
101
+ END
102
+ }
103
+ li=a.uml_isReadOnly? ? [] : ["add"]
104
+ li.each {|meth|
105
+ f="#{meth}#{a.java_NameBean}"
106
+ write <<-END
107
+ public function #{f}(e:SuggestionAddedEvent) :void{
108
+ if("_"+e.idToAdd != "_empty") {
109
+ this.#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}="#{f}";
110
+ this.#{Muml_Class::STRUTS_REQUESTED_TAB}=e.idToAdd;
111
+ submit();
112
+ } else {
113
+ ExtendedAlert.error("no element selected for \\n#{flex_localizeMsg("#{self.java_qualifiedName}.#{a.java_Name}")}");
114
+ }
115
+ }
116
+ END
117
+ }
118
+ }
119
+ end
120
+
121
+ end #module
122
+
123
+
124
+ class JavaMapping
125
+ def flex_writeMXML_validate(prop)
126
+ prop.write("//#{prop.java_Name}")
127
+ prop.write(" mapping=#{self.class}")
128
+ prop.write(" maxStringLength=#{self.maxStringLength}")
129
+ re=self.getValidationRegexp
130
+ prop.write(%{ regexp=#{re.nil? ? "nil" : re.source}})
131
+ prop.write("\n")
132
+ end
133
+ def flex_writeMXML_MXvalidator(prop)
134
+ #nop
135
+ end
136
+ end
137
+ class JavaMappingText < JavaMapping
138
+ # Example
139
+ # <mx:RegExpValidator source={le nom du control � valider} property="text" required="true/false pour obligatoire ou pas" expression="l'expression reguliere"/>
140
+ #<mx:StringValidator source="{txtNom}" property="text" required="false"/>
141
+ def flex_writeMXML_MXvalidator(prop)
142
+ re=getValidationRegexp
143
+ validator= re.nil? ? "StringValidator" : "RegExpValidator"
144
+ prop.encloseWrite(" <mx:#{validator}","/>\n") {
145
+ prop.write(%{ source="{#{flex_prefix}#{prop.java_NameBean}}"})
146
+ prop.write(%{ property="text"})
147
+ prop.write(%{ required="#{prop.umlx_lowerValueIsZero? ? "false":"true"}"})
148
+ prop.write(%{ expression="#{re.source}"}) unless re.nil?
149
+ }
150
+ end
151
+ end
152
+ class JavaMappingOrdinal < JavaMappingText
153
+ def flex_writeMXML_MXvalidator(prop)
154
+ #nop
155
+ end
156
+ def flex_writeMXML_validate(prop)
157
+ super
158
+ end
159
+ end
160
+ class JavaMappingTimeStamp < JavaMapping
161
+ def flex_writeMXML_validate(prop)
162
+ super
163
+ end
164
+ end
165
+ class JavaMappingCalendar < JavaMapping
166
+ def flex_writeMXML_validate(prop)
167
+ super
168
+ end
169
+ end
170
+ class JavaMappingGenericEnum < JavaMapping
171
+ def flex_writeMXML_validate(prop)
172
+ super
173
+ end
174
+ end
175
+ class JavaMappingBoolean < JavaMapping
176
+ def flex_writeMXML_validate(prop)
177
+ super
178
+ end
179
+ end
180
+ class JavaMappingGenericClass < JavaMapping
181
+ def flex_writeMXML_validate(prop)
182
+ super
183
+ end
184
+ end