public AssociationPropertyCtrl(AssociationPropertyDefinitionDecorator p, SchemaDesignContext context, NodeUpdateHandler updater) : this() { _context = context; _mappings = new BindingList <KeyMapping>(); _ap = p; txtName.DataBindings.Add("Text", p, "Name"); txtDescription.DataBindings.Add("Text", p, "Description"); string schema = p.DecoratedObject.Parent.Parent.Name; cmbDeleteRule.DataSource = Enum.GetValues(typeof(DeleteRule)); cmbDeleteRule.DataBindings.Add("SelectedItem", p, "DeleteRule"); var mappings = _ap.GetMappings(); cmbAssociatedClass.DisplayMember = "Name"; cmbAssociatedClass.DataSource = _context.GetClasses(schema); cmbAssociatedClass.DataBindings.Add("SelectedItem", p, "AssociatedClass"); txtMultiplicity.DataBindings.Add("Text", p, "Multiplicity"); chkReadOnly.DataBindings.Add("Checked", p, "IsReadOnly"); chkLockCascade.DataBindings.Add("Checked", p, "LockCascade"); txtReverseName.DataBindings.Add("Text", p, "ReverseName"); txtRevMultiplicity.DataBindings.Add("Text", p, "ReverseMultiplicity"); foreach (var map in mappings) { _mappings.Add(map); } grdMappings.DataSource = _mappings; _mappings.ListChanged += new ListChangedEventHandler(OnMappingsChanged); p.PropertyChanged += (s, evt) => { if (evt.PropertyName == "Name") { updater(); } }; }
public AssociationPropertyCtrl(AssociationPropertyDefinitionDecorator p, SchemaDesignContext context, NodeUpdateHandler updater) : this() { _context = context; _mappings = new BindingList<KeyMapping>(); _ap = p; txtName.DataBindings.Add("Text", p, "Name"); txtDescription.DataBindings.Add("Text", p, "Description"); string schema = p.DecoratedObject.Parent.Parent.Name; cmbDeleteRule.DataSource = Enum.GetValues(typeof(DeleteRule)); cmbDeleteRule.DataBindings.Add("SelectedItem", p, "DeleteRule"); var mappings = _ap.GetMappings(); cmbAssociatedClass.DisplayMember = "Name"; cmbAssociatedClass.DataSource = _context.GetClasses(schema); cmbAssociatedClass.DataBindings.Add("SelectedItem", p, "AssociatedClass"); txtMultiplicity.DataBindings.Add("Text", p, "Multiplicity"); chkReadOnly.DataBindings.Add("Checked", p, "IsReadOnly"); chkLockCascade.DataBindings.Add("Checked", p, "LockCascade"); txtReverseName.DataBindings.Add("Text", p, "ReverseName"); txtRevMultiplicity.DataBindings.Add("Text", p, "ReverseMultiplicity"); foreach (var map in mappings) { _mappings.Add(map); } grdMappings.DataSource = _mappings; _mappings.ListChanged += new ListChangedEventHandler(OnMappingsChanged); p.PropertyChanged += (s, evt) => { if (evt.PropertyName == "Name") updater(); }; }
public ObjectPropertyCtrl(ObjectPropertyDefinitionDecorator p, SchemaDesignContext context, NodeUpdateHandler updater) : this() { _context = context; txtName.DataBindings.Add("Text", p, "Name"); txtDescription.DataBindings.Add("Text", p, "Description"); cmbObjectType.DataSource = Enum.GetValues(typeof(ObjectType)); cmbOrderType.DataSource = Enum.GetValues(typeof(OrderType)); cmbObjectType.DataBindings.Add("SelectedItem", p, "ObjectType"); cmbOrderType.DataBindings.Add("SelectedItem", p, "OrderType"); string schema = p.DecoratedObject.Parent.Parent.Name; cmbClass.DisplayMember = "Name"; cmbClass.DataSource = _context.GetClasses(schema); EventHandler clsIndexChanged = (sender, e) => { var cls = cmbClass.SelectedItem as ClassDefinition; if (cls != null) { p.Class = cls; cmbIdentityProperty.DisplayMember = "Name"; List<DataPropertyDefinition> dataProps = new List<DataPropertyDefinition>(); foreach (PropertyDefinition prop in cls.Properties) { if (prop.PropertyType == PropertyType.PropertyType_DataProperty) dataProps.Add((DataPropertyDefinition)prop); } cmbIdentityProperty.DataSource = dataProps; if (p.IdentityProperty != null && cls.Properties.Contains(p.IdentityProperty)) { cmbIdentityProperty.SelectedItem = p.IdentityProperty; } else { if (cmbIdentityProperty.Items.Count == 0) cmbIdentityProperty.SelectedIndex = 0; } } }; EventHandler prpIndexChanged = (sender, e) => { var prop = cmbIdentityProperty.SelectedItem as DataPropertyDefinition; if (prop != null) { p.IdentityProperty = prop; } else { p.IdentityProperty = null; } }; cmbClass.SelectedItem = p.Class; cmbClass.SelectedIndexChanged += clsIndexChanged; cmbIdentityProperty.SelectedIndexChanged += prpIndexChanged; clsIndexChanged(this, EventArgs.Empty); p.PropertyChanged += (s, evt) => { if (evt.PropertyName == "Name") updater(); }; }
public ObjectPropertyCtrl(ObjectPropertyDefinitionDecorator p, SchemaDesignContext context, NodeUpdateHandler updater) : this() { _context = context; txtName.DataBindings.Add("Text", p, "Name"); txtDescription.DataBindings.Add("Text", p, "Description"); cmbObjectType.DataSource = Enum.GetValues(typeof(ObjectType)); cmbOrderType.DataSource = Enum.GetValues(typeof(OrderType)); cmbObjectType.DataBindings.Add("SelectedItem", p, "ObjectType"); cmbOrderType.DataBindings.Add("SelectedItem", p, "OrderType"); string schema = p.DecoratedObject.Parent.Parent.Name; cmbClass.DisplayMember = "Name"; cmbClass.DataSource = _context.GetClasses(schema); EventHandler clsIndexChanged = (sender, e) => { var cls = cmbClass.SelectedItem as ClassDefinition; if (cls != null) { p.Class = cls; cmbIdentityProperty.DisplayMember = "Name"; List <DataPropertyDefinition> dataProps = new List <DataPropertyDefinition>(); foreach (PropertyDefinition prop in cls.Properties) { if (prop.PropertyType == PropertyType.PropertyType_DataProperty) { dataProps.Add((DataPropertyDefinition)prop); } } cmbIdentityProperty.DataSource = dataProps; if (p.IdentityProperty != null && cls.Properties.Contains(p.IdentityProperty)) { cmbIdentityProperty.SelectedItem = p.IdentityProperty; } else { if (cmbIdentityProperty.Items.Count == 0) { cmbIdentityProperty.SelectedIndex = 0; } } } }; EventHandler prpIndexChanged = (sender, e) => { var prop = cmbIdentityProperty.SelectedItem as DataPropertyDefinition; if (prop != null) { p.IdentityProperty = prop; } else { p.IdentityProperty = null; } }; cmbClass.SelectedItem = p.Class; cmbClass.SelectedIndexChanged += clsIndexChanged; cmbIdentityProperty.SelectedIndexChanged += prpIndexChanged; clsIndexChanged(this, EventArgs.Empty); p.PropertyChanged += (s, evt) => { if (evt.PropertyName == "Name") { updater(); } }; }