public virtual Box GetEntityBox(DiagramTableItem item, Dictionary <int, Box> colNameBoxes) { var panel = new PanelBox { Orientation = Orientation.Vertical }; panel.BorderAllBrush = Brushes.Black; var header = new StringBox { Text = item.Table.Name, Font = GetHeaderFont(), Brush = Brushes.Black }; panel.Boxes.Add(header); var table = new TableBox(); table.HAlign = BoxModelAlignement.Fill; FillColumnsTable(item, colNameBoxes, table); panel.Boxes.Add(table); header.BorderBottom = 1; header.PadLeft = header.PadRight = 3; FillHeader(header); panel.BorderAll = 1; panel.BorderAllBrush = Brushes.Black; panel.BackgroundBrush = Brushes.White; var es = item.GetCurrentEntityStyle(); if (es.IsDefinedHeader) { header.Gradient = es.HeaderBg; table.Gradient = es.BodyBg; } else { panel.Gradient = es.BodyBg; } return(panel); }
protected override void FillColumnsTable(DiagramTableItem item, Dictionary <int, Box> colNameBoxes, TableBox table) { var fkColsIndexes = GetFkColIndexes(item.Table); IPrimaryKey pk = item.Table.FindConstraint <IPrimaryKey>(); int fldindex = 0; table.ColumnDelimiter = new FixedBox { BackgroundBrush = Brushes.Black, FixedSize = new Size(1, 1) }; if (pk != null) { foreach (IColumnStructure col in item.Table.Columns) { if (pk.Columns.IndexOfIf(cr => cr.ColumnName == col.ColumnName) >= 0) { var row = table.AddRow(); row.AddCell("PK", ColumnBold, Brushes.Black); var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } } fldindex++; } table.RowDelimiterOverrides[pk.Columns.Count] = new FixedBox { BackgroundBrush = Brushes.Black, FixedSize = new Size(1, 1), MarginTop = 2, MarginBottom = 2 }; } foreach (IColumnStructure col in item.Table.Columns) { if (pk == null || pk.Columns.IndexOfIf(cr => cr.ColumnName == col.ColumnName) < 0) { var row = table.AddRow(); if (fkColsIndexes.ContainsKey(col.ColumnName)) { row.AddCell("FK" + (fkColsIndexes[col.ColumnName] + 1).ToString(), ColumnRegular, Brushes.Black); } else { row.AddCell(new FixedBox { FixedSize = new Size(16, 16) }); } var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } } fldindex++; } }
protected override void FillColumnsTable(DiagramTableItem item, Dictionary <int, Box> colNameBoxes, TableBox table) { var fkColsIndexes = GetFkColIndexes(item.Table); int fldindex = 0; foreach (var col in item.Table.Columns) { var row = table.AddRow(); if (item.Table.GetKeyWithColumn <IPrimaryKey>(col) != null) { row.AddCell(CoreIcons.primary_key); } else if (fkColsIndexes.ContainsKey(col.ColumnName)) { row.AddCell(CoreIcons.foreign_key); } else { row.AddCell(new FixedBox { FixedSize = new Size(16, 16) }); } var cname = row.AddCell(col.ColumnName, col.IsNullable ? ColumnRegular : ColumnBold, Brushes.Black); if (colNameBoxes != null) { colNameBoxes[fldindex] = cname; } row.AddCell(item.GetFullTypeName(col), ColumnRegular, Brushes.Black); fldindex++; } }
protected virtual void FillColumnsTable(DiagramTableItem item, Dictionary <int, Box> colNameBoxes, TableBox table) { }