public void Initialize(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 (dataTypes == null)
            {
                throw new ArgumentNullException("dataTypes");
            }

            this.table       = table;
            this.columns     = columns;
            this.constraints = constraints;
            this.dataTypes   = dataTypes;

            foreach (ColumnSchema column in columns)
            {
                AppendColumnSchema(column);
            }

            foreach (DataTypeSchema dataType in dataTypes)
            {
                storeTypes.AppendValues(dataType.Name, dataType);
            }
        }
        private void InitializeThreaded(object state)
        {
            tables      = schemaProvider.GetTables();
            dataTypes   = schemaProvider.GetDataTypes();
            columns     = originalTable.Columns;
            constraints = originalTable.Constraints;
            triggers    = originalTable.Triggers;
            //TODO: indices
            indexes = new IndexSchemaCollection();

            Runtime.LoggingService.Error("TABLE " + originalTable.Name);
            Runtime.LoggingService.Error("   columns = " + columns.Count);
            Runtime.LoggingService.Error("   constraints = " + constraints.Count);

            try {
                foreach (ColumnSchema col in columns)
                {
                    int dummy = col.Constraints.Count;             //get column constraints
                    Runtime.LoggingService.Error("CONSTRAINTS " + col.Name + " " + dummy);
                }
            } catch (Exception ee) {
                Runtime.LoggingService.Error(ee);
                Runtime.LoggingService.Error(ee.StackTrace);
            }

            if (action == SchemaActions.Alter)             //make a duplicate if we are going to alter the table
            {
                this.table = originalTable.Clone() as TableSchema;
            }

            DispatchService.GuiDispatch(delegate() {
                InitializeGui();
            });
        }
        private void InitializeThreaded(object state)
        {
            tables      = schemaProvider.GetTables();
            dataTypes   = schemaProvider.GetDataTypes();
            columns     = originalTable.Columns;
            constraints = originalTable.Constraints;
            triggers    = originalTable.Triggers;
            //TODO: indices
            indexes = new IndexSchemaCollection();

            System.Text.StringBuilder builder = new System.Text.StringBuilder();
            builder.Append("Loading editor for TABLE ");
            builder.Append(originalTable.Name);
            builder.AppendLine();
            builder.Append("    columns = ");
            builder.Append(columns.Count);
            builder.AppendLine();
            builder.Append("constraints = ");
            builder.Append(constraints.Count);
            builder.AppendLine();

            try {
                foreach (ColumnSchema col in columns)
                {
                    int dummy = col.Constraints.Count;                     //get column constraints
                    builder.Append("CONSTRAINTS ");
                    builder.Append(col.Name);
                    builder.Append(" ");
                    builder.Append(dummy);
                    builder.AppendLine();
                }
                LoggingService.LogDebug(builder.ToString());
            } catch (Exception ee) {
                LoggingService.LogDebug(builder.ToString());
                LoggingService.LogError(ee.ToString());
            }

            if (action == SchemaActions.Alter)             //make a duplicate if we are going to alter the table
            {
                this.table = originalTable.Clone() as TableSchema;
            }

            DispatchService.GuiDispatch(delegate() {
                InitializeGui();
            });
        }
		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 ();
		}
		private void InitializeThreaded (object state)
		{
			tables = schemaProvider.GetTables ();
			dataTypes = schemaProvider.GetDataTypes ();
			columns = originalTable.Columns;
			constraints = originalTable.Constraints;
			triggers = originalTable.Triggers;
			//TODO: indices
			indexes = new IndexSchemaCollection ();
			
			System.Text.StringBuilder builder = new System.Text.StringBuilder ();
			builder.Append ("Loading editor for TABLE ");
			builder.Append (originalTable.Name);
			builder.AppendLine ();
			builder.Append ("    columns = ");
			builder.Append (columns.Count);
			builder.AppendLine ();
			builder.Append ("constraints = ");
			builder.Append (constraints.Count);
			builder.AppendLine ();

			try {
				foreach (ColumnSchema col in columns) {				
					int dummy = col.Constraints.Count; //get column constraints
					builder.Append ("CONSTRAINTS ");
					builder.Append (col.Name);
					builder.Append (" ");
					builder.Append (dummy);
					builder.AppendLine ();
				}
				LoggingService.LogDebug (builder.ToString ());
			} catch (Exception ee) {
				LoggingService.LogDebug (builder.ToString ());
				LoggingService.LogError (ee.ToString ());
			}

			if (action == SchemaActions.Alter) //make a duplicate if we are going to alter the table
				this.table = originalTable.Clone () as TableSchema;

			DispatchService.GuiDispatch (delegate () {
				InitializeGui ();
			});
		}
		
		public override DataTypeSchemaCollection GetDataTypes ()
		{
			DataTypeSchemaCollection collection = new DataTypeSchemaCollection ();
			
			#region Types
			// ENUM
			DataTypeSchema schema = new DataTypeSchema (this);
			schema.Name = "smallint";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(Int16);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Integer
			schema = new DataTypeSchema (this);
			schema.Name = "integer";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(int);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Big Int
			schema = new DataTypeSchema (this);
			schema.Name = "bigint";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(long);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Serial
			schema = new DataTypeSchema (this);
			schema.Name = "serial";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(long);
			schema.IsAutoincrementable = true;
			schema.IsFixedLength = true;
			schema.IsNullable = false;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Big Serial
			schema = new DataTypeSchema (this);
			schema.Name = "bigserial";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(long);
			schema.IsAutoincrementable = true;
			schema.IsFixedLength = true;
			schema.IsNullable = false;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Numeric
			schema = new DataTypeSchema (this);
			schema.Name = "numeric";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(float);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Decimal
			schema = new DataTypeSchema (this);
			schema.Name = "decimal";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(float);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// real
			schema = new DataTypeSchema (this);
			schema.Name = "real";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(float);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// double precision
			schema = new DataTypeSchema (this);
			schema.Name = "double precision";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(float);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// money
			schema = new DataTypeSchema (this);
			schema.Name = "money";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(float);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// character varying
			schema = new DataTypeSchema (this);
			schema.Name = "character varying";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// varying
			schema = new DataTypeSchema (this);
			schema.Name = "varying";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// varchar
			schema = new DataTypeSchema (this);
			schema.Name = "varchar";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// text
			schema = new DataTypeSchema (this);
			schema.Name = "text";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// character
			schema = new DataTypeSchema (this);
			schema.Name = "character";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// char
			schema = new DataTypeSchema (this);
			schema.Name = "char";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// bytea
			schema = new DataTypeSchema (this);
			schema.Name = "bytea";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(byte);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);			

			// timeSpan
			schema = new DataTypeSchema (this);
			schema.Name = "timespan";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(object);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);

			// interval
			schema = new DataTypeSchema (this);
			schema.Name = "interval";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(TimeSpan);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Date
			schema = new DataTypeSchema (this);
			schema.Name = "date";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(DateTime);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// Time
			schema = new DataTypeSchema (this);
			schema.Name = "time";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(DateTime);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// boolean
			schema = new DataTypeSchema (this);
			schema.Name = "boolean";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(bool);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// bit
			schema = new DataTypeSchema (this);
			schema.Name = "bit";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(bool);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// uuid
			schema = new DataTypeSchema (this);
			schema.Name = "bit";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(Guid);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// xml
			schema = new DataTypeSchema (this);
			schema.Name = "xml";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(Guid);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// point
			schema = new DataTypeSchema (this);
			schema.Name = "point";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// line
			schema = new DataTypeSchema (this);
			schema.Name = "line";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// lseg
			schema = new DataTypeSchema (this);
			schema.Name = "lseg";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// box
			schema = new DataTypeSchema (this);
			schema.Name = "box";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// polygon
			schema = new DataTypeSchema (this);
			schema.Name = "polygon";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// circle
			schema = new DataTypeSchema (this);
			schema.Name = "circle";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			// inet
			schema = new DataTypeSchema (this);
			schema.Name = "inet";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			
			// cidr
			schema = new DataTypeSchema (this);
			schema.Name = "cidr";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(string);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = true;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			schema = new DataTypeSchema (this);
			schema.Name = "enum";
			schema.LengthRange = new Range (0);
			schema.DotNetType = typeof(object);
			schema.IsAutoincrementable = false;
			schema.IsFixedLength = false;
			schema.IsNullable = true;
			schema.ScaleRange = new Range (0, 0);
			schema.PrecisionRange = new Range (0, 0);
			collection.Add (schema);
			
			#endregion 
			return collection;
		private void InitializeThreaded (object state)
		{
			tables = schemaProvider.GetTables ();
			dataTypes = schemaProvider.GetDataTypes ();
			columns = originalTable.Columns;
			constraints = originalTable.Constraints;
			triggers = originalTable.Triggers;
			//TODO: indices
			indexes = new IndexSchemaCollection ();
			
			Runtime.LoggingService.Error ("TABLE " + originalTable.Name);
			Runtime.LoggingService.Error ("   columns = " + columns.Count);
			Runtime.LoggingService.Error ("   constraints = " + constraints.Count);

			try {
			foreach (ColumnSchema col in columns) {				
				int dummy = col.Constraints.Count; //get column constraints
				Runtime.LoggingService.Error ("CONSTRAINTS " + col.Name + " " + dummy);
			}
			} catch (Exception ee) {
				Runtime.LoggingService.Error (ee);
				Runtime.LoggingService.Error (ee.StackTrace);
			}

			if (action == SchemaActions.Alter) //make a duplicate if we are going to alter the table
				this.table = originalTable.Clone () as TableSchema;

			DispatchService.GuiDispatch (delegate () {
				InitializeGui ();
			});
		}
		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");

			if (pkEditor != null)
				pkEditor.Initialize (table, columns, constraints);
			if (fkEditor != null)
				fkEditor.Initialize (tables, table, columns, constraints);
			if (checkEditor != null)
				checkEditor.Initialize (table, columns, constraints);
			if (uniqueEditor != null)
				uniqueEditor.Initialize (table, columns, constraints);
		}
		public virtual DataTypeSchemaCollection GetDataTypes ()
		{
			DataTypeSchemaCollection collection = new DataTypeSchemaCollection ();
			
			IPooledDbConnection conn = connectionPool.Request ();
			try {
				//restrictions: name
				DataTable dt = conn.GetSchema (dataTypesCollectionString);
				for (int r = 0; r < dt.Rows.Count; r++) {
					DataRow row = dt.Rows[r];
					collection.Add (GetDataType (row));
				}
			} catch (Exception e) {
				QueryService.RaiseException (e);
			}
			
			conn.Release ();
			
			return collection;
		}
        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();
        }
