/// <summary>
        /// Constructor that initializes the model with the given objects
        /// </summary>
        /// <param name="TreeView">The TreeViewAdv control this model belongs to</param>
        /// <param name="GrtTree">The GRT tree this model belongs to</param>
        public DbMysqlTableIndexColumnsListModel(TreeViewAdv ListView, IndexColumnsListWrapper GrtList,
                                                 MySQLTableColumnsListWrapper TableColumnGrtList,
                                                 NodeCheckBox EnabledNodeControl,
                                                 AdvNodeComboBox NameNodeControl,
                                                 AdvNodeComboBox OrderNodeControl,
                                                 AdvNodeComboBox StorageNodeControl,
                                                 AdvNodeTextBox LengthNodeControl)
            : base(ListView, GrtList, false)
        {
            tableColumnGrtList = TableColumnGrtList;

            enabledNodeControl = EnabledNodeControl;
            nameNodeControl    = NameNodeControl;
            orderNodeControl   = OrderNodeControl;
            storageNodeControl = StorageNodeControl;
            lengthNodeControl  = LengthNodeControl;

            // assign virtual value events for displaying and processing the edited value content
            enabledNodeControl.ValueNeeded      += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            enabledNodeControl.ValuePushed      += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            nameNodeControl.EditorInitialize    += new EditorInitializeEventHandler(EditorInitialize);
            nameNodeControl.ValueNeeded         += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            nameNodeControl.ValuePushed         += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            orderNodeControl.EditorInitialize   += new EditorInitializeEventHandler(EditorInitialize);
            orderNodeControl.ValueNeeded        += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            orderNodeControl.ValuePushed        += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            storageNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            storageNodeControl.ValueNeeded      += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            storageNodeControl.ValuePushed      += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            lengthNodeControl.EditorInitialize  += new EditorInitializeEventHandler(EditorInitialize);
            lengthNodeControl.ValueNeeded       += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            lengthNodeControl.ValuePushed       += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
        }
        /// <summary>
        /// Constructor that initializes the model with the given objects
        /// </summary>
        /// <param name="TreeView">The TreeViewAdv control this model belongs to</param>
        /// <param name="GrtTree">The GRT tree this model belongs to</param>
        public DbMysqlTableIndexColumnsListModel(TreeViewAdv ListView, IndexColumnsListWrapper GrtList,
            MySQLTableColumnsListWrapper TableColumnGrtList,
            NodeCheckBox EnabledNodeControl,
            AdvNodeComboBox NameNodeControl,
            AdvNodeComboBox OrderNodeControl,
            AdvNodeComboBox StorageNodeControl,
            AdvNodeTextBox LengthNodeControl)
            : base(ListView, GrtList, false)
        {
            tableColumnGrtList = TableColumnGrtList;

              enabledNodeControl = EnabledNodeControl;
            nameNodeControl = NameNodeControl;
              orderNodeControl = OrderNodeControl;
              storageNodeControl = StorageNodeControl;
              lengthNodeControl = LengthNodeControl;

            // assign virtual value events for displaying and processing the edited value content
              enabledNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              enabledNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              nameNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            nameNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            nameNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              orderNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
              orderNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              orderNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              storageNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            storageNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            storageNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              lengthNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
              lengthNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              lengthNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
        }
Esempio n. 3
0
        /// <summary>
        /// Constructor that initializes the model with the given objects
        /// </summary>
        /// <param name="TreeView">The TreeViewAdv control this model belongs to</param>
        /// <param name="GrtTree">The GRT tree this model belongs to</param>
        /// <param name="NodeStateIcon">The NodeStateIcon NodeControl that displays the icon</param>
        public DbMysqlTableColumnsListModel(IModelChangeListener listener, TreeViewAdv tree,
                                            MySQLTableColumnsListWrapper grtList,
                                            NodeIcon columnIconNodeControl, AdvNodeTextBox nameNodeControl, AdvNodeComboBox datatypeComboBoxNodeControl,
                                            NodeCheckBox pkNodeControl, NodeCheckBox nnNodeControl, NodeCheckBox uqNodeControl, NodeCheckBox binNodeControl,
                                            NodeCheckBox unNodeControl, NodeCheckBox zfNodeControl, NodeCheckBox aiNodeControl,
                                            NodeCheckBox gNodeControl, AdvNodeTextBox defaultNodeControl, MySQLTableEditorWrapper wrapper)
            : base(tree, grtList, columnIconNodeControl, true)
        {
            this.listener = listener;

            this.nameNodeControl             = nameNodeControl;
            this.datatypeComboBoxNodeControl = datatypeComboBoxNodeControl;
            this.pkNodeControl           = pkNodeControl;
            this.nnNodeControl           = nnNodeControl;
            this.uqNodeControl           = uqNodeControl;
            this.binNodeControl          = binNodeControl;
            this.unNodeControl           = unNodeControl;
            this.zfNodeControl           = zfNodeControl;
            this.aiNodeControl           = aiNodeControl;
            this.gNodeControl            = gNodeControl;
            this.defaultNodeControl      = defaultNodeControl;
            this.mySQLTableEditorWrapper = wrapper;

            // assign virtual value events for displaying and processing the edited value content
            nameNodeControl.EditorInitialize             += new EditorInitializeEventHandler(EditorInitialize);
            nameNodeControl.ValueNeeded                  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            nameNodeControl.ValuePushed                  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            datatypeComboBoxNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            datatypeComboBoxNodeControl.ValueNeeded      += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            datatypeComboBoxNodeControl.ValuePushed      += new EventHandler <NodeControlValueEventArgs>(ValuePushed);

            pkNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            pkNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            nnNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            nnNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            uqNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            uqNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            binNodeControl.ValueNeeded += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            binNodeControl.ValuePushed += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            unNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            unNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            zfNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            zfNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            aiNodeControl.ValueNeeded  += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            aiNodeControl.ValuePushed  += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
            gNodeControl.ValueNeeded   += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            gNodeControl.ValuePushed   += new EventHandler <NodeControlValueEventArgs>(ValuePushed);

            defaultNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            defaultNodeControl.ValueNeeded      += new EventHandler <NodeControlValueEventArgs>(ValueNeeded);
            defaultNodeControl.ValuePushed      += new EventHandler <NodeControlValueEventArgs>(ValuePushed);
        }
        /// <summary>
        /// Constructor that initializes the model with the given objects
        /// </summary>
        /// <param name="TreeView">The TreeViewAdv control this model belongs to</param>
        /// <param name="GrtTree">The GRT tree this model belongs to</param>
        /// <param name="NodeStateIcon">The NodeStateIcon NodeControl that displays the icon</param>
        public DbMysqlTableColumnsListModel(IModelChangeListener listener, TreeViewAdv tree,
            MySQLTableColumnsListWrapper grtList,
            NodeIcon columnIconNodeControl, AdvNodeTextBox nameNodeControl, AdvNodeComboBox datatypeComboBoxNodeControl,
            NodeCheckBox pkNodeControl, NodeCheckBox nnNodeControl, NodeCheckBox uqNodeControl, NodeCheckBox binNodeControl,
            NodeCheckBox unNodeControl, NodeCheckBox zfNodeControl, NodeCheckBox aiNodeControl,
            NodeCheckBox gNodeControl, AdvNodeTextBox defaultNodeControl, MySQLTableEditorWrapper wrapper)
            : base(tree, grtList, columnIconNodeControl, true)
        {
            this.listener = listener;

              this.nameNodeControl = nameNodeControl;
              this.datatypeComboBoxNodeControl = datatypeComboBoxNodeControl;
              this.pkNodeControl = pkNodeControl;
              this.nnNodeControl = nnNodeControl;
              this.uqNodeControl = uqNodeControl;
              this.binNodeControl = binNodeControl;
              this.unNodeControl = unNodeControl;
              this.zfNodeControl = zfNodeControl;
              this.aiNodeControl = aiNodeControl;
              this.gNodeControl = gNodeControl;
              this.defaultNodeControl = defaultNodeControl;
              this.mySQLTableEditorWrapper = wrapper;

            // assign virtual value events for displaying and processing the edited value content
            nameNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            nameNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            nameNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              datatypeComboBoxNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
              datatypeComboBoxNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              datatypeComboBoxNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);

              pkNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              pkNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              nnNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            nnNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              uqNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              uqNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              binNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              binNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              unNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              unNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              zfNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              zfNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              aiNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            aiNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
              gNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
              gNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);

              defaultNodeControl.EditorInitialize += new EditorInitializeEventHandler(EditorInitialize);
            defaultNodeControl.ValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNeeded);
            defaultNodeControl.ValuePushed += new EventHandler<NodeControlValueEventArgs>(ValuePushed);
        }
        private void updateColumnTextField(MySQLTableColumnsListWrapper.MySQLColumnListColumns column, TextBox box)
        {
            if (columnsTreeView.SelectedNode != null)
              {
            // Change an attribute triggers a whole chain of events which ultimately cause the
            // table editor to refresh completely (including all nodes in the columns tree etc.).
            // So we have to take measure to restore what was active when the user changed the value.
            NodeIdWrapper nodeId = new NodeIdWrapper(columnsTreeView.SelectedNode.Index);
            if (!columnsListModel.GrtList.set_field(nodeId, (int)column, box.Text))
            {
              CustomMessageBox.Show(MessageType.MessageError, "Could not set new value",
            "The entered value contains errors and cannot be accepted. The previous value is kept instead.",
            "Close");

              string originalText;
              columnsListModel.GrtList.get_field(nodeId, (int)column, out originalText);
              box.Text = originalText;
            }

            columnsTreeView.SelectedNode = columnsTreeView.Root.Children[nodeId.get_by_index(0)];
              }
        }