public ConstraintsEditorWidget (ISchemaProvider schemaProvider, SchemaActions action, ConstraintEditorSettings settings) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.action = action; this.Build(); notebook = new Notebook (); Add (notebook); if (settings.ShowPrimaryKeyConstraints) { //not for column constraints, since they are already editable in the column editor pkEditor = new PrimaryKeyConstraintEditorWidget (schemaProvider, action); pkEditor.ContentChanged += new EventHandler (OnContentChanged); pkEditor.PrimaryKeyChanged += delegate(object sender, EventArgs e) { if (PrimaryKeyChanged != null) PrimaryKeyChanged (this, new EventArgs ()); }; notebook.AppendPage (pkEditor, new Label (AddinCatalog.GetString ("Primary Key"))); } if (settings.ShowForeignKeyConstraints) { fkEditor = new ForeignKeyConstraintEditorWidget (schemaProvider, action, settings.ForeignKeySettings); fkEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (fkEditor, new Label (AddinCatalog.GetString ("Foreign Key"))); } if (settings.ShowCheckConstraints) { checkEditor = new CheckConstraintEditorWidget (schemaProvider, action, settings.CheckSettings); checkEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (checkEditor, new Label (AddinCatalog.GetString ("Check"))); } if (settings.ShowUniqueConstraints) { uniqueEditor = new UniqueConstraintEditorWidget (schemaProvider, action); uniqueEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (uniqueEditor, new Label (AddinCatalog.GetString ("Unique"))); } ShowAll (); }
public TableEditorSettings () { constraintSettings = new ConstraintEditorSettings (); columnSettings = new ColumnEditorSettings (); }