Beispiel #11
0
        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");
            }

            if (pkEditor != null)
            {
                pkEditor.Initialize(table, columns, constraints);
            }
            if (fkEditor != null)
            {
                fkEditor.Initialize(tables, table, columns, constraints);
            }
            if (checkEditor != null)
            {
                checkEditor.Initialize(table, columns, constraints);
            }
            if (uniqueEditor != null)
            {
                uniqueEditor.Initialize(table, columns, constraints);
            }
        }
 /*private void AppendColumnSchema (ColumnSchema column)
 {
     bool pk = column.Constraints.GetConstraint (ConstraintType.PrimaryKey) != null;
     storeColumns.AppendValues (pk, column.Name, column.DataType.Name, column.DataType.LengthRange.Default.ToString (), column.IsNullable, column.Comment, column);
 }*/
 private void Initialize()
 {
     tableColumns = new ArrayList ();
     tableIndexes = new ArrayList ();
     tableTriggers = new ArrayList ();
     //Initialize Datatypes
     dataTypes = tableSchemaProvider.GetDataTypes ();
     storeTypes = new SortedList<string, DataTypeSchema> ();
     foreach (DataTypeSchema dataType in dataTypes)
         storeTypes.Add (dataType.Name, dataType);
     //Create a text figure for each column in model
     if (tableSchema != null) {
         if (tableSchema.Columns != null) {
             foreach (ColumnSchema col in tableSchema.Columns) {
                 columns.Add (new ColumnFigure (col, storeTypes, null));
             }
         }
     }
 }
		public void Initialize (TableSchema table, ColumnSchemaCollection columns, ConstraintSchemaCollection constraints, DataTypeSchemaCollection dataTypes)
		{
			Runtime.LoggingService.Error ("CEW: Initialize");
			if (columns == null)
				throw new ArgumentNullException ("columns");
			if (constraints == null)
				throw new ArgumentNullException ("constraints");
			if (table == null)
				throw new ArgumentNullException ("table");
			if (dataTypes == null)
				throw new ArgumentNullException ("dataTypes");

			this.table = table;
			this.columns = columns;
			this.constraints = constraints;
			this.dataTypes = dataTypes;
			
			foreach (ColumnSchema column in columns)
				AppendColumnSchema (column);
			
			foreach (DataTypeSchema dataType in dataTypes)
				storeTypes.AppendValues (dataType.Name, storeTypes);
			Runtime.LoggingService.Error ("CEW: Initialize 2");
		}