Rev 2098 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;namespace EA_DocGen{/// <summary>/// Summary description for EA_DocGenOptionsForm./// </summary>public class EA_DocGenOptionsForm : System.Windows.Forms.Form{private System.Windows.Forms.Button buttonCancel;private System.Windows.Forms.Button buttonOK;private System.Windows.Forms.GroupBox groupBoxRequirements;private System.Windows.Forms.RadioButton radioButtonReqDefault;private System.Windows.Forms.RadioButton radioButtonReqSections;private System.Windows.Forms.RadioButton radioButtonReqFormat;private System.Windows.Forms.TextBox textBox_ReqFormat;private System.Windows.Forms.GroupBox groupBoxElementTypes;private System.Windows.Forms.Button button_ET_All;private System.Windows.Forms.Button button_ET_None;private System.Windows.Forms.CheckedListBox checkedListBox_ETs;private System.Windows.Forms.Button buttonDefault;private System.Windows.Forms.Label label1;private System.Windows.Forms.TextBox textBoxNumParaTransition;private System.Windows.Forms.CheckBox checkBox_SuppressEleDescMissWarn;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateClasses;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateMethods;private System.Windows.Forms.CheckBox checkBox_SuppressPrivateAttrs;/// <summary>/// Required designer variable./// </summary>private System.ComponentModel.Container components = null;public EA_DocGenOptionsForm(){//// Required for Windows Form Designer support//InitializeComponent();//// TODO: Add any constructor code after InitializeComponent call//}/// <summary>/// Clean up any resources being used./// </summary>protected override void Dispose( bool disposing ){if( disposing ){if(components != null){components.Dispose();}}base.Dispose( disposing );}#region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>private void InitializeComponent(){this.buttonCancel = new System.Windows.Forms.Button();this.buttonOK = new System.Windows.Forms.Button();this.groupBoxRequirements = new System.Windows.Forms.GroupBox();this.textBox_ReqFormat = new System.Windows.Forms.TextBox();this.radioButtonReqFormat = new System.Windows.Forms.RadioButton();this.radioButtonReqSections = new System.Windows.Forms.RadioButton();this.radioButtonReqDefault = new System.Windows.Forms.RadioButton();this.checkedListBox_ETs = new System.Windows.Forms.CheckedListBox();this.groupBoxElementTypes = new System.Windows.Forms.GroupBox();this.buttonDefault = new System.Windows.Forms.Button();this.button_ET_None = new System.Windows.Forms.Button();this.button_ET_All = new System.Windows.Forms.Button();this.label1 = new System.Windows.Forms.Label();this.textBoxNumParaTransition = new System.Windows.Forms.TextBox();this.checkBox_SuppressEleDescMissWarn = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateClasses = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateMethods = new System.Windows.Forms.CheckBox();this.checkBox_SuppressPrivateAttrs = new System.Windows.Forms.CheckBox();this.groupBoxRequirements.SuspendLayout();this.groupBoxElementTypes.SuspendLayout();this.SuspendLayout();//// buttonCancel//this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;this.buttonCancel.Location = new System.Drawing.Point(328, 584);this.buttonCancel.Name = "buttonCancel";this.buttonCancel.Size = new System.Drawing.Size(96, 24);this.buttonCancel.TabIndex = 0;this.buttonCancel.Text = "Cancel";//// buttonOK//this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;this.buttonOK.Location = new System.Drawing.Point(216, 584);this.buttonOK.Name = "buttonOK";this.buttonOK.Size = new System.Drawing.Size(96, 24);this.buttonOK.TabIndex = 1;this.buttonOK.Text = "OK";//// groupBoxRequirements//this.groupBoxRequirements.Controls.Add(this.textBox_ReqFormat);this.groupBoxRequirements.Controls.Add(this.radioButtonReqFormat);this.groupBoxRequirements.Controls.Add(this.radioButtonReqSections);this.groupBoxRequirements.Controls.Add(this.radioButtonReqDefault);this.groupBoxRequirements.Location = new System.Drawing.Point(16, 24);this.groupBoxRequirements.Name = "groupBoxRequirements";this.groupBoxRequirements.Size = new System.Drawing.Size(408, 120);this.groupBoxRequirements.TabIndex = 2;this.groupBoxRequirements.TabStop = false;this.groupBoxRequirements.Text = "Requirement Element Handling";//// textBox_ReqFormat//this.textBox_ReqFormat.Location = new System.Drawing.Point(176, 82);this.textBox_ReqFormat.Name = "textBox_ReqFormat";this.textBox_ReqFormat.Size = new System.Drawing.Size(216, 22);this.textBox_ReqFormat.TabIndex = 3;this.textBox_ReqFormat.Text = "[REQUIREMENT: %s]";//// radioButtonReqFormat//this.radioButtonReqFormat.Location = new System.Drawing.Point(16, 80);this.radioButtonReqFormat.Name = "radioButtonReqFormat";this.radioButtonReqFormat.Size = new System.Drawing.Size(152, 24);this.radioButtonReqFormat.TabIndex = 2;this.radioButtonReqFormat.Text = "Display with format:";//// radioButtonReqSections//this.radioButtonReqSections.Location = new System.Drawing.Point(16, 56);this.radioButtonReqSections.Name = "radioButtonReqSections";this.radioButtonReqSections.Size = new System.Drawing.Size(376, 24);this.radioButtonReqSections.TabIndex = 1;this.radioButtonReqSections.Text = "Display as sections (each requirement is a section)";//// radioButtonReqDefault//this.radioButtonReqDefault.Checked = true;this.radioButtonReqDefault.Location = new System.Drawing.Point(16, 32);this.radioButtonReqDefault.Name = "radioButtonReqDefault";this.radioButtonReqDefault.Size = new System.Drawing.Size(152, 24);this.radioButtonReqDefault.TabIndex = 0;this.radioButtonReqDefault.TabStop = true;this.radioButtonReqDefault.Text = "Default (style based)";//// checkedListBox_ETs//this.checkedListBox_ETs.Location = new System.Drawing.Point(32, 192);this.checkedListBox_ETs.Name = "checkedListBox_ETs";this.checkedListBox_ETs.Size = new System.Drawing.Size(272, 208);this.checkedListBox_ETs.TabIndex = 3;//// groupBoxElementTypes//this.groupBoxElementTypes.Controls.Add(this.buttonDefault);this.groupBoxElementTypes.Controls.Add(this.button_ET_None);this.groupBoxElementTypes.Controls.Add(this.button_ET_All);this.groupBoxElementTypes.Location = new System.Drawing.Point(16, 160);this.groupBoxElementTypes.Name = "groupBoxElementTypes";this.groupBoxElementTypes.Size = new System.Drawing.Size(408, 256);this.groupBoxElementTypes.TabIndex = 4;this.groupBoxElementTypes.TabStop = false;this.groupBoxElementTypes.Text = "Element Types to be serialised to document";//// buttonDefault//this.buttonDefault.Location = new System.Drawing.Point(304, 128);this.buttonDefault.Name = "buttonDefault";this.buttonDefault.Size = new System.Drawing.Size(88, 23);this.buttonDefault.TabIndex = 2;this.buttonDefault.Text = "Defaults";this.buttonDefault.Click += new System.EventHandler(this.buttonDefault_Click);//// button_ET_None//this.button_ET_None.Location = new System.Drawing.Point(304, 72);this.button_ET_None.Name = "button_ET_None";this.button_ET_None.Size = new System.Drawing.Size(88, 23);this.button_ET_None.TabIndex = 1;this.button_ET_None.Text = "DeSelect All";this.button_ET_None.Click += new System.EventHandler(this.button_ET_None_Click);//// button_ET_All//this.button_ET_All.Location = new System.Drawing.Point(304, 32);this.button_ET_All.Name = "button_ET_All";this.button_ET_All.Size = new System.Drawing.Size(88, 24);this.button_ET_All.TabIndex = 0;this.button_ET_All.Text = "Select All";this.button_ET_All.Click += new System.EventHandler(this.button_ET_All_Click);//// label1//this.label1.Location = new System.Drawing.Point(16, 528);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(224, 40);this.label1.TabIndex = 5;this.label1.Text = "Transition to NumPara style at level (0 denotes no transition)";//// textBoxNumParaTransition//this.textBoxNumParaTransition.Location = new System.Drawing.Point(248, 528);this.textBoxNumParaTransition.Name = "textBoxNumParaTransition";this.textBoxNumParaTransition.Size = new System.Drawing.Size(40, 22);this.textBoxNumParaTransition.TabIndex = 6;this.textBoxNumParaTransition.Text = "0";//// checkBox_SuppressEleDescMissWarn//this.checkBox_SuppressEleDescMissWarn.Location = new System.Drawing.Point(16, 496);this.checkBox_SuppressEleDescMissWarn.Name = "checkBox_SuppressEleDescMissWarn";this.checkBox_SuppressEleDescMissWarn.Size = new System.Drawing.Size(336, 16);this.checkBox_SuppressEleDescMissWarn.TabIndex = 7;this.checkBox_SuppressEleDescMissWarn.Text = "Suppress Element Description Missing Warnings";//// checkBox_SuppressPrivateClasses//this.checkBox_SuppressPrivateClasses.Location = new System.Drawing.Point(16, 464);this.checkBox_SuppressPrivateClasses.Name = "checkBox_SuppressPrivateClasses";this.checkBox_SuppressPrivateClasses.Size = new System.Drawing.Size(192, 24);this.checkBox_SuppressPrivateClasses.TabIndex = 8;this.checkBox_SuppressPrivateClasses.Text = "Suppress Private Classes";//// checkBox_SuppressPrivateMethods//this.checkBox_SuppressPrivateMethods.Location = new System.Drawing.Point(16, 432);this.checkBox_SuppressPrivateMethods.Name = "checkBox_SuppressPrivateMethods";this.checkBox_SuppressPrivateMethods.Size = new System.Drawing.Size(184, 24);this.checkBox_SuppressPrivateMethods.TabIndex = 9;this.checkBox_SuppressPrivateMethods.Text = "Suppress Private Methods";//// checkBox_SuppressPrivateAttrs//this.checkBox_SuppressPrivateAttrs.Location = new System.Drawing.Point(216, 432);this.checkBox_SuppressPrivateAttrs.Name = "checkBox_SuppressPrivateAttrs";this.checkBox_SuppressPrivateAttrs.Size = new System.Drawing.Size(192, 24);this.checkBox_SuppressPrivateAttrs.TabIndex = 10;this.checkBox_SuppressPrivateAttrs.Text = "Suppress Private Attributes";//// EA_DocGenOptionsForm//this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);this.ClientSize = new System.Drawing.Size(440, 624);this.Controls.Add(this.checkBox_SuppressPrivateAttrs);this.Controls.Add(this.checkBox_SuppressPrivateMethods);this.Controls.Add(this.checkBox_SuppressPrivateClasses);this.Controls.Add(this.checkBox_SuppressEleDescMissWarn);this.Controls.Add(this.textBoxNumParaTransition);this.Controls.Add(this.label1);this.Controls.Add(this.checkedListBox_ETs);this.Controls.Add(this.groupBoxRequirements);this.Controls.Add(this.buttonOK);this.Controls.Add(this.buttonCancel);this.Controls.Add(this.groupBoxElementTypes);this.Name = "EA_DocGenOptionsForm";this.Text = "EA_DocGenOptionsForm";this.groupBoxRequirements.ResumeLayout(false);this.groupBoxElementTypes.ResumeLayout(false);this.ResumeLayout(false);}#endregionpublic void populate(EA.Repository EA_Repository, EA_DocGenOptions options){EA.ObjectType objType;object obj;objType = EA_Repository.GetTreeSelectedItem( out obj );if (objType == EA.ObjectType.otElement){EA.Element ele = (EA.Element)obj;if (0 == ele.Name.CompareTo(EA_Constants.EA_DocGenBaseName)){if (options.opt_DisplayRequirementElementsAsSections == true){radioButtonReqSections.Checked = true;}else if (options.opt_DisplayRequirementsWithStatus == true){radioButtonReqDefault.Checked = true;}else{radioButtonReqFormat.Checked = true;textBox_ReqFormat.Text = options.opt_RequirementElementDisplayFormat;}textBoxNumParaTransition.Text = options.opt_ElementHeadingTransitionLevel.ToString();CheckState defState;if (options.opt_ElementTypes.Count > 0)defState = CheckState.Unchecked;elsedefState = CheckState.Checked;checkedListBox_ETs.Items.Add("Action", defState);checkedListBox_ETs.Items.Add("Activity", defState);checkedListBox_ETs.Items.Add("ActivityPartition", defState);checkedListBox_ETs.Items.Add("ActivityRegion", defState);checkedListBox_ETs.Items.Add("Actor", defState);checkedListBox_ETs.Items.Add("Artifact", defState);checkedListBox_ETs.Items.Add("Association", defState);checkedListBox_ETs.Items.Add("Boundary", defState);checkedListBox_ETs.Items.Add("Change", defState);checkedListBox_ETs.Items.Add("Class", defState);checkedListBox_ETs.Items.Add("Collaboration", defState);checkedListBox_ETs.Items.Add("Component", defState);checkedListBox_ETs.Items.Add("Constraint", defState);checkedListBox_ETs.Items.Add("Decision", defState);checkedListBox_ETs.Items.Add("DeploymentSpecification", defState);checkedListBox_ETs.Items.Add("DiagramFrame", defState);checkedListBox_ETs.Items.Add("EmbeddedElement", defState);checkedListBox_ETs.Items.Add("Entity", defState);checkedListBox_ETs.Items.Add("EntryPoint", defState);checkedListBox_ETs.Items.Add("Event", defState);checkedListBox_ETs.Items.Add("ExceptionHandler", defState);checkedListBox_ETs.Items.Add("ExitPoint", defState);checkedListBox_ETs.Items.Add("ExpansionNode", defState);checkedListBox_ETs.Items.Add("ExpansionRegion", defState);checkedListBox_ETs.Items.Add("GUIElement", defState);checkedListBox_ETs.Items.Add("InteractionFragment", defState);checkedListBox_ETs.Items.Add("InteractionOccurrence", defState);checkedListBox_ETs.Items.Add("InteractionState", defState);checkedListBox_ETs.Items.Add("Interface", defState);checkedListBox_ETs.Items.Add("InterruptibleActivityRegion",defState);checkedListBox_ETs.Items.Add("Issue", defState);checkedListBox_ETs.Items.Add("Node", defState);checkedListBox_ETs.Items.Add("Note", defState);checkedListBox_ETs.Items.Add("Object", defState);checkedListBox_ETs.Items.Add("Package", defState);checkedListBox_ETs.Items.Add("Parameter", defState);checkedListBox_ETs.Items.Add("Part", defState);checkedListBox_ETs.Items.Add("Port", defState);checkedListBox_ETs.Items.Add("ProvidedInterface", defState);checkedListBox_ETs.Items.Add("Report", defState);checkedListBox_ETs.Items.Add("RequiredInterface", defState);checkedListBox_ETs.Items.Add("Requirement", defState);checkedListBox_ETs.Items.Add("Screen", defState);checkedListBox_ETs.Items.Add("Sequence", defState);checkedListBox_ETs.Items.Add("State", defState);checkedListBox_ETs.Items.Add("StateNode", defState);checkedListBox_ETs.Items.Add("Synchronization", defState);checkedListBox_ETs.Items.Add("Text", defState);checkedListBox_ETs.Items.Add("TimeLine", defState);checkedListBox_ETs.Items.Add("UMLDiagram", defState);checkedListBox_ETs.Items.Add("UseCase", defState);if (options.opt_ElementTypes.Count > 0){foreach(string s in options.opt_ElementTypes){int i = checkedListBox_ETs.FindStringExact(s);if (i != -1){checkedListBox_ETs.SetItemChecked(i,true);}}}checkBox_SuppressEleDescMissWarn.Checked = options.opt_SuppressElementDescriptionMissingWarnings;checkBox_SuppressPrivateClasses.Checked = options.opt_SuppressPrivateClasses;checkBox_SuppressPrivateMethods.Checked = options.opt_SuppressPrivateMethods;checkBox_SuppressPrivateAttrs.Checked = options.opt_SuppressPrivateAttributes;}}}public void read(EA.Repository EA_Repository, EA_DocGenOptions options){options.opt_RequirementElementDisplayFormat = textBox_ReqFormat.Text;if (radioButtonReqSections.Checked == true){options.opt_DisplayRequirementElementsAsSections = true;options.opt_DisplayRequirementsWithStatus = false;}else if (radioButtonReqDefault.Checked == true){options.opt_DisplayRequirementElementsAsSections = false;options.opt_DisplayRequirementsWithStatus = true;}else{options.opt_DisplayRequirementElementsAsSections = false;options.opt_DisplayRequirementsWithStatus = false;}options.opt_ElementHeadingTransitionLevel = System.Convert.ToInt32(textBoxNumParaTransition.Text);// If every item is checked then we give back an empty opt_ElementTypes list because// that indicates that the user wants everything.options.opt_ElementTypes.Clear();if (checkedListBox_ETs.CheckedItems.Count != checkedListBox_ETs.Items.Count){foreach(string s in checkedListBox_ETs.CheckedItems){options.opt_ElementTypes.Add(s);}}options.opt_SuppressElementDescriptionMissingWarnings = checkBox_SuppressEleDescMissWarn.Checked;options.opt_SuppressPrivateClasses = checkBox_SuppressPrivateClasses.Checked;options.opt_SuppressPrivateMethods= checkBox_SuppressPrivateMethods.Checked;options.opt_SuppressPrivateAttributes = checkBox_SuppressPrivateAttrs.Checked;}private void button_ET_All_Click(object sender, System.EventArgs e){int i;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, true);}}private void button_ET_None_Click(object sender, System.EventArgs e){int i;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, false);}}private void findAndCheckItem(string s){int i = checkedListBox_ETs.FindStringExact(s);if (i != -1)checkedListBox_ETs.SetItemChecked(i,true);}private void checkDefaultItems(){findAndCheckItem("Class");findAndCheckItem("Component");findAndCheckItem("Interface");findAndCheckItem("Requirement");}private void buttonDefault_Click(object sender, System.EventArgs e){int i = 0;for (i=0; i < checkedListBox_ETs.Items.Count; i++){checkedListBox_ETs.SetItemChecked(i, false);}checkDefaultItems();}}}