TableStyleCreator.cs :  » Persistence-Frameworks » NEO » SQLToNeo » Model » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » NEO 
NEO » SQLToNeo » Model » TableStyleCreator.cs
/* $Id: TableStyleCreator.cs,v 1.9 2005/01/12 06:36:30 larsbm Exp $
 * Copyright (c) 2004 Engine EAR GmbH & Co. KG
 * Developed by: Lars Behrmann, lb@engine.de
 */

using System;
using System.Data;
using System.Windows.Forms;

namespace SQLToNeo.Model{
  /// <summary>
  /// Zusammenfassung fr TableStyleCreator.
  /// </summary>
  public class TableStyleCreator
  {
    public static DataGridTableStyle StyleTable()
    {
      DataGridTableStyle s = new DataGridTableStyle();
      s.MappingName = "table";

      DataGridColumnStyle id = new DataGridTextBoxColumn();
      id.MappingName = "id";
      id.Width = 0;
      s.GridColumnStyles.Add(id);

      DataGridColumnStyle name = new DataGridTextBoxColumn();
      name.MappingName = "name";
      name.HeaderText = "Name";
      name.Width = 60;
      name.ReadOnly = true;
      s.GridColumnStyles.Add(name);

      DataGridColumnStyle jname = new DataGridTextBoxColumn();
      jname.MappingName = "javaName";
      jname.HeaderText = "javaName";
      jname.Width = 60;
      s.GridColumnStyles.Add(jname);

      DataGridColumnStyle defaultProperty = new DataGridTextBoxColumn();
      defaultProperty.MappingName = "defaultProperty";
      defaultProperty.HeaderText = "DefaultProperty";
      defaultProperty.Width = 60;
      defaultProperty.ReadOnly = false;
      s.GridColumnStyles.Add(defaultProperty);
        
      DataTable AccessDataTypes = new DataTable();
      AccessDataTypes.Columns.Add(new DataColumn("Value", typeof(string)));
      AccessDataTypes.Columns.Add(new DataColumn("idMethod", typeof(string)));
      AccessDataTypes.Rows.Add(new object[] {"idbroker", "idbroker"});
      AccessDataTypes.Rows.Add(new object[] {"native", "native"});
      AccessDataTypes.Rows.Add(new object[] {"guid", "guid"});
      AccessDataTypes.Rows.Add(new object[] {"none", "none"});
      AccessDataTypes.Rows.Add(new object[] {"null", "null"});

      DataGridComboBoxColumn idMethod = new DataGridComboBoxColumn(AccessDataTypes, 0, 0);
      idMethod.MappingName = "idMethod";
      idMethod.HeaderText = "IdMethod";
      idMethod.Width = 60;
      idMethod.ReadOnly = false;
      s.GridColumnStyles.Add(idMethod);
      
      DataGridColumnStyle manyToMany = new DataGridBoolColumn();
      manyToMany.MappingName = "manyToMany";
      manyToMany.HeaderText = "ManyToMany";
      manyToMany.Width = 40;
      s.GridColumnStyles.Add(manyToMany);
      
      DataGridColumnStyle create = new DataGridBoolColumn();
      create.MappingName = "create";
      create.HeaderText = "Create";
      create.Width = 50;
      s.GridColumnStyles.Add(create);

      return s;
    }

