public void Remove(HighlightDescriptor value)
 {
     items.Remove(value);
 }
 public bool Contains(HighlightDescriptor value)
 {
     return(items.Contains(value));
 }
Esempio n. 3
0
		private void btnAddGlossaryItem_Click(object sender, System.EventArgs e)
		{
			frmCreator frm = new frmCreator(this.localizer,this.localizer.GetValue("Globals","GlossaryItem"));
			if(frm.ShowDialog(this) == DialogResult.OK)
			{
				Model model = (Model)this.currentElement;
				GlossaryItem gi = 
					model.NewGlossaryItem(frm.tbName.Text,defaultGPrefix,model.Glossary.GetNextFreeID());
				model.AddGlossaryItem(gi);
				model.Glossary.Sorted("Name");

				this.Cursor = Cursors.WaitCursor;
				GList.DataBind();
				this.Cursor = Cursors.Default;

				for(int counter = 0; counter < model.Glossary.Count; counter++)
				{
					if((string)GList.Items[counter].Tag == gi.UniqueID)
					{
						GList.SelectedIndex = counter;
					}
				}
				
				string sub = "\"" + gi.Name + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new 
					HighlightDescriptor(sub,Color.Green,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
				this.SetModified(true);
			}
			frm.Dispose();
		}
 public void Insert(int index, HighlightDescriptor value)
 {
     items.Insert(index, value);
 }
Esempio n. 5
0
		/**
		 * @brief Gestione del modello
		 * 
		 * Aggiunge un elemento alla struttura del modello tramite
		 * il business dell'applicazione.
		 * @param element Elemento da aggiungere
		 * @param owner Elemento a cui appartiene l'elemento da aggiungere
		 * @addToParent Flag che stabilisce se l'elemento è gia collegato al genitore
		 */
		private void AddElement(object element, object owner, bool addToParent)
		{
			String ownerUniqueID = String.Empty;
			string sub = null;

			if(element.GetType() == typeof(Model))
			{
				Model model = (Model)element;
				tvModelBrowser.Nodes.Clear();
				TreeNode node = new TreeNode(model.Name + " (" + model.ElementID + ")");
				node.Tag = model.UniqueID;
				tvModelBrowser.Nodes.Add(node);
				tvModelBrowser.SelectedNode = node;
				TreeNode ownerNode = node;
				node = new TreeNode(this.localizer.GetValue("Globals","Actors"),1,1);
				node.Tag = model.Actors.UniqueID;
				ownerNode.Nodes.Add(node);
				node = new TreeNode(this.localizer.GetValue("Globals","UseCases"),2,2);
				node.Tag = model.UseCases.UniqueID;
				ownerNode.Nodes.Add(node);
				sub = "\"" + model.Path + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new HighlightDescriptor(sub,Color.DarkGray,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
				sub = "\"" + model.Name + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				hd = new HighlightDescriptor(sub,Color.Red,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
			}

			if(element.GetType() == typeof(Package))
			{
				Package package = (Package)element;
				ownerUniqueID = ((Package)owner).UniqueID;
				if(addToParent)
				{
					((Package)owner).AddPackage(package);
				}
				TreeNode node = new TreeNode(package.Name + " (" + package.ElementID + ")");
				node.Tag = package.UniqueID;
				TreeNode ownerNode = this.FindNode(null,ownerUniqueID);
				if(ownerNode != null)
				{
					ownerNode.Nodes.Add(node);
					tvModelBrowser.SelectedNode = node;
					ownerNode = node;
					node = new TreeNode(this.localizer.GetValue("Globals","Actors"),1,1);
					node.Tag = package.Actors.UniqueID;
					ownerNode.Nodes.Add(node);
					node = new TreeNode(this.localizer.GetValue("Globals","UseCases"),2,2);
					node.Tag = package.UseCases.UniqueID;
					ownerNode.Nodes.Add(node);
				}
				sub = "\"" + package.Path + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new HighlightDescriptor(sub,Color.DarkGray,null,DescriptorType.Word,DescriptorRecognition.WholeWord,false);
				this.hdc.Add(hd);
				sub = "\"" + package.Name + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				hd = new HighlightDescriptor(sub,Color.Red,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
			}

			if(element.GetType() == typeof(Actor))
			{
				Actor actor = (Actor)element;
				Package package = (Package)owner;
				if(addToParent)
				{
					package.AddActor(actor);
				}
				TreeNode node = new TreeNode(actor.Name + " (" + actor.ElementID + ")",3,3);
				node.Tag = actor.UniqueID;
				TreeNode ownerNode = this.FindNode(null,package.UniqueID);
				if(ownerNode != null)
				{
					foreach(TreeNode subNode in ownerNode.Nodes)
					{
						if((String)subNode.Tag == package.Actors.UniqueID)
						{
							subNode.Nodes.Add(node);
							tvModelBrowser.SelectedNode = node;
							break;
						}
					}
				}
				sub = "\"" + actor.Path + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new HighlightDescriptor(sub,Color.DarkGray,null,DescriptorType.Word,DescriptorRecognition.WholeWord,false);
				this.hdc.Add(hd);
				sub = "\"" + actor.Name + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				hd = new HighlightDescriptor(sub,Color.Red,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
			}

			if(element.GetType() == typeof(UseCase))
			{
				UseCase useCase = (UseCase)element;
				Package package = (Package)owner;
				if(addToParent)
				{
					package.AddUseCase(useCase);
				}
				TreeNode node = new TreeNode(useCase.Name + " (" + useCase.ElementID + ")",4,4);
				node.Tag = useCase.UniqueID;
				TreeNode ownerNode = this.FindNode(null,package.UniqueID);
				if(ownerNode != null)
				{
					foreach(TreeNode subNode in ownerNode.Nodes)
					{
						if((String)subNode.Tag == package.UseCases.UniqueID)
						{
							subNode.Nodes.Add(node);
							tvModelBrowser.SelectedNode = node;
							break;
						}
					}
				}
				sub = "\"" + useCase.Path + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new HighlightDescriptor(sub,Color.DarkGray,null,DescriptorType.Word,DescriptorRecognition.WholeWord,false);
				this.hdc.Add(hd);
				sub = "\"" + useCase.Name + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				hd = new HighlightDescriptor(sub,Color.Red,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);
			}

			this.SetModified(true);
		}
Esempio n. 6
0
		private string ElementNameChange(IdentificableObject ia)
		{
			string type = string.Empty;

			if(ia.GetType() == typeof(Model))
			{
				type = this.localizer.GetValue("Globals","Model");
			}
			if(ia.GetType() == typeof(Package))
			{
				type = this.localizer.GetValue("Globals","Package");
			}
			if(ia.GetType() == typeof(Actor))
			{
				type = this.localizer.GetValue("Globals","Actor");
			}
			if(ia.GetType() == typeof(UseCase))
			{
				type = this.localizer.GetValue("Globals","UseCase");
			}
			if(ia.GetType() == typeof(GlossaryItem))
			{
				type = this.localizer.GetValue("Globals","GlossaryItem");
			}

			frmNameChanger frm = new frmNameChanger(this.localizer,type);
			frm.lblOldName.Text = ia.Name;

			if(frm.ShowDialog(this) == DialogResult.OK)
			{
				string token = "\"" + frm.lblOldName.Text + "\"";
				token = token.Replace(" ","\t");
				token = token.Replace(".","\v");

				RemoveHighlightDescriptor(token,string.Empty);

				string sub = "\"" + frm.tbNewName.Text + "\"";
				sub = sub.Replace(" ","\t");
				sub = sub.Replace(".","\v");
				HighlightDescriptor hd = new 
					HighlightDescriptor(sub,Color.Red,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
				this.hdc.Add(hd);

				if(!frm.cbNoReplace.Checked)
				{
					model.ReplaceElementName(
						frm.lblOldName.Text,
						"\"",
						"\"",
						frm.tbNewName.Text,
						"\"",
						"\"");
					if(this.currentElement.GetType() == typeof(UseCase))
					{
						this.UpdateView();
						tabUseCase.SelectedTab = this.pgUCGeneral;
					}
				}

				ia.Name = frm.tbNewName.Text;

				// Glossary must be always sorted
				if(ia.GetType() == typeof(GlossaryItem))
				{
					model.Glossary.Sorted("Name");
					this.Cursor = Cursors.WaitCursor;
					GList.DataBind();
					this.Cursor = Cursors.Default;
				}
				
				this.SetModified(true);
			}
			frm.Dispose();
			return ia.Name;
		}
Esempio n. 7
0
        public string ElementNameChange(IdentificableObject ia)
        {
            string type = string.Empty;
            Color hdcolor = Color.Red;

            if(ia.GetType() == typeof(Model))
            {
                type = this.localizer.GetValue("Globals","Model");
            }
            if(ia.GetType() == typeof(Package))
            {
                type = this.localizer.GetValue("Globals","Package");
            }
            if(ia.GetType() == typeof(Actor))
            {
                type = this.localizer.GetValue("Globals","Actor");
            }
            if(ia.GetType() == typeof(UseCase))
            {
                type = this.localizer.GetValue("Globals","UseCase");
            }
            if(ia.GetType() == typeof(GlossaryItem))
            {
                type = this.localizer.GetValue("Globals","GlossaryItem");
                hdcolor = Color.Green;
            }
            if(ia.GetType() == typeof(Stakeholder))
            {
                type = this.localizer.GetValue("Globals", "Stakeholder");
                hdcolor = Color.Blue;
            }

            frmNameChanger frm = new frmNameChanger(this.localizer,type);
            frm.lblOldName.Text = ia.Name;

            if(frm.ShowDialog(this) == DialogResult.OK)
            {
                string token = "\"" + frm.lblOldName.Text + "\"";
                token = token.Replace(" ","\t");
                token = token.Replace(".","\v");

                RemoveHighlightDescriptor(token,string.Empty);

                string sub = "\"" + frm.tbNewName.Text + "\"";
                sub = sub.Replace(" ","\t");
                sub = sub.Replace(".","\v");
                HighlightDescriptor hd = new
                    HighlightDescriptor(sub,hdcolor,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
                this.hdc.Add(hd);

                if(!frm.cbNoReplace.Checked)
                {
                    model.ReplaceElementName(
                        frm.lblOldName.Text,
                        "\"",
                        "\"",
                        frm.tbNewName.Text,
                        "\"",
                        "\"");
                    if (dockPanel.ActiveDocument != null)
                    {
                        ((frmTabView)dockPanel.ActiveDocument.DockHandler.Form).UpdateView();
                    }
                }

                ia.Name = frm.tbNewName.Text;

                foreach (IDockContent content in this.dockPanel.Documents)
                {
                    if (content.DockHandler.TabText == frm.lblOldName.Text)
                    {
                        content.DockHandler.TabText = frm.tbNewName.Text;
                    }
                    ((frmTabView)content.DockHandler.Form).UpdateView();
                }

                this.SetModified(true);
            }
            frm.Dispose();
            return ia.Name;
        }
		public void Remove(HighlightDescriptor value)
		{
			items.Remove(value);
		}
Esempio n. 9
0
 public void AddGlossaryItemHD(String glossaryItem)
 {
     String token = "\"" + glossaryItem + "\"";
     token = token.Replace(" ", "\t");
     token = token.Replace(".", "\v");
     HighlightDescriptor hd = new
         HighlightDescriptor(token, Color.Green, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true);
     this.hdc.Add(hd);
 }
Esempio n. 10
0
 public void AddStakeholderHD(String stakeholder)
 {
     String token = "\"" + stakeholder + "\"";
     token = token.Replace(" ", "\t");
     token = token.Replace(".", "\v");
     HighlightDescriptor hd = new
         HighlightDescriptor(token, Color.Blue, null, DescriptorType.Word, DescriptorRecognition.WholeWord, true);
     this.hdc.Add(hd);
 }
		public int Add(HighlightDescriptor value)
		{
			return items.Add(value);
		}
		public int IndexOf(HighlightDescriptor value)
		{
			return items.IndexOf(value);
		}
		public bool Contains(HighlightDescriptor value)
		{
			return items.Contains(value);
		}
 public int IndexOf(HighlightDescriptor value)
 {
     return(items.IndexOf(value));
 }
Esempio n. 15
0
		/**
		 * @brief Visualizzazione del modello
		 * 
		 * Costruisce la vista ad albero che riflette la struttura del modello
		 * correntemente in uso
		 */
		private void BuildView(object element)
		{
			if(element.GetType() == typeof(Model))
			{
				Model model = (Model)element;
				AddElement(model,null,false);
				foreach(Actor actor in model.Actors.Sorted("ID"))
				{
					actor.Owner = model;
					AddElement(actor,actor.Owner,false);
				}
				foreach(UseCase useCase in model.UseCases.Sorted("ID"))
				{
					useCase.Owner = model;
					AddElement(useCase,useCase.Owner,false);
				}
				foreach(Package subPackage in model.Packages.Sorted("ID"))
				{
					subPackage.Owner = model;
					BuildView(subPackage);
				}
				foreach(GlossaryItem gi in model.Glossary.Sorted("Name"))
				{
					gi.Owner = model;
					string sub = "\"" + gi.Name + "\"";
					sub = sub.Replace(" ","\t");
					sub = sub.Replace(".","\v");
					HighlightDescriptor hd = new 
						HighlightDescriptor(sub,Color.Green,null,DescriptorType.Word,DescriptorRecognition.WholeWord,true);
					this.hdc.Add(hd);
				}
			}
			if(element.GetType() == typeof(Package))
			{
				Package package = (Package)element;
				AddElement(package,package.Owner,false);
				foreach(Actor actor in package.Actors.Sorted("ID"))
				{
					actor.Owner = package;
					AddElement(actor,actor.Owner,false);
				}
				foreach(UseCase useCase in package.UseCases.Sorted("ID"))
				{
					useCase.Owner = package;
					AddElement(useCase,useCase.Owner,false);
				}
				foreach(Package subPackage in package.Packages.Sorted("ID"))
				{
					subPackage.Owner = package;
					BuildView(subPackage);
				}
			}
		}
 public int Add(HighlightDescriptor value)
 {
     return(items.Add(value));
 }
		public void Insert(int index, HighlightDescriptor value)
		{
			items.Insert(index, value);
		}