From d7cfc9de292e19652dcf11f00371c45b7924293e Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Mon, 13 Oct 2025 12:20:15 +0200 Subject: [PATCH] - Aggiunto componente CardTree - Aggiunti commenti - Enum di TableComp portati in un file esterno (LayoutConst) --- WebWindowComplex/Compo/AreaSplit.razor | 8 +- WebWindowComplex/Compo/AreaSplit.razor.cs | 21 +- WebWindowComplex/Compo/CardFill.razor.cs | 58 ++++- WebWindowComplex/Compo/CardTree.razor | 45 ++++ WebWindowComplex/Compo/CardTree.razor.cs | 139 +++++++++++ WebWindowComplex/LayoutConst.cs | 30 +++ WebWindowComplex/TableComp.razor | 54 +---- WebWindowComplex/TableComp.razor.cs | 216 +++++++++--------- WebWindowComplex/WebWindowComplex.csproj | 11 +- .../WebWindowConfigurator.csproj | 9 +- 10 files changed, 413 insertions(+), 178 deletions(-) create mode 100644 WebWindowComplex/Compo/CardTree.razor create mode 100644 WebWindowComplex/Compo/CardTree.razor.cs create mode 100644 WebWindowComplex/LayoutConst.cs diff --git a/WebWindowComplex/Compo/AreaSplit.razor b/WebWindowComplex/Compo/AreaSplit.razor index cf8a058..4a3400a 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor +++ b/WebWindowComplex/Compo/AreaSplit.razor @@ -19,10 +19,10 @@
@for (int j = 0; j < CurrSashList.Count; j++) { - int Index = j; -
- -
+ int Index = j; +
+ +
}
diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index 1c03182..c7c87b4 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -8,17 +8,29 @@ namespace WebWindowComplex.Compo { #region Public Properties + /// + /// Lista delle sash + /// [Parameter] public List CurrSashList { get; set; } = null; + /// + /// Oggetto splitted corrente + /// [Parameter] public Splitted CurrSplitted { get; set; } = null; + /// + /// Lista degli Splitted + /// [Parameter] public List CurrSplittedList { get; set; } = null; + /// + /// Evento per copiare Sash + /// [Parameter] - public EventCallback EC_CopySash { get; set; } + public EventCallback EC_CopySash { get; set; } #endregion Public Properties @@ -30,7 +42,7 @@ namespace WebWindowComplex.Compo /// private async Task RaiseCopySash(Splitted item, int indexCurrSash) { - var Args = new Data + var Args = new DataAreaSplit { splitted = item, index = indexCurrSash, @@ -42,7 +54,10 @@ namespace WebWindowComplex.Compo } - public class Data + /// + /// Classe per raggruppare oggetti che servono per copiare Sash + /// + public class DataAreaSplit { public Splitted splitted { get; set; } public int index { get; set; } diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index cc5cbe3..36e4f4f 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -8,30 +8,57 @@ namespace WebWindowComplex.Compo { #region Public Properties + /// + /// Indice del fill corrente rispetto alla lista fill + /// [Parameter] public int CurrIndex { get; set; } = 0; + /// + /// Fill corrente rispetto alla lista fill + /// [Parameter] public Fill CurrItem { get; set; } = null!; + /// + /// Evento per cambiare tutti i fill + /// [Parameter] public EventCallback EC_ChangeAllType { get; set; } + /// + /// Evento per cambiare solo il fill corrente + /// [Parameter] public EventCallback EC_ChangeType { get; set; } + /// + /// Evento per copiare sash + /// [Parameter] - public EventCallback EC_CopySash { get; set; } + public EventCallback EC_CopySash { get; set; } + /// + /// Evento per tornare nella pagine Tree + /// [Parameter] public EventCallback EC_ReqClose { get; set; } + /// + /// Lista dei Fill + /// [Parameter] public List FillList { get; set; } = null!; + /// + /// Lista delle sash + /// [Parameter] public List SashList { get; set; } = null!; + /// + /// Lista degli Splitted + /// [Parameter] public List SplittedList { get; set; } = null!; @@ -40,17 +67,32 @@ namespace WebWindowComplex.Compo #region Protected Methods + /// + /// Sollevo evento per cambiare tutti i Fill + /// + /// tipo di fill richiesto + /// protected async Task ChangeAllFill(FillTypes reqFillType) { await EC_ChangeAllType.InvokeAsync(reqFillType); } + /// + /// Sollevo evento per cambiare solo il Fill corrente + /// + /// tipo di fill richiesto + /// protected async Task ChangeOneFill(FillTypes reqFillType) { await EC_ChangeType.InvokeAsync(reqFillType); } - protected async Task CopySash(Data Args) + /// + /// Sollevo evento per copiare sash + /// + /// + /// + protected async Task CopySash(DataAreaSplit Args) { await EC_CopySash.InvokeAsync(Args); } @@ -59,6 +101,14 @@ namespace WebWindowComplex.Compo #region Private Methods + /// + /// Sollevo evento per tornare alla pagina Tree + /// + private void ReqClose() + { + _ = EC_ReqClose.InvokeAsync(true); + } + /// /// Calcola bottone selezionato per il Fill /// @@ -70,9 +120,5 @@ namespace WebWindowComplex.Compo #endregion Private Methods - private void ReqClose() - { - _ = EC_ReqClose.InvokeAsync(true); - } } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor new file mode 100644 index 0000000..214df6d --- /dev/null +++ b/WebWindowComplex/Compo/CardTree.razor @@ -0,0 +1,45 @@ +@using static WebWindowComplex.LayoutConst + + + + @for (int i = 0; i < ItemTableList.Count; i++) + { + + @for (int j = 0; j < maxCol; j++) + { + CompileStep cs = CompileStep.Frame; + int ind = -1; + @if (j + 1 == ItemTableList[i].Col) + { + @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) + { + cs = CompileStep.Frame; + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) + { + cs = CompileStep.Split; + ind = ItemTableList[i].IndexItem; + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) + { + cs = CompileStep.Sash; + ind = ItemTableList[i].IndexItem; + } + else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) + { + cs = CompileStep.Fill; + ind = ItemTableList[i].IndexItem; + } + + } + else + { + + } + } + + } + +
+ + @FillTable(i, j)
\ No newline at end of file diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs new file mode 100644 index 0000000..923541a --- /dev/null +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -0,0 +1,139 @@ +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static WebWindowComplex.LayoutConst; + +namespace WebWindowComplex.Compo +{ + public partial class CardTree + { + /// + /// Lista oggetti ItemTable + /// + [Parameter] + public List ItemTableList { get; set; } = null!; + + /// + /// Numero massimo di colonne + /// + [Parameter] + public int maxCol { get; set; } = 0; + + /// + /// Evento richiesta prossimo step + /// + [Parameter] + public EventCallback EC_NextStep { get; set; } + + /// + /// Sollevo evento richiesta prossimo step + /// + /// + private async Task RaiseNextStep(CompileStep cs, int indexStep) + { + var Args = new DataNextStep + { + currCompileStep = cs, + index = indexStep, + }; + await EC_NextStep.InvokeAsync(Args); + } + + /// + /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura + /// + /// riga della cella + /// colonna della cella + /// + private string FillTable(int row, int col) + { + List itemSameCol = new List(); + for (int k = 0; k < row; k++) + { + if (ItemTableList[k].Col == col + 1) + { + itemSameCol.Add(ItemTableList[k]); + } + continue; + } + int numItemNextCol = 0; + for (int k = 0; k < row; k++) + { + if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2) + { + numItemNextCol++; + } + continue; + } + if (itemSameCol.Count > 1) + { + for (int i = 0; i <= itemSameCol.Count - 2; i++) + { + if (itemSameCol[i].NumChild > 0) + numItemNextCol = numItemNextCol - itemSameCol[i].NumChild; + } + } + if (itemSameCol.Count > 0) + { + // Sono alla riga successiva di un elemento e nella stessa colonna + if (itemSameCol.Last().Row == row) + { + // se ha un solo figlio + if (itemSameCol.Last().NumChild == 1) + { + return "└"; + } + else if (itemSameCol.Last().NumChild == 0) + { + return " "; + } + else + { + return "├"; + } + } + // Non sono alla riga successiva + else + { + // se ha un solo figlio + if (itemSameCol.Last().NumChild == 1) + { + return " "; + } + else if (col + 2 <= maxCol && ItemTableList[row].Col == col + 2) + { + if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1)) + { + return "├"; + } + return "└"; + } + else if (numItemNextCol < itemSameCol.Last().NumChild) + { + return "│"; + } + else + { + return " "; + } + } + } + else + { + return " "; + } + } + } + + /// + /// Classe per inserire dati per NextStep + /// + public class DataNextStep + { + public CompileStep currCompileStep { get; set; } + public int index { get; set; } + } +} diff --git a/WebWindowComplex/LayoutConst.cs b/WebWindowComplex/LayoutConst.cs new file mode 100644 index 0000000..0c16781 --- /dev/null +++ b/WebWindowComplex/LayoutConst.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebWindowComplex +{ + public partial class LayoutConst + { + public enum CompileStep + { + Template = 0, + Tree = 1, + Frame, + Split, + Sash, + Fill, + General + } + + public enum PositionJoints + { + BL = 0, // Bottom Left + BR = 1, // Bottom Right + TR, // Top Right + TL // Top Left + } + } +} diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 3777e8a..31f2207 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -1,4 +1,5 @@ -
+@using static WebWindowComplex.LayoutConst +
@if (isLoading) { @@ -59,10 +60,10 @@ @if (FrameWindow != null) { } @@ -117,52 +118,7 @@ } @if (currStep == CompileStep.Tree) { -
- - - @for (int i = 0; i < ItemTableList.Count; i++) - { - - @for (int j = 0; j < m_maxCol; j++) - { - CompileStep cs = CompileStep.Frame; - int ind = -1; - @if (j + 1 == ItemTableList[i].Col) - { - @if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FRAME) - { - cs = CompileStep.Frame; - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT) - { - cs = CompileStep.Split; - ind = ItemTableList[i].IndexItem; - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.SASH) - { - cs = CompileStep.Sash; - ind = ItemTableList[i].IndexItem; - } - else if (ItemTableList[i].Type is Json.WindowConst.AreaTypes.FILL) - { - cs = CompileStep.Fill; - ind = ItemTableList[i].IndexItem; - } - - } - else - { - - } - } - - } - -
- - @FillTable(i, j)
-
- + } else if (currStep == CompileStep.Frame) { diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 7d982e0..ef36db4 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -6,7 +6,9 @@ using WebWindowComplex.Compo; using WebWindowComplex.DTO; using WebWindowComplex.Json; using WebWindowComplex.Models; +using static WebWindowComplex.LayoutConst; using static WebWindowComplex.Json.WindowConst; +//using static WebWindowComplex.Compo.CardTree; namespace WebWindowComplex { @@ -88,29 +90,6 @@ namespace WebWindowComplex #endregion Protected Fields - #region Protected Enums - - protected enum CompileStep - { - Template = 0, - Tree = 1, - Frame, - Split, - Sash, - Fill, - General - } - - protected enum PositionJoints - { - BL = 0, // Bottom Left - BR = 1, // Bottom Right - TR, // Top Right - TL // Top Left - } - - #endregion Protected Enums - #region Protected Properties protected List FillList @@ -975,7 +954,7 @@ namespace WebWindowComplex /// Area Splitted corrente /// Indice della Sash che si vuole copiare /// - private async Task CopySash(Data Args) + private async Task CopySash(DataAreaSplit Args) { Splitted currSplitted = Args.splitted; int numSash = Args.index; @@ -990,90 +969,92 @@ namespace WebWindowComplex await DoPreviewSvg(); } - /// - /// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura - /// - /// riga della cella - /// colonna della cella - /// - private string FillTable(int row, int col) - { - List itemSameCol = new List(); - for (int k = 0; k < row; k++) - { - if (ItemTableList[k].Col == col + 1) - { - itemSameCol.Add(ItemTableList[k]); - } - continue; - } - int numItemNextCol = 0; - for (int k = 0; k < row; k++) - { - if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2) - { - numItemNextCol++; - } - continue; - } - if (itemSameCol.Count > 1) - { - for (int i = 0; i <= itemSameCol.Count - 2; i++) - { - if (itemSameCol[i].NumChild > 0) - numItemNextCol = numItemNextCol - itemSameCol[i].NumChild; - } - } - if (itemSameCol.Count > 0) - { - // Sono alla riga successiva di un elemento e nella stessa colonna - if (itemSameCol.Last().Row == row) - { - // se ha un solo figlio - if (itemSameCol.Last().NumChild == 1) - { - return "└"; - } - else if (itemSameCol.Last().NumChild == 0) - { - return " "; - } - else - { - return "├"; - } - } - // Non sono alla riga successiva - else - { - // se ha un solo figlio - if (itemSameCol.Last().NumChild == 1) - { - return " "; - } - else if (col + 2 <= m_maxCol && ItemTableList[row].Col == col + 2) - { - if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1)) - { - return "├"; - } - return "└"; - } - else if (numItemNextCol < itemSameCol.Last().NumChild) - { - return "│"; - } - else - { - return " "; - } - } - } - else - { - return " "; - } - } + ///// + ///// Metodo per riempire tabella con contenuto vuoto o con i simboli per rappresentare la struttura + ///// + ///// riga della cella + ///// colonna della cella + ///// + //private string FillTable(DataFillTable Args) + //{ + // int row = Args.indRow; + // int col = Args.indCol; + // List itemSameCol = new List(); + // for (int k = 0; k < row; k++) + // { + // if (ItemTableList[k].Col == col + 1) + // { + // itemSameCol.Add(ItemTableList[k]); + // } + // continue; + // } + // int numItemNextCol = 0; + // for (int k = 0; k < row; k++) + // { + // if (ItemTableList[k].Row <= row && ItemTableList[k].Col == col + 2) + // { + // numItemNextCol++; + // } + // continue; + // } + // if (itemSameCol.Count > 1) + // { + // for (int i = 0; i <= itemSameCol.Count - 2; i++) + // { + // if (itemSameCol[i].NumChild > 0) + // numItemNextCol = numItemNextCol - itemSameCol[i].NumChild; + // } + // } + // if (itemSameCol.Count > 0) + // { + // // Sono alla riga successiva di un elemento e nella stessa colonna + // if (itemSameCol.Last().Row == row) + // { + // // se ha un solo figlio + // if (itemSameCol.Last().NumChild == 1) + // { + // return "└"; + // } + // else if (itemSameCol.Last().NumChild == 0) + // { + // return " "; + // } + // else + // { + // return "├"; + // } + // } + // // Non sono alla riga successiva + // else + // { + // // se ha un solo figlio + // if (itemSameCol.Last().NumChild == 1) + // { + // return " "; + // } + // else if (col + 2 <= m_maxCol && ItemTableList[row].Col == col + 2) + // { + // if (numItemNextCol < itemSameCol.Last().NumChild && numItemNextCol != (itemSameCol.Last().NumChild - 1)) + // { + // return "├"; + // } + // return "└"; + // } + // else if (numItemNextCol < itemSameCol.Last().NumChild) + // { + // return "│"; + // } + // else + // { + // return " "; + // } + // } + // } + // else + // { + // return " "; + // } + //} /// /// Calcola larghezza colonna header nav @@ -1102,10 +1083,21 @@ namespace WebWindowComplex } /// - /// Metodo per cambiare step e aggiornare preview svg + /// Metodo per cambiare step + /// + /// argomenti passati dal componente + private void NextStepArgs(DataNextStep Args) + { + CompileStep newStep = Args.currCompileStep; + int Index = Args.index; + NextStep(newStep, Index); + } + + /// + /// Metodo per cambiare step /// /// step successivo - private void NextStepAndPreview(CompileStep newStep, int Index = -1) + private void NextStep(CompileStep newStep, int Index = 1) { editLock = true; currStep = newStep; @@ -1133,10 +1125,6 @@ namespace WebWindowComplex break; } } - -#if false - await DoPreviewSvg(); -#endif } /// diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index e6c1883..856e81f 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.1310 + 2.7.10.1312 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -61,6 +61,15 @@ + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index d3afbe3..3368837 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 2.7.10.1310 + 2.7.10.1312 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -101,6 +101,13 @@ + + + + + + +