/// <summary> /// ��̬�����༭���� /// </summary> /// <param name="designer"></param> /// <param name="set"></param> /// <param name="obj"></param> /// <returns></returns> public IDictionary<string, IFiledEditor> BuildEditUI( ComponentDesignControl designer , ComponentSet set, object obj) { if (_RepeatColumns % 2 != 0) _RepeatColumns += 1; int FieldNums = set.Fields.Count; int surplus = FieldNums % (_RepeatColumns / 2); int rowCount = GetRepeatRows(FieldNums, _RepeatColumns / 2); for (int i = 0; i < rowCount; i++) { TableRow row = new TableRow(); designer.Rows.Add(row); int tmp = GetRepeatCols(i, FieldNums, _RepeatColumns/2, rowCount); for (int j = 0; j < tmp; j++) { FieldSet p = set.Fields[i * _RepeatColumns / 2 + j]; TableCell cell = new TableCell(); cell.CssClass = designer.NameCellCssClass; cell.Text = p.DisplayName; row.Cells.Add(cell); cell = new TableCell(); row.Cells.Add(cell); System.Web.UI.WebControls.WebControl ctl = FieldEditorFactory.GetFieldEditor(p); ctl.CssClass = designer.ValueCellCssClass; ctl.ID = p.UniqueName; IFiledEditor fe = (IFiledEditor)ctl; fe.FieldValue = p.GetValue(obj); this.FieldSetEditors.Add(p.UniqueName, fe); cell.Controls.Add(ctl); designer.RaiseControlCreatedEvent(ctl, p); } } return FieldSetEditors; }
/// <summary> /// ��̬������ͼ���� /// </summary> /// <param name="designer"></param> /// <param name="set"></param> /// <param name="obj"></param> public void BuildViewUI(ComponentDesignControl designer ,ComponentSet set, object obj) { if (_RepeatColumns % 2 != 0) _RepeatColumns += 1; int FieldNums = set.Fields.Count; int surplus = FieldNums % (_RepeatColumns/2); int rows = FieldNums / (_RepeatColumns/2); int rowCount = 0; //IList<FieldSet> sortedFields = FieldsSort(set.Fields); if (surplus > 0) { rowCount = rows + 1; } else { rowCount = rows; } for (int i = 0; i < rowCount; i++) { TableRow row = new TableRow(); designer.Rows.Add(row); int tmp = 0; if (i == rowCount - 1 && surplus == 0) { tmp = _RepeatColumns/2; } else if (i == rowCount - 1 && surplus > 0) { tmp = surplus; } else tmp = _RepeatColumns/2; for (int j = 0; j < tmp; j++) { FieldSet p = set.Fields[i * _RepeatColumns / 2 + j]; TableCell cell = new TableCell(); cell.Width = new Unit("131px"); row.Cells.Add(cell); cell.Text = p.DisplayName; cell = new TableCell(); row.Cells.Add(cell); cell.Text = "" + p.GetValue(obj); } } }
/// <summary> /// ��̬�����ش����� /// </summary> /// <param name="designer"></param> /// <param name="set"></param> /// <returns></returns> public IDictionary<string, IFiledEditor> BuildRetrieveUI(ComponentDesignControl designer, ComponentSet set) { this.FieldSetEditors.Clear(); if (_RepeatColumns % 2 != 0) _RepeatColumns += 1; int FieldNums = set.Fields.Count; int surplus = FieldNums % (_RepeatColumns / 2); int rows = FieldNums / (_RepeatColumns / 2); int rowCount = 0; if (surplus > 0) { rowCount = rows + 1; } else { rowCount = rows; } for (int i = 0; i < rowCount; i++) { TableRow row = new TableRow(); designer.Rows.Add(row); int tmp = 0; if (i == rowCount - 1 && surplus == 0) { tmp = _RepeatColumns/2; } else if (i == rowCount - 1 && surplus > 0) { tmp = surplus; } else tmp = _RepeatColumns/2; for (int j = 0; j < tmp; j++) { FieldSet p = set.Fields[i * (_RepeatColumns / 2) + j]; TableCell cell = new TableCell(); row.Cells.Add(cell); cell.Text = p.DisplayName; cell.CssClass = designer.NameCellCssClass; cell = new TableCell(); System.Web.UI.WebControls.WebControl ctl = FieldEditorFactory.GetFieldEditor(p); ctl.CssClass = designer.ValueCellCssClass; ctl.ID = p.UniqueName; IFiledEditor fe = (IFiledEditor)ctl; this.FieldSetEditors.Add(p.UniqueName, fe); cell.Controls.Add(ctl); row.Cells.Add(cell); designer.RaiseControlCreatedEvent(ctl, p); } } return FieldSetEditors; }