    public static DataGridTableStyle StyleColumn()
    {
      DataGridTableStyle s = new DataGridTableStyle();
      s.MappingName = "column";

      DataGridColumnStyle id = new DataGridTextBoxColumn();
      id.MappingName = "id";
      id.Width = 0;
      s.GridColumnStyles.Add(id);

      DataGridColumnStyle tid = new DataGridTextBoxColumn();
      tid.MappingName = "tableid";
      tid.Width = 0;
      s.GridColumnStyles.Add(tid);

      DataGridColumnStyle name = new DataGridTextBoxColumn();
      name.MappingName = "name";
      name.HeaderText = "Name";
      name.Width = 60;
      name.ReadOnly = true;
      s.GridColumnStyles.Add(name);

      DataGridColumnStyle jname = new DataGridTextBoxColumn();
      jname.MappingName = "javaName";
      jname.HeaderText = "javaName";
      jname.Width = 60;
      s.GridColumnStyles.Add(jname);

      DataTable AccessDataTypes = new DataTable();
      AccessDataTypes.Columns.Add(new DataColumn("Value", typeof(string)));
      AccessDataTypes.Columns.Add(new DataColumn("type", typeof(string)));
      AccessDataTypes.Rows.Add(new object[] {"BIT", "BIT"});
      AccessDataTypes.Rows.Add(new object[] {"TINYINT", "TINYINT"});
      AccessDataTypes.Rows.Add(new object[] {"SMALLINT", "SMALLINT"});
      AccessDataTypes.Rows.Add(new object[] {"INTEGER", "INTEGER"});
      AccessDataTypes.Rows.Add(new object[] {"BIGINT", "BIGINT"});
      AccessDataTypes.Rows.Add(new object[] {"FLOAT", "FLOAT"});
      AccessDataTypes.Rows.Add(new object[] {"REAL", "REAL"});
      AccessDataTypes.Rows.Add(new object[] {"NUMERIC", "NUMERIC"});
      AccessDataTypes.Rows.Add(new object[] {"DECIMAL", "DECIMAL"});
      AccessDataTypes.Rows.Add(new object[] {"CHAR", "CHAR"});
      AccessDataTypes.Rows.Add(new object[] {"VARCHAR", "VARCHAR"});
      AccessDataTypes.Rows.Add(new object[] {"LONGVARCHAR", "LONGVARCHAR"});
      AccessDataTypes.Rows.Add(new object[] {"DATE", "DATE"});
      AccessDataTypes.Rows.Add(new object[] {"TIME", "TIME"});
      AccessDataTypes.Rows.Add(new object[] {"TIMESTAMP", "TIMESTAMP"});
      AccessDataTypes.Rows.Add(new object[] {"BINARY", "BINARY"});
      AccessDataTypes.Rows.Add(new object[] {"VARBINARY", "VARBINARY"});
      AccessDataTypes.Rows.Add(new object[] {"LONGVARBINARY", "LONGVARBINARY"});
      AccessDataTypes.Rows.Add(new object[] {"NULL", "NULL"});
      AccessDataTypes.Rows.Add(new object[] {"OTHER", "OTHER"});
      AccessDataTypes.Rows.Add(new object[] {"JAVA_OBJECT", "JAVA_OBJECT"});
      AccessDataTypes.Rows.Add(new object[] {"DISTINCT", "DISTINCT"});
      AccessDataTypes.Rows.Add(new object[] {"STRUCT", "STRUCT"});
      AccessDataTypes.Rows.Add(new object[] {"ARRAY", "ARRAY"});
      AccessDataTypes.Rows.Add(new object[] {"BLOB", "BLOB"});
      AccessDataTypes.Rows.Add(new object[] {"CLOB", "CLOB"});
      AccessDataTypes.Rows.Add(new object[] {"REF", "REF"});
      AccessDataTypes.Rows.Add(new object[] {"BOOLEANINT", "BOOLEANINT"});
      AccessDataTypes.Rows.Add(new object[] {"BOOLEANCHAR", "BOOLEANCHAR"});
      AccessDataTypes.Rows.Add(new object[] {"UNIQUEIDENTIFIER", "UNIQUEIDENTIFIER"});
      AccessDataTypes.Rows.Add(new object[] {"DOUBLE", "DOUBLE"});
      AccessDataTypes.Rows.Add(new object[] {"DATETIME", "DATETIME"});
      AccessDataTypes.Rows.Add(new object[] {"TEXT", "TEXT"});
            
      DataGridComboBoxColumn type = new DataGridComboBoxColumn(AccessDataTypes, 0, 0);
      type.MappingName = "type";
      type.HeaderText = "Type";
      type.Width = 100;
      type.ReadOnly = true;
      s.GridColumnStyles.Add(type);

      DataGridColumnStyle size = new DataGridTextBoxColumn();
      size.MappingName = "size";
      size.HeaderText = "Size";
      size.Width = 60;
      s.GridColumnStyles.Add(size);

      DataGridColumnStyle required = new DataGridBoolColumn();
      required.MappingName = "required";
      required.HeaderText = "Required";
      required.Width = 60;
      //required.ReadOnly = false;
      s.GridColumnStyles.Add(required);

      DataGridColumnStyle hidden = new DataGridBoolColumn();
      hidden.MappingName = "hidden";
      hidden.HeaderText = "Hidden";
      hidden.Width = 60;
      //hidden.ReadOnly = false;
      s.GridColumnStyles.Add(hidden);
      
      DataGridColumnStyle ident = new DataGridBoolColumn();
      ident.MappingName = "identity";
      ident.HeaderText = "Ident";
      ident.Width = 40;
      s.GridColumnStyles.Add(ident);

      DataGridColumnStyle pk = new DataGridBoolColumn();
      pk.MappingName = "primaryKey";
      pk.HeaderText = "PK";
      pk.Width = 30;
      s.GridColumnStyles.Add(pk);
      
      DataGridColumnStyle create = new DataGridBoolColumn();
      create.MappingName = "create";
      create.HeaderText = "Create";
      create.Width = 50;
      s.GridColumnStyles.Add(create);

      return s;
    }

