private void generateRows() { if (DatabaseObject == null) { return; } grid.Rows.Clear(); foreach (DBAttribute currAttr in DatabaseObject.Attributes) { int rowNum = grid.Rows.Add(); DataGridViewRow currRow = grid.Rows[rowNum]; currRow.Tag = currAttr; // build the custom value cell IDBFieldBackedControl valueCell; if (currAttr.Description.SelectionMode == DBAttrDescription.SelectionModeEnum.Dynamic || currAttr.Description.SelectionMode == DBAttrDescription.SelectionModeEnum.Selection) { valueCell = new DBComboBoxCell(); ((DBComboBoxCell)valueCell).SetCustomChoices(currAttr.Description.PossibleValues); } else { valueCell = new DBTextBoxCell(); } valueCell.Table = typeof(DBAttribute); valueCell.DatabaseFieldName = "Value"; switch (currAttr.Description.ValueType) { case DBAttrDescription.ValueTypeEnum.INT: valueCell.DBTypeOverride = DBField.DBDataType.INTEGER; break; case DBAttrDescription.ValueTypeEnum.LONG: valueCell.DBTypeOverride = DBField.DBDataType.LONG; break; case DBAttrDescription.ValueTypeEnum.FLOAT: valueCell.DBTypeOverride = DBField.DBDataType.REAL; break; case DBAttrDescription.ValueTypeEnum.BOOL: valueCell.DBTypeOverride = DBField.DBDataType.BOOL; break; case DBAttrDescription.ValueTypeEnum.STRING: valueCell.DBTypeOverride = DBField.DBDataType.TEXT; break; } valueCell.DatabaseObject = currAttr; currRow.Cells["valueColumn"] = (DataGridViewCell)valueCell; currRow.Cells["fieldColumn"].Value = currAttr.Description.Name; } }
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 generateRows() { if (DatabaseObject == null) return; grid.Rows.Clear(); foreach (DBAttribute currAttr in DatabaseObject.Attributes) { int rowNum = grid.Rows.Add(); DataGridViewRow currRow = grid.Rows[rowNum]; currRow.Tag = currAttr; // build the custom value cell IDBFieldBackedControl valueCell; if (currAttr.Description.SelectionMode == DBAttrDescription.SelectionModeEnum.Dynamic || currAttr.Description.SelectionMode == DBAttrDescription.SelectionModeEnum.Selection) { valueCell = new DBComboBoxCell(); ((DBComboBoxCell)valueCell).SetCustomChoices(currAttr.Description.PossibleValues); } else valueCell = new DBTextBoxCell(); valueCell.Table = typeof(DBAttribute); valueCell.DatabaseFieldName = "Value"; switch (currAttr.Description.ValueType) { case DBAttrDescription.ValueTypeEnum.INT: valueCell.DBTypeOverride = DBField.DBDataType.INTEGER; break; case DBAttrDescription.ValueTypeEnum.FLOAT: valueCell.DBTypeOverride = DBField.DBDataType.REAL; break; case DBAttrDescription.ValueTypeEnum.BOOL: valueCell.DBTypeOverride = DBField.DBDataType.BOOL; break; case DBAttrDescription.ValueTypeEnum.STRING: valueCell.DBTypeOverride = DBField.DBDataType.TEXT; break; } valueCell.DatabaseObject = currAttr; currRow.Cells["valueColumn"] = (DataGridViewCell)valueCell; currRow.Cells["fieldColumn"].Value = currAttr.Description.Name; } }
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; } }