From 8990ff9ce946c46c4a12bcc8861bdf649ac184f5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1s=C3=A1ry=20D=C3=A1niel?= Date: Fri, 20 Oct 2017 12:34:14 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30657 --- client/IntegrationTests/JobEngineIT.cs | 7 ++ client/Maestro/MaestroForm.Metadata.cs | 52 ++++++++---- client/Maestro/MaestroForm.Source.cs | 3 +- client/Maestro/Metadata/IDTypes.cs | 2 +- client/MediaCubeClient/Model/Model.cs | 5 ++ client/OctopusClient/OctopusAPI.cs | 2 +- .../OctopusIDSelector.Designer.cs | 80 +++++++++---------- client/OctopusClient/OctopusIDSelector.cs | 58 ++++---------- client/PlanAIRClient/TrafficAPI.cs | 6 +- .../TrafficIDSelector.Designer.cs | 58 +++++++------- client/PlanAIRClient/TrafficIDSelector.cs | 33 +++----- .../run-mediacube-server-localhost.launch | 2 +- .../src/user/jobengine/db/JSONBase.java | 2 +- .../src/user/jobengine/db/MasterId.java | 4 +- 14 files changed, 153 insertions(+), 161 deletions(-) diff --git a/client/IntegrationTests/JobEngineIT.cs b/client/IntegrationTests/JobEngineIT.cs index 56794fc8..14e07d8c 100644 --- a/client/IntegrationTests/JobEngineIT.cs +++ b/client/IntegrationTests/JobEngineIT.cs @@ -30,6 +30,13 @@ namespace IntegrationTests { var actual = client.Create(item); } + [TestMethod] + public void TestCreateMasterId() { + MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100); + MasterId masterId = client.Create(new MasterId()) as MasterId; + Assert.IsTrue(masterId.id > 0); + } + [TestMethod] public void TestCreateMany() { MediaCubeApi client = new MediaCubeApi("http://localhost:8080/services/rest/jobengine/", null, null, 100); diff --git a/client/Maestro/MaestroForm.Metadata.cs b/client/Maestro/MaestroForm.Metadata.cs index 14177048..0e490c20 100644 --- a/client/Maestro/MaestroForm.Metadata.cs +++ b/client/Maestro/MaestroForm.Metadata.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Text.RegularExpressions; using JobEngineClient; +using Model; namespace Maestro { public partial class MaestroForm { @@ -80,7 +81,7 @@ namespace Maestro { } private SourceIDType GetSourceType(string id) { - SourceIDType result = SourceIDType.None; + SourceIDType result = SourceIDType.MediaCube; if (!String.IsNullOrEmpty(id)) { Match match = Regex.Match(id, "[A-Z]{1}[0-9]{6}[A-Z]{1}"); if (match.Success) @@ -134,32 +135,53 @@ namespace Maestro { ArchiveMetadata result = null; SourceIDType idType = GetSourceType(textSelectedMetadata.Text); Cursor.Current = Cursors.WaitCursor; - if (idType == SourceIDType.OctopusID) - result = GetOctopusMetadata(); - if (idType == SourceIDType.TrafficID) - result = GetTrafficMetadata(); + switch (idType) { + case SourceIDType.MediaCube: + result = GetMediaCubeMetadata(); + break; + case SourceIDType.OctopusID: + result = GetOctopusMetadata(); + break; + case SourceIDType.TrafficID: + result = GetTrafficMetadata(); + break; + } Cursor.Current = Cursors.Default; return result; } + private ArchiveMetadata GetMediaCubeMetadata() { + MasterId masterId = mediaCubeApi.Create(new MasterId()) as MasterId; + if (masterId == null) + return null; + ArchiveMetadata result = new ArchiveMetadata(); + result.itemHouseId = masterId.ToString(); + result.mediaHouseId = masterId.ToString(); + return result; + } + private ArchiveMetadata GetTrafficMetadata() { string id = textSelectedMetadata.Text; if (String.IsNullOrEmpty(id)) return null; TrafficAPI api = trafficIDSelector.trafficAPI; - List trafficResult = null; + List trafficResult = null; MetadataType metadataType = GetTrafficMetadataType(id); - - if (id.StartsWith("M")) - trafficResult = api.GetBroadcastArchiveMetadata(id); - else if (id.StartsWith("P")) - trafficResult = api.GetPromotionalArchiveMetadata(id); - else if (id.StartsWith("R")) - trafficResult = api.GetAdvertisementArchiveMetadata(id); + switch (metadataType) { + case MetadataType.TrafficMaterial: + trafficResult = api.GetMaterialMetadata(id); + break; + case MetadataType.TrafficPromo: + trafficResult = api.GetPromoMetadata(id); + break; + case MetadataType.TrafficAD: + trafficResult = api.GetADMetadata(id); + break; + } if (trafficResult == null) return null; ArchiveMetadata result = new ArchiveMetadata(); - TrafficClient.TrafficItemMetadata actualResult = trafficResult[0]; + TrafficItemMetadata actualResult = trafficResult[0]; result.itemHouseId = actualResult.ProgID; result.itemTitle = actualResult.ProgTitle; result.itemDescription = actualResult.ProgDescription; @@ -265,7 +287,7 @@ namespace Maestro { } private void UpdateEditArchiveMetadataEnabled() { - ctxiModifyArchiveMetadata.Enabled = selectedMetadata != null; + ctxiModifyArchiveMetadata.Enabled = !String.IsNullOrEmpty(textSelectedSource.Text); } private void UpdateDefineSegmentEnabled() { diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 3706b8bb..0212c6ee 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -29,6 +29,7 @@ namespace Maestro { set { selectedSource = value; textSelectedSource.Text = selectedSource.Name; + UpdateEditArchiveMetadataEnabled(); } } @@ -310,7 +311,7 @@ namespace Maestro { } private void UpdateDetectMetadataEnabled() { - buttonMetadata.Enabled = SourceIDType != SourceIDType.None; + buttonMetadata.Enabled = SourceIDType != SourceIDType.MediaCube; } } diff --git a/client/Maestro/Metadata/IDTypes.cs b/client/Maestro/Metadata/IDTypes.cs index 83c38aff..cd21a3f7 100644 --- a/client/Maestro/Metadata/IDTypes.cs +++ b/client/Maestro/Metadata/IDTypes.cs @@ -2,6 +2,6 @@ public enum SourceIDType { TrafficID = 1, OctopusID = 2, - None = 0 + MediaCube = 0 } } diff --git a/client/MediaCubeClient/Model/Model.cs b/client/MediaCubeClient/Model/Model.cs index aa5671cc..281e5642 100644 --- a/client/MediaCubeClient/Model/Model.cs +++ b/client/MediaCubeClient/Model/Model.cs @@ -14,4 +14,9 @@ namespace Model { public String tag; public long size; } + + public class MasterId { + public long id; + public DateTime? created; + } } diff --git a/client/OctopusClient/OctopusAPI.cs b/client/OctopusClient/OctopusAPI.cs index 1c0cb664..3cf392d0 100644 --- a/client/OctopusClient/OctopusAPI.cs +++ b/client/OctopusClient/OctopusAPI.cs @@ -99,7 +99,7 @@ namespace OctopusClient { Name = d["name"].ToString(), Start = d["scheduledStart"].ToString() }; - logger.Debug($"{r}"); + //logger.Debug($"{r}"); return r; }); } diff --git a/client/OctopusClient/OctopusIDSelector.Designer.cs b/client/OctopusClient/OctopusIDSelector.Designer.cs index 02f186c8..056baa0d 100644 --- a/client/OctopusClient/OctopusIDSelector.Designer.cs +++ b/client/OctopusClient/OctopusIDSelector.Designer.cs @@ -27,17 +27,17 @@ this.dateScheduled = new System.Windows.Forms.DateTimePicker(); this.comboRudowns = new System.Windows.Forms.ComboBox(); this.bindingRundown = new System.Windows.Forms.BindingSource(this.components); - this.treeContent = new System.Windows.Forms.TreeView(); + this.treeOctopus = new System.Windows.Forms.TreeView(); this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); - this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tpRundown = new System.Windows.Forms.TabPage(); + this.tpStoryFolder = new System.Windows.Forms.TabPage(); this.comboStoryFolder = new System.Windows.Forms.ComboBox(); this.bindingStoryFolder = new System.Windows.Forms.BindingSource(this.components); this.linkID = new System.Windows.Forms.LinkLabel(); ((System.ComponentModel.ISupportInitialize)(this.bindingRundown)).BeginInit(); this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); - this.tabPage2.SuspendLayout(); + this.tpRundown.SuspendLayout(); + this.tpStoryFolder.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.bindingStoryFolder)).BeginInit(); this.SuspendLayout(); // @@ -66,21 +66,21 @@ // // treeContent // - this.treeContent.BackColor = System.Drawing.Color.White; - this.treeContent.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.treeContent.CheckBoxes = true; - this.treeContent.Dock = System.Windows.Forms.DockStyle.Fill; - this.treeContent.FullRowSelect = true; - this.treeContent.Location = new System.Drawing.Point(10, 70); - this.treeContent.Name = "treeContent"; - this.treeContent.Size = new System.Drawing.Size(251, 273); - this.treeContent.TabIndex = 5; - this.treeContent.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeContent_KeyDown); + this.treeOctopus.BackColor = System.Drawing.Color.White; + this.treeOctopus.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.treeOctopus.CheckBoxes = true; + this.treeOctopus.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeOctopus.FullRowSelect = true; + this.treeOctopus.Location = new System.Drawing.Point(10, 70); + this.treeOctopus.Name = "treeContent"; + this.treeOctopus.Size = new System.Drawing.Size(251, 273); + this.treeOctopus.TabIndex = 5; + this.treeOctopus.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeContent_KeyDown); // // tabControl1 // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tpRundown); + this.tabControl1.Controls.Add(this.tpStoryFolder); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top; this.tabControl1.Location = new System.Drawing.Point(10, 10); this.tabControl1.Name = "tabControl1"; @@ -92,26 +92,26 @@ // // tabPage1 // - this.tabPage1.Controls.Add(this.dateScheduled); - this.tabPage1.Controls.Add(this.comboRudowns); - this.tabPage1.Location = new System.Drawing.Point(4, 22); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(243, 34); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = "Rundown"; - this.tabPage1.UseVisualStyleBackColor = true; + this.tpRundown.Controls.Add(this.dateScheduled); + this.tpRundown.Controls.Add(this.comboRudowns); + this.tpRundown.Location = new System.Drawing.Point(4, 22); + this.tpRundown.Name = "tabPage1"; + this.tpRundown.Padding = new System.Windows.Forms.Padding(3); + this.tpRundown.Size = new System.Drawing.Size(243, 34); + this.tpRundown.TabIndex = 0; + this.tpRundown.Text = "Rundown"; + this.tpRundown.UseVisualStyleBackColor = true; // // tabPage2 // - this.tabPage2.Controls.Add(this.comboStoryFolder); - this.tabPage2.Location = new System.Drawing.Point(4, 22); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(243, 34); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = "Story Folder"; - this.tabPage2.UseVisualStyleBackColor = true; + this.tpStoryFolder.Controls.Add(this.comboStoryFolder); + this.tpStoryFolder.Location = new System.Drawing.Point(4, 22); + this.tpStoryFolder.Name = "tabPage2"; + this.tpStoryFolder.Padding = new System.Windows.Forms.Padding(3); + this.tpStoryFolder.Size = new System.Drawing.Size(243, 34); + this.tpStoryFolder.TabIndex = 1; + this.tpStoryFolder.Text = "Story Folder"; + this.tpStoryFolder.UseVisualStyleBackColor = true; // // comboStoryFolder // @@ -147,7 +147,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.treeContent); + this.Controls.Add(this.treeOctopus); this.Controls.Add(this.tabControl1); this.Controls.Add(this.linkID); this.Margin = new System.Windows.Forms.Padding(10); @@ -157,8 +157,8 @@ this.Load += new System.EventHandler(this.OctopusIDSelector_Load); ((System.ComponentModel.ISupportInitialize)(this.bindingRundown)).EndInit(); this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); + this.tpRundown.ResumeLayout(false); + this.tpStoryFolder.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.bindingStoryFolder)).EndInit(); this.ResumeLayout(false); @@ -168,11 +168,11 @@ private System.Windows.Forms.DateTimePicker dateScheduled; private System.Windows.Forms.ComboBox comboRudowns; - private System.Windows.Forms.TreeView treeContent; + private System.Windows.Forms.TreeView treeOctopus; private System.Windows.Forms.BindingSource bindingRundown; private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tpRundown; + private System.Windows.Forms.TabPage tpStoryFolder; private System.Windows.Forms.LinkLabel linkID; private System.Windows.Forms.ComboBox comboStoryFolder; private System.Windows.Forms.BindingSource bindingStoryFolder; diff --git a/client/OctopusClient/OctopusIDSelector.cs b/client/OctopusClient/OctopusIDSelector.cs index 4ea6e690..1091e9e6 100644 --- a/client/OctopusClient/OctopusIDSelector.cs +++ b/client/OctopusClient/OctopusIDSelector.cs @@ -33,12 +33,12 @@ namespace OctopusClient { public OctopusIDSelector() { InitializeComponent(); InitializeControlTexts(); - treeContent.AfterCheck += OnTreeAfterCheck; + treeOctopus.AfterCheck += OnTreeAfterCheck; } private void InitializeControlTexts() { - tabPage1.Text = Resources.ADASTUKOR; - tabPage2.Text = Resources.MAPPA; + tpRundown.Text = Resources.ADASTUKOR; + tpStoryFolder.Text = Resources.MAPPA; linkID.Text = Resources.KERESES; bindingRundown.Add(Resources.VALASSZON_ELEMET); bindingStoryFolder.Add(Resources.VALASSZON_ELEMET); @@ -53,7 +53,7 @@ namespace OctopusClient { private void comboRudowns_SelectedValueChanged(object sender, EventArgs e) { Rundown rundown = comboRudowns.SelectedValue as Rundown; - treeContent.Nodes.Clear(); + treeOctopus.Nodes.Clear(); if (rundown == null) return; logger.Info("Selected rundown {0} {1}", rundown.ID, rundown.Name); @@ -61,7 +61,7 @@ namespace OctopusClient { if (stories != null) foreach (var story in stories) { string name = story.Name == null ? "" : story.Name; - TreeNode actualNode = treeContent.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); + TreeNode actualNode = treeOctopus.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); MosObject[] mosObjects = story.MosObjects; foreach (MosObject mosObject in mosObjects) actualNode.Nodes.Add(mosObject.ID, mosObject.ID); @@ -73,7 +73,7 @@ namespace OctopusClient { StoryFolder storyFolder = comboStoryFolder.SelectedValue as StoryFolder; if (storyFolder == null) return; - treeContent.Nodes.Clear(); + treeOctopus.Nodes.Clear(); logger.Info("Selected StoryFolder {0} {1}", storyFolder.ID, storyFolder.Name); if (storyFolder.ID.Equals("0")) return; @@ -81,7 +81,7 @@ namespace OctopusClient { if (stories == null) return; foreach (var story in stories) { - TreeNode actualNode = treeContent.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); + TreeNode actualNode = treeOctopus.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); MosObject[] mosObjects = story.MosObjects; foreach (MosObject mosObject in mosObjects) actualNode.Nodes.Add(mosObject.ID, mosObject.ID); @@ -108,7 +108,7 @@ namespace OctopusClient { bindingRundowns.Add(actualRundown); bindingRundown.DataSource = bindingRundowns; comboRudowns.SelectedIndex = selectedRundownIndex == -1 ? 0 : selectedRundownIndex; - InitCheckID(treeContent.Nodes); + InitCheckID(treeOctopus.Nodes); Cursor.Current = Cursors.Default; } @@ -126,7 +126,7 @@ namespace OctopusClient { bindingStoryFolders.Add(actualStoryFolder); bindingStoryFolder.DataSource = bindingStoryFolders; comboStoryFolder.SelectedIndex = selectedStoryFolderIndex == -1 ? 0 : selectedStoryFolderIndex; - InitCheckID(treeContent.Nodes); + InitCheckID(treeOctopus.Nodes); } private void InitCheckID(TreeNodeCollection collection) { @@ -145,14 +145,14 @@ namespace OctopusClient { public void ClearSelection() { if (selectedNode == null) return; - treeContent.AfterCheck -= OnTreeAfterCheck; + treeOctopus.AfterCheck -= OnTreeAfterCheck; selectedNode.Checked = false; - treeContent.AfterCheck += OnTreeAfterCheck; + treeOctopus.AfterCheck += OnTreeAfterCheck; selectedNode = null; } private void tabControl1_Selected(object sender, TabControlEventArgs e) { - treeContent.Nodes.Clear(); + treeOctopus.Nodes.Clear(); if (e.TabPageIndex == 0) refreshRundowns(); else @@ -169,13 +169,13 @@ namespace OctopusClient { } private void RefreshPlaceHolderIDS(String ID) { - treeContent.Nodes.Clear(); + treeOctopus.Nodes.Clear(); var stories = client.GetStoriesByStoryFolderID(ID); if (stories == null) return; foreach (var story in stories) - treeContent.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); + treeOctopus.Nodes.Add(story.ID, String.Format($"{story.ID} {story.Name}")); } private void tabControl1_KeyDown(object sender, KeyEventArgs e) { @@ -191,7 +191,7 @@ namespace OctopusClient { if (!e.Node.Equals(selectedNode)) { ClearSelection(); selectedNode = e.Node; - treeContent.SelectedNode = selectedNode; + treeOctopus.SelectedNode = selectedNode; } id = selectedNode.Checked ? selectedNode.Name : null; IDChangedEvent?.Invoke(id); @@ -206,33 +206,7 @@ namespace OctopusClient { refreshRundowns(); refreshStoryFolders(); } - //InitCheckID(treeContent.Nodes); - } - - //private void HandleCheck(TreeNode node) { - // string text = node.Name; - // checkFromCode = false; - // //ClearCheckBox?.Invoke(); - // ClearSelectionSource(node, treeContent.Nodes); - // id = node.Checked ? text : null; - // IDChangedEvent?.Invoke(id); - // checkFromCode = false; - //} - - //private void ClearSelectionSource(TreeNode actualNode, TreeNodeCollection nodes) { - // foreach (TreeNode actual in nodes) { - // if (!actual.Equals(actualNode)) { - // checkFromCode = true; - // actual.Checked = false; - // ClearSelectionSource(actualNode, actual.Nodes); - // } - // } - // checkFromCode = false; - //} - - //public void ClearEveryCheckBox() { - // ClearSelectionSource(null, treeContent.Nodes); - //} + } public OctopusAPI GetClient() { return client; diff --git a/client/PlanAIRClient/TrafficAPI.cs b/client/PlanAIRClient/TrafficAPI.cs index 1a13c3ef..102053ab 100644 --- a/client/PlanAIRClient/TrafficAPI.cs +++ b/client/PlanAIRClient/TrafficAPI.cs @@ -31,7 +31,7 @@ namespace TrafficClient { return broadvastWorker.GetBroadcasts(strParam, from, to, missingCopia); } - public List GetBroadcastArchiveMetadata(string strParam) { + public List GetMaterialMetadata(string strParam) { return broadvastWorker.GetBroadcastArchiveMetadata(strParam); } @@ -43,7 +43,7 @@ namespace TrafficClient { return promoWorker.GetPromotionals(strParam); } - public List GetPromotionalArchiveMetadata(string strParam) { + public List GetPromoMetadata(string strParam) { return promoWorker.GetPromotionalArchiveMetadata(strParam); } @@ -59,7 +59,7 @@ namespace TrafficClient { adWorker.SetAdvertisementToOkForAir(spotID, ok); } - public List GetAdvertisementArchiveMetadata(string strParam) { + public List GetADMetadata(string strParam) { return adWorker.GetAdvertisementArchiveMetadata(strParam); } diff --git a/client/PlanAIRClient/TrafficIDSelector.Designer.cs b/client/PlanAIRClient/TrafficIDSelector.Designer.cs index 6870887d..c8aa2be7 100644 --- a/client/PlanAIRClient/TrafficIDSelector.Designer.cs +++ b/client/PlanAIRClient/TrafficIDSelector.Designer.cs @@ -38,7 +38,7 @@ this.backgroundWorker3 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker4 = new System.ComponentModel.BackgroundWorker(); this.panel1 = new System.Windows.Forms.Panel(); - this.dataGridView1 = new TrafficClient.CustomDataGridView(); + this.dgTraffic = new TrafficClient.CustomDataGridView(); this.scheduledDate = new System.Windows.Forms.DateTimePicker(); this.textBox1 = new System.Windows.Forms.TextBox(); this.searchButton = new System.Windows.Forms.Button(); @@ -51,7 +51,7 @@ this.panel2 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.trafficAPIBindingSource)).BeginInit(); this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgTraffic)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); this.tableLayoutPanelSearch.SuspendLayout(); this.panel2.SuspendLayout(); @@ -59,7 +59,7 @@ // // panel1 // - this.panel1.Controls.Add(this.dataGridView1); + this.panel1.Controls.Add(this.dgTraffic); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 62); this.panel1.Name = "panel1"; @@ -68,14 +68,14 @@ // // dataGridView1 // - this.dataGridView1.AllowUserToAddRows = false; - this.dataGridView1.AllowUserToDeleteRows = false; - this.dataGridView1.AllowUserToResizeRows = false; - this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells; - this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; - this.dataGridView1.BackgroundColor = System.Drawing.Color.White; - this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.dataGridView1.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; + this.dgTraffic.AllowUserToAddRows = false; + this.dgTraffic.AllowUserToDeleteRows = false; + this.dgTraffic.AllowUserToResizeRows = false; + this.dgTraffic.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells; + this.dgTraffic.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCells; + this.dgTraffic.BackgroundColor = System.Drawing.Color.White; + this.dgTraffic.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.dgTraffic.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Raised; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); @@ -83,7 +83,7 @@ dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + this.dgTraffic.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); @@ -91,22 +91,22 @@ dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.Gainsboro; dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black; dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle2; - this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.dataGridView1.Location = new System.Drawing.Point(0, 0); - this.dataGridView1.MultiSelect = false; - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersVisible = false; + this.dgTraffic.DefaultCellStyle = dataGridViewCellStyle2; + this.dgTraffic.Dock = System.Windows.Forms.DockStyle.Fill; + this.dgTraffic.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; + this.dgTraffic.Location = new System.Drawing.Point(0, 0); + this.dgTraffic.MultiSelect = false; + this.dgTraffic.Name = "dataGridView1"; + this.dgTraffic.RowHeadersVisible = false; dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3; - this.dataGridView1.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView1.Size = new System.Drawing.Size(263, 217); - this.dataGridView1.TabIndex = 0; - this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); - this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); - this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnDataGridKeyDown); + this.dgTraffic.RowsDefaultCellStyle = dataGridViewCellStyle3; + this.dgTraffic.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.dgTraffic.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgTraffic.Size = new System.Drawing.Size(263, 217); + this.dgTraffic.TabIndex = 0; + this.dgTraffic.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick); + this.dgTraffic.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); + this.dgTraffic.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnDataGridKeyDown); // // scheduledDate // @@ -247,7 +247,7 @@ this.Size = new System.Drawing.Size(263, 279); ((System.ComponentModel.ISupportInitialize)(this.trafficAPIBindingSource)).EndInit(); this.panel1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.dgTraffic)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); this.tableLayoutPanelSearch.ResumeLayout(false); @@ -275,6 +275,6 @@ private System.Windows.Forms.RadioButton radioButtonPromo; private System.Windows.Forms.RadioButton radioButtonAD; private System.Windows.Forms.Panel panel2; - private CustomDataGridView dataGridView1; + private CustomDataGridView dgTraffic; } } diff --git a/client/PlanAIRClient/TrafficIDSelector.cs b/client/PlanAIRClient/TrafficIDSelector.cs index 2defe2e0..9a20e9b0 100644 --- a/client/PlanAIRClient/TrafficIDSelector.cs +++ b/client/PlanAIRClient/TrafficIDSelector.cs @@ -6,7 +6,6 @@ using System.Diagnostics; namespace TrafficClient { public delegate void OnSelectedIDChanged(string ID, int variantID); - //public delegate void ClearCheckBox(); public delegate void TrafficErrorReporterDelegate(DateTime time, String level, String message, Color color); public partial class TrafficIDSelector : UserControl { @@ -15,9 +14,6 @@ namespace TrafficClient { private DataGridViewCheckBoxCell selectedCell; public TrafficErrorReporterDelegate ErrorReporter { get; set; } - //TODO - //public ClearCheckBox clearCheckBox { get; set; } - public TrafficIDSelector() { InitializeComponent(); InitializeTexts(); @@ -25,7 +21,7 @@ namespace TrafficClient { } private void SetColumnsToResizeable() { - foreach (DataGridViewColumn actualColumn in dataGridView1.Columns) { + foreach (DataGridViewColumn actualColumn in dgTraffic.Columns) { int width = actualColumn.Width; actualColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; actualColumn.Width = width; @@ -36,8 +32,8 @@ namespace TrafficClient { searchButton.Text = Resources.KERESES; copiaCheckBox.Text = Resources.HIANYZO_KOPIA; - dataGridView1.AutoGenerateColumns = false; - dataGridView1.Columns.AddRange( + dgTraffic.AutoGenerateColumns = false; + dgTraffic.Columns.AddRange( new DataGridViewColumn[] { new DataGridViewCheckBoxColumn(){ AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, @@ -99,7 +95,7 @@ namespace TrafficClient { else if (radioButtonPromo.Checked) result = trafficAPI.GetPromotionals(searchText)?.ToArray(); if (result == null) { - dataGridView1.DataSource = null; + dgTraffic.DataSource = null; Cursor.Current = Cursors.Default; return; } @@ -108,7 +104,7 @@ namespace TrafficClient { list.Add(actual); if (CanSort(list)) list.Sort((x, y) => DateTime.Compare(x.NextBroadcastDate.Value, y.NextBroadcastDate.Value)); - dataGridView1.DataSource = list; + dgTraffic.DataSource = list; SetColumnsToResizeable(); Cursor.Current = Cursors.Default; } @@ -127,7 +123,7 @@ namespace TrafficClient { } private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { - OnSelectionChanged(dataGridView1.SelectedRows[0]); + OnSelectionChanged(dgTraffic.SelectedRows[0]); } private void searchButton_Click(object sender, EventArgs e) { @@ -146,7 +142,7 @@ namespace TrafficClient { DataGridView gridView = sender as DataGridView; if (gridView == null) return; - OnSelectionChanged(dataGridView1.SelectedRows[0]); + OnSelectionChanged(dgTraffic.SelectedRows[0]); } private void OnSelectionChanged(DataGridViewRow actualRow) { @@ -162,13 +158,6 @@ namespace TrafficClient { selectedCell.Value = !(bool)selectedCell.Value; bool selected = (bool)selectedCell.Value; Debug.WriteLine("Selection {0}", selected); - //DataGridViewCheckBoxCell checkBoxCell = actualRow.Cells[0] as DataGridViewCheckBoxCell; - //selectedCell = actualRow.Cells[0] as DataGridViewCheckBoxCell; - //bool beforeClear = checkBoxCell.Value.Equals(true); - //ClearSelectionSource(); - //checkBoxCell.Value = !beforeClear; - //bool selected = checkBoxCell.Value.Equals(true); - //clearCheckBox?.Invoke(); if (selected) { IDChangedEvent?.Invoke(res.MediaID, res.VariantID); } else @@ -180,15 +169,11 @@ namespace TrafficClient { return; selectedCell.Value = false; selectedCell = null; - //foreach (DataGridViewRow row in dataGridView1.Rows) { - // DataGridViewCheckBoxCell actual = row.Cells[0] as DataGridViewCheckBoxCell; - // actual.Value = false; - //} } private void OnDataGridKeyDown(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Space && dataGridView1.CurrentCell.GetType() != typeof(DataGridViewCheckBoxCell)) - OnSelectionChanged(dataGridView1.SelectedRows[0]); + if (e.KeyCode == Keys.Space && dgTraffic.CurrentCell.GetType() != typeof(DataGridViewCheckBoxCell)) + OnSelectionChanged(dgTraffic.SelectedRows[0]); } } diff --git a/server/-configuration/run-mediacube-server-localhost.launch b/server/-configuration/run-mediacube-server-localhost.launch index 62c83bb5..551a58e4 100644 --- a/server/-configuration/run-mediacube-server-localhost.launch +++ b/server/-configuration/run-mediacube-server-localhost.launch @@ -19,7 +19,7 @@ - + diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/JSONBase.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/JSONBase.java index 811d6ed4..93b4da48 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/JSONBase.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/JSONBase.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import user.commons.EntityBase; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "$type") -@JsonSubTypes({ @Type(WorkflowAction.class) }) +@JsonSubTypes({ @Type(WorkflowAction.class), @Type(MasterId.class) }) public class JSONBase extends EntityBase { } \ No newline at end of file diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/MasterId.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/MasterId.java index 37270990..24226baf 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/MasterId.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/MasterId.java @@ -2,9 +2,7 @@ package user.jobengine.db; import java.sql.Timestamp; -import user.commons.EntityBase; - -public class MasterId extends EntityBase { +public class MasterId extends JSONBase { private Timestamp created = null; public Timestamp getCreated() { -- 2.54.0