public void Initialize(TableSchemaCollection tables, TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints, DataTypeSchemaCollection dataTypes) { if (columns == null) { throw new ArgumentNullException("columns"); } if (constraints == null) { throw new ArgumentNullException("constraints"); } if (table == null) { throw new ArgumentNullException("table"); } if (tables == null) { throw new ArgumentNullException("tables"); } IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported("Table", action, TableCapabilities.PrimaryKeyConstraint)) { //not for column constraints, since they are already editable in the column editor pkEditor = new PrimaryKeyConstraintEditorWidget(schemaProvider, action, table, columns, constraints); pkEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(pkEditor, new Label(GettextCatalog.GetString("Primary Key"))); } if (fac.IsCapabilitySupported("Table", action, TableCapabilities.ForeignKeyConstraint) || fac.IsCapabilitySupported("TableColumn", action, TableCapabilities.ForeignKeyConstraint)) { fkEditor = new ForeignKeyConstraintEditorWidget(schemaProvider, action, tables, table, columns, constraints); fkEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(fkEditor, new Label(GettextCatalog.GetString("Foreign Key"))); } if (fac.IsCapabilitySupported("Table", action, TableCapabilities.CheckConstraint) || fac.IsCapabilitySupported("TableColumn", action, TableCapabilities.CheckConstraint)) { checkEditor = new CheckConstraintEditorWidget(schemaProvider, action, table, columns, constraints); checkEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(checkEditor, new Label(GettextCatalog.GetString("Check"))); } if (fac.IsCapabilitySupported("Table", action, TableCapabilities.UniqueConstraint) || fac.IsCapabilitySupported("TableColumn", action, TableCapabilities.CheckConstraint)) { uniqueEditor = new UniqueConstraintEditorWidget(schemaProvider, action, table, columns, constraints); uniqueEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(uniqueEditor, new Label(GettextCatalog.GetString("Unique"))); } ShowAll(); }
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 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 void Initialize (TableSchemaCollection tables, TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints, DataTypeSchemaCollection dataTypes) { if (columns == null) throw new ArgumentNullException ("columns"); if (constraints == null) throw new ArgumentNullException ("constraints"); if (table == null) throw new ArgumentNullException ("table"); if (tables == null) throw new ArgumentNullException ("tables"); IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.PrimaryKeyConstraint)) { //not for column constraints, since they are already editable in the column editor pkEditor = new PrimaryKeyConstraintEditorWidget (schemaProvider, action, table, columns, constraints); pkEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (pkEditor, new Label (GettextCatalog.GetString ("Primary Key"))); } if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.ForeignKeyConstraint) || fac.IsCapabilitySupported ("TableColumn", action, TableCapabilities.ForeignKeyConstraint)) { fkEditor = new ForeignKeyConstraintEditorWidget (schemaProvider, action, tables, table, columns, constraints); fkEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (fkEditor, new Label (GettextCatalog.GetString ("Foreign Key"))); } if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.CheckConstraint) || fac.IsCapabilitySupported ("TableColumn", action, TableCapabilities.CheckConstraint)) { checkEditor = new CheckConstraintEditorWidget (schemaProvider, action, table, columns, constraints); checkEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (checkEditor, new Label (GettextCatalog.GetString ("Check"))); } if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.UniqueConstraint) || fac.IsCapabilitySupported ("TableColumn", action, TableCapabilities.CheckConstraint)) { uniqueEditor = new UniqueConstraintEditorWidget (schemaProvider, action, table, columns, constraints); uniqueEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (uniqueEditor, new Label (GettextCatalog.GetString ("Unique"))); } ShowAll (); }