예제 #1
0
        public IDictionary<string, IFiledEditor> BuildEditUI( ComponentDesignControl designer , ComponentSet set, object obj)
        {
            foreach (FieldSet p in set.Fields)
            {
                TableRow row = new TableRow();
                designer.Rows.Add(row);

                TableCell cell = new TableCell();
                cell.CssClass = designer.NameCellCssClass;
                cell.Width = NameColumnWidth;
                row.Cells.Add(cell);

                if (set.Depth == 0)
                    cell.Text = FormatDisplayName(p.DisplayName, designer);
                else
                    cell.Text = this.GenSpace(set.Depth + 2) + FormatDisplayName(p.DisplayName, designer);

                cell = new TableCell();
                cell.CssClass = designer.ValueCellCssClass;
                cell.Width = ValueColumnWidth;
                row.Cells.Add(cell);

                System.Web.UI.WebControls.WebControl ctl = FieldEditorFactory.GetFieldEditor(p);

                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);
            }

            foreach (ComponentSet subSet in set.SubSet)
            {
                TableRow row = new TableRow();
                designer.Rows.Add(row);

                TableCell cell = new TableCell();
                cell.ColumnSpan = 2;
                row.Cells.Add(cell);
                cell.Text = this.GenSpace(subSet.ParentSet.Depth) + FormatDisplayName(subSet.DisplayName,designer);

                BuildEditUI( designer , subSet, subSet.GetValue(obj));
            }

            return FieldSetEditors;
        }
예제 #2
0
 private string FormatDisplayName(string name, ComponentDesignControl designer)
 {
     if (String.IsNullOrEmpty(designer.FieldNameFormatString))
         return name;
     else
         return String.Format(designer.FieldNameFormatString, name);
 }
예제 #3
0
        public void BuildViewUI(ComponentDesignControl designer ,ComponentSet set, object obj)
        {
            foreach (FieldSet p in set.Fields)
            {
                TableRow row = new TableRow();
                designer.Rows.Add(row);

                TableCell cell = new TableCell();
                cell.Width = NameColumnWidth;
                cell.CssClass = designer.NameCellCssClass;
                row.Cells.Add(cell);

                if (set.Depth == 0)
                    cell.Text = FormatDisplayName(p.DisplayName, designer);
                else
                    cell.Text = this.GenSpace(set.Depth + 2) + FormatDisplayName(p.DisplayName, designer);

                //
                cell = new TableCell();
                cell.CssClass = designer.ValueCellCssClass;
                cell.Width = ValueColumnWidth;
                row.Cells.Add(cell);
                cell.Text = "" + p.GetValue(obj);
            }

            foreach (ComponentSet subSet in set.SubSet)
            {
                TableRow row = new TableRow();
                designer.Rows.Add(row);

                TableCell cell = new TableCell();
                cell.ColumnSpan = 2;
                row.Cells.Add(cell);
                cell.Text = this.GenSpace(subSet.ParentSet.Depth) + FormatDisplayName( subSet.DisplayName,designer);

                BuildViewUI(designer,subSet, subSet.GetValue(obj));
            }
        }