private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == targetNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    if (e.Node != null && e.Node.Tag != null)
                    {
                        GrtListNode node = e.Node.Tag as GrtListNode;

                        String value;
                        grtList.get_field(node.NodeId, (int)FKConstraintListWrapper.FKConstraintListColumns.RefTable, out value);

                        comboBox.Items.Clear();
                        using (Graphics graphics = comboBox.CreateGraphics())
                        {
                            float         maxWidth = 200; // Minimum width
                            List <string> tables   = mySQLTableEditorWrapper.get_all_table_names();
                            foreach (string table in tables)
                            {
                                comboBox.Items.Add(table);
                                SizeF size = graphics.MeasureString(table, comboBox.Font);
                                if (size.Width > maxWidth)
                                {
                                    maxWidth = size.Width;
                                }

                                // Make sure the previous selected item is selected again
                                if (table.Equals(value))
                                {
                                    comboBox.SelectedIndex = comboBox.Items.Count - 1;
                                }
                            }

                            // Limit width to a sane value.
                            if (maxWidth > 700)
                            {
                                maxWidth = 700;
                            }
                            comboBox.DropDownWidth = (int)Math.Ceiling(maxWidth);
                        }
                    }

                    comboBox.KeyDown        += new KeyEventHandler(textBox_KeyDown);
                    comboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
                }
            }
        }
 private void EditorInitialize(object sender, EditorInitializeEventArgs e)
 {
     if (sender is AdvNodeTextBox)
     {
         TextBox textBox = e.Editor as TextBox;
         if (textBox != null)
         {
             textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
         }
     }
 }
示例#3
0
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    if (TreeView.CurrentNode.Index == 0)
                    {
                        textBox.Text = "id" + mySQLTableEditorWrapper.get_name();
                    }

                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == targetColumnNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }

                GrtListNode node = treeView.CurrentNode.Tag as GrtListNode;

                List <string> columns = ((FKConstraintColumnsListWrapper)GrtList).get_ref_columns_list(node.NodeId, false);

                string selected;
                grtList.get_field(node.NodeId, (int)FKConstraintColumnsListWrapper.FKConstraintColumnsListColumns.RefColumn, out selected);

                comboBox.Items.Clear();
                comboBox.Items.AddRange(columns.ToArray());

                int i = 0;
                foreach (String col in columns)
                {
                    if (col == selected)
                    {
                        comboBox.SelectedIndex = i;
                    }
                    i++;
                }
            }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == typeNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    if (e.Node != null && e.Node.Tag != null)
                    {
                        GrtListNode node = e.Node.Tag as GrtListNode;

                        String value;
                        grtList.get_field(node.NodeId, (int)IndexListWrapper.IndexListColumns.Type, out value);

                        comboBox.Items.Clear();
                        List <string> indexTypes = tableEditorWrapper.get_index_types();
                        foreach (string indexType in indexTypes)
                        {
                            comboBox.Items.Add(indexType);

                            // Make sure the previous selected item is selected again
                            if (indexType.Equals(value))
                            {
                                comboBox.SelectedIndex = comboBox.Items.Count - 1;
                            }
                        }
                    }

                    comboBox.KeyDown        += new KeyEventHandler(textBox_KeyDown);
                    comboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
                }
            }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.Items.Clear();

                    // Add table columns
                    for (int i = 0; i < tableColumnGrtList.count(); i++)
                    {
                        string caption;

                        tableColumnGrtList.get_field(tableColumnGrtList.get_node(i),
                                                     (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out caption);

                        comboBox.Items.Add(caption);
                    }

                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == orderNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.Items.Clear();
                    int maxOrderIndex = ((IndexColumnsListWrapper)grtList).get_max_order_index();
                    for (int i = 1; i <= maxOrderIndex; i++)
                    {
                        comboBox.Items.Add(i);
                    }

                    //comboBox.DropDownStyle = ComboBoxStyle.DropDown;
                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == storageNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.Items.Clear();
                    comboBox.Items.Add("ASC");
                    comboBox.Items.Add("DESC");


                    //comboBox.DropDownStyle = ComboBoxStyle.DropDown;
                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == lengthNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
        }
 protected void OnEditorInitialize(EditorInitializeEventArgs args)
 {
     if (EditorInitialize != null)
         EditorInitialize(this, args);
 }
