public void AddIndex(Index index) { TableGroup groupIndex = (TableGroup)this.Groups[1]; groupIndex.Groups.Add(index); this.SelectedItem = index; }
private void Start() { int num = 0; foreach (object obj in base.transform) { Transform transform = (Transform)obj; TableNodes component = transform.GetComponent <TableNodes>(); nodes.Add(component); if (num < component.table.tableNumber) { num = component.table.tableNumber; } } tables = new TableGroup[num]; for (int i = 0; i < tables.Length; i++) { tables[i] = new TableGroup(); tables[i].capacity = 0; tables[i].tableMats = new List <Table>(); tables[i].tableNodes = new List <TableNodes>(); } foreach (TableNodes tableNodes in nodes) { int num2 = tableNodes.table.tableNumber - 1; tables[num2].tableNodes.Add(tableNodes); tables[num2].tableMats.Add(tableNodes.table); tables[num2].capacity++; } }
internal void ResetContext(TableGroupCollection newRenderSubGroups, TableRowsCollection newRenderDetails) { if (m_isDetailGroup) { m_group.CurrentRenderGroupIndex = -1; _ = m_rowDefinitionEndIndex; _ = m_rowDefinitionStartIndex; if (newRenderDetails != null) { m_renderDetails = newRenderDetails; } ((ShimTableMemberCollection)m_children).UpdateDetails(m_renderDetails[0]); } else if (m_group != null && m_group.RenderGroups != null) { m_group.CurrentRenderGroupIndex = -1; if (newRenderSubGroups != null) { m_group.RenderGroups = new ShimRenderGroups(newRenderSubGroups); } if (m_children != null) { TableGroup tableGroup = m_group.CurrentShimRenderGroup as TableGroup; ((ShimTableMemberCollection)m_children).UpdateHeaderFooter(tableGroup.GroupHeader, tableGroup.GroupFooter); ((ShimTableMemberCollection)m_children).ResetContext(null); } } SetNewContext(fromMoveNext: true); }
public void RemoveIndex(Index index) { // Get Index Grouo TableGroup groupIndex = (TableGroup)this.Groups[1]; // Get Index int i = groupIndex.Groups.IndexOf(index); if (i == -1) { return; } // Remove Index groupIndex.Groups.RemoveAt(i); // Select Next Index if (groupIndex.Groups.Count == 0) { this.SelectedItem = groupIndex; } else { if (i != groupIndex.Groups.Count) { this.SelectedItem = groupIndex.Groups[i]; } else { this.SelectedItem = groupIndex.Groups[groupIndex.Groups.Count - 1]; } } }
public frmTable() { InitializeComponent(); Model model = diagram1.Model; diagram1.Paging.Enabled = false; diagram1.Model.SetSize(new Size(1000, 1000)); Table table = new Table(); table.Location = new PointF(100, 100); TableGroup group = new TableGroup("Group 1"); TableRow row = new TableRow("Group 1 Item"); table.Rows.Add(new TableRow("Table row item")); group.Rows.Add(row); table.Groups.Add(group); TablePort tablePort = new TablePort(row); table.Ports.Add(tablePort); model.Shapes.Add(table); diagram1.Refresh(); }
public void GetGroupsOfOrderEight() { IList <IGroup> dgroups = GetGroupsOfOrder(8); Assert.IsNotNull(dgroups); Assert.AreEqual(5, dgroups.Count); int nconmutatives = 0; int nnonconmutatives = 0; foreach (IGroup group in dgroups) { TableGroup tgroup = (TableGroup)group; if (tgroup.Table.IsCommutative) { nconmutatives++; } else { nnonconmutatives++; } } Assert.AreEqual(3, nconmutatives); Assert.AreEqual(2, nnonconmutatives); }
public void ResetContext(TableGroupCollection newRenderSubGroups, TableRowsCollection newRenderDetails) { if (this.m_isDetailGroup) { base.m_group.CurrentRenderGroupIndex = -1; if (newRenderDetails != null) { this.m_renderDetails = newRenderDetails; } ((ShimTableMemberCollection)base.m_children).UpdateDetails(this.m_renderDetails[0]); } else if (base.m_group != null && base.m_group.RenderGroups != null) { base.m_group.CurrentRenderGroupIndex = -1; if (newRenderSubGroups != null) { base.m_group.RenderGroups = new ShimRenderGroups(newRenderSubGroups); } if (base.m_children != null) { TableGroup tableGroup = base.m_group.CurrentShimRenderGroup as TableGroup; ((ShimTableMemberCollection)base.m_children).UpdateHeaderFooter(tableGroup.GroupHeader, tableGroup.GroupFooter); ((ShimTableMemberCollection)base.m_children).ResetContext(null); } } this.SetNewContext(true); }
private void ResetTable(TableItem item, Table table) { if (item is TableRow) { TableRow tableRow = (TableRow)item; if (tableRow is EsriTableRow) { ((EsriTableRow)tableRow).SetTable2(table); } } else if (item is TableGroup) { TableGroup tableGroup = (TableGroup)item; if (tableGroup is EsriTableGroup) { ((EsriTableGroup)tableGroup).SetTable2(table); } foreach (TableItem item2 in tableGroup.Groups) { this.ResetTable(item2, table); } foreach (TableItem item3 in tableGroup.Rows) { this.ResetTable(item3, table); } } }
public void AddPosKeys() { //this.txtBlockMenuName.Text = menuName; TableGroup tableGroup = new TableGroup(); tableGroup.Organization_no = PosSettings.Default.Organization; tableGroup.Store_no = PosSettings.Default.Store; DataSet dataSet = tableGroup.LoadTableGroup(); DataTable dt = dataSet.Tables[0]; int col = 0; int row = 0; foreach (DataRow dr in dt.Rows) { RegisterPosKeyAndEvent(int.Parse(dr["table_group_no"].ToString()), 1931184 + col, dr["table_group_name"].ToString(), new Thickness(5, 5, 5, 0), col, row, 1931184 + col, "EclipsePos.Apps.PosEvents.SelectTableGroup"); col++; if (col == 6) { row++; col = 0; } } }
public void AddField(Field field) { TableGroup groupField = (TableGroup)this.Groups[0]; groupField.Rows.Add(field); this.SelectedItem = field; }
public void RemoveField(Field field) { // Get Field Group TableGroup groupField = (TableGroup)this.Groups[0]; // Get Field int i = groupField.Rows.IndexOf(field); if (i == -1) { return; } // Remove Field groupField.Rows.RemoveAt(i); // Select Next Coded Value if (groupField.Rows.Count == 0) { this.SelectedItem = groupField; } else { if (i != groupField.Rows.Count) { this.SelectedItem = groupField.Rows[i]; } else { this.SelectedItem = groupField.Rows[groupField.Rows.Count - 1]; } } }
public void CreateNewTableGroup(TableGroupInDb newTableGroup) { var tableGroup = new TableGroup { Name = newTableGroup.Name, TeacherId = newTableGroup.TeacherId }; _tableGroupRepository.AddNewTableGroup(tableGroup); }
private TableGroup SetColumn(Crosstab crosstab, CrosstabReportValueDTO val) { TableGroup tableGroup = new TableGroup(); var textbox = new TextBox(); textbox.Value = val.EntityListViewColumn.Alias; tableGroup.ReportItem = textbox; crosstab.Items.Add(textbox); return(tableGroup); }
public void TestMinimalMetadata() { var tg = new TableGroup(); var _ = new Table(tg) { Url = new Uri("http://example.org/countries.csv") }; var actual = ParseMetadata(Path.Combine("data", "valid-table-1.json"), null); actual.Should().BeEquivalentTo(tg, options => options.Excluding(o => o.SelectedMemberPath.EndsWith(".Parent"))); }
public List <Index> GetIndexes() { List <Index> indexes = new List <Index>(); TableGroup groupIndex = (TableGroup)this.Groups[1]; foreach (Index index in groupIndex.Rows) { indexes.Add(index); } return(indexes); }
public List <Field> GetFields() { List <Field> fields = new List <Field>(); TableGroup groupField = (TableGroup)this.Groups[0]; foreach (Field field in groupField.Rows) { fields.Add(field); } return(fields); }
public override void RenderElement(IRenderable element, Graphics graphics, Render render) { TableGroup group = element as TableGroup; Table table = group.Table; byte opacity = 100; if (table != null) { opacity = table.Opacity; } //Draw Background SolidBrush brush = new SolidBrush(render.AdjustColor(group.Backcolor, 1, opacity)); brush.Color = Color.FromArgb(brush.Color.A / 2, brush.Color); graphics.FillRectangle(brush, group.Rectangle); //Draw plus or minus rectangle SmoothingMode smoothing = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.HighQuality; RectangleF expander = new RectangleF(4 + group.Indent, group.Rectangle.Top + 4, 11, 11); LinearGradientBrush gradientBrush = new LinearGradientBrush(expander, Color.FromArgb(255, Color.White), Color.FromArgb(255, 166, 176, 185), LinearGradientMode.Vertical); graphics.FillRectangle(gradientBrush, expander); // internal Pen pen = new Pen(Color.FromArgb(128, Color.Gray), 1); graphics.DrawRectangle(pen, expander.X, expander.Y, expander.Width, expander.Height); //border pen.Color = Color.FromArgb(128, Color.Black); pen.Width = 2; graphics.DrawLine(pen, expander.X + 2, expander.Y + 5.5F, expander.X + 9, expander.Y + 5.5F); //minus if (!group.Expanded) { graphics.DrawLine(pen, expander.X + 5.5F, expander.Y + 2, expander.X + 5.5F, expander.Y + 9); //plus } graphics.SmoothingMode = smoothing; //Draw text RectangleF textRectangle = new RectangleF(20 + group.Indent, group.Rectangle.Top, group.Rectangle.Width - 20 - group.Indent, group.Rectangle.Height); brush = new SolidBrush(render.AdjustColor(group.Forecolor, 1, opacity)); StringFormat format = new StringFormat(); format.LineAlignment = StringAlignment.Center; format.FormatFlags = StringFormatFlags.NoWrap; graphics.DrawString(group.Text, Singleton.Instance.GetFont(group.FontName, group.FontSize, group.FontStyle), brush, textRectangle, format); //Draw indent //brush = new SolidBrush(render.AdjustColor(Backcolor,1,opacity)); //brush.Color = Color.FromArgb(brush.Color.A /2, brush.Color); //graphics.FillRectangle(brush,0,Rectangle.Top,Indent,Rectangle.Height); }
private TableGroup SetTotalColumn(Crosstab crosstab, CrosstabReportValueDTO val, CrosstabReportColumnDTO item1, int colindex, CrosstabReportColumnDTO nextColumn, CrosstabReportColumnDTO prevColumn) { TableGroup tableGroup = new TableGroup(); var textbox = new TextBox(); if (prevColumn == null) { textbox.Value = val.EntityListViewColumn.Alias; } tableGroup.ReportItem = textbox; crosstab.Items.Add(textbox); return(tableGroup); }
public override void RenderSelection(IRenderable element, Graphics graphics, ControlRender render) { TableGroup group = element as TableGroup; SmoothingMode mode = graphics.SmoothingMode; graphics.SmoothingMode = SmoothingMode.None; Pen pen = Singleton.Instance.SelectionPen; RectangleF rect = new RectangleF(group.Rectangle.X + 2, group.Rectangle.Y, group.Rectangle.Width - 4, group.Rectangle.Height); graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); graphics.SmoothingMode = mode; }
public Field FindField(string name) { Field field = null; TableGroup groupField = (TableGroup)this.Groups[0]; foreach (Field fieldTest in groupField.Rows) { if (name.ToUpper() == fieldTest.Name.ToUpper()) { field = fieldTest; break; } } return(field); }
public TableGroup ParseTableGroup(JObject root) { if (!root.TryGetValue("tables", out JToken t)) { throw new MetadataParseException("Did not find required 'tables' property on table group object"); } var tablesArray = t as JArray; if (tablesArray == null) { throw new MetadataParseException("The value of the 'tables' property must be an array"); } var tableGroup = new TableGroup(); if (root.TryGetValue("dialect", out t)) { if (!(t is JObject dialectObject)) { throw new MetadataParseException("The value of the 'dialect' property must be a JSON object"); } tableGroup.Dialect = ParseDialect(dialectObject); } else { tableGroup.Dialect = new Dialect(); } foreach (var item in tablesArray) { var tableDescriptionObject = item as JObject; if (tableDescriptionObject == null) { throw new MetadataParseException("Items in the 'tables' array must be objects"); } ParseTable(tableGroup, tableDescriptionObject); } if (root.TryGetValue("@id", out t)) { tableGroup.Id = ParseLinkProperty(t, "@id"); } ParseInheritedProperties(root, tableGroup); ParseCommonProperties(root, tableGroup); tableGroup.Notes = ParseNotes(root); return(tableGroup); }
private TableGroup Parse(JObject metadataObject) { JToken t; if (metadataObject.TryGetValue("tables", out t)) { return(ParseTableGroup(metadataObject)); } if (metadataObject.TryGetValue("url", out t)) { var tableGroup = new TableGroup(); ParseTable(tableGroup, metadataObject); return(tableGroup); } throw new MetadataParseException("Unrecognized root object type"); }
internal override bool SetNewContext(int index) { base.ResetContext(); if (m_instance != null) { m_instance.SetNewContext(); } if (m_isDetailGroup) { if (base.OwnerTablix.RenderTable.NoRows) { return(false); } if (m_renderDetails == null || index < 0 || index >= m_renderDetails.Count) { return(false); } bool num = m_group.CurrentRenderGroupIndex == -1 && index == 0; m_group.CurrentRenderGroupIndex = index; if (!num) { ((ShimTableMemberCollection)m_children).UpdateDetails(m_renderDetails[index]); } return(true); } if (m_group != null && m_group.RenderGroups != null) { if (base.OwnerTablix.RenderTable.NoRows) { return(false); } if (index < 0 || index >= m_group.RenderGroups.Count) { return(false); } TableGroup tableGroup = m_group.RenderGroups[index] as TableGroup; if (tableGroup.InstanceInfo == null) { return(false); } m_group.CurrentRenderGroupIndex = index; ((ShimTableMemberCollection)m_children).UpdateHeaderFooter(tableGroup.GroupHeader, tableGroup.GroupFooter); ((ShimTableMemberCollection)m_children).ResetContext(tableGroup); return(true); } return(index <= 1); }
public override bool SetNewContext(int index) { base.ResetContext(); if (base.m_instance != null) { base.m_instance.SetNewContext(); } if (this.m_isDetailGroup) { if (base.OwnerTablix.RenderTable.NoRows) { return(false); } if (this.m_renderDetails != null && index >= 0 && index < this.m_renderDetails.Count) { bool flag = base.m_group.CurrentRenderGroupIndex == -1 && 0 == index; base.m_group.CurrentRenderGroupIndex = index; if (!flag) { ((ShimTableMemberCollection)base.m_children).UpdateDetails(this.m_renderDetails[index]); } return(true); } return(false); } if (base.m_group != null && base.m_group.RenderGroups != null) { if (base.OwnerTablix.RenderTable.NoRows) { return(false); } if (index >= 0 && index < base.m_group.RenderGroups.Count) { TableGroup tableGroup = base.m_group.RenderGroups[index] as TableGroup; if (tableGroup.InstanceInfo == null) { return(false); } base.m_group.CurrentRenderGroupIndex = index; ((ShimTableMemberCollection)base.m_children).UpdateHeaderFooter(tableGroup.GroupHeader, tableGroup.GroupFooter); ((ShimTableMemberCollection)base.m_children).ResetContext(tableGroup); return(true); } return(false); } return(index <= 1); }
public Table ParseTable(TableGroup tableGroup, JObject root) { JToken t; if (!root.TryGetValue("url", out t)) { throw new MetadataParseException("Did not find required 'url' property on table object"); } var tableUri = ParseLinkProperty(t, "url"); var table = new Table(tableGroup) { Url = tableUri }; if (root.TryGetValue("@id", out t)) { table.Id = ParseLinkProperty(t, "@id"); } if (root.TryGetValue("tableSchema", out t)) { if (!(t is JObject schemaObject)) { throw new MetadataParseException("The value of the 'tableSchema' property must be a JSON object"); } table.TableSchema = ParseTableSchema(table, schemaObject); } if (root.TryGetValue("dialect", out t)) { if (!(t is JObject dialectObject)) { throw new MetadataParseException("The value of the 'dialect' property must be a JSON object"); } table.Dialect = ParseDialect(dialectObject); } else { table.Dialect = tableGroup.Dialect ?? new Dialect(); } table.SuppressOutput = ParseSuppressOutput(root); ParseInheritedProperties(root, table); ParseCommonProperties(root, table); table.Notes = ParseNotes(root); return(table); }
public async Task ConvertWithLocalMetadata(Uri sourceUri, HttpClient httpClient, string localMetadata) { var response = await httpClient.GetAsync(sourceUri); response.EnsureSuccessStatusCode(); TableGroup tableGroup = null; if (IsCsvMimeType(response.Content.Headers.ContentType.MediaType)) { tableGroup = ParseCsvMetadata(sourceUri, localMetadata); } if (tableGroup != null) { await ConvertAsync(tableGroup); } }
public IEnumerable <DbTableContent> ExtractTable(TableGroup tableGroup) { List <DbTableContent> dataTableList = new List <DbTableContent>(); foreach (string tableName in tableGroup.TableNames) { string query = BuildSqlQuery(tableName, tableGroup.PkName, tableGroup.TableColumns, tableGroup.Where); SqlCommand command = new SqlCommand(query, _connection); SqlDataReader result = command.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(result); dataTableList.Add(new DbTableContent { TableName = tableName, Data = dt }); } return(dataTableList); }
private static void CreateTableGroups(ReportWizardState state, Table table, Length rowHeight) { foreach (FieldMetaData groupField in state.GroupingFields) { TableGroup group = CreateTableGroup(state, groupField, rowHeight); if (group != null) { table.TableGroups.Add(group); foreach (TableRow row in group.Header.TableRows) { table.Height += row.Height; } foreach (TableRow row in group.Footer.TableRows) { table.Height += row.Height; } } } }
protected override DataTemplate OnSelectTemplate(object item, BindableObject container) { if (item is TableGroup) { TableGroup thisGroup = (TableGroup)item; switch (thisGroup.HeaderType) { case TableGroup.GroupHeaderSelector.BlankHeader: return(TablePageBlankTemplate); case TableGroup.GroupHeaderSelector.DividerHeader: return(TablePageDividerTemplate); case TableGroup.GroupHeaderSelector.TakeoutRow: return(TablePageTakeoutRowTemplate); } } return(TablePageBlankTemplate); }
public void TestColumnWithPropertyUrl() { var expected = new TableGroup(); var t = new Table(expected) { Url = new Uri("http://example.org/countries.csv") }; t.TableSchema = new Schema(t) { AboutUrl = new UriTemplate("http://example.org/countries/{countryCode}"), Columns = new List <ColumnDescription>() }; t.TableSchema.Columns.Add(new ColumnDescription(t.TableSchema) { Name = "countryCode", PropertyUrl = new UriTemplate("http://example.org/countries.csv/def/countryCode") }); t.TableSchema.Columns.Add(new ColumnDescription(t.TableSchema) { Name = "latitude", Datatype = new DatatypeDescription { Base = "decimal" } }); t.TableSchema.Columns.Add(new ColumnDescription(t.TableSchema) { Name = "longitude", Datatype = new DatatypeDescription { Base = "decimal" } }); t.TableSchema.Columns.Add(new ColumnDescription(t.TableSchema) { Name = "name" }); var actual = ParseMetadata(Path.Combine("data", "valid-table-6.json"), null); actual.Should().BeEquivalentTo(expected, options => options.Excluding(o => o.SelectedMemberPath.EndsWith(".Parent"))); }
/// <summary> /// Creates the table. /// </summary> /// <param name="columns">The columns.</param> /// <returns>Table.</returns> private Table CreateTable(IEnumerable<TableColumn> columns) { var table = new Table(); var i = 0; foreach (var col in columns) { var header = new TextBox(); header.Style.Font.Size = Unit.Point(10); header.Style.BackgroundColor = Color.Gainsboro; header.Style.BorderStyle.Default = BorderType.Double; header.Size = new SizeU(col.Width, Unit.Inch(0.2)); header.Value = col.Name; table.ColumnGroups.Add(new TableGroup { ReportItem = header }); table.Body.Columns.Add(new TableBodyColumn(col.Width)); ReportItem cell; if (col.DataType != null && col.DataType == typeof(byte[])) { cell = new PictureBox(); ((PictureBox)cell).Sizing = ImageSizeMode.ScaleProportional; ((PictureBox)cell).Value = string.Format(@"=UserFunctions.GetImageValue(Fields.[{0}])", col.Data); } else { cell = new TextBox(); ((TextBox)cell).CanGrow = true; ((TextBox)cell).Value = string.Format("=Fields.[{0}]", col.Data); } cell.Style.Font.Size = Unit.Point(9); cell.Style.VerticalAlign = VerticalAlign.Middle; cell.Style.BorderStyle.Default = BorderType.Double; cell.Size = new SizeU(col.Width, Unit.Inch(0.2)); table.Body.SetCellContent(0, i++, cell); } var tableGroupRow = new TableGroup(); tableGroupRow.Groupings.Add(new Grouping()); table.RowGroups.Add(tableGroupRow); return table; }
protected virtual void WriteTableGroup(SvgDocument document, Table table, TableGroup group, ref int id, ref int rowId, ref float height) { //Add background mDefinition.Path = new GraphicsPath(); mDefinition.Path.AddRectangle(new RectangleF(0, 0, table.Width, table.RowHeight)); //Add the definition string defId = document.AddDefinition(mDefinition.ExtractRectangle()); StringBuilder builder = new StringBuilder(); builder.Append("fill:"); builder.Append(Style.GetCompatibleColor(group.Backcolor)); builder.Append(";fill-opacity:0.5;"); //Add the class string classId = document.AddClass(builder.ToString()); string key = "Group" + id.ToString(); document.AddUse(key, defId, classId, "", 0, height); //Add the text Style style = new Style(); Font font = null; //Add group text if (group.Text.Trim() != "") { string clipId = document.AddClipPath(defId, 0, height); //Add clipping to style if required style.ClipPathId = clipId; StringFormat format = new StringFormat(); format.LineAlignment = StringAlignment.Center; format.FormatFlags = StringFormatFlags.NoWrap; //Set up text object Text text = new Text(); text.Format = format; text.LayoutRectangle = new RectangleF(0, 0, table.Width - 20 - table.Indent - group.Indent, table.RowHeight); //Get style font = Component.Instance.GetFont(table.FontName, table.FontSize, table.FontStyle); classId = document.AddClass(text.GetStyle(font, table.Forecolor, clipId), ""); //Create fragment and add to document XmlDocumentFragment frag = null; XmlNode newElementNode = null; frag = document.CreateDocumentFragment(); frag.InnerXml = text.ExtractText(group.Text, font, table.Indent + group.Indent, height, key + "Text"); frag.FirstChild.Attributes.GetNamedItem("class").InnerText = classId; newElementNode = document.ContainerNode.AppendChild(frag); } id++; height += table.RowHeight; if (group.Expanded) { //Draw child groups foreach (TableGroup child in group.Groups) { WriteTableGroup(document, table, child, ref id, ref rowId, ref height); } //Draw child groups foreach (TableRow childRow in group.Rows) { WriteTableRow(document, table, childRow, ref rowId, ref height); } } }
public void LoadDataSet(DataSet ds) { Route route = new Route(model1); route.Avoid = true; model1.Route = route; Text = ds.DataSetName; TabText = ds.DataSetName; dataSet = ds; if (dataSet == null || dataSet.Relations == null) return; List<string> remove = new List<string>(); foreach (string table in entityTypes.Keys) { if (!dataSet.Tables.Contains(table)) remove.Add(table); } foreach (string str in remove) entityTypes.Remove(str); model1.Suspend(); model1.Shapes.Clear(); foreach (DataTable table in dataSet.Tables) { if (!visibleTables.Contains(table.TableName)) continue; Table t = new Table(); t.BackColor = Color.White; t.GradientColor = Color.FromArgb(96, SystemColors.Highlight); t.Location = new PointF(100, 50); t.Width = 140; t.Height = 200; t.Indent = 10; t.Heading = table.TableName; t.SubHeading = "Table"; t.MaximumSize = new SizeF(new Point(1000, 1000)); t.DrawExpand = true; t.AllowScale = false; TableGroup tg = new TableGroup(); tg.Text = "Columns"; t.Groups.Add(tg); float maxWidth = 0.0f; foreach (DataColumn column in table.Columns) { TableRow row = new TableRow(); row.Text = column.ColumnName; row.Image = new Crainiate.ERM4.Image("Resource.publicfield.gif", "Crainiate.ERM4.Component"); foreach (DataColumn col in table.PrimaryKey) { if (col.Equals(column)) row.Image = new Crainiate.ERM4.Image("Resource.protectedfield.gif", "Crainiate.ERM4.Component"); } tg.Rows.Add(row); Graphics g = model1.CreateGraphics(); SizeF size = g.MeasureString(row.Text, Component.Instance.DefaultFont); float width = size.Width + 50; if (width > maxWidth) maxWidth = width; } model1.Shapes.Add(table.TableName, t); t.Width = maxWidth; if (!entityTypes.ContainsKey(table.TableName)) entityTypes[table.TableName] = EntityTypes.Unclassified; } model1.Lines.Clear(); foreach (DataRelation dr in dataSet.Relations) { if (!visibleTables.Contains(dr.ParentTable.TableName)) continue; if (!visibleTables.Contains(dr.ChildTable.TableName)) continue; Connector line = new Connector((Shape)model1.Shapes[dr.ParentTable.TableName], (Shape)model1.Shapes[dr.ChildTable.TableName]); line.Avoid = true; line.Rounded = true; line.End.Marker = new Arrow(); line.Tag = dr.RelationName; model1.Lines.Add(model1.Lines.CreateKey(), line); } DoLayout(); RefreshHierarquies(); }
private static void AddTableGrouping(Modeling.Report repdef, Table table) { for (int grouping_col_index = 0; grouping_col_index < repdef.GroupOnColumns.Count; grouping_col_index++) { var grouping_col = repdef.GroupOnColumns[grouping_col_index]; var tablegroup = new TableGroup(); tablegroup.Name = string.Format("TABLE_GROUP_ON_COL_{0}_{1}", grouping_col, grouping_col_index); var col = repdef.DataTable.Columns[grouping_col]; tablegroup.GroupingExpressions.Add(Util.GetExprFieldValue(col.ColumnName)); table.TableGroups.Add(tablegroup); var tableheight = new TableRow(); tableheight.Height = repdef.DetailRowHeight; tablegroup.Header.TableRows.Add(tableheight); for (int colindex = 0; colindex < repdef.DataTable.Columns.Count; colindex++) { var tablecell = new TableCell(); tableheight.TableCells.Add(tablecell); var textbox = new TextBox(tablegroup.Name + "_" + colindex.ToString(), null); tablecell.ReportItems.Add(textbox); if (colindex == grouping_col_index) { textbox.Value = Util.GetExprFieldValue(col.ColumnName); } else { textbox.Value = ""; } textbox.Height = repdef.DetailRowHeight; } // TODO hide the column that was grouped! } }