Datei: NDOPackage/RelationDialog.cs
Last Commit (e424d5f)
1 | // |
2 | // Copyright (c) 2002-2022 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Drawing; |
25 | using System. Collections; |
26 | using System.ComponentModel; |
27 | using System.Windows.Forms; |
28 | |
29 | namespace NDOVsPackage |
30 | { |
31 | ····internal enum ListType |
32 | ····{ |
33 | ········IList, |
34 | ········ArrayList |
35 | ····} |
36 | |
37 | ····/// <summary> |
38 | ····/// Zusammenfassung für RelationDialog. |
39 | ····/// </summary> |
40 | ····internal class RelationDialog : System.Windows.Forms.Form |
41 | ····{ |
42 | ········private System.Windows.Forms.TextBox txtFieldName; |
43 | ········private System.Windows.Forms.Label label1; |
44 | ········private System.Windows.Forms.GroupBox groupBox1; |
45 | ········private System.Windows.Forms.RadioButton radioSingle; |
46 | ········private System.Windows.Forms.RadioButton radioList; |
47 | ········private System.Windows.Forms.GroupBox groupBox2; |
48 | ········private System.Windows.Forms.RadioButton radioComposite; |
49 | ········private System.Windows.Forms.RadioButton radioAggregate; |
50 | ········private System.Windows.Forms.Button btnOK; |
51 | ········private System.Windows.Forms.Button btnCancel; |
52 | ········private System.Windows.Forms.TextBox txtElementType; |
53 | ········private System.Windows.Forms.Label label2; |
54 | ········private System.Windows.Forms.ToolTip toolTip1; |
55 | ········private System.Windows.Forms.TextBox txtRoleName; |
56 | ········private System.Windows.Forms.Label label3; |
57 | ········private System.Windows.Forms.GroupBox groupBox3; |
58 | ········private System.Windows.Forms.RadioButton radioArrayList; |
59 | ········private System.Windows.Forms.RadioButton radioIList; |
60 | ········private System.Windows.Forms.CheckBox chkUseGenerics; |
61 | ········private System.ComponentModel.IContainer components; |
62 | |
63 | ········public RelationDialog() |
64 | ········{ |
65 | ············// |
66 | ············// Erforderlich für die Windows Form-Designerunterstützung |
67 | ············// |
68 | ············InitializeComponent(); |
69 | ············this.chkUseGenerics.Checked = true; |
70 | |
71 | ············if (Screen.FromControl( this ).Bounds.Width >= 2600) |
72 | ················Font = new Font( "Segoe UI", 11f, FontStyle.Regular, GraphicsUnit.Point, 0 ); |
73 | ········} |
74 | |
75 | ········public string FieldName |
76 | ········{ |
77 | ············get { return this.txtFieldName.Text; } |
78 | ········} |
79 | |
80 | ········public string Type |
81 | ········{ |
82 | ············get { return this.txtElementType.Text; } |
83 | ········} |
84 | |
85 | ········public bool Composite |
86 | ········{ |
87 | ············get { return this.radioComposite.Checked; } |
88 | ········} |
89 | |
90 | ········public bool List |
91 | ········{ |
92 | ············get { return this.radioList.Checked; } |
93 | ········} |
94 | |
95 | ········public string RelationName |
96 | ········{ |
97 | ············get { return this.txtRoleName.Text; } |
98 | ········} |
99 | |
100 | ········public ListType ListType |
101 | ········{ |
102 | ············get |
103 | ············{ |
104 | ················if (radioIList.Checked) |
105 | ····················return ListType.IList; |
106 | ················return ListType.ArrayList; |
107 | ············} |
108 | ········} |
109 | |
110 | ········public bool UseGenerics |
111 | ········{ |
112 | ············get { return this.chkUseGenerics.Checked; } |
113 | ········} |
114 | |
115 | |
116 | ········/// <summary> |
117 | ········/// Die verwendeten Ressourcen bereinigen. |
118 | ········/// </summary> |
119 | ········protected override void Dispose( bool disposing ) |
120 | ········{ |
121 | ············if( disposing ) |
122 | ············{ |
123 | ················if(components != null) |
124 | ················{ |
125 | ····················components.Dispose(); |
126 | ················} |
127 | ············} |
128 | ············base.Dispose( disposing ); |
129 | ········} |
130 | |
131 | ········#region Vom Windows Form-Designer generierter Code |
132 | ········/// <summary> |
133 | ········/// Erforderliche Methode für die Designerunterstützung. |
134 | ········/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. |
135 | ········/// </summary> |
136 | ········private void InitializeComponent() |
137 | ········{ |
138 | ············this.components = new System.ComponentModel.Container(); |
139 | ············System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RelationDialog)); |
140 | ············this.txtFieldName = new System.Windows.Forms.TextBox(); |
141 | ············this.label1 = new System.Windows.Forms.Label(); |
142 | ············this.groupBox1 = new System.Windows.Forms.GroupBox(); |
143 | ············this.radioList = new System.Windows.Forms.RadioButton(); |
144 | ············this.radioSingle = new System.Windows.Forms.RadioButton(); |
145 | ············this.groupBox2 = new System.Windows.Forms.GroupBox(); |
146 | ············this.radioAggregate = new System.Windows.Forms.RadioButton(); |
147 | ············this.radioComposite = new System.Windows.Forms.RadioButton(); |
148 | ············this.btnOK = new System.Windows.Forms.Button(); |
149 | ············this.btnCancel = new System.Windows.Forms.Button(); |
150 | ············this.txtElementType = new System.Windows.Forms.TextBox(); |
151 | ············this.label2 = new System.Windows.Forms.Label(); |
152 | ············this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); |
153 | ············this.txtRoleName = new System.Windows.Forms.TextBox(); |
154 | ············this.radioArrayList = new System.Windows.Forms.RadioButton(); |
155 | ············this.radioIList = new System.Windows.Forms.RadioButton(); |
156 | ············this.label3 = new System.Windows.Forms.Label(); |
157 | ············this.groupBox3 = new System.Windows.Forms.GroupBox(); |
158 | ············this.chkUseGenerics = new System.Windows.Forms.CheckBox(); |
159 | ············this.groupBox1.SuspendLayout(); |
160 | ············this.groupBox2.SuspendLayout(); |
161 | ············this.groupBox3.SuspendLayout(); |
162 | ············this.SuspendLayout(); |
163 | ············// |
164 | ············// txtFieldName |
165 | ············// |
166 | ············this.txtFieldName.Location = new System.Drawing.Point(137, 59); |
167 | ············this.txtFieldName.Name = "txtFieldName"; |
168 | ············this.txtFieldName.Size = new System.Drawing.Size(267, 20); |
169 | ············this.txtFieldName.TabIndex = 1; |
170 | ············this.toolTip1.SetToolTip(this.txtFieldName, "Name of the variable in which the relation is stored"); |
171 | ············this.txtFieldName.TextChanged += new System.EventHandler(this.txtFieldName_TextChanged); |
172 | ············// |
173 | ············// label1 |
174 | ············// |
175 | ············this.label1.Location = new System.Drawing.Point(44, 59); |
176 | ············this.label1.Name = "label1"; |
177 | ············this.label1.Size = new System.Drawing.Size(80, 20); |
178 | ············this.label1.TabIndex = 15; |
179 | ············this.label1.Text = "Field Name"; |
180 | ············// |
181 | ············// groupBox1 |
182 | ············// |
183 | ············this.groupBox1.Controls.Add(this.radioList); |
184 | ············this.groupBox1.Controls.Add(this.radioSingle); |
185 | ············this.groupBox1.Location = new System.Drawing.Point(230, 128); |
186 | ············this.groupBox1.Name = "groupBox1"; |
187 | ············this.groupBox1.Size = new System.Drawing.Size(174, 90); |
188 | ············this.groupBox1.TabIndex = 4; |
189 | ············this.groupBox1.TabStop = false; |
190 | ············this.groupBox1.Text = " Multiplicity "; |
191 | ············// |
192 | ············// radioList |
193 | ············// |
194 | ············this.radioList.Checked = true; |
195 | ············this.radioList.Location = new System.Drawing.Point(37, 60); |
196 | ············this.radioList.Name = "radioList"; |
197 | ············this.radioList.Size = new System.Drawing.Size(120, 28); |
198 | ············this.radioList.TabIndex = 1; |
199 | ············this.radioList.TabStop = true; |
200 | ············this.radioList.Text = "List"; |
201 | ············this.toolTip1.SetToolTip(this.radioList, "Relation to a list of objects"); |
202 | ············// |
203 | ············// radioSingle |
204 | ············// |
205 | ············this.radioSingle.Location = new System.Drawing.Point(37, 35); |
206 | ············this.radioSingle.Name = "radioSingle"; |
207 | ············this.radioSingle.Size = new System.Drawing.Size(120, 21); |
208 | ············this.radioSingle.TabIndex = 0; |
209 | ············this.radioSingle.Text = "Single Element"; |
210 | ············this.toolTip1.SetToolTip(this.radioSingle, "Relation to one single object"); |
211 | ············this.radioSingle.CheckedChanged += new System.EventHandler(this.radioSingle_CheckedChanged); |
212 | ············// |
213 | ············// groupBox2 |
214 | ············// |
215 | ············this.groupBox2.Controls.Add(this.radioAggregate); |
216 | ············this.groupBox2.Controls.Add(this.radioComposite); |
217 | ············this.groupBox2.Location = new System.Drawing.Point(44, 128); |
218 | ············this.groupBox2.Name = "groupBox2"; |
219 | ············this.groupBox2.Size = new System.Drawing.Size(173, 90); |
220 | ············this.groupBox2.TabIndex = 3; |
221 | ············this.groupBox2.TabStop = false; |
222 | ············this.groupBox2.Text = " Relation Type··"; |
223 | ············// |
224 | ············// radioAggregate |
225 | ············// |
226 | ············this.radioAggregate.Location = new System.Drawing.Point(30, 60); |
227 | ············this.radioAggregate.Name = "radioAggregate"; |
228 | ············this.radioAggregate.Size = new System.Drawing.Size(127, 21); |
229 | ············this.radioAggregate.TabIndex = 1; |
230 | ············this.radioAggregate.Text = "Assoziation"; |
231 | ············this.toolTip1.SetToolTip(this.radioAggregate, "Relation contains independent objects with own life-cycles"); |
232 | ············// |
233 | ············// radioComposite |
234 | ············// |
235 | ············this.radioComposite.Checked = true; |
236 | ············this.radioComposite.Location = new System.Drawing.Point(30, 35); |
237 | ············this.radioComposite.Name = "radioComposite"; |
238 | ············this.radioComposite.Size = new System.Drawing.Size(127, 21); |
239 | ············this.radioComposite.TabIndex = 0; |
240 | ············this.radioComposite.TabStop = true; |
241 | ············this.radioComposite.Text = "Composition"; |
242 | ············this.toolTip1.SetToolTip(this.radioComposite, "Life-cycle of the related objects are coupled to the lifetime of the owner"); |
243 | ············// |
244 | ············// btnOK |
245 | ············// |
246 | ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; |
247 | ············this.btnOK.Enabled = false; |
248 | ············this.btnOK.Location = new System.Drawing.Point(297, 343); |
249 | ············this.btnOK.Name = "btnOK"; |
250 | ············this.btnOK.Size = new System.Drawing.Size(107, 28); |
251 | ············this.btnOK.TabIndex = 7; |
252 | ············this.btnOK.Text = "OK"; |
253 | ············// |
254 | ············// btnCancel |
255 | ············// |
256 | ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
257 | ············this.btnCancel.Location = new System.Drawing.Point(177, 343); |
258 | ············this.btnCancel.Name = "btnCancel"; |
259 | ············this.btnCancel.Size = new System.Drawing.Size(107, 28); |
260 | ············this.btnCancel.TabIndex = 6; |
261 | ············this.btnCancel.Text = "Cancel"; |
262 | ············// |
263 | ············// txtElementType |
264 | ············// |
265 | ············this.txtElementType.Location = new System.Drawing.Point(137, 24); |
266 | ············this.txtElementType.Name = "txtElementType"; |
267 | ············this.txtElementType.Size = new System.Drawing.Size(267, 20); |
268 | ············this.txtElementType.TabIndex = 0; |
269 | ············this.toolTip1.SetToolTip(this.txtElementType, "Type of the related objects"); |
270 | ············this.txtElementType.TextChanged += new System.EventHandler(this.txtElementType_TextChanged); |
271 | ············// |
272 | ············// label2 |
273 | ············// |
274 | ············this.label2.Location = new System.Drawing.Point(44, 24); |
275 | ············this.label2.Name = "label2"; |
276 | ············this.label2.Size = new System.Drawing.Size(80, 21); |
277 | ············this.label2.TabIndex = 8; |
278 | ············this.label2.Text = "Element Type"; |
279 | ············// |
280 | ············// txtRoleName |
281 | ············// |
282 | ············this.txtRoleName.Location = new System.Drawing.Point(137, 93); |
283 | ············this.txtRoleName.Name = "txtRoleName"; |
284 | ············this.txtRoleName.Size = new System.Drawing.Size(267, 20); |
285 | ············this.txtRoleName.TabIndex = 2; |
286 | ············this.toolTip1.SetToolTip(this.txtRoleName, "Name of the variable in which the relation is stored"); |
287 | ············// |
288 | ············// radioArrayList |
289 | ············// |
290 | ············this.radioArrayList.Checked = true; |
291 | ············this.radioArrayList.Location = new System.Drawing.Point(30, 60); |
292 | ············this.radioArrayList.Name = "radioArrayList"; |
293 | ············this.radioArrayList.Size = new System.Drawing.Size(127, 21); |
294 | ············this.radioArrayList.TabIndex = 1; |
295 | ············this.radioArrayList.TabStop = true; |
296 | ············this.radioArrayList.Text = "List<T>"; |
297 | ············this.toolTip1.SetToolTip(this.radioArrayList, "Relation contains independent objects with own life-cycles"); |
298 | ············// |
299 | ············// radioIList |
300 | ············// |
301 | ············this.radioIList.Location = new System.Drawing.Point(30, 35); |
302 | ············this.radioIList.Name = "radioIList"; |
303 | ············this.radioIList.Size = new System.Drawing.Size(127, 21); |
304 | ············this.radioIList.TabIndex = 0; |
305 | ············this.radioIList.Text = "IList<T>"; |
306 | ············this.toolTip1.SetToolTip(this.radioIList, "Life-cycle of the related objects are coupled to the lifetime of the owner"); |
307 | ············// |
308 | ············// label3 |
309 | ············// |
310 | ············this.label3.Location = new System.Drawing.Point(43, 91); |
311 | ············this.label3.Name = "label3"; |
312 | ············this.label3.Size = new System.Drawing.Size(86, 28); |
313 | ············this.label3.TabIndex = 15; |
314 | ············this.label3.Text = "Optional Role Name"; |
315 | ············// |
316 | ············// groupBox3 |
317 | ············// |
318 | ············this.groupBox3.Controls.Add(this.chkUseGenerics); |
319 | ············this.groupBox3.Controls.Add(this.radioArrayList); |
320 | ············this.groupBox3.Controls.Add(this.radioIList); |
321 | ············this.groupBox3.Location = new System.Drawing.Point(44, 225); |
322 | ············this.groupBox3.Name = "groupBox3"; |
323 | ············this.groupBox3.Size = new System.Drawing.Size(360, 91); |
324 | ············this.groupBox3.TabIndex = 5; |
325 | ············this.groupBox3.TabStop = false; |
326 | ············this.groupBox3.Text = " Coding Style··"; |
327 | ············// |
328 | ············// chkUseGenerics |
329 | ············// |
330 | ············this.chkUseGenerics.Checked = true; |
331 | ············this.chkUseGenerics.CheckState = System.Windows.Forms.CheckState.Checked; |
332 | ············this.chkUseGenerics.Location = new System.Drawing.Point(204, 35); |
333 | ············this.chkUseGenerics.Name = "chkUseGenerics"; |
334 | ············this.chkUseGenerics.Size = new System.Drawing.Size(160, 21); |
335 | ············this.chkUseGenerics.TabIndex = 3; |
336 | ············this.chkUseGenerics.Text = "Use Generics"; |
337 | ············this.chkUseGenerics.CheckedChanged += new System.EventHandler(this.chkUseGenerics_CheckedChanged); |
338 | ············// |
339 | ············// RelationDialog |
340 | ············// |
341 | ············this.AcceptButton = this.btnOK; |
342 | ············this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
343 | ············this.AutoScaleMode = AutoScaleMode.Font; |
344 | ············this.CancelButton = this.btnCancel; |
345 | ············this.ClientSize = new System.Drawing.Size(448, 403); |
346 | ············this.Controls.Add(this.groupBox3); |
347 | ············this.Controls.Add(this.txtRoleName); |
348 | ············this.Controls.Add(this.label3); |
349 | ············this.Controls.Add(this.label2); |
350 | ············this.Controls.Add(this.txtElementType); |
351 | ············this.Controls.Add(this.txtFieldName); |
352 | ············this.Controls.Add(this.btnCancel); |
353 | ············this.Controls.Add(this.btnOK); |
354 | ············this.Controls.Add(this.groupBox2); |
355 | ············this.Controls.Add(this.groupBox1); |
356 | ············this.Controls.Add(this.label1); |
357 | ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
358 | ············this.Name = "RelationDialog"; |
359 | ············this.Text = "Add Relation"; |
360 | ············this.groupBox1.ResumeLayout(false); |
361 | ············this.groupBox2.ResumeLayout(false); |
362 | ············this.groupBox3.ResumeLayout(false); |
363 | ············this.ResumeLayout(false); |
364 | ············this.PerformLayout(); |
365 | |
366 | ········} |
367 | ········#endregion |
368 | |
369 | ········private void txtElementType_TextChanged(object sender, System.EventArgs e) |
370 | ········{ |
371 | ············this.btnOK.Enabled = (txtElementType.Text.Trim() != "" && txtFieldName.Text.Trim() != ""); |
372 | ········} |
373 | |
374 | ········private void txtFieldName_TextChanged(object sender, System.EventArgs e) |
375 | ········{ |
376 | ············this.btnOK.Enabled = (txtElementType.Text.Trim() != "" && txtFieldName.Text.Trim() != ""); |
377 | ········} |
378 | |
379 | ········private void radioSingle_CheckedChanged(object sender, System.EventArgs e) |
380 | ········{ |
381 | ············this.chkUseGenerics.Enabled = |
382 | ················this.radioArrayList.Enabled = |
383 | ················this.radioIList.Enabled = !radioSingle.Checked; |
384 | ········} |
385 | |
386 | ········private void chkUseGenerics_CheckedChanged(object sender, EventArgs e) |
387 | ········{ |
388 | ············if (chkUseGenerics.Checked) |
389 | ············{ |
390 | ················radioArrayList.Text = "List<T>"; |
391 | ················radioIList.Text = "IList<T>"; |
392 | ············} |
393 | ············else |
394 | ············{ |
395 | ················radioArrayList.Text = "ArrayList"; |
396 | ················radioArrayList.Checked = true; |
397 | ················radioIList.Text = "IList"; |
398 | ············} |
399 | ········} |
400 | ····} |
401 | } |
402 |
New Commit (5192672)
1 | // |
2 | // Copyright (c) 2002-2022 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Drawing; |
25 | using WinForms. FontSize; |
26 | using System.ComponentModel; |
27 | using System.Windows.Forms; |
28 | |
29 | namespace NDOVsPackage |
30 | { |
31 | ····internal enum ListType |
32 | ····{ |
33 | ········IList, |
34 | ········ArrayList |
35 | ····} |
36 | |
37 | ····/// <summary> |
38 | ····/// Zusammenfassung für RelationDialog. |
39 | ····/// </summary> |
40 | ····internal class RelationDialog : System.Windows.Forms.Form |
41 | ····{ |
42 | ········private System.Windows.Forms.TextBox txtFieldName; |
43 | ········private System.Windows.Forms.Label label1; |
44 | ········private System.Windows.Forms.GroupBox groupBox1; |
45 | ········private System.Windows.Forms.RadioButton radioSingle; |
46 | ········private System.Windows.Forms.RadioButton radioList; |
47 | ········private System.Windows.Forms.GroupBox groupBox2; |
48 | ········private System.Windows.Forms.RadioButton radioComposite; |
49 | ········private System.Windows.Forms.RadioButton radioAggregate; |
50 | ········private System.Windows.Forms.Button btnOK; |
51 | ········private System.Windows.Forms.Button btnCancel; |
52 | ········private System.Windows.Forms.TextBox txtElementType; |
53 | ········private System.Windows.Forms.Label label2; |
54 | ········private System.Windows.Forms.ToolTip toolTip1; |
55 | ········private System.Windows.Forms.TextBox txtRoleName; |
56 | ········private System.Windows.Forms.Label label3; |
57 | ········private System.Windows.Forms.GroupBox groupBox3; |
58 | ········private System.Windows.Forms.RadioButton radioArrayList; |
59 | ········private System.Windows.Forms.RadioButton radioIList; |
60 | ········private System.Windows.Forms.CheckBox chkUseGenerics; |
61 | ········private System.ComponentModel.IContainer components; |
62 | |
63 | ········public RelationDialog() |
64 | ········{ |
65 | ············// |
66 | ············// Erforderlich für die Windows Form-Designerunterstützung |
67 | ············// |
68 | ············InitializeComponent(); |
69 | ············// Calculate the new font size after InitializeComponent |
70 | ············var newFontSize = FontCalculator.Calculate(Screen.FromControl(this), Font.Size); |
71 | ············if (newFontSize > Font.Size) |
72 | ················Font = new Font( Font.FontFamily, newFontSize, FontStyle.Regular, GraphicsUnit.Point, 0 ); |
73 | |
74 | ············this.chkUseGenerics.Checked = true;············ |
75 | ········} |
76 | |
77 | ········public string FieldName |
78 | ········{ |
79 | ············get { return this.txtFieldName.Text; } |
80 | ········} |
81 | |
82 | ········public string Type |
83 | ········{ |
84 | ············get { return this.txtElementType.Text; } |
85 | ········} |
86 | |
87 | ········public bool Composite |
88 | ········{ |
89 | ············get { return this.radioComposite.Checked; } |
90 | ········} |
91 | |
92 | ········public bool List |
93 | ········{ |
94 | ············get { return this.radioList.Checked; } |
95 | ········} |
96 | |
97 | ········public string RelationName |
98 | ········{ |
99 | ············get { return this.txtRoleName.Text; } |
100 | ········} |
101 | |
102 | ········public ListType ListType |
103 | ········{ |
104 | ············get |
105 | ············{ |
106 | ················if (radioIList.Checked) |
107 | ····················return ListType.IList; |
108 | ················return ListType.ArrayList; |
109 | ············} |
110 | ········} |
111 | |
112 | ········public bool UseGenerics |
113 | ········{ |
114 | ············get { return this.chkUseGenerics.Checked; } |
115 | ········} |
116 | |
117 | |
118 | ········/// <summary> |
119 | ········/// Die verwendeten Ressourcen bereinigen. |
120 | ········/// </summary> |
121 | ········protected override void Dispose( bool disposing ) |
122 | ········{ |
123 | ············if( disposing ) |
124 | ············{ |
125 | ················if(components != null) |
126 | ················{ |
127 | ····················components.Dispose(); |
128 | ················} |
129 | ············} |
130 | ············base.Dispose( disposing ); |
131 | ········} |
132 | |
133 | ········#region Vom Windows Form-Designer generierter Code |
134 | ········/// <summary> |
135 | ········/// Erforderliche Methode für die Designerunterstützung. |
136 | ········/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. |
137 | ········/// </summary> |
138 | ········private void InitializeComponent() |
139 | ········{ |
140 | ············this.components = new System.ComponentModel.Container(); |
141 | ············System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RelationDialog)); |
142 | ············this.txtFieldName = new System.Windows.Forms.TextBox(); |
143 | ············this.label1 = new System.Windows.Forms.Label(); |
144 | ············this.groupBox1 = new System.Windows.Forms.GroupBox(); |
145 | ············this.radioList = new System.Windows.Forms.RadioButton(); |
146 | ············this.radioSingle = new System.Windows.Forms.RadioButton(); |
147 | ············this.groupBox2 = new System.Windows.Forms.GroupBox(); |
148 | ············this.radioAggregate = new System.Windows.Forms.RadioButton(); |
149 | ············this.radioComposite = new System.Windows.Forms.RadioButton(); |
150 | ············this.btnOK = new System.Windows.Forms.Button(); |
151 | ············this.btnCancel = new System.Windows.Forms.Button(); |
152 | ············this.txtElementType = new System.Windows.Forms.TextBox(); |
153 | ············this.label2 = new System.Windows.Forms.Label(); |
154 | ············this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); |
155 | ············this.txtRoleName = new System.Windows.Forms.TextBox(); |
156 | ············this.radioArrayList = new System.Windows.Forms.RadioButton(); |
157 | ············this.radioIList = new System.Windows.Forms.RadioButton(); |
158 | ············this.label3 = new System.Windows.Forms.Label(); |
159 | ············this.groupBox3 = new System.Windows.Forms.GroupBox(); |
160 | ············this.chkUseGenerics = new System.Windows.Forms.CheckBox(); |
161 | ············this.groupBox1.SuspendLayout(); |
162 | ············this.groupBox2.SuspendLayout(); |
163 | ············this.groupBox3.SuspendLayout(); |
164 | ············this.SuspendLayout(); |
165 | ············// |
166 | ············// txtFieldName |
167 | ············// |
168 | ············this.txtFieldName.Location = new System.Drawing.Point(137, 59); |
169 | ············this.txtFieldName.Name = "txtFieldName"; |
170 | ············this.txtFieldName.Size = new System.Drawing.Size(267, 20); |
171 | ············this.txtFieldName.TabIndex = 1; |
172 | ············this.toolTip1.SetToolTip(this.txtFieldName, "Name of the variable in which the relation is stored"); |
173 | ············this.txtFieldName.TextChanged += new System.EventHandler(this.txtFieldName_TextChanged); |
174 | ············// |
175 | ············// label1 |
176 | ············// |
177 | ············this.label1.Location = new System.Drawing.Point(44, 59); |
178 | ············this.label1.Name = "label1"; |
179 | ············this.label1.Size = new System.Drawing.Size(80, 20); |
180 | ············this.label1.TabIndex = 15; |
181 | ············this.label1.Text = "Field Name"; |
182 | ············// |
183 | ············// groupBox1 |
184 | ············// |
185 | ············this.groupBox1.Controls.Add(this.radioList); |
186 | ············this.groupBox1.Controls.Add(this.radioSingle); |
187 | ············this.groupBox1.Location = new System.Drawing.Point(230, 128); |
188 | ············this.groupBox1.Name = "groupBox1"; |
189 | ············this.groupBox1.Size = new System.Drawing.Size(174, 90); |
190 | ············this.groupBox1.TabIndex = 4; |
191 | ············this.groupBox1.TabStop = false; |
192 | ············this.groupBox1.Text = " Multiplicity "; |
193 | ············// |
194 | ············// radioList |
195 | ············// |
196 | ············this.radioList.Checked = true; |
197 | ············this.radioList.Location = new System.Drawing.Point(37, 60); |
198 | ············this.radioList.Name = "radioList"; |
199 | ············this.radioList.Size = new System.Drawing.Size(120, 28); |
200 | ············this.radioList.TabIndex = 1; |
201 | ············this.radioList.TabStop = true; |
202 | ············this.radioList.Text = "List"; |
203 | ············this.toolTip1.SetToolTip(this.radioList, "Relation to a list of objects"); |
204 | ············// |
205 | ············// radioSingle |
206 | ············// |
207 | ············this.radioSingle.Location = new System.Drawing.Point(37, 35); |
208 | ············this.radioSingle.Name = "radioSingle"; |
209 | ············this.radioSingle.Size = new System.Drawing.Size(120, 21); |
210 | ············this.radioSingle.TabIndex = 0; |
211 | ············this.radioSingle.Text = "Single Element"; |
212 | ············this.toolTip1.SetToolTip(this.radioSingle, "Relation to one single object"); |
213 | ············this.radioSingle.CheckedChanged += new System.EventHandler(this.radioSingle_CheckedChanged); |
214 | ············// |
215 | ············// groupBox2 |
216 | ············// |
217 | ············this.groupBox2.Controls.Add(this.radioAggregate); |
218 | ············this.groupBox2.Controls.Add(this.radioComposite); |
219 | ············this.groupBox2.Location = new System.Drawing.Point(44, 128); |
220 | ············this.groupBox2.Name = "groupBox2"; |
221 | ············this.groupBox2.Size = new System.Drawing.Size(173, 90); |
222 | ············this.groupBox2.TabIndex = 3; |
223 | ············this.groupBox2.TabStop = false; |
224 | ············this.groupBox2.Text = " Relation Type··"; |
225 | ············// |
226 | ············// radioAggregate |
227 | ············// |
228 | ············this.radioAggregate.Location = new System.Drawing.Point(30, 60); |
229 | ············this.radioAggregate.Name = "radioAggregate"; |
230 | ············this.radioAggregate.Size = new System.Drawing.Size(127, 21); |
231 | ············this.radioAggregate.TabIndex = 1; |
232 | ············this.radioAggregate.Text = "Assoziation"; |
233 | ············this.toolTip1.SetToolTip(this.radioAggregate, "Relation contains independent objects with own life-cycles"); |
234 | ············// |
235 | ············// radioComposite |
236 | ············// |
237 | ············this.radioComposite.Checked = true; |
238 | ············this.radioComposite.Location = new System.Drawing.Point(30, 35); |
239 | ············this.radioComposite.Name = "radioComposite"; |
240 | ············this.radioComposite.Size = new System.Drawing.Size(127, 21); |
241 | ············this.radioComposite.TabIndex = 0; |
242 | ············this.radioComposite.TabStop = true; |
243 | ············this.radioComposite.Text = "Composition"; |
244 | ············this.toolTip1.SetToolTip(this.radioComposite, "Life-cycle of the related objects are coupled to the lifetime of the owner"); |
245 | ············// |
246 | ············// btnOK |
247 | ············// |
248 | ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; |
249 | ············this.btnOK.Enabled = false; |
250 | ············this.btnOK.Location = new System.Drawing.Point(297, 343); |
251 | ············this.btnOK.Name = "btnOK"; |
252 | ············this.btnOK.Size = new System.Drawing.Size(107, 28); |
253 | ············this.btnOK.TabIndex = 7; |
254 | ············this.btnOK.Text = "OK"; |
255 | ············// |
256 | ············// btnCancel |
257 | ············// |
258 | ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
259 | ············this.btnCancel.Location = new System.Drawing.Point(177, 343); |
260 | ············this.btnCancel.Name = "btnCancel"; |
261 | ············this.btnCancel.Size = new System.Drawing.Size(107, 28); |
262 | ············this.btnCancel.TabIndex = 6; |
263 | ············this.btnCancel.Text = "Cancel"; |
264 | ············// |
265 | ············// txtElementType |
266 | ············// |
267 | ············this.txtElementType.Location = new System.Drawing.Point(137, 24); |
268 | ············this.txtElementType.Name = "txtElementType"; |
269 | ············this.txtElementType.Size = new System.Drawing.Size(267, 20); |
270 | ············this.txtElementType.TabIndex = 0; |
271 | ············this.toolTip1.SetToolTip(this.txtElementType, "Type of the related objects"); |
272 | ············this.txtElementType.TextChanged += new System.EventHandler(this.txtElementType_TextChanged); |
273 | ············// |
274 | ············// label2 |
275 | ············// |
276 | ············this.label2.Location = new System.Drawing.Point(44, 24); |
277 | ············this.label2.Name = "label2"; |
278 | ············this.label2.Size = new System.Drawing.Size(80, 21); |
279 | ············this.label2.TabIndex = 8; |
280 | ············this.label2.Text = "Element Type"; |
281 | ············// |
282 | ············// txtRoleName |
283 | ············// |
284 | ············this.txtRoleName.Location = new System.Drawing.Point(137, 93); |
285 | ············this.txtRoleName.Name = "txtRoleName"; |
286 | ············this.txtRoleName.Size = new System.Drawing.Size(267, 20); |
287 | ············this.txtRoleName.TabIndex = 2; |
288 | ············this.toolTip1.SetToolTip(this.txtRoleName, "Name of the variable in which the relation is stored"); |
289 | ············// |
290 | ············// radioArrayList |
291 | ············// |
292 | ············this.radioArrayList.Checked = true; |
293 | ············this.radioArrayList.Location = new System.Drawing.Point(30, 60); |
294 | ············this.radioArrayList.Name = "radioArrayList"; |
295 | ············this.radioArrayList.Size = new System.Drawing.Size(127, 21); |
296 | ············this.radioArrayList.TabIndex = 1; |
297 | ············this.radioArrayList.TabStop = true; |
298 | ············this.radioArrayList.Text = "List<T>"; |
299 | ············this.toolTip1.SetToolTip(this.radioArrayList, "Relation contains independent objects with own life-cycles"); |
300 | ············// |
301 | ············// radioIList |
302 | ············// |
303 | ············this.radioIList.Location = new System.Drawing.Point(30, 35); |
304 | ············this.radioIList.Name = "radioIList"; |
305 | ············this.radioIList.Size = new System.Drawing.Size(127, 21); |
306 | ············this.radioIList.TabIndex = 0; |
307 | ············this.radioIList.Text = "IList<T>"; |
308 | ············this.toolTip1.SetToolTip(this.radioIList, "Life-cycle of the related objects are coupled to the lifetime of the owner"); |
309 | ············// |
310 | ············// label3 |
311 | ············// |
312 | ············this.label3.Location = new System.Drawing.Point(43, 91); |
313 | ············this.label3.Name = "label3"; |
314 | ············this.label3.Size = new System.Drawing.Size(86, 28); |
315 | ············this.label3.TabIndex = 15; |
316 | ············this.label3.Text = "Optional Role Name"; |
317 | ············// |
318 | ············// groupBox3 |
319 | ············// |
320 | ············this.groupBox3.Controls.Add(this.chkUseGenerics); |
321 | ············this.groupBox3.Controls.Add(this.radioArrayList); |
322 | ············this.groupBox3.Controls.Add(this.radioIList); |
323 | ············this.groupBox3.Location = new System.Drawing.Point(44, 225); |
324 | ············this.groupBox3.Name = "groupBox3"; |
325 | ············this.groupBox3.Size = new System.Drawing.Size(360, 91); |
326 | ············this.groupBox3.TabIndex = 5; |
327 | ············this.groupBox3.TabStop = false; |
328 | ············this.groupBox3.Text = " Coding Style··"; |
329 | ············// |
330 | ············// chkUseGenerics |
331 | ············// |
332 | ············this.chkUseGenerics.Checked = true; |
333 | ············this.chkUseGenerics.CheckState = System.Windows.Forms.CheckState.Checked; |
334 | ············this.chkUseGenerics.Location = new System.Drawing.Point(204, 35); |
335 | ············this.chkUseGenerics.Name = "chkUseGenerics"; |
336 | ············this.chkUseGenerics.Size = new System.Drawing.Size(160, 21); |
337 | ············this.chkUseGenerics.TabIndex = 3; |
338 | ············this.chkUseGenerics.Text = "Use Generics"; |
339 | ············this.chkUseGenerics.CheckedChanged += new System.EventHandler(this.chkUseGenerics_CheckedChanged); |
340 | ············// |
341 | ············// RelationDialog |
342 | ············// |
343 | ············this.AcceptButton = this.btnOK; |
344 | ············this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
345 | ············this.AutoScaleMode = AutoScaleMode.Font; |
346 | ············this.CancelButton = this.btnCancel; |
347 | ············this.ClientSize = new System.Drawing.Size(448, 403); |
348 | ············this.Controls.Add(this.groupBox3); |
349 | ············this.Controls.Add(this.txtRoleName); |
350 | ············this.Controls.Add(this.label3); |
351 | ············this.Controls.Add(this.label2); |
352 | ············this.Controls.Add(this.txtElementType); |
353 | ············this.Controls.Add(this.txtFieldName); |
354 | ············this.Controls.Add(this.btnCancel); |
355 | ············this.Controls.Add(this.btnOK); |
356 | ············this.Controls.Add(this.groupBox2); |
357 | ············this.Controls.Add(this.groupBox1); |
358 | ············this.Controls.Add(this.label1); |
359 | ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
360 | ············this.Name = "RelationDialog"; |
361 | ············this.Text = "Add Relation"; |
362 | ············this.groupBox1.ResumeLayout(false); |
363 | ············this.groupBox2.ResumeLayout(false); |
364 | ············this.groupBox3.ResumeLayout(false); |
365 | ············this.ResumeLayout(false); |
366 | ············this.PerformLayout(); |
367 | |
368 | ········} |
369 | ········#endregion |
370 | |
371 | ········private void txtElementType_TextChanged(object sender, System.EventArgs e) |
372 | ········{ |
373 | ············this.btnOK.Enabled = (txtElementType.Text.Trim() != "" && txtFieldName.Text.Trim() != ""); |
374 | ········} |
375 | |
376 | ········private void txtFieldName_TextChanged(object sender, System.EventArgs e) |
377 | ········{ |
378 | ············this.btnOK.Enabled = (txtElementType.Text.Trim() != "" && txtFieldName.Text.Trim() != ""); |
379 | ········} |
380 | |
381 | ········private void radioSingle_CheckedChanged(object sender, System.EventArgs e) |
382 | ········{ |
383 | ············this.chkUseGenerics.Enabled = |
384 | ················this.radioArrayList.Enabled = |
385 | ················this.radioIList.Enabled = !radioSingle.Checked; |
386 | ········} |
387 | |
388 | ········private void chkUseGenerics_CheckedChanged(object sender, EventArgs e) |
389 | ········{ |
390 | ············if (chkUseGenerics.Checked) |
391 | ············{ |
392 | ················radioArrayList.Text = "List<T>"; |
393 | ················radioIList.Text = "IList<T>"; |
394 | ············} |
395 | ············else |
396 | ············{ |
397 | ················radioArrayList.Text = "ArrayList"; |
398 | ················radioArrayList.Checked = true; |
399 | ················radioIList.Text = "IList"; |
400 | ············} |
401 | ········} |
402 | ····} |
403 | } |
404 |