    public static DataGridTableStyle StyleForeignkey(string type)
    {
      DataGridTableStyle s = new DataGridTableStyle();
      s.MappingName = type;

      DataGridColumnStyle id = new DataGridTextBoxColumn();
      id.MappingName = "id";
      id.Width = 0;
      s.GridColumnStyles.Add(id);

      DataGridColumnStyle tableid = new DataGridTextBoxColumn();
      tableid.MappingName = "tableid";
      tableid.Width = 0;
      s.GridColumnStyles.Add(tableid);

      DataGridColumnStyle name = new DataGridTextBoxColumn();
      name.MappingName = "name";
      name.HeaderText = "Name";
      name.Width = 60;
      s.GridColumnStyles.Add(name);

      DataGridColumnStyle foreigntable = new DataGridTextBoxColumn();
      foreigntable.MappingName = "foreigntable";
      foreigntable.HeaderText = "foreigntable";
      foreigntable.Width = 70;
      foreigntable.ReadOnly = true;
      s.GridColumnStyles.Add(foreigntable);

      DataGridColumnStyle local = new DataGridTextBoxColumn();
      local.MappingName = "local";
      local.HeaderText = "Local";
      local.Width = 60;
      local.ReadOnly = true;
      s.GridColumnStyles.Add(local);

      DataGridColumnStyle foreign = new DataGridTextBoxColumn();
      foreign.MappingName = "foreign";
      foreign.HeaderText = "Foreign";
      foreign.Width = 60;
      foreign.ReadOnly = true;
      s.GridColumnStyles.Add(foreign);
      
      DataTable AccessDataTypesUpdate = new DataTable();
      AccessDataTypesUpdate.Columns.Add(new DataColumn("Value", typeof(string)));
      AccessDataTypesUpdate.Columns.Add(new DataColumn("onUpdate", typeof(string)));
      AccessDataTypesUpdate.Rows.Add(new object[] {"cascade", "cascade"});
      AccessDataTypesUpdate.Rows.Add(new object[] {"setnull", "setnull"});
      AccessDataTypesUpdate.Rows.Add(new object[] {"restrict", "restrict"});
      AccessDataTypesUpdate.Rows.Add(new object[] {"none", "none"});
        
      DataGridComboBoxColumn onupdate = new DataGridComboBoxColumn(AccessDataTypesUpdate, 0, 0);
      onupdate.MappingName = "onUpdate";
      onupdate.HeaderText = "onUpdate";
      onupdate.Width = 60;
      onupdate.ReadOnly = true;
      s.GridColumnStyles.Add(onupdate);

      DataTable AccessDataTypesDelete = new DataTable();
      AccessDataTypesDelete.Columns.Add(new DataColumn("Value", typeof(string)));
      AccessDataTypesDelete.Columns.Add(new DataColumn("onUpdate", typeof(string)));
      AccessDataTypesDelete.Rows.Add(new object[] {"cascade", "cascade"});
      AccessDataTypesDelete.Rows.Add(new object[] {"setnull", "setnull"});
      AccessDataTypesDelete.Rows.Add(new object[] {"restrict", "restrict"});
      AccessDataTypesDelete.Rows.Add(new object[] {"none", "none"});

      DataGridComboBoxColumn ondelete = new DataGridComboBoxColumn(AccessDataTypesDelete, 0, 0);
      ondelete.MappingName = "onDelete";
      ondelete.HeaderText = "onDelete";
      ondelete.Width = 60;
      ondelete.ReadOnly = true;
      s.GridColumnStyles.Add(ondelete);

      DataGridColumnStyle create = new DataGridBoolColumn();
      create.MappingName = "create";
      create.HeaderText = "Create";
      create.Width = 50;
      s.GridColumnStyles.Add(create);

      return s;
    }
  }
}

/*
 * $Log: TableStyleCreator.cs,v $
 * Revision 1.9  2005/01/12 06:36:30  larsbm
 * - Bugfixing: javaName and name were permuted
 *
 * Revision 1.8  2004/11/29 12:02:26  larsbm
 * - bugfix in writing foregein and iforeignrelations, now, foreigntable, local and foreign fields refers to the name
 * field instead of the javaName field
 *
 * Revision 1.7  2004/11/29 10:45:37  larsbm
 * - bugfix write ireference instead reference
 * - bugfix hidden was always true
 * - conversion to boolean failed
 * - set readonlys
 *
 * Revision 1.6  2004/11/01 14:36:33  larsbm
 * - Finished NeoXmlModelWriter
 * - Fixed bugs in TableStyleCreator and TableBuilder
 * - Implement new RestrictionChecker and additional test cases
 *
 * Revision 1.5  2004/10/27 14:09:23  larsbm
 * - Fixed bugs in tablebuilder, TablestyleCreator
 * - Working on the forms
 * - Finishing DBTypes
 * - Add IWriter & Writer, NeoXMLModelWriter as abstraction for writing the xml model
 *
 * Revision 1.4  2004/10/26 13:23:45  larsbm
 * - Fixed bugs in tablebuilder
 * - Working on the forms
 * - Finishing MergeSpecial
 * - Make app run with mergespecial
 * - start converter for sqldatatypes
 *
 */
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.