示例#7
0
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    // Only do for the placeholder row.
                    if (TreeView.CurrentNode.Index == grtList.count() - 1)
                    {
                        if (e.Node != null && e.Node.Tag != null)
                        {
                            GrtListNode node = e.Node.Tag as GrtListNode;

                            String value;
                            grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out value);

                            if (value.Equals(""))
                            {
                                // Mark this row as placeholder. This activates special handling in the backend
                                // (e.g. default value generation).
                                grtList.set_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, 1);

                                // Read the default value and initialize the editor control with it.
                                grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out value);
                                textBox.Text = value;
                            }
                        }
                    }

                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                    textBox.Leave   += new EventHandler(textBox_Leave);
                }
            }
            else if (sender == datatypeComboBoxNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    if (e.Node != null && e.Node.Tag != null)
                    {
                        GrtListNode node = e.Node.Tag as GrtListNode;

                        String value;
                        grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Type, out value);

                        if (value.Equals(""))
                        {
                            grtList.set_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, 1);
                            comboBox.Text = value;
                        }
                        else
                        {
                            comboBox.Text = value;
                        }
                    }

                    // BOOL/BOOLEAN as well as a few others types listed here
                    // http://dev.mysql.com/doc/refman/5.6/en/other-vendor-data-types.html
                    // are not supported by server but rather converted to the
                    // corresponding native types. WB pre-loads these types as user-defined.

                    comboBox.Items.Clear();
                    comboBox.Items.AddRange(((MySQLTableColumnsListWrapper)grtList).get_datatype_names().ToArray());

                    comboBox.DropDownHeight = 450;
                    comboBox.KeyDown       += new KeyEventHandler(textBox_KeyDown);
                    comboBox.Leave         += new EventHandler(comboBox_Leave);
                }
            }
            else if (sender == defaultNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                {
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                    textBox.Leave   += new EventHandler(textBox_Leave);
                }
            }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
            if (textBox != null)
            {
              // Only do for the placeholder row.
              if (TreeView.CurrentNode.Index == grtList.count() - 1)
              {
            if (e.Node != null && e.Node.Tag != null)
            {
              GrtListNode node = e.Node.Tag as GrtListNode;

              String value;
              grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out value);

              if (value.Equals(""))
              {
                // Mark this row as placeholder. This activates special handling in the backend
                // (e.g. default value generation).
                grtList.set_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, 1);

                // Read the default value and initialize the editor control with it.
                grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out value);
                textBox.Text = value;
              }
            }
              }

              textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              textBox.Leave += new EventHandler(textBox_Leave);
            }
            }
              else if (sender == datatypeComboBoxNodeControl)
              {
            ComboBox comboBox = e.Editor as ComboBox;
            if (comboBox != null)
            {
              if (e.Node != null && e.Node.Tag != null)
              {
            GrtListNode node = e.Node.Tag as GrtListNode;

            String value;
            grtList.get_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Type, out value);

            if (value.Equals(""))
            {
              grtList.set_field(node.NodeId, (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, 1);
              comboBox.Text = value;
            }
            else
              comboBox.Text = value;
              }

              // BOOL/BOOLEAN as well as a few others types listed here
              // http://dev.mysql.com/doc/refman/5.6/en/other-vendor-data-types.html
              // are not supported by server but rather converted to the
              // corresponding native types. WB pre-loads these types as user-defined.

              comboBox.Items.Clear();
              comboBox.Items.AddRange(((MySQLTableColumnsListWrapper)grtList).get_datatype_names().ToArray());

              comboBox.DropDownHeight = 450;
              comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              comboBox.Leave += new EventHandler(comboBox_Leave);
            }
              }
              else if (sender == defaultNodeControl)
              {
            TextBox textBox = e.Editor as TextBox;
            if (textBox != null)
            {
              textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              textBox.Leave += new EventHandler(textBox_Leave);
            }
              }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
              {
            TextBox textBox = e.Editor as TextBox;
            if (textBox != null)
              textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              }
              else if (sender == targetNodeControl)
              {
            ComboBox comboBox = e.Editor as ComboBox;
            if (comboBox != null)
            {
              if (e.Node != null && e.Node.Tag != null)
              {
            GrtListNode node = e.Node.Tag as GrtListNode;

            String value;
            grtList.get_field(node.NodeId, (int)FKConstraintListWrapper.FKConstraintListColumns.RefTable, out value);

            comboBox.Items.Clear();
            using (Graphics graphics = comboBox.CreateGraphics())
            {
              float maxWidth = 200; // Minimum width
              List<string> tables = mySQLTableEditorWrapper.get_all_table_names();
              foreach (string table in tables)
              {
                comboBox.Items.Add(table);
                SizeF size = graphics.MeasureString(table, comboBox.Font);
                if (size.Width > maxWidth)
                  maxWidth = size.Width;

                // Make sure the previous selected item is selected again
                if (table.Equals(value))
                  comboBox.SelectedIndex = comboBox.Items.Count - 1;
              }

              // Limit width to a sane value.
              if (maxWidth > 700)
                maxWidth = 700;
              comboBox.DropDownWidth = (int)Math.Ceiling(maxWidth);
            }
              }

              comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              comboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
            }
              }
        }
 private void EditorInitialize(object sender, EditorInitializeEventArgs e)
 {
     if (sender is AdvNodeTextBox)
       {
     TextBox textBox = e.Editor as TextBox;
     if (textBox != null)
     {
       textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);//LLL
     }
       }
 }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
              {
            TextBox textBox = e.Editor as TextBox;
            if (textBox != null)
            {
              if (TreeView.CurrentNode.Index == 0)
            textBox.Text = "id" + mySQLTableEditorWrapper.get_name();

              textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
            }
              }
              else if (sender == targetColumnNodeControl)
              {
            ComboBox comboBox = e.Editor as ComboBox;
            if (comboBox != null)
              comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);

            GrtListNode node = treeView.CurrentNode.Tag as GrtListNode;

            List<string> columns = ((FKConstraintColumnsListWrapper)GrtList).get_ref_columns_list(node.NodeId, false);

            string selected;
            grtList.get_field(node.NodeId, (int)FKConstraintColumnsListWrapper.FKConstraintColumnsListColumns.RefColumn, out selected);

            comboBox.Items.Clear();
            comboBox.Items.AddRange(columns.ToArray());

            int i= 0;
            foreach (String col in columns)
            {
              if (col == selected)
              {
            comboBox.SelectedIndex = i;
              }
              i++;
            }
              }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
            }
            else if (sender == typeNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
              if (e.Node != null && e.Node.Tag != null)
              {
            GrtListNode node = e.Node.Tag as GrtListNode;

            String value;
            grtList.get_field(node.NodeId, (int)IndexListWrapper.IndexListColumns.Type, out value);

            comboBox.Items.Clear();
            List<string> indexTypes = tableEditorWrapper.get_index_types();
            foreach (string indexType in indexTypes)
            {
              comboBox.Items.Add(indexType);

              // Make sure the previous selected item is selected again
              if (indexType.Equals(value))
                comboBox.SelectedIndex = comboBox.Items.Count - 1;
            }
              }

                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
              comboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
                }
            }
        }
        private void EditorInitialize(object sender, EditorInitializeEventArgs e)
        {
            if (sender == nameNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.Items.Clear();

                    // Add table columns
                    for (int i = 0; i < tableColumnGrtList.count(); i++)
                    {
                        string caption;

                        tableColumnGrtList.get_field(tableColumnGrtList.get_node(i),
                            (int)MySQLTableColumnsListWrapper.MySQLColumnListColumns.Name, out caption);

                        comboBox.Items.Add(caption);
                    }

                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
            else if (sender == orderNodeControl)
            {
                ComboBox comboBox = e.Editor as ComboBox;
                if (comboBox != null)
                {
                    comboBox.Items.Clear();
              int maxOrderIndex = ((IndexColumnsListWrapper)grtList).get_max_order_index();
              for (int i = 1; i <= maxOrderIndex; i++)
                      comboBox.Items.Add(i);

                    //comboBox.DropDownStyle = ComboBoxStyle.DropDown;
                    comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
                }
            }
              else if (sender == storageNodeControl)
              {
            ComboBox comboBox = e.Editor as ComboBox;
            if (comboBox != null)
            {
              comboBox.Items.Clear();
              comboBox.Items.Add("ASC");
              comboBox.Items.Add("DESC");

              //comboBox.DropDownStyle = ComboBoxStyle.DropDown;
              comboBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
            }
              }
            else if (sender == lengthNodeControl)
            {
                TextBox textBox = e.Editor as TextBox;
                if (textBox != null)
                    textBox.KeyDown += new KeyEventHandler(textBox_KeyDown);
            }
        }