Пример #1
0
        private void CreateFieldEditors()
        {
            int            count        = 0;
            AXFieldMapping fieldMapping = null;

            if (axFolder.Fields.Length > 0)
            {
                string[] fields = axFolder.Fields.Split('|');

                foreach (string field in fields)
                {
                    fieldMapping = GetAxFieldMapping(field);
                    RepositoryItem[] repositoryItems = GetRepositoryEditor(fieldMapping);
                    rbnCntrlAxFolderPnal.RepositoryItems.AddRange(repositoryItems);

                    BarEditItem barEditItem = new DevExpress.XtraBars.BarEditItem();

                    barEditItem.Caption = field + ":";
                    barEditItem.Edit    = repositoryItems[0];
                    barEditItem.Id      = count;
                    barEditItem.Name    = "barEditItem" + field;
                    barEditItem.Width   = 100;

                    if (!fieldMapping.DefaultValue.Contains(","))
                    {
                        barEditItem.EditValue = fieldMapping.DefaultValue;
                    }

                    if (fieldMapping != null)
                    {
                        if (fieldMapping.DisplayName != "")
                        {
                            barEditItem.Caption = fieldMapping.DisplayName + ":";
                        }
                        if (fieldMapping.Width != "")
                        {
                            barEditItem.Width = Convert.ToInt16(fieldMapping.Width);
                        }

                        DevExpress.Utils.ToolTipTitleItem toolTipTitleItem1 = new DevExpress.Utils.ToolTipTitleItem();
                        DevExpress.Utils.SuperToolTip     superToolTip1     = new DevExpress.Utils.SuperToolTip();
                        DevExpress.Utils.ToolTipItem      toolTipItem1      = new DevExpress.Utils.ToolTipItem();

                        toolTipTitleItem1.Text  = "Field Information";
                        toolTipItem1.LeftIndent = 6;
                        toolTipItem1.Text       = fieldMapping.HelpDisplay;
                        superToolTip1.Items.Add(toolTipTitleItem1);
                        superToolTip1.Items.Add(toolTipItem1);
                        barEditItem.SuperTip = superToolTip1;
                    }
                    rbnCntrlAxFolderPnal.Items.AddRange(new DevExpress.XtraBars.BarItem[] { barEditItem });
                    rbnCntrlAxFolderPnal.Toolbar.ItemLinks.Add(barEditItem);
                    ribnPageGrpAxFields.ItemLinks.Add(barEditItem);
                    count++;
                }
            }
        }
Пример #2
0
        private AXFieldMapping GetAxFieldMapping(string field)
        {
            AXFieldMapping fieldMapping = null;

            if (axFieldMappings != null)
            {
                DataRow[] rows = axFieldMappings.Select("FieldName = '" + field + "'");
                if ((rows != null) && (rows.Length > 0))
                {
                    DataRow dr = rows[0];
                    fieldMapping = CollectionHelper.CreateObjectFromDataRow <AXFieldMapping>(dr);
                }
            }
            if (fieldMapping == null)  // create a default field
            {
                fieldMapping = new AXFieldMapping(field);
            }
            return(fieldMapping);
        }
Пример #3
0
        private RepositoryItem[] GetRepositoryEditor(AXFieldMapping fieldMapping)
        {
            RepositoryItem[] items      = new DevExpress.XtraEditors.Repository.RepositoryItem[1];
            EditorType       editorType = (EditorType)Enum.Parse(typeof(EditorType), fieldMapping.EditorType, true);

            if (fieldMapping != null)
            {
                switch (editorType)
                {
                case EditorType.TXT:
                {
                    RepositoryItemTextEdit repositoryItemEditor = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
                    ((System.ComponentModel.ISupportInitialize)(repositoryItemEditor)).BeginInit();
                    repositoryItemEditor.AutoHeight = false;
                    repositoryItemEditor.Name       = "repositoryItemTextEdit" + fieldMapping.FieldName;
                    items[0] = repositoryItemEditor;
                    break;
                }

                case EditorType.CMBO:
                {
                    RepositoryItemComboBox repositoryItemEditor = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();
                    ((System.ComponentModel.ISupportInitialize)(repositoryItemEditor)).BeginInit();

                    repositoryItemEditor.AutoHeight = false;
                    repositoryItemEditor.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
                            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
                        });
                    repositoryItemEditor.Name = "repositoryItemTextEdit" + fieldMapping.FieldName;
                    string[] values = fieldMapping.DefaultValue.Split(',');
                    repositoryItemEditor.Items.AddRange(values);
                    items[0] = repositoryItemEditor;
                    break;
                }
                }
            }
            return(items);
        }
Пример #4
0
        private AXFieldMapping GetAxFieldMapping(string field)
        {
            AXFieldMapping fieldMapping = null;

            if (axFieldMappings != null)
            {
                DataRow[] rows = axFieldMappings.Select("FieldName = '" + field + "'");
                if ((rows != null) && (rows.Length > 0))
                {
                    DataRow dr = rows[0];
                    fieldMapping = CollectionHelper.CreateObjectFromDataRow<AXFieldMapping>(dr);
                }
            }
            if (fieldMapping == null)  // create a default field 
            {
                fieldMapping = new AXFieldMapping(field);
            }
            return fieldMapping;
        }
Пример #5
0
        private RepositoryItem[] GetRepositoryEditor(AXFieldMapping fieldMapping)
        {
            RepositoryItem[] items = new DevExpress.XtraEditors.Repository.RepositoryItem[1];
            EditorType editorType = (EditorType)Enum.Parse(typeof(EditorType), fieldMapping.EditorType, true);

            if (fieldMapping != null)
            {
                switch (editorType)
                {
                    case EditorType.TXT:
                        {
                            RepositoryItemTextEdit repositoryItemEditor = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
                            ((System.ComponentModel.ISupportInitialize)(repositoryItemEditor)).BeginInit();
                            repositoryItemEditor.AutoHeight = false;
                            repositoryItemEditor.Name = "repositoryItemTextEdit" + fieldMapping.FieldName;
                            items[0] = repositoryItemEditor;
                            break;
                        }
                    case EditorType.CMBO:
                        {
                            RepositoryItemComboBox repositoryItemEditor = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox();
                            ((System.ComponentModel.ISupportInitialize)(repositoryItemEditor)).BeginInit();

                            repositoryItemEditor.AutoHeight = false;
                            repositoryItemEditor.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
                            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
                            repositoryItemEditor.Name = "repositoryItemTextEdit" + fieldMapping.FieldName;
                            string[] values = fieldMapping.DefaultValue.Split(',');
                            repositoryItemEditor.Items.AddRange(values);
                            items[0] = repositoryItemEditor;
                            break;
                        }
                }
            }
            return items;
        }