From 233f945fcbe5ae1f0dac33fd87c51102b4514a37 Mon Sep 17 00:00:00 2001 From: Michael Hoffmeister Date: Sat, 29 Jul 2023 11:10:13 +0200 Subject: [PATCH] * Plugin Export Table: new lines for table cells --- .../AasxPluginExportTable.options.json | 10 ++++++++-- .../Table/ImportExportTableRecord.cs | 3 ++- src/AasxWpfControlLibrary/AnyUiWpf.cs | 3 ++- src/AnyUi/AnyUiBase.cs | 1 - src/AnyUi/AnyUiSmallWidgetToolkit.cs | 14 ++++++++------ src/Notes_V3.md | 4 ++-- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/AasxPluginExportTable/AasxPluginExportTable.options.json b/src/AasxPluginExportTable/AasxPluginExportTable.options.json index 0b8e70102..ebb0466e4 100644 --- a/src/AasxPluginExportTable/AasxPluginExportTable.options.json +++ b/src/AasxPluginExportTable/AasxPluginExportTable.options.json @@ -638,8 +638,8 @@ }, { "Name": "Export scratch info", - "Format": 2, - "RowsTop": 1, + "Format": 3, + "RowsTop": 3, "RowsBody": 1, "RowsGap": 2, "Cols": 2, @@ -653,6 +653,12 @@ "", "", "", + "", + "", + "%Parent.idShort%", + "", + "", + "", "" ], "Body": [ diff --git a/src/AasxPluginExportTable/Table/ImportExportTableRecord.cs b/src/AasxPluginExportTable/Table/ImportExportTableRecord.cs index ac2b54455..0a2cf009e 100644 --- a/src/AasxPluginExportTable/Table/ImportExportTableRecord.cs +++ b/src/AasxPluginExportTable/Table/ImportExportTableRecord.cs @@ -98,7 +98,8 @@ public void SaveToFile(string fn) using (StreamWriter file = File.CreateText(fn)) { JsonSerializer serializer = new JsonSerializer(); - serializer.Formatting = Formatting.Indented; + serializer.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()); + serializer.Formatting = Formatting.Indented; serializer.Serialize(file, this); } } diff --git a/src/AasxWpfControlLibrary/AnyUiWpf.cs b/src/AasxWpfControlLibrary/AnyUiWpf.cs index 760b9db6d..f03a44073 100644 --- a/src/AasxWpfControlLibrary/AnyUiWpf.cs +++ b/src/AasxWpfControlLibrary/AnyUiWpf.cs @@ -906,12 +906,13 @@ private void InitRenderRecs() wpf.Padding = GetWpfTickness(cntl.Padding); if (cntl.TextWrapping.HasValue) wpf.TextWrapping = (TextWrapping)((int) cntl.TextWrapping.Value); + if (cntl.MultiLine) + wpf.AcceptsReturn = true; if (cntl.IsReadOnly) wpf.IsReadOnly = cntl.IsReadOnly; wpf.VerticalScrollBarVisibility = (ScrollBarVisibility) ((int) cntl.VerticalScrollBarVisibility); - wpf.AcceptsReturn = cntl.AcceptsReturn; if (cntl.MaxLines != null) wpf.MaxLines = cntl.MaxLines.Value; wpf.Text = cntl.Text; diff --git a/src/AnyUi/AnyUiBase.cs b/src/AnyUi/AnyUiBase.cs index 8236a323f..1b54d892d 100644 --- a/src/AnyUi/AnyUiBase.cs +++ b/src/AnyUi/AnyUiBase.cs @@ -1282,7 +1282,6 @@ public class AnyUiTextBox : AnyUiControl public AnyUiScrollBarVisibility VerticalScrollBarVisibility; - public bool AcceptsReturn; public bool MultiLine; public Nullable MaxLines; public bool IsReadOnly = false; diff --git a/src/AnyUi/AnyUiSmallWidgetToolkit.cs b/src/AnyUi/AnyUiSmallWidgetToolkit.cs index c8f994457..93216f48e 100644 --- a/src/AnyUi/AnyUiSmallWidgetToolkit.cs +++ b/src/AnyUi/AnyUiSmallWidgetToolkit.cs @@ -245,13 +245,15 @@ public AnyUiTextBox AddSmallTextBoxTo( tb.VerticalContentAlignment = verticalContentAlignment.Value; if (textWrap.HasValue) tb.TextWrapping = textWrap.Value; - if (multiLine.HasValue) - tb.MultiLine = multiLine.Value; - - // (MIHO, 2020-11-13): constrain to one line - tb.AcceptsReturn = false; + + // (MIHO, 2020-11-13): be default constrain to one line + tb.MultiLine = false; tb.MaxLines = 3; - tb.VerticalScrollBarVisibility = AnyUiScrollBarVisibility.Auto; + + if (multiLine.HasValue) + tb.MultiLine = multiLine.Value; + + tb.VerticalScrollBarVisibility = AnyUiScrollBarVisibility.Auto; AnyUiGrid.SetRow(tb, row); AnyUiGrid.SetColumn(tb, col); diff --git a/src/Notes_V3.md b/src/Notes_V3.md index becac3486..b64363b62 100644 --- a/src/Notes_V3.md +++ b/src/Notes_V3.md @@ -66,7 +66,7 @@ if (reference.Keys == null || reference.Keys.Count == 0 || otherReference?.Keys Soll ich den Bug im Repository eintragen bzw. ein PullRequest starten? Oder pflegst du so etwas „auf dem kurzen Dienstweg“ ein? -* Export table / cells / allow return +* Submodel "move up" (fast re-ordering) show other order than real (slow) ordering! ## Done (w.r.t. recently V3.0) @@ -115,7 +115,7 @@ Soll ich den Bug im Repository eintragen bzw. ein PullRequest starten? Oder pfle * when Find/ Replace: before invoke "Replace all", "Start" needs to be invoked! -- Done * "add known" .. alphabetic sorting of domains and individual names of semanticIds. Done for WPF and Blazor (WPF keeps also last selected). -* Submodel "move up" (fast re-ordering) show other order than real (slow) ordering! +* Export table / cells / allow return -- done (re-structed TextBox / MultiLine) ## Notes (influencing todos)