개정판 b23dcfc5
issue #09000 markup data 그리드에 출력
Change-Id: I7da456a7b2b426c8e50b10531b55a56a8166e54f
ID2.Manager/ID2.Manager/Controls/MarkupDetailCellElement.cs | ||
---|---|---|
1 |
using Newtonsoft.Json.Linq; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Drawing; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using System.Threading.Tasks; |
|
8 |
using Telerik.WinControls.UI; |
|
9 |
|
|
10 |
namespace ID2.Manager.Controls |
|
11 |
{ |
|
12 |
public class MarkupDetailCellElement : GridDetailViewCellElement |
|
13 |
{ |
|
14 |
StackLayoutElement layoutRoot; |
|
15 |
RadListViewElement listView; |
|
16 |
|
|
17 |
public MarkupDetailCellElement(GridViewColumn column, GridRowElement row) : base(column, row) |
|
18 |
{ |
|
19 |
this.MaxSize = new System.Drawing.Size(450, 100); |
|
20 |
} |
|
21 |
|
|
22 |
protected override Type ThemeEffectiveType |
|
23 |
{ |
|
24 |
get |
|
25 |
{ |
|
26 |
return typeof(GridDetailViewCellElement); |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
protected override void CreateChildElements() |
|
32 |
{ |
|
33 |
base.CreateChildElements(); |
|
34 |
|
|
35 |
layoutRoot = new StackLayoutElement(); |
|
36 |
listView = new RadListViewElement(); |
|
37 |
listView.VisualItemCreating += ListView_VisualItemCreating; |
|
38 |
|
|
39 |
listView.ViewType = ListViewType.DetailsView; |
|
40 |
listView.ShowColumnHeaders = false; |
|
41 |
listView.BestFitColumns(ListViewBestFitColumnMode.AllCells); |
|
42 |
listView.ColumnCreating += ListView_ColumnCreating; |
|
43 |
|
|
44 |
layoutRoot.Orientation = System.Windows.Forms.Orientation.Horizontal; |
|
45 |
layoutRoot.Children.Add(listView); |
|
46 |
this.Children.Add(layoutRoot); |
|
47 |
} |
|
48 |
|
|
49 |
private void ListView_ColumnCreating(object sender, ListViewColumnCreatingEventArgs e) |
|
50 |
{ |
|
51 |
if (e.Column.FieldName == "NAME") |
|
52 |
{ |
|
53 |
e.Column.MaxWidth = 140; |
|
54 |
} |
|
55 |
else if (e.Column.FieldName == "CREATE_DATE") |
|
56 |
{ |
|
57 |
e.Column.MaxWidth = 120; |
|
58 |
} |
|
59 |
else |
|
60 |
{ |
|
61 |
e.Column.BestFit(); |
|
62 |
} |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
private void ListView_VisualItemCreating(object sender, ListViewVisualItemCreatingEventArgs e) |
|
67 |
{ |
|
68 |
//e.VisualItem = new MarkupListViewItem(); |
|
69 |
} |
|
70 |
|
|
71 |
protected override bool IsInVisibleClipBounds(Rectangle clipRectangle) |
|
72 |
{ |
|
73 |
return base.IsInVisibleClipBounds(clipRectangle); |
|
74 |
} |
|
75 |
|
|
76 |
protected override void OnViewCellFormatting(CellFormattingEventArgs e) |
|
77 |
{ |
|
78 |
base.OnViewCellFormatting(e); |
|
79 |
} |
|
80 |
|
|
81 |
protected override void UpdateInfoCore() |
|
82 |
{ |
|
83 |
base.UpdateInfoCore(); |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
protected override GridTableElement CreateChildTableElement() |
|
89 |
{ |
|
90 |
var table = base.CreateChildTableElement(); |
|
91 |
|
|
92 |
|
|
93 |
table.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; |
|
94 |
return table; |
|
95 |
} |
|
96 |
|
|
97 |
public override void UpdateInfo() |
|
98 |
{ |
|
99 |
base.UpdateInfo(); |
|
100 |
|
|
101 |
List<Markup> markups = new List<Markup>(); |
|
102 |
var markup = (this.HierarchyRow.DataBoundItem as ID2.Manager.Data.Models.Documents).MarkupText; |
|
103 |
|
|
104 |
listView.DataSource = null; |
|
105 |
|
|
106 |
if (!string.IsNullOrWhiteSpace(markup)) |
|
107 |
{ |
|
108 |
var items = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Markup>>(markup); |
|
109 |
listView.DataSource = items; |
|
110 |
listView.BestFitColumns(ListViewBestFitColumnMode.AllCells); |
|
111 |
|
|
112 |
} |
|
113 |
} |
|
114 |
} |
|
115 |
|
|
116 |
public class Markup |
|
117 |
{ |
|
118 |
//public string PROJECT_NO { get; set; } |
|
119 |
//public string DOCUMENT_ID { get; set; } |
|
120 |
//public string MARKUP_DATA_ID { get; set; } |
|
121 |
//public int PAGENUMBER { get; set; } |
|
122 |
|
|
123 |
public string NAME { get; set; } |
|
124 |
public string Text { get; set; } |
|
125 |
|
|
126 |
private string create_Date; |
|
127 |
|
|
128 |
public string CREATE_DATE |
|
129 |
{ |
|
130 |
get |
|
131 |
{ return create_Date; } |
|
132 |
|
|
133 |
set |
|
134 |
{ |
|
135 |
create_Date = Convert.ToDateTime(value).ToString("yyyy-MM-dd HH:mm"); |
|
136 |
} |
|
137 |
} |
|
138 |
} |
|
139 |
} |
ID2.Manager/ID2.Manager/Controls/MarkupListViewItem.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Drawing; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
using System.Windows.Forms; |
|
8 |
using Telerik.WinControls.Layouts; |
|
9 |
using Telerik.WinControls.UI; |
|
10 |
|
|
11 |
namespace ID2.Manager.Controls |
|
12 |
{ |
|
13 |
public class MarkupListViewItem : SimpleListViewVisualItem |
|
14 |
{ |
|
15 |
private LightVisualElement textElement; |
|
16 |
private LightVisualElement nameElement; |
|
17 |
private LightVisualElement dateElement; |
|
18 |
private StackLayoutPanel stackLayout; |
|
19 |
|
|
20 |
protected override void CreateChildElements() |
|
21 |
{ |
|
22 |
base.CreateChildElements(); |
|
23 |
|
|
24 |
this.stackLayout = new StackLayoutPanel(); |
|
25 |
this.stackLayout.Orientation = Orientation.Horizontal; |
|
26 |
this.stackLayout.EqualChildrenWidth = true; |
|
27 |
this.stackLayout.ShouldHandleMouseInput = false; |
|
28 |
this.stackLayout.NotifyParentOnMouseInput = true; |
|
29 |
|
|
30 |
this.nameElement = new LightVisualElement(); |
|
31 |
this.nameElement.StretchHorizontally = true; |
|
32 |
this.nameElement.MinSize = new Size(120, 0); |
|
33 |
this.nameElement.BorderThickness = new Padding(1); |
|
34 |
this.nameElement.TextAlignment = ContentAlignment.MiddleCenter; |
|
35 |
this.nameElement.ShouldHandleMouseInput = false; |
|
36 |
this.nameElement.NotifyParentOnMouseInput = true; |
|
37 |
this.stackLayout.Children.Add(this.nameElement); |
|
38 |
|
|
39 |
this.textElement = new LightVisualElement(); |
|
40 |
this.textElement.StretchHorizontally = true; |
|
41 |
this.textElement.MinSize = new Size(200, 0); |
|
42 |
this.nameElement.BorderThickness = new Padding(0,1,0,1); |
|
43 |
this.nameElement.TextAlignment = ContentAlignment.MiddleLeft; |
|
44 |
this.textElement.ShouldHandleMouseInput = false; |
|
45 |
this.textElement.NotifyParentOnMouseInput = true; |
|
46 |
this.stackLayout.Children.Add(this.textElement); |
|
47 |
|
|
48 |
|
|
49 |
this.dateElement = new LightVisualElement(); |
|
50 |
this.dateElement.StretchHorizontally = true; |
|
51 |
this.dateElement.MinSize = new Size(120, 0); |
|
52 |
this.nameElement.BorderThickness = new Padding(0, 1, 1, 1); |
|
53 |
this.nameElement.TextAlignment = ContentAlignment.MiddleCenter; |
|
54 |
this.dateElement.ShouldHandleMouseInput = false; |
|
55 |
this.dateElement.NotifyParentOnMouseInput = true; |
|
56 |
this.stackLayout.Children.Add(this.dateElement); |
|
57 |
|
|
58 |
this.Children.Add(this.stackLayout); |
|
59 |
} |
|
60 |
|
|
61 |
protected override void SynchronizeProperties() |
|
62 |
{ |
|
63 |
base.SynchronizeProperties(); |
|
64 |
|
|
65 |
this.Text = ""; |
|
66 |
this.dateElement.Text = Convert.ToDateTime(this.Data["CREATE_DATE"]).ToString("yyyy-MM-dd HH:mm"); |
|
67 |
this.textElement.Text = Convert.ToString(this.Data["Text"]); |
|
68 |
this.nameElement.Text = Convert.ToString(this.Data["NAME"]); |
|
69 |
} |
|
70 |
|
|
71 |
protected override Type ThemeEffectiveType |
|
72 |
{ |
|
73 |
get |
|
74 |
{ |
|
75 |
return typeof(SimpleListViewVisualItem); |
|
76 |
} |
|
77 |
} |
|
78 |
} |
|
79 |
} |
ID2.Manager/ID2.Manager/Controls/RowDetailViewRowElement.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Drawing; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
using Telerik.WinControls.UI; |
|
8 |
|
|
9 |
namespace ID2.Manager.Controls |
|
10 |
{ |
|
11 |
public class RowDetailViewRowElement : GridDetailViewRowElement |
|
12 |
{ |
|
13 |
public RowDetailViewRowElement() |
|
14 |
{ |
|
15 |
} |
|
16 |
|
|
17 |
protected override Type ThemeEffectiveType |
|
18 |
{ |
|
19 |
get { return typeof(GridDetailViewRowElement); } |
|
20 |
} |
|
21 |
//protected override SizeF MeasureOverride(SizeF availableSize) |
|
22 |
//{ |
|
23 |
// this.ContentCell.ChildTableElement.StretchHorizontally = false; |
|
24 |
// return base.MeasureOverride(availableSize); |
|
25 |
//} |
|
26 |
//protected override SizeF ArrangeOverride(SizeF finalSize) |
|
27 |
//{ |
|
28 |
// base.ArrangeOverride(finalSize); |
|
29 |
|
|
30 |
// RectangleF clientRect = GetClientRectangle(finalSize); |
|
31 |
|
|
32 |
// float x = clientRect.Left; |
|
33 |
|
|
34 |
// x = this.TableElement.Size.Width / 2 - (clientRect.Left + TableElement.CellSpacing + ContentCell.DesiredSize.Width + this.TableElement.VScrollBar.Size.Width) / 2; |
|
35 |
|
|
36 |
// ContentCell.Arrange(new RectangleF(x, clientRect.Top, clientRect.Width, clientRect.Height)); |
|
37 |
// return finalSize; |
|
38 |
//} |
|
39 |
|
|
40 |
protected override void CreateChildElements() |
|
41 |
{ |
|
42 |
//base.CreateChildElements(); |
|
43 |
this.Margin = new System.Windows.Forms.Padding(10,1,0,5); |
|
44 |
} |
|
45 |
|
|
46 |
public override void Synchronize() |
|
47 |
{ |
|
48 |
base.Synchronize(); |
|
49 |
} |
|
50 |
} |
|
51 |
} |
ID2.Manager/ID2.Manager/ID2.Manager.csproj | ||
---|---|---|
87 | 87 |
<Compile Include="Controls\DetailGridViewTemplate.cs"> |
88 | 88 |
<SubType>Component</SubType> |
89 | 89 |
</Compile> |
90 |
<Compile Include="Controls\MarkupDetailCellElement.cs" /> |
|
91 |
<Compile Include="Controls\MarkupListViewItem.cs" /> |
|
90 | 92 |
<Compile Include="Controls\OpenProjectView.cs"> |
91 | 93 |
<SubType>UserControl</SubType> |
92 | 94 |
</Compile> |
... | ... | |
96 | 98 |
<Compile Include="Controls\PDFViewer.cs"> |
97 | 99 |
<SubType>UserControl</SubType> |
98 | 100 |
</Compile> |
101 |
<Compile Include="Controls\RowDetailViewRowElement.cs" /> |
|
99 | 102 |
<Compile Include="Forms\AddUser.cs"> |
100 | 103 |
<SubType>Form</SubType> |
101 | 104 |
</Compile> |
ID2.Manager/ID2.Manager/Main.cs | ||
---|---|---|
64 | 64 |
|
65 | 65 |
this.radGridViewDocuments.SelectionChanged += RadGridViewDocuments_SelectionChanged; |
66 | 66 |
this.radGridViewDocuments.ViewCellFormatting += RadGridViewDocuments_ViewCellFormatting; |
67 |
this.radGridViewDocuments.CreateRow += RadGridViewDocuments_CreateRow; |
|
68 |
this.radGridViewDocuments.CreateCell += RadGridViewDocuments_CreateCell1; |
|
67 | 69 |
this.radGridViewDocuments.CellBeginEdit += RadGridViewDocuments_CellBeginEdit; |
68 | 70 |
this.radGridViewDocuments.CommandCellClick += RadGridViewDocuments_CommandCellClick; |
69 | 71 |
|
... | ... | |
144 | 146 |
if (File.Exists(FilePath) && viewer != null) viewer.ReadPDF(FilePath); |
145 | 147 |
} |
146 | 148 |
|
147 |
if (this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc) |
|
149 |
if (this.radGridViewDocuments.SelectedRows.Count() > 0 && this.radGridViewDocuments.SelectedRows.First().DataBoundItem is Documents doc)
|
|
148 | 150 |
{ |
149 | 151 |
string dwgExtension = ".dwg"; |
150 | 152 |
string dwgFilePath = Path.Combine(informations.FindID2LocalPath(doc.RefProjectCode), "drawings", "Native", $"{doc.DocumentNo}{dwgExtension}"); |
... | ... | |
294 | 296 |
|
295 | 297 |
private void InitializeGridViewDetail() |
296 | 298 |
{ |
297 |
|
|
298 |
this.radGridViewDocuments.CreateCell += RadGridViewDocuments_CreateCell; |
|
299 | 299 |
this.radGridViewDocuments.ChildViewExpanded += RadGridViewDocuments_ChildViewExpanded; |
300 | 300 |
} |
301 | 301 |
|
... | ... | |
306 | 306 |
e.ChildRow.Height = 224; |
307 | 307 |
} |
308 | 308 |
|
309 |
private void RadGridViewDocuments_CreateCell(object sender, GridViewCreateCellEventArgs e) |
|
310 |
{ |
|
311 |
//if (e.CellType == typeof(GridDetailViewCellElement)) |
|
312 |
//{ |
|
313 |
// //e.CellElement = new DetailGridViewElement(e.Column, e.Row); |
|
314 |
//} |
|
315 |
} |
|
316 | 309 |
#endregion |
317 | 310 |
|
318 | 311 |
private void OpenProjectView_OpenProjectClick(object sender, EventArgs e) |
... | ... | |
781 | 774 |
} |
782 | 775 |
} |
783 | 776 |
|
777 |
private void RadGridViewDocuments_CreateRow(object sender, GridViewCreateRowEventArgs e) |
|
778 |
{ |
|
779 |
if (e.RowType == typeof(GridDetailViewRowElement)) |
|
780 |
{ |
|
781 |
//if (e.RowInfo.ChildRows.Count() > 0) |
|
782 |
//{ |
|
783 |
e.RowElement = new RowDetailViewRowElement(); |
|
784 |
//} |
|
785 |
//else |
|
786 |
//{ |
|
787 |
// e.RowElement = null; |
|
788 |
//} |
|
789 |
} |
|
790 |
} |
|
791 |
|
|
792 |
|
|
793 |
private void RadGridViewDocuments_CreateCell1(object sender, GridViewCreateCellEventArgs e) |
|
794 |
{ |
|
795 |
if (e.CellType == typeof(GridDetailViewCellElement)) |
|
796 |
{ |
|
797 |
//if (e.Row.RowInfo.ChildRows.Count() > 0) |
|
798 |
//{ |
|
799 |
e.CellElement = new MarkupDetailCellElement(e.Column, e.Row); |
|
800 |
//} |
|
801 |
} |
|
802 |
} |
|
803 |
|
|
804 |
|
|
784 | 805 |
private void RadGridViewDocuments_ViewCellFormatting(object sender, CellFormattingEventArgs e) |
785 | 806 |
{ |
786 | 807 |
if (e.Row is GridViewDataRowInfo) |
... | ... | |
834 | 855 |
|
835 | 856 |
} |
836 | 857 |
} |
858 |
else if(e.Row is GridViewDetailsRowInfo) |
|
859 |
{ |
|
860 |
if(e.CellElement is MarkupDetailCellElement element) |
|
861 |
{ |
|
862 |
element.UpdateInfo(); |
|
863 |
} |
|
864 |
} |
|
837 | 865 |
else |
838 | 866 |
{ |
839 | 867 |
|
내보내기 Unified diff