public frmRefSelector(UseCase caller, Model model, Localizer localizer) { // // Necessario per il supporto di Progettazione Windows Form // InitializeComponent(); // // TODO: aggiungere il codice del costruttore dopo la chiamata a InitializeComponent // this.caller = caller; this.model = model; this.localizer = localizer; this.localizer.LocalizeControls(this); this.lblUpperUseCase.Text = caller.Name; this.lblLowerUseCase.Text = ""; this.selected = null; this.btnOK.Enabled = false; this.btnSwap.Enabled = false; }
public void RemoveMappedUseCase(UseCase useCase) { ReferencedObject refobj = (ReferencedObject)this.MappedUseCases.FindByUniqueID(useCase.UniqueID); if(refobj != null) { this.MappedUseCases.Remove(refobj); } }
public void AddMappedUseCase(UseCase useCase) { ReferencedObject refobj = new ReferencedObject(); refobj.UniqueID = useCase.UniqueID; this.MappedUseCases.Add(refobj); }
private void UpdateUCList(UseCase useCase) { for(int counter = 0; counter < useCase.Steps.Count; counter++) { Step step = (Step)useCase.Steps[counter]; if(step.Dependency.Type != DependencyItem.ReferenceType.None) { UCList.Items[counter].ReadOnly = true; UCList.Items[counter].IndexImage = imgListSteps.Images[3]; } else { switch(step.Type) { case Step.StepType.Default: UCList.Items[counter].IndexImage = imgListSteps.Images[0]; break; case Step.StepType.Alternative: UCList.Items[counter].IndexImage = imgListSteps.Images[1]; break; case Step.StepType.AlternativeChild: UCList.Items[counter].IndexImage = imgListSteps.Images[2]; break; default: break; } } } }
public Int32 InsertStep( Step previousStep, String stereotype, UseCase referencedUseCase, DependencyItem.ReferenceType referenceType) { Step step = new Step(); Int32 ret; if(referenceType != DependencyItem.ReferenceType.None) { step.Dependency.Stereotype = stereotype; step.Dependency.PartnerUniqueID = referencedUseCase.UniqueID; step.Dependency.Type = referenceType; step.Description = (step.Dependency.Stereotype != "") ? "<<" + step.Dependency.Stereotype + ">>" : ""; step.Description += " \""; step.Description += referencedUseCase.Name; step.Description += "\""; } if(previousStep.Type == Step.StepType.Default) { step.ID = previousStep.ID; foreach(Step tmpStep in this.steps) { if(tmpStep.ID >= step.ID) { tmpStep.ID += 1; } } } else if(previousStep.Type == Step.StepType.Alternative) { step.Prefix = previousStep.Prefix; if(step.Prefix == String.Empty) { step.Prefix = "A"; } step.ID = previousStep.ID; step.Type = Step.StepType.Alternative; foreach(Step tmpStep in this.steps) { if(tmpStep.ID == step.ID) { if(tmpStep.Prefix != String.Empty && tmpStep.Prefix.CompareTo(step.Prefix) >= 0) { Char nextChar = tmpStep.Prefix[0]; nextChar++; tmpStep.Prefix = new String(nextChar,1); } } } } else if(previousStep.Type == Step.StepType.AlternativeChild) { step.Type = Step.StepType.AlternativeChild; step.ID = previousStep.ID; step.Prefix = previousStep.Prefix; step.ChildID = previousStep.ChildID; foreach(Step tmpStep in this.steps) { if(tmpStep.ID == step.ID && tmpStep.Prefix == step.Prefix) { if(tmpStep.ChildID >= step.ChildID) { tmpStep.ChildID += 1; } } } } int index = this.FindStepIndexByUniqueID(previousStep.UniqueID); this.steps.Insert(index,step); ret = index; return ret; }
public Int32 AddStep( Step previousStep, Step.StepType type, String stereotype, UseCase referencedUseCase, DependencyItem.ReferenceType referenceType) { Step step = new Step(); Int32 index; Int32 ret; if(referenceType != DependencyItem.ReferenceType.None) { step.Dependency.Stereotype = stereotype; step.Dependency.PartnerUniqueID = referencedUseCase.UniqueID; step.Dependency.Type = referenceType; step.Description = (step.Dependency.Stereotype != "") ? "<<" + step.Dependency.Stereotype + ">>" : ""; step.Description += " \""; step.Description += referencedUseCase.Name; step.Description += "\""; } if(previousStep == null) { step.ID = 1; ret = this.steps.Add(step); return ret; } else { switch(type) { case Step.StepType.Default: if(previousStep.Type == Step.StepType.Default) { step.ID = previousStep.ID; index = this.FindStepIndexByUniqueID(previousStep.UniqueID) + 1; while(true) { if(index == this.steps.Count) { previousStep = (Step)this.steps[index - 1]; break; } Step tmpStep = (Step)this.steps[index]; if(tmpStep.ID != step.ID) { previousStep = (Step)this.steps[index - 1]; break; } index += 1; } step.ID = previousStep.ID + 1; foreach(Step tmpStep in this.steps) { if(tmpStep.ID >= step.ID) { tmpStep.ID += 1; } } } else if(previousStep.Type == Step.StepType.Alternative) { step.ID = previousStep.ID; step.Type = Step.StepType.Alternative; index = this.FindStepIndexByUniqueID(previousStep.UniqueID) + 1; while(true) { if(index == this.steps.Count) { previousStep = (Step)this.steps[index - 1]; break; } Step tmpStep = (Step)this.steps[index]; if(tmpStep.ID != step.ID || tmpStep.Prefix == String.Empty) { previousStep = (Step)this.steps[index - 1]; break; } index += 1; } step.Prefix = previousStep.Prefix; if(step.Prefix != String.Empty) { Char nextChar = step.Prefix[0]; nextChar++; step.Prefix = new String(nextChar,1); } else { step.Prefix = "A"; } foreach(Step tmpStep in this.steps) { if(tmpStep.ID == step.ID) { if(tmpStep.Prefix != String.Empty && tmpStep.Prefix.CompareTo(step.Prefix) >= 0) { Char nextChar = tmpStep.Prefix[0]; nextChar++; tmpStep.Prefix = new String(nextChar,1); } } } } else if(previousStep.Type == Step.StepType.AlternativeChild) { step.Type = Step.StepType.AlternativeChild; step.ID = previousStep.ID; step.Prefix = previousStep.Prefix; index = this.FindStepIndexByUniqueID(previousStep.UniqueID) + 1; while(true) { if(index == this.steps.Count) { previousStep = (Step)this.steps[index - 1]; break; } Step tmpStep = (Step)this.steps[index]; if(tmpStep.ID != step.ID || tmpStep.Prefix != step.Prefix) { previousStep = (Step)this.steps[index - 1]; break; } index += 1; } step.Prefix = previousStep.Prefix; step.ChildID = previousStep.ChildID + 1; } break; case Step.StepType.Alternative: if(previousStep.Type == Step.StepType.Default) { step.ID = previousStep.ID; step.Type = Step.StepType.Alternative; index = this.FindStepIndexByUniqueID(previousStep.UniqueID) + 1; while(true) { if(index == this.steps.Count) { previousStep = (Step)this.steps[index - 1]; break; } Step tmpStep = (Step)this.steps[index]; if(tmpStep.ID != step.ID || tmpStep.Prefix == String.Empty) { previousStep = (Step)this.steps[index - 1]; break; } index += 1; } step.Prefix = previousStep.Prefix; if(step.Prefix != String.Empty) { Char nextChar = step.Prefix[0]; nextChar++; step.Prefix = new String(nextChar,1); } else { step.Prefix = "A"; } foreach(Step tmpStep in this.steps) { if(tmpStep.ID == step.ID) { if(tmpStep.Prefix != String.Empty && tmpStep.Prefix.CompareTo(step.Prefix) >= 0) { Char nextChar = tmpStep.Prefix[0]; nextChar++; tmpStep.Prefix = new String(nextChar,1); } } } } else if(previousStep.Type == Step.StepType.Alternative) { step.Type = Step.StepType.AlternativeChild; step.ID = previousStep.ID; step.Prefix = previousStep.Prefix; step.ChildID = 1; } break; } } index = this.FindStepIndexByUniqueID(previousStep.UniqueID) + 1; if(index == this.steps.Count) { ret = this.steps.Add(step); } else { this.steps.Insert(index, step); ret = index; } return ret; }
public void RemoveUseCase( UseCase useCase, String oldNameStartTag, String oldNameEndTag, String newNameStartTag, String newNameEndTag, Boolean dontMarkOccurrences) { this.PurgeReferences( useCase, null, oldNameStartTag, oldNameEndTag, newNameStartTag, newNameEndTag, dontMarkOccurrences); UseCases.Remove(useCase); }
public UseCase NewUseCase(String name, String prefix, Int32 id) { UseCase useCase = new UseCase(name,prefix,id,this); return useCase; }
public void AddUseCase(UseCase useCase) { useCase.Owner = this; UseCases.Add(useCase); }
private void btnSelectUseCase_Click(object sender, EventArgs e) { frmChooser frm = new frmChooser( this.model, this.localizer, this.localizer.GetValue("Globals", "UseCase")); frm.ShowActors = false; frm.ShowUseCases = true; frm.PackageSelectionIsValid = false; frm.UseCaseSelectionIsValid = true; frm.ActorSelectionIsValid = false; frm.Initialize(); if(frm.ShowDialog(this) == DialogResult.OK) { this.selected = (UseCase)frm.SelectedElement; this.lblUpperUseCase.Text = caller.Name; this.lblLowerUseCase.Text = selected.Name; this.btnOK.Enabled = true; this.btnSwap.Enabled = true; } frm.Dispose(); }
private void tvModelBrowser_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { TreeNode node = tvModelBrowser.SelectedNode; object element = model.FindElementByUniqueID((String)node.Tag); if(element.GetType() == typeof(UseCase)) { selected = (UseCase)element; this.lblUpperUseCase.Text = caller.Name; this.lblLowerUseCase.Text = selected.Name; this.btnOK.Enabled = true; this.btnSwap.Enabled = true; } }