/// <summary> /// When removing an object we have to also remove the drawable object /// and any relations in a diagram to it. /// </summary> /// <param name="o">object to remove </param> public void removeCObject(CObject o) { int id = 0; foreach (DDTObjectMap current in objectMaps) { if (current.oId == o.ID) { id = current.ddtOId; } } removeDDTObject(id); cObjects.Remove(o); }
/// <summary> /// When adding a new CObject we need to add a drawable oject as well. /// The map will allows up to synchronized them. /// </summary> /// <param name="o"></param> public void addNewCObject(CObject o) { DDTObject newObject = new DDTObject(DDT_Obj_Type.COBJECT, o.name); cObjects.Add(o); objects.Add(newObject); objectMaps.Add(new DDTObjectMap(o.ID, newObject.ID)); }
private void chighlight_Click(object sender, EventArgs e) { label1.BackColor = Color.Gray; label1.ForeColor = Color.WhiteSmoke; chighlight.FillColor = Color.Gray; label1.BringToFront(); cpanel.Show(); clean(); cname.Clear(); list_attrib.Items.Clear(); newCObject = null; newCObject = new DDT.CObject(); //MessageBox.Show(newCObject.ID.ToString()); cname.Focus(); // we are going to create a new object. newObject = true; }
private void objectExplorer_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Level != 0) { if (e.Node.Tag.GetType() == typeof(DDT.CObject)) { newCObject = (DDT.CObject)e.Node.Tag; // MessageBox.Show("display C object gui thingy"); cname.Text = newCObject.name; list_attrib.Items.Clear(); foreach( DDT.Attribute a in newCObject.attributes) { list_attrib.Items.Add(a.name); } cpanel.Show(); //TODO add the code to fill your data. } else if (e.Node.Tag.GetType() == typeof(DDT.ADTObject)) { MessageBox.Show("display ADT object gui thingy"); } else if (e.Node.Tag.GetType() == typeof(DDT.SMObject)) { MessageBox.Show("display SM object gui thingy"); } } }
private void button_save_Click(object sender, EventArgs e) { newCObject.name = cname.Text; // MessageBox.Show(newCObject.ID.ToString()); if (newObject) { // if this a new object do the follow DDTHelper.manager.project.addNewCObject(newCObject); } // set my reference to null clean(); list_attrib.Items.Clear(); cpanel.Hide(); newCObject = null; newObject = false; }