Esempio n. 1
0
 protected void generateFieldProperties()
 {
     foreach (DBField currField in Fields)
     {
         if (getProperties(currField.Name) == null)
         {
             FieldProperty metaData = new FieldProperty();
             metaData.FieldName = currField.Name;
             metaData.Visible   = true;
             FieldProperties.Add(metaData);
         }
     }
 }
Esempio n. 2
0
        public void OnFieldPropertiesChanged()
        {
            if (grid.Columns.Count == 0)
            {
                return;
            }

            grid.Rows.Clear();

            foreach (DBField currField in FieldDisplaySettings.Fields)
            {
                FieldProperty properties = FieldDisplaySettings.getProperties(currField.Name);
                if (properties == null)
                {
                    properties           = new FieldProperty();
                    properties.FieldName = currField.Name;
                    properties.Visible   = true;
                }

                if (properties.Visible == false)
                {
                    continue;
                }

                int             rowNum  = grid.Rows.Add();
                DataGridViewRow currRow = grid.Rows[rowNum];
                currRow.Tag      = currField;
                currRow.ReadOnly = properties.ReadOnly;

                // build the custom value cell
                IDBFieldBackedControl valueCell;
                if (currField.DBType == DBField.DBDataType.ENUM)
                {
                    valueCell = new DBComboBoxCell();
                }
                else
                {
                    valueCell = new DBTextBoxCell();
                }

                valueCell.Table              = FieldDisplaySettings.Table;
                valueCell.DatabaseFieldName  = properties.FieldName;
                valueCell.DatabaseObject     = DatabaseObject;
                valueCell.FieldChanged      += new FieldChangedListener(OnFieldChanged);
                currRow.Cells["valueColumn"] = (DataGridViewCell)valueCell;

                currRow.Cells["fieldColumn"].Value = properties.DisplayName;
            }
        }
Esempio n. 3
0
        private void BuildColumns()
        {
            this.Items.Clear();
            this.Columns.Clear();

            Dictionary <FieldProperty, ColumnHeader> columnLookup = new Dictionary <FieldProperty, ColumnHeader>();

            foreach (DBField currField in FieldDisplaySettings.Fields)
            {
                FieldProperty properties = FieldDisplaySettings.getProperties(currField.Name);
                if (properties == null)
                {
                    properties           = new FieldProperty();
                    properties.FieldName = currField.Name;
                    properties.Visible   = true;
                }

                if (properties.Visible == false)
                {
                    continue;
                }


                ColumnHeader newColumn = new ColumnHeader();
                newColumn.Text = properties.DisplayName;
                newColumn.Name = properties.FieldName + "_column";
                newColumn.Tag  = currField;

                columnLookup[properties] = newColumn;

                this.Columns.Add(newColumn);

                // if we are not displaying columns we only need the first one.
                if (!_displayColumns)
                {
                    break;
                }
            }

            foreach (FieldProperty currProperty in FieldDisplaySettings.FieldProperties)
            {
                if (currProperty.ColumnWidth != null && currProperty.Visible != false)
                {
                    columnLookup[currProperty].Width = (int)currProperty.ColumnWidth;
                    autoSize = false;
                }
            }
        }
        public void OnFieldPropertiesChanged()
        {
            if (grid.Columns.Count == 0)
                return;

            grid.Rows.Clear();

            foreach (DBField currField in FieldDisplaySettings.Fields) {
                FieldProperty properties = FieldDisplaySettings.getProperties(currField.Name);
                if (properties == null) {
                    properties = new FieldProperty();
                    properties.FieldName = currField.Name;
                    properties.Visible = true;
                }

                if (properties.Visible == false)
                    continue;

                int rowNum = grid.Rows.Add();
                DataGridViewRow currRow = grid.Rows[rowNum];
                currRow.Tag = currField;
                currRow.ReadOnly = properties.ReadOnly;

                // build the custom value cell
                IDBFieldBackedControl valueCell;
                if (currField.DBType == DBField.DBDataType.ENUM)
                    valueCell = new DBComboBoxCell();
                else
                    valueCell = new DBTextBoxCell();

                valueCell.Table = FieldDisplaySettings.Table;
                valueCell.DatabaseFieldName = properties.FieldName;
                valueCell.DatabaseObject = DatabaseObject;
                valueCell.FieldChanged += new FieldChangedListener(OnFieldChanged);
                currRow.Cells["valueColumn"] = (DataGridViewCell)valueCell;

                currRow.Cells["fieldColumn"].Value = properties.DisplayName;
            }
        }
        private void BuildColumns()
        {
            this.Items.Clear();
            this.Columns.Clear();

            Dictionary<FieldProperty, ColumnHeader> columnLookup = new Dictionary<FieldProperty,ColumnHeader>();

            foreach (DBField currField in FieldDisplaySettings.Fields) {
                FieldProperty properties = FieldDisplaySettings.getProperties(currField.Name);
                if (properties == null) {
                    properties = new FieldProperty();
                    properties.FieldName = currField.Name;
                    properties.Visible = true;
                }

                if (properties.Visible == false)
                    continue;

                ColumnHeader newColumn = new ColumnHeader();
                newColumn.Text = properties.DisplayName;
                newColumn.Name = properties.FieldName + "_column";
                newColumn.Tag = currField;

                columnLookup[properties] = newColumn;

                this.Columns.Add(newColumn);

                // if we are not displaying columns we only need the first one.
                if (!_displayColumns) break;
            }

            foreach (FieldProperty currProperty in FieldDisplaySettings.FieldProperties) {
                if (currProperty.ColumnWidth != null && currProperty.Visible != false) {
                    columnLookup[currProperty].Width = (int)currProperty.ColumnWidth;
                    autoSize = false;
                }
            }
        }
 protected void generateFieldProperties()
 {
     foreach (DBField currField in Fields) {
         if (getProperties(currField.Name) == null) {
             FieldProperty metaData = new FieldProperty();
             metaData.FieldName = currField.Name;
             metaData.Visible = true;
             FieldProperties.Add(metaData);
         }
     }
 }