| 2155 |
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_ReqPro
|
|
|
8 |
{
|
|
|
9 |
/// <summary>
|
|
|
10 |
/// Summary description for ExportForm.
|
|
|
11 |
/// </summary>
|
|
|
12 |
public class ExportForm : System.Windows.Forms.Form
|
|
|
13 |
{
|
|
|
14 |
private ReqPro_object m_rq_root_package;
|
|
|
15 |
private ArrayList m_req_types;
|
|
|
16 |
private string m_default_pkg_selection_guid;
|
|
|
17 |
private bool m_got_pkg_selection;
|
|
|
18 |
|
|
|
19 |
private System.Windows.Forms.Button button_ok;
|
|
|
20 |
private System.Windows.Forms.Button button_cancel;
|
|
|
21 |
private System.Windows.Forms.TreeView PackageFilterTreeView;
|
|
|
22 |
private System.Windows.Forms.TextBox textBox_newFolder;
|
|
|
23 |
private System.Windows.Forms.CheckBox checkBox_createFolder;
|
|
|
24 |
private System.Windows.Forms.ComboBox comboBox_ReqType;
|
|
|
25 |
private System.Windows.Forms.Label label1;
|
|
|
26 |
private System.Windows.Forms.Label label2;
|
|
|
27 |
private System.Windows.Forms.ComboBox comboBox_ExportExtent;
|
|
|
28 |
private System.Windows.Forms.Label label4;
|
|
|
29 |
/// <summary>
|
|
|
30 |
/// Required designer variable.
|
|
|
31 |
/// </summary>
|
|
|
32 |
private System.ComponentModel.Container components = null;
|
|
|
33 |
|
|
|
34 |
public enum ExportExtent
|
|
|
35 |
{
|
|
|
36 |
SINGLE_REQ,
|
|
|
37 |
PACKAGE_REQS,
|
|
|
38 |
REQPRODB_REQS
|
|
|
39 |
};
|
|
|
40 |
|
|
|
41 |
public ExportForm()
|
|
|
42 |
{
|
|
|
43 |
//
|
|
|
44 |
// Required for Windows Form Designer support
|
|
|
45 |
//
|
|
|
46 |
InitializeComponent();
|
|
|
47 |
|
|
|
48 |
//
|
|
|
49 |
// TODO: Add any constructor code after InitializeComponent call
|
|
|
50 |
//
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
/// <summary>
|
|
|
54 |
/// Clean up any resources being used.
|
|
|
55 |
/// </summary>
|
|
|
56 |
protected override void Dispose( bool disposing )
|
|
|
57 |
{
|
|
|
58 |
if( disposing )
|
|
|
59 |
{
|
|
|
60 |
if(components != null)
|
|
|
61 |
{
|
|
|
62 |
components.Dispose();
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
base.Dispose( disposing );
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
#region Windows Form Designer generated code
|
|
|
69 |
/// <summary>
|
|
|
70 |
/// Required method for Designer support - do not modify
|
|
|
71 |
/// the contents of this method with the code editor.
|
|
|
72 |
/// </summary>
|
|
|
73 |
private void InitializeComponent()
|
|
|
74 |
{
|
|
|
75 |
this.button_ok = new System.Windows.Forms.Button();
|
|
|
76 |
this.button_cancel = new System.Windows.Forms.Button();
|
|
|
77 |
this.PackageFilterTreeView = new System.Windows.Forms.TreeView();
|
|
|
78 |
this.textBox_newFolder = new System.Windows.Forms.TextBox();
|
|
|
79 |
this.checkBox_createFolder = new System.Windows.Forms.CheckBox();
|
|
|
80 |
this.comboBox_ReqType = new System.Windows.Forms.ComboBox();
|
|
|
81 |
this.label1 = new System.Windows.Forms.Label();
|
|
|
82 |
this.label2 = new System.Windows.Forms.Label();
|
|
|
83 |
this.comboBox_ExportExtent = new System.Windows.Forms.ComboBox();
|
|
|
84 |
this.label4 = new System.Windows.Forms.Label();
|
|
|
85 |
this.SuspendLayout();
|
|
|
86 |
//
|
|
|
87 |
// button_ok
|
|
|
88 |
//
|
|
|
89 |
this.button_ok.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
|
90 |
this.button_ok.Location = new System.Drawing.Point(328, 552);
|
|
|
91 |
this.button_ok.Name = "button_ok";
|
|
|
92 |
this.button_ok.TabIndex = 4;
|
|
|
93 |
this.button_ok.Text = "OK";
|
|
|
94 |
//
|
|
|
95 |
// button_cancel
|
|
|
96 |
//
|
|
|
97 |
this.button_cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
|
98 |
this.button_cancel.Location = new System.Drawing.Point(424, 552);
|
|
|
99 |
this.button_cancel.Name = "button_cancel";
|
|
|
100 |
this.button_cancel.TabIndex = 5;
|
|
|
101 |
this.button_cancel.Text = "Cancel";
|
|
|
102 |
//
|
|
|
103 |
// PackageFilterTreeView
|
|
|
104 |
//
|
|
|
105 |
this.PackageFilterTreeView.HideSelection = false;
|
|
|
106 |
this.PackageFilterTreeView.ImageIndex = -1;
|
|
|
107 |
this.PackageFilterTreeView.Location = new System.Drawing.Point(8, 40);
|
|
|
108 |
this.PackageFilterTreeView.Name = "PackageFilterTreeView";
|
|
|
109 |
this.PackageFilterTreeView.SelectedImageIndex = -1;
|
|
|
110 |
this.PackageFilterTreeView.Size = new System.Drawing.Size(488, 368);
|
|
|
111 |
this.PackageFilterTreeView.TabIndex = 0;
|
|
|
112 |
//
|
|
|
113 |
// textBox_newFolder
|
|
|
114 |
//
|
|
|
115 |
this.textBox_newFolder.Location = new System.Drawing.Point(8, 424);
|
|
|
116 |
this.textBox_newFolder.Name = "textBox_newFolder";
|
|
|
117 |
this.textBox_newFolder.Size = new System.Drawing.Size(456, 22);
|
|
|
118 |
this.textBox_newFolder.TabIndex = 1;
|
|
|
119 |
this.textBox_newFolder.Text = "new sub-folder name here (if applicable)";
|
|
|
120 |
this.textBox_newFolder.TextChanged += new System.EventHandler(this.textBox_newFolder_TextChanged);
|
|
|
121 |
//
|
|
|
122 |
// checkBox_createFolder
|
|
|
123 |
//
|
|
|
124 |
this.checkBox_createFolder.Location = new System.Drawing.Point(472, 424);
|
|
|
125 |
this.checkBox_createFolder.Name = "checkBox_createFolder";
|
|
|
126 |
this.checkBox_createFolder.Size = new System.Drawing.Size(24, 24);
|
|
|
127 |
this.checkBox_createFolder.TabIndex = 4;
|
|
|
128 |
//
|
|
|
129 |
// comboBox_ReqType
|
|
|
130 |
//
|
|
|
131 |
this.comboBox_ReqType.Location = new System.Drawing.Point(192, 464);
|
|
|
132 |
this.comboBox_ReqType.Name = "comboBox_ReqType";
|
|
|
133 |
this.comboBox_ReqType.Size = new System.Drawing.Size(304, 24);
|
|
|
134 |
this.comboBox_ReqType.TabIndex = 2;
|
|
|
135 |
this.comboBox_ReqType.Text = "comboBox1";
|
|
|
136 |
//
|
|
|
137 |
// label1
|
|
|
138 |
//
|
|
|
139 |
this.label1.Location = new System.Drawing.Point(8, 465);
|
|
|
140 |
this.label1.Name = "label1";
|
|
|
141 |
this.label1.Size = new System.Drawing.Size(176, 23);
|
|
|
142 |
this.label1.TabIndex = 7;
|
|
|
143 |
this.label1.Text = "Export As Requirement Type";
|
|
|
144 |
//
|
|
|
145 |
// label2
|
|
|
146 |
//
|
|
|
147 |
this.label2.Location = new System.Drawing.Point(8, 8);
|
|
|
148 |
this.label2.Name = "label2";
|
|
|
149 |
this.label2.Size = new System.Drawing.Size(400, 16);
|
|
|
150 |
this.label2.TabIndex = 6;
|
|
|
151 |
this.label2.Text = "Select ReqPro package where new requirements will be written";
|
|
|
152 |
//
|
|
|
153 |
// comboBox_ExportExtent
|
|
|
154 |
//
|
|
|
155 |
this.comboBox_ExportExtent.Location = new System.Drawing.Point(120, 504);
|
|
|
156 |
this.comboBox_ExportExtent.Name = "comboBox_ExportExtent";
|
|
|
157 |
this.comboBox_ExportExtent.Size = new System.Drawing.Size(376, 24);
|
|
|
158 |
this.comboBox_ExportExtent.TabIndex = 10;
|
|
|
159 |
this.comboBox_ExportExtent.Text = "comboBox1";
|
|
|
160 |
//
|
|
|
161 |
// label4
|
|
|
162 |
//
|
|
|
163 |
this.label4.Location = new System.Drawing.Point(8, 504);
|
|
|
164 |
this.label4.Name = "label4";
|
|
|
165 |
this.label4.Size = new System.Drawing.Size(104, 16);
|
|
|
166 |
this.label4.TabIndex = 11;
|
|
|
167 |
this.label4.Text = "Extent of Export";
|
|
|
168 |
//
|
|
|
169 |
// ExportForm
|
|
|
170 |
//
|
|
|
171 |
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
|
|
172 |
this.ClientSize = new System.Drawing.Size(512, 592);
|
|
|
173 |
this.Controls.Add(this.label4);
|
|
|
174 |
this.Controls.Add(this.comboBox_ExportExtent);
|
|
|
175 |
this.Controls.Add(this.label2);
|
|
|
176 |
this.Controls.Add(this.label1);
|
|
|
177 |
this.Controls.Add(this.comboBox_ReqType);
|
|
|
178 |
this.Controls.Add(this.checkBox_createFolder);
|
|
|
179 |
this.Controls.Add(this.textBox_newFolder);
|
|
|
180 |
this.Controls.Add(this.PackageFilterTreeView);
|
|
|
181 |
this.Controls.Add(this.button_cancel);
|
|
|
182 |
this.Controls.Add(this.button_ok);
|
|
|
183 |
this.Name = "ExportForm";
|
|
|
184 |
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
|
185 |
this.Text = "Export To ReqPro Database";
|
|
|
186 |
this.ResumeLayout(false);
|
|
|
187 |
|
|
|
188 |
}
|
|
|
189 |
#endregion
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
#region Form methods
|
|
|
193 |
/// <summary>
|
|
|
194 |
/// Populate the treeView control with package names and hierarchy captured and passed in
|
|
|
195 |
/// in the form of a ReqPro_object (the root object)
|
|
|
196 |
/// </summary>
|
|
|
197 |
/// <param name="rq_root_package"></param>
|
|
|
198 |
public void populate(ReqPro_object rq_root_package,
|
|
|
199 |
string defaultPackageselectionGUID,
|
|
|
200 |
ArrayList req_types,
|
|
|
201 |
ArrayList rq_req_status_types)
|
|
|
202 |
{
|
|
|
203 |
m_rq_root_package = rq_root_package;
|
|
|
204 |
m_default_pkg_selection_guid = defaultPackageselectionGUID;
|
|
|
205 |
|
|
|
206 |
// Package Filter population
|
|
|
207 |
m_got_pkg_selection = false;
|
|
|
208 |
PackageFilterTreeView.BeginUpdate();
|
|
|
209 |
PackageFilterTreeView.Nodes.Clear();
|
|
|
210 |
int i_new = PackageFilterTreeView.Nodes.Add(new TreeNode(rq_root_package.name));
|
|
|
211 |
populate_PackageFilterTreeView_node(rq_root_package, PackageFilterTreeView.Nodes[i_new].Nodes);
|
|
|
212 |
PackageFilterTreeView.ExpandAll();
|
|
|
213 |
if (false == m_got_pkg_selection)
|
|
|
214 |
PackageFilterTreeView.SelectedNode = PackageFilterTreeView.Nodes[i_new];
|
|
|
215 |
PackageFilterTreeView.EndUpdate();
|
|
|
216 |
|
|
|
217 |
// Requirement Type combo population
|
|
|
218 |
comboBox_ReqType.BeginUpdate();
|
|
|
219 |
comboBox_ReqType.Items.Clear();
|
|
|
220 |
populate_RequirementTypeList(req_types);
|
|
|
221 |
comboBox_ReqType.EndUpdate();
|
|
|
222 |
|
|
|
223 |
// set default export extent
|
|
|
224 |
comboBox_ExportExtent.BeginUpdate();
|
|
|
225 |
comboBox_ExportExtent.Items.Clear();
|
|
|
226 |
populate_ExtentOfExport();
|
|
|
227 |
comboBox_ExportExtent.EndUpdate();
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
private void populate_PackageFilterTreeView_node(ReqPro_object rq_obj, TreeNodeCollection tnc)
|
|
|
232 |
{
|
|
|
233 |
// scan this ReqPro objects sub-objects. For each package found, add a
|
|
|
234 |
// tree node, and recurse to find and populate tree nodes for its sub-packages
|
|
|
235 |
foreach( ReqPro_object sub_obj in rq_obj.ReqPro_objects )
|
|
|
236 |
{
|
|
|
237 |
if (sub_obj.isPackage)
|
|
|
238 |
{
|
|
|
239 |
int i_new = 0;
|
|
|
240 |
|
|
|
241 |
// Add a tree node to the control
|
|
|
242 |
if (sub_obj.numberOfRequirements > 0)
|
|
|
243 |
{
|
|
|
244 |
string nodeName = String.Format("{0} ({1})", sub_obj.name, sub_obj.numberOfRequirements);
|
|
|
245 |
i_new = tnc.Add(new TreeNode(nodeName));
|
|
|
246 |
}
|
|
|
247 |
else
|
|
|
248 |
{
|
|
|
249 |
i_new = tnc.Add(new TreeNode(sub_obj.name));
|
|
|
250 |
}
|
|
|
251 |
|
|
|
252 |
// Use the Node's Tag to hold a reference to our ReqPro_object.
|
|
|
253 |
// This allows rapid access to the object whenever we do something with or to
|
|
|
254 |
// a node during the use of the dialog.
|
|
|
255 |
tnc[i_new].Tag = sub_obj;
|
|
|
256 |
|
|
|
257 |
if (m_got_pkg_selection == false && sub_obj.guid.Equals(this.m_default_pkg_selection_guid))
|
|
|
258 |
{
|
|
|
259 |
m_got_pkg_selection = true;
|
|
|
260 |
PackageFilterTreeView.SelectedNode = tnc[i_new];
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
// recurse
|
|
|
264 |
populate_PackageFilterTreeView_node(sub_obj, tnc[i_new].Nodes);
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
private void populate_RequirementTypeList(ArrayList req_types)
|
|
|
271 |
{
|
|
|
272 |
m_req_types = req_types;
|
|
|
273 |
bool gotDefaultSelection = false;
|
|
|
274 |
|
|
|
275 |
foreach(ReqPro_ReqType req_type in req_types)
|
|
|
276 |
{
|
|
|
277 |
string node_name = String.Format("{0} ({1})", req_type.name, req_type.prefix);
|
|
|
278 |
|
|
|
279 |
int i = comboBox_ReqType.Items.Add(node_name);
|
|
|
280 |
|
|
|
281 |
if (node_name.IndexOf("SPR",0) >= 0)
|
|
|
282 |
{
|
|
|
283 |
comboBox_ReqType.SelectedIndex = i;
|
|
|
284 |
gotDefaultSelection = true;
|
|
|
285 |
}
|
|
|
286 |
}
|
|
|
287 |
|
|
|
288 |
if (!gotDefaultSelection)
|
|
|
289 |
comboBox_ReqType.SelectedIndex = 0;
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
private void populate_ExtentOfExport()
|
|
|
294 |
{
|
|
|
295 |
comboBox_ExportExtent.Items.Add("Selected (single) requirement only");
|
|
|
296 |
comboBox_ExportExtent.Items.Add("Req's from selected package and below");
|
|
|
297 |
comboBox_ExportExtent.Items.Add("Req's from ReqProDB container package and below"); // Default
|
|
|
298 |
comboBox_ExportExtent.SelectedIndex = 2;
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
public ReqPro_object user_selected_object()
|
|
|
302 |
{
|
|
|
303 |
return (ReqPro_object)PackageFilterTreeView.SelectedNode.Tag;
|
|
|
304 |
}
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
public bool user_create_folder_selection(out string folderName)
|
|
|
308 |
{
|
|
|
309 |
if (checkBox_createFolder.Checked)
|
|
|
310 |
{
|
|
|
311 |
folderName = textBox_newFolder.Text;
|
|
|
312 |
return true;
|
|
|
313 |
}
|
|
|
314 |
else
|
|
|
315 |
{
|
|
|
316 |
folderName = null;
|
|
|
317 |
return false;
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
|
|
|
321 |
|
|
|
322 |
public string user_selected_requirement_type()
|
|
|
323 |
{
|
|
|
324 |
return (string)comboBox_ReqType.SelectedItem;
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
public ExportExtent user_selected_export_extent()
|
|
|
329 |
{
|
|
|
330 |
return (ExportExtent)comboBox_ExportExtent.SelectedIndex;
|
|
|
331 |
}
|
|
|
332 |
|
|
|
333 |
|
|
|
334 |
#endregion
|
|
|
335 |
|
|
|
336 |
private void textBox_newFolder_TextChanged(object sender, System.EventArgs e)
|
|
|
337 |
{
|
|
|
338 |
checkBox_createFolder.Checked = true;
|
|
|
339 |
}
|
|
|
340 |
|
|
|
341 |
}
|
|
|
342 |
}
|