public void Initialize(ColumnSchemaCollection columns) { this.columns = columns; store = new SortedColumnListStore(columns); store.ColumnToggled += delegate(object sender, EventArgs args) { if (ColumnToggled != null) { ColumnToggled(this, args); } }; list.Model = store.Store; }
public void Initialize (ColumnSchemaCollection columns) { this.columns = columns; store = new SortedColumnListStore (columns); store.ColumnToggled += delegate (object sender, EventArgs args) { if (ColumnToggled != null) ColumnToggled (this, args); }; list.Model = store.Store; }
public void Initialize (TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints) { if (columns == null) throw new ArgumentNullException ("columns"); if (table == null) throw new ArgumentNullException ("table"); if (constraints == null) throw new ArgumentNullException ("constraints"); this.table = table; this.columns = columns; this.constraints = constraints; foreach (CheckConstraintSchema check in constraints.GetConstraints (ConstraintType.Check)) AddConstraint (check); storeColumns = new SortedColumnListStore (columns); columnRenderer.Model = storeColumns.Store; //TODO: also col constraints }
public CheckConstraintEditorWidget (ISchemaProvider schemaProvider, SchemaActions action, TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints) { if (columns == null) throw new ArgumentNullException ("columns"); if (table == null) throw new ArgumentNullException ("table"); if (constraints == null) throw new ArgumentNullException ("constraints"); if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.table = table; this.columns = columns; this.constraints = constraints; this.action = action; this.Build(); store = new ListStore (typeof (string), typeof (string), typeof (bool), typeof (string), typeof (object)); storeColumns = new SortedColumnListStore (columns); listCheck.Model = store; TreeViewColumn colName = new TreeViewColumn (); TreeViewColumn colColumn = new TreeViewColumn (); TreeViewColumn colIsColumnConstraint = new TreeViewColumn (); colName.Title = GettextCatalog.GetString ("Name"); colColumn.Title = GettextCatalog.GetString ("Column"); colIsColumnConstraint.Title = GettextCatalog.GetString ("Column Constraint"); colColumn.MinWidth = 120; //request a bigger width CellRendererText nameRenderer = new CellRendererText (); CellRendererCombo columnRenderer = new CellRendererCombo (); CellRendererToggle isColumnConstraintRenderer = new CellRendererToggle (); nameRenderer.Editable = true; nameRenderer.Edited += new EditedHandler (NameEdited); columnRenderer.Model = storeColumns.Store; columnRenderer.TextColumn = SortedColumnListStore.ColNameIndex; columnRenderer.Editable = true; columnRenderer.Edited += new EditedHandler (ColumnEdited); isColumnConstraintRenderer.Activatable = true; isColumnConstraintRenderer.Toggled += new ToggledHandler (IsColumnConstraintToggled); colName.PackStart (nameRenderer, true); colColumn.PackStart (columnRenderer, true); colIsColumnConstraint.PackStart (isColumnConstraintRenderer, true); colName.AddAttribute (nameRenderer, "text", colNameIndex); colColumn.AddAttribute (columnRenderer, "text", colColumnNameIndex); colIsColumnConstraint.AddAttribute (isColumnConstraintRenderer, "active", colIsColumnConstraintIndex); IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; columnConstraintsSupported = fac.IsCapabilitySupported ("TableColumn", action, TableCapabilities.CheckConstraint); tableConstraintsSupported = fac.IsCapabilitySupported ("Table", action, TableCapabilities.CheckConstraint); listCheck.AppendColumn (colName); if (columnConstraintsSupported) listCheck.AppendColumn (colColumn); if (columnConstraintsSupported && tableConstraintsSupported) listCheck.AppendColumn (colIsColumnConstraint); listCheck.Selection.Changed += new EventHandler (OnSelectionChanged); sqlEditor.TextChanged += new EventHandler (SourceChanged); foreach (CheckConstraintSchema check in constraints.GetConstraints (ConstraintType.Check)) AddConstraint (check); //TODO: also col constraints ShowAll (); }