Subversion Repositories DevTools

Rev

Rev 2098 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2094 ghuddy 1
using System;
2
using System.Drawing;
3
using System.Collections;
4
using System.ComponentModel;
5
using System.Windows.Forms;
6
 
7
namespace EA_DocGen
8
{
9
	/// <summary>
10
	/// Summary description for EA_DocGenOptionsForm.
11
	/// </summary>
12
	public class EA_DocGenOptionsForm : System.Windows.Forms.Form
13
	{
14
      private System.Windows.Forms.Button buttonCancel;
15
      private System.Windows.Forms.Button buttonOK;
16
      private System.Windows.Forms.GroupBox groupBoxRequirements;
17
      private System.Windows.Forms.RadioButton radioButtonReqDefault;
18
      private System.Windows.Forms.RadioButton radioButtonReqSections;
19
      private System.Windows.Forms.RadioButton radioButtonReqFormat;
20
      private System.Windows.Forms.TextBox textBox_ReqFormat;
21
      private System.Windows.Forms.GroupBox groupBoxElementTypes;
22
      private System.Windows.Forms.Button button_ET_All;
23
      private System.Windows.Forms.Button button_ET_None;
24
      private System.Windows.Forms.CheckedListBox checkedListBox_ETs;
25
      private System.Windows.Forms.Button buttonDefault;
26
      private System.Windows.Forms.Label label1;
27
      private System.Windows.Forms.TextBox textBoxNumParaTransition;
28
      private System.Windows.Forms.CheckBox checkBox_SuppressEleDescMissWarn;
29
      private System.Windows.Forms.CheckBox checkBox_SuppressPrivateClasses;
30
      private System.Windows.Forms.CheckBox checkBox_SuppressPrivateMethods;
31
      private System.Windows.Forms.CheckBox checkBox_SuppressPrivateAttrs;
32
		/// <summary>
33
		/// Required designer variable.
34
		/// </summary>
35
		private System.ComponentModel.Container components = null;
36
 
37
		public EA_DocGenOptionsForm()
38
		{
39
			//
40
			// Required for Windows Form Designer support
41
			//
42
			InitializeComponent();
43
 
44
			//
45
			// TODO: Add any constructor code after InitializeComponent call
46
			//
47
		}
48
 
49
		/// <summary>
50
		/// Clean up any resources being used.
51
		/// </summary>
52
		protected override void Dispose( bool disposing )
53
		{
54
			if( disposing )
55
			{
56
				if(components != null)
57
				{
58
					components.Dispose();
59
				}
60
			}
61
			base.Dispose( disposing );
62
		}
63
 
64
		#region Windows Form Designer generated code
65
		/// <summary>
66
		/// Required method for Designer support - do not modify
67
		/// the contents of this method with the code editor.
68
		/// </summary>
69
		private void InitializeComponent()
70
		{
71
         this.buttonCancel = new System.Windows.Forms.Button();
72
         this.buttonOK = new System.Windows.Forms.Button();
73
         this.groupBoxRequirements = new System.Windows.Forms.GroupBox();
74
         this.textBox_ReqFormat = new System.Windows.Forms.TextBox();
75
         this.radioButtonReqFormat = new System.Windows.Forms.RadioButton();
76
         this.radioButtonReqSections = new System.Windows.Forms.RadioButton();
77
         this.radioButtonReqDefault = new System.Windows.Forms.RadioButton();
78
         this.checkedListBox_ETs = new System.Windows.Forms.CheckedListBox();
79
         this.groupBoxElementTypes = new System.Windows.Forms.GroupBox();
80
         this.buttonDefault = new System.Windows.Forms.Button();
81
         this.button_ET_None = new System.Windows.Forms.Button();
82
         this.button_ET_All = new System.Windows.Forms.Button();
83
         this.label1 = new System.Windows.Forms.Label();
84
         this.textBoxNumParaTransition = new System.Windows.Forms.TextBox();
85
         this.checkBox_SuppressEleDescMissWarn = new System.Windows.Forms.CheckBox();
86
         this.checkBox_SuppressPrivateClasses = new System.Windows.Forms.CheckBox();
87
         this.checkBox_SuppressPrivateMethods = new System.Windows.Forms.CheckBox();
88
         this.checkBox_SuppressPrivateAttrs = new System.Windows.Forms.CheckBox();
89
         this.groupBoxRequirements.SuspendLayout();
90
         this.groupBoxElementTypes.SuspendLayout();
91
         this.SuspendLayout();
92
         // 
93
         // buttonCancel
94
         // 
95
         this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
96
         this.buttonCancel.Location = new System.Drawing.Point(328, 584);
97
         this.buttonCancel.Name = "buttonCancel";
98
         this.buttonCancel.Size = new System.Drawing.Size(96, 24);
99
         this.buttonCancel.TabIndex = 0;
100
         this.buttonCancel.Text = "Cancel";
101
         // 
102
         // buttonOK
103
         // 
104
         this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
105
         this.buttonOK.Location = new System.Drawing.Point(216, 584);
106
         this.buttonOK.Name = "buttonOK";
107
         this.buttonOK.Size = new System.Drawing.Size(96, 24);
108
         this.buttonOK.TabIndex = 1;
109
         this.buttonOK.Text = "OK";
110
         // 
111
         // groupBoxRequirements
112
         // 
113
         this.groupBoxRequirements.Controls.Add(this.textBox_ReqFormat);
114
         this.groupBoxRequirements.Controls.Add(this.radioButtonReqFormat);
115
         this.groupBoxRequirements.Controls.Add(this.radioButtonReqSections);
116
         this.groupBoxRequirements.Controls.Add(this.radioButtonReqDefault);
117
         this.groupBoxRequirements.Location = new System.Drawing.Point(16, 24);
118
         this.groupBoxRequirements.Name = "groupBoxRequirements";
119
         this.groupBoxRequirements.Size = new System.Drawing.Size(408, 120);
120
         this.groupBoxRequirements.TabIndex = 2;
121
         this.groupBoxRequirements.TabStop = false;
122
         this.groupBoxRequirements.Text = "Requirement Element Handling";
123
         // 
124
         // textBox_ReqFormat
125
         // 
126
         this.textBox_ReqFormat.Location = new System.Drawing.Point(176, 82);
127
         this.textBox_ReqFormat.Name = "textBox_ReqFormat";
128
         this.textBox_ReqFormat.Size = new System.Drawing.Size(216, 22);
129
         this.textBox_ReqFormat.TabIndex = 3;
130
         this.textBox_ReqFormat.Text = "[REQUIREMENT: %s]";
131
         // 
132
         // radioButtonReqFormat
133
         // 
134
         this.radioButtonReqFormat.Location = new System.Drawing.Point(16, 80);
135
         this.radioButtonReqFormat.Name = "radioButtonReqFormat";
136
         this.radioButtonReqFormat.Size = new System.Drawing.Size(152, 24);
137
         this.radioButtonReqFormat.TabIndex = 2;
138
         this.radioButtonReqFormat.Text = "Display with format:";
139
         // 
140
         // radioButtonReqSections
141
         // 
142
         this.radioButtonReqSections.Location = new System.Drawing.Point(16, 56);
143
         this.radioButtonReqSections.Name = "radioButtonReqSections";
144
         this.radioButtonReqSections.Size = new System.Drawing.Size(376, 24);
145
         this.radioButtonReqSections.TabIndex = 1;
146
         this.radioButtonReqSections.Text = "Display as sections (each requirement is a section)";
147
         // 
148
         // radioButtonReqDefault
149
         // 
150
         this.radioButtonReqDefault.Checked = true;
151
         this.radioButtonReqDefault.Location = new System.Drawing.Point(16, 32);
152
         this.radioButtonReqDefault.Name = "radioButtonReqDefault";
153
         this.radioButtonReqDefault.Size = new System.Drawing.Size(152, 24);
154
         this.radioButtonReqDefault.TabIndex = 0;
155
         this.radioButtonReqDefault.TabStop = true;
156
         this.radioButtonReqDefault.Text = "Default (style based)";
157
         // 
158
         // checkedListBox_ETs
159
         // 
160
         this.checkedListBox_ETs.Location = new System.Drawing.Point(32, 192);
161
         this.checkedListBox_ETs.Name = "checkedListBox_ETs";
162
         this.checkedListBox_ETs.Size = new System.Drawing.Size(272, 208);
163
         this.checkedListBox_ETs.TabIndex = 3;
164
         // 
165
         // groupBoxElementTypes
166
         // 
167
         this.groupBoxElementTypes.Controls.Add(this.buttonDefault);
168
         this.groupBoxElementTypes.Controls.Add(this.button_ET_None);
169
         this.groupBoxElementTypes.Controls.Add(this.button_ET_All);
170
         this.groupBoxElementTypes.Location = new System.Drawing.Point(16, 160);
171
         this.groupBoxElementTypes.Name = "groupBoxElementTypes";
172
         this.groupBoxElementTypes.Size = new System.Drawing.Size(408, 256);
173
         this.groupBoxElementTypes.TabIndex = 4;
174
         this.groupBoxElementTypes.TabStop = false;
175
         this.groupBoxElementTypes.Text = "Element Types to be serialised to document";
176
         // 
177
         // buttonDefault
178
         // 
179
         this.buttonDefault.Location = new System.Drawing.Point(304, 128);
180
         this.buttonDefault.Name = "buttonDefault";
181
         this.buttonDefault.Size = new System.Drawing.Size(88, 23);
182
         this.buttonDefault.TabIndex = 2;
183
         this.buttonDefault.Text = "Defaults";
184
         this.buttonDefault.Click += new System.EventHandler(this.buttonDefault_Click);
185
         // 
186
         // button_ET_None
187
         // 
188
         this.button_ET_None.Location = new System.Drawing.Point(304, 72);
189
         this.button_ET_None.Name = "button_ET_None";
190
         this.button_ET_None.Size = new System.Drawing.Size(88, 23);
191
         this.button_ET_None.TabIndex = 1;
192
         this.button_ET_None.Text = "DeSelect All";
193
         this.button_ET_None.Click += new System.EventHandler(this.button_ET_None_Click);
194
         // 
195
         // button_ET_All
196
         // 
197
         this.button_ET_All.Location = new System.Drawing.Point(304, 32);
198
         this.button_ET_All.Name = "button_ET_All";
199
         this.button_ET_All.Size = new System.Drawing.Size(88, 24);
200
         this.button_ET_All.TabIndex = 0;
201
         this.button_ET_All.Text = "Select All";
202
         this.button_ET_All.Click += new System.EventHandler(this.button_ET_All_Click);
203
         // 
204
         // label1
205
         // 
206
         this.label1.Location = new System.Drawing.Point(16, 528);
207
         this.label1.Name = "label1";
208
         this.label1.Size = new System.Drawing.Size(224, 40);
209
         this.label1.TabIndex = 5;
210
         this.label1.Text = "Transition to NumPara style at level (0 denotes no transition)";
211
         // 
212
         // textBoxNumParaTransition
213
         // 
214
         this.textBoxNumParaTransition.Location = new System.Drawing.Point(248, 528);
215
         this.textBoxNumParaTransition.Name = "textBoxNumParaTransition";
216
         this.textBoxNumParaTransition.Size = new System.Drawing.Size(40, 22);
217
         this.textBoxNumParaTransition.TabIndex = 6;
218
         this.textBoxNumParaTransition.Text = "0";
219
         // 
220
         // checkBox_SuppressEleDescMissWarn
221
         // 
222
         this.checkBox_SuppressEleDescMissWarn.Location = new System.Drawing.Point(16, 496);
223
         this.checkBox_SuppressEleDescMissWarn.Name = "checkBox_SuppressEleDescMissWarn";
224
         this.checkBox_SuppressEleDescMissWarn.Size = new System.Drawing.Size(336, 16);
225
         this.checkBox_SuppressEleDescMissWarn.TabIndex = 7;
226
         this.checkBox_SuppressEleDescMissWarn.Text = "Suppress Element Description Missing Warnings";
227
         // 
228
         // checkBox_SuppressPrivateClasses
229
         // 
230
         this.checkBox_SuppressPrivateClasses.Location = new System.Drawing.Point(16, 464);
231
         this.checkBox_SuppressPrivateClasses.Name = "checkBox_SuppressPrivateClasses";
232
         this.checkBox_SuppressPrivateClasses.Size = new System.Drawing.Size(192, 24);
233
         this.checkBox_SuppressPrivateClasses.TabIndex = 8;
234
         this.checkBox_SuppressPrivateClasses.Text = "Suppress Private Classes";
235
         // 
236
         // checkBox_SuppressPrivateMethods
237
         // 
238
         this.checkBox_SuppressPrivateMethods.Location = new System.Drawing.Point(16, 432);
239
         this.checkBox_SuppressPrivateMethods.Name = "checkBox_SuppressPrivateMethods";
240
         this.checkBox_SuppressPrivateMethods.Size = new System.Drawing.Size(184, 24);
241
         this.checkBox_SuppressPrivateMethods.TabIndex = 9;
242
         this.checkBox_SuppressPrivateMethods.Text = "Suppress Private Methods";
243
         // 
244
         // checkBox_SuppressPrivateAttrs
245
         // 
246
         this.checkBox_SuppressPrivateAttrs.Location = new System.Drawing.Point(216, 432);
247
         this.checkBox_SuppressPrivateAttrs.Name = "checkBox_SuppressPrivateAttrs";
248
         this.checkBox_SuppressPrivateAttrs.Size = new System.Drawing.Size(192, 24);
249
         this.checkBox_SuppressPrivateAttrs.TabIndex = 10;
250
         this.checkBox_SuppressPrivateAttrs.Text = "Suppress Private Attributes";
251
         // 
252
         // EA_DocGenOptionsForm
253
         // 
254
         this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
255
         this.ClientSize = new System.Drawing.Size(440, 624);
256
         this.Controls.Add(this.checkBox_SuppressPrivateAttrs);
257
         this.Controls.Add(this.checkBox_SuppressPrivateMethods);
258
         this.Controls.Add(this.checkBox_SuppressPrivateClasses);
259
         this.Controls.Add(this.checkBox_SuppressEleDescMissWarn);
260
         this.Controls.Add(this.textBoxNumParaTransition);
261
         this.Controls.Add(this.label1);
262
         this.Controls.Add(this.checkedListBox_ETs);
263
         this.Controls.Add(this.groupBoxRequirements);
264
         this.Controls.Add(this.buttonOK);
265
         this.Controls.Add(this.buttonCancel);
266
         this.Controls.Add(this.groupBoxElementTypes);
267
         this.Name = "EA_DocGenOptionsForm";
268
         this.Text = "EA_DocGenOptionsForm";
269
         this.groupBoxRequirements.ResumeLayout(false);
270
         this.groupBoxElementTypes.ResumeLayout(false);
271
         this.ResumeLayout(false);
272
 
273
      }
274
		#endregion
275
 
276
 
277
      public void populate(EA.Repository EA_Repository, EA_DocGenOptions options)
278
      {
279
         EA.ObjectType objType;
280
         object obj;
281
 
282
         objType = EA_Repository.GetTreeSelectedItem( out obj );
283
         if (objType == EA.ObjectType.otElement)
284
         {
285
            EA.Element ele = (EA.Element)obj;
286
            if (0 == ele.Name.CompareTo(EA_Constants.EA_DocGenBaseName))
287
            {
288
               if (options.opt_DisplayRequirementElementsAsSections == true)
289
               {
290
                  radioButtonReqSections.Checked = true;
291
               }
292
               else if (options.opt_DisplayRequirementsWithStatus == true)
293
               {
294
                  radioButtonReqDefault.Checked = true;
295
               }
296
               else 
297
               {
298
                  radioButtonReqFormat.Checked = true;
299
                  textBox_ReqFormat.Text = options.opt_RequirementElementDisplayFormat;
300
               }
301
 
302
               textBoxNumParaTransition.Text = options.opt_ElementHeadingTransitionLevel.ToString();
303
 
304
               CheckState defState;
305
               if (options.opt_ElementTypes.Count > 0)
306
                  defState = CheckState.Unchecked;
307
               else
308
                  defState = CheckState.Checked;
309
 
310
               checkedListBox_ETs.Items.Add("Action",                    defState); 
311
               checkedListBox_ETs.Items.Add("Activity",                  defState); 
312
               checkedListBox_ETs.Items.Add("ActivityPartition",         defState); 
313
               checkedListBox_ETs.Items.Add("ActivityRegion",            defState); 
314
               checkedListBox_ETs.Items.Add("Actor",                     defState); 
315
               checkedListBox_ETs.Items.Add("Artifact",                  defState); 
316
               checkedListBox_ETs.Items.Add("Association",               defState); 
317
               checkedListBox_ETs.Items.Add("Boundary",                  defState); 
318
               checkedListBox_ETs.Items.Add("Change",                    defState); 
319
               checkedListBox_ETs.Items.Add("Class",                     defState); 
320
               checkedListBox_ETs.Items.Add("Collaboration",             defState); 
321
               checkedListBox_ETs.Items.Add("Component",                 defState); 
322
               checkedListBox_ETs.Items.Add("Constraint",                defState); 
323
               checkedListBox_ETs.Items.Add("Decision",                  defState); 
324
               checkedListBox_ETs.Items.Add("DeploymentSpecification",   defState); 
325
               checkedListBox_ETs.Items.Add("DiagramFrame",              defState); 
326
               checkedListBox_ETs.Items.Add("EmbeddedElement",           defState); 
327
               checkedListBox_ETs.Items.Add("Entity",                    defState); 
328
               checkedListBox_ETs.Items.Add("EntryPoint",                defState); 
329
               checkedListBox_ETs.Items.Add("Event",                     defState); 
330
               checkedListBox_ETs.Items.Add("ExceptionHandler",          defState); 
331
               checkedListBox_ETs.Items.Add("ExitPoint",                 defState); 
332
               checkedListBox_ETs.Items.Add("ExpansionNode",             defState); 
333
               checkedListBox_ETs.Items.Add("ExpansionRegion",           defState); 
334
               checkedListBox_ETs.Items.Add("GUIElement",                defState); 
335
               checkedListBox_ETs.Items.Add("InteractionFragment",       defState); 
336
               checkedListBox_ETs.Items.Add("InteractionOccurrence",     defState); 
337
               checkedListBox_ETs.Items.Add("InteractionState",          defState); 
338
               checkedListBox_ETs.Items.Add("Interface",                 defState); 
339
               checkedListBox_ETs.Items.Add("InterruptibleActivityRegion",defState); 
340
               checkedListBox_ETs.Items.Add("Issue",                     defState); 
341
               checkedListBox_ETs.Items.Add("Node",                      defState); 
342
               checkedListBox_ETs.Items.Add("Note",                      defState); 
343
               checkedListBox_ETs.Items.Add("Object",                    defState); 
344
               checkedListBox_ETs.Items.Add("Package",                   defState); 
345
               checkedListBox_ETs.Items.Add("Parameter",                 defState); 
346
               checkedListBox_ETs.Items.Add("Part",                      defState); 
347
               checkedListBox_ETs.Items.Add("Port",                      defState); 
348
               checkedListBox_ETs.Items.Add("ProvidedInterface",         defState); 
349
               checkedListBox_ETs.Items.Add("Report",                    defState); 
350
               checkedListBox_ETs.Items.Add("RequiredInterface",         defState); 
351
               checkedListBox_ETs.Items.Add("Requirement",               defState); 
352
               checkedListBox_ETs.Items.Add("Screen",                    defState); 
353
               checkedListBox_ETs.Items.Add("Sequence",                  defState); 
354
               checkedListBox_ETs.Items.Add("State",                     defState); 
355
               checkedListBox_ETs.Items.Add("StateNode",                 defState); 
356
               checkedListBox_ETs.Items.Add("Synchronization",           defState); 
357
               checkedListBox_ETs.Items.Add("Text",                      defState); 
358
               checkedListBox_ETs.Items.Add("TimeLine",                  defState); 
359
               checkedListBox_ETs.Items.Add("UMLDiagram",                defState); 
360
               checkedListBox_ETs.Items.Add("UseCase",                   defState); 
361
 
362
               if (options.opt_ElementTypes.Count > 0)
363
               {
364
                  foreach(string s in options.opt_ElementTypes)
365
                  {
366
                     int i = checkedListBox_ETs.FindStringExact(s);
367
                     if (i != -1)
368
                     {
369
                        checkedListBox_ETs.SetItemChecked(i,true);
370
                     }
371
                  }
372
               }
373
 
374
               checkBox_SuppressEleDescMissWarn.Checked = options.opt_SuppressElementDescriptionMissingWarnings;
375
 
376
               checkBox_SuppressPrivateClasses.Checked = options.opt_SuppressPrivateClasses;
377
               checkBox_SuppressPrivateMethods.Checked = options.opt_SuppressPrivateMethods;
378
               checkBox_SuppressPrivateAttrs.Checked = options.opt_SuppressPrivateAttributes;
379
 
380
 
381
            }
382
         }
383
      }
384
 
385
 
386
      public void read(EA.Repository EA_Repository, EA_DocGenOptions options)
387
      {
388
         options.opt_RequirementElementDisplayFormat = textBox_ReqFormat.Text;
389
 
390
         if (radioButtonReqSections.Checked == true)
391
         {
392
            options.opt_DisplayRequirementElementsAsSections = true;
393
            options.opt_DisplayRequirementsWithStatus = false;
394
         }
395
         else if (radioButtonReqDefault.Checked == true)
396
         {
397
            options.opt_DisplayRequirementElementsAsSections = false;
398
            options.opt_DisplayRequirementsWithStatus = true;
399
         }
400
         else 
401
         {
402
            options.opt_DisplayRequirementElementsAsSections = false;
403
            options.opt_DisplayRequirementsWithStatus = false;
404
         }
405
 
406
         options.opt_ElementHeadingTransitionLevel = System.Convert.ToInt32(textBoxNumParaTransition.Text);
407
 
408
         // If every item is checked then we give back an empty opt_ElementTypes list because
409
         // that indicates that the user wants everything.
410
         options.opt_ElementTypes.Clear();
411
         if (checkedListBox_ETs.CheckedItems.Count != checkedListBox_ETs.Items.Count)
412
         {
413
            foreach(string s in checkedListBox_ETs.CheckedItems)
414
            {
415
               options.opt_ElementTypes.Add(s);
416
            }
417
         }
418
 
419
         options.opt_SuppressElementDescriptionMissingWarnings = checkBox_SuppressEleDescMissWarn.Checked;
420
 
421
         options.opt_SuppressPrivateClasses = checkBox_SuppressPrivateClasses.Checked;
422
         options.opt_SuppressPrivateMethods= checkBox_SuppressPrivateMethods.Checked;
423
         options.opt_SuppressPrivateAttributes = checkBox_SuppressPrivateAttrs.Checked;
424
      }
425
 
426
      private void button_ET_All_Click(object sender, System.EventArgs e)
427
      {
428
         int i;
429
         for (i=0; i < checkedListBox_ETs.Items.Count; i++)
430
         {
431
            checkedListBox_ETs.SetItemChecked(i, true);
432
         }
433
      }
434
 
435
      private void button_ET_None_Click(object sender, System.EventArgs e)
436
      {
437
         int i;
438
         for (i=0; i < checkedListBox_ETs.Items.Count; i++)
439
         {
440
            checkedListBox_ETs.SetItemChecked(i, false);
441
         }
442
      }
443
 
444
      private void findAndCheckItem(string s)
445
      {
446
         int i = checkedListBox_ETs.FindStringExact(s);
447
         if (i != -1)
448
            checkedListBox_ETs.SetItemChecked(i,true);
449
      }
450
 
451
      private void checkDefaultItems()
452
      {
453
         findAndCheckItem("Class");
454
         findAndCheckItem("Component");
455
         findAndCheckItem("Interface");
456
         findAndCheckItem("Requirement");
457
      }
458
 
459
      private void buttonDefault_Click(object sender, System.EventArgs e)
460
      {
461
         int i = 0;
462
 
463
         for (i=0; i < checkedListBox_ETs.Items.Count; i++)
464
         {
465
            checkedListBox_ETs.SetItemChecked(i, false);
466
         }
467
         checkDefaultItems();
468
      }
469
 
470
 
471
	}
472
}