Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
* SMT value validation
Browse files Browse the repository at this point in the history
  in 1st degree in UI
  • Loading branch information
festo-i40 committed Nov 11, 2023
1 parent cb91a46 commit 8f79617
Show file tree
Hide file tree
Showing 25 changed files with 1,684 additions and 448 deletions.
4 changes: 1 addition & 3 deletions src/AasxCore.Samm2_2_0/SammClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1659,9 +1659,7 @@ public void Add(
if (t != null && _renderInfo.ContainsKey(t))
return _renderInfo[t];
return null;
}


}

static Constants()
{
Expand Down
21 changes: 19 additions & 2 deletions src/AasxCsharpLibrary/AdminShellCollections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This source code may use other Open Source software components (see LICENSE.txt)
*/

using System.Collections.Generic;
using System.Linq;

namespace AdminShellNS
{
Expand Down Expand Up @@ -41,15 +42,31 @@ public void Add(K key, V value)

public List<V> this[K key] => dict[key];

public IEnumerable<List<V>> Keys
public IEnumerable<List<V>> Values
{
get
{
return dict.Values;
}
}

public void Clear() => dict.Clear();
public IEnumerable<K> Keys
{
get
{
return dict.Keys;
}
}

public void Clear() => dict.Clear();

public IEnumerable<V> All(K key)
{
if (!dict.ContainsKey(key))
yield break;
foreach (var x in dict[key])
yield return x;
}
}

public class DoubleSidedDict<T1, T2>
Expand Down
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/MainWindow.CommandBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ private async Task CommandBinding_GeneralDispatch(

if (cmd == "editmenu" || cmd == "editkey"
|| cmd == "hintsmenu" || cmd == "hintskey"
|| cmd == "showirimenu" || cmd == "showirikey")
|| cmd == "showirimenu" || cmd == "showirikey"
|| cmd == "checksmtelements")
{
// start
ticket.StartExec();
Expand Down
25 changes: 17 additions & 8 deletions src/AasxPackageExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public void UiShowRepositories(bool visible)

public void PrepareDispEditEntity(
AdminShellPackageEnv package, ListOfVisualElementBasic entities,
bool editMode, bool hintMode, bool showIriMode,
bool editMode, bool hintMode, bool showIriMode, bool checkSmt,
DispEditHighlight.HighlightFieldInfo hightlightField = null)
{
// determine some flags
Expand All @@ -597,7 +597,7 @@ public void PrepareDispEditEntity(
DynamicMenu.Menu.Clear();
var renderHints = DispEditEntityPanel.DisplayOrEditVisualAasxElement(
PackageCentral, DisplayContext,
entities, editMode, hintMode, showIriMode, tiCds?.CdSortOrder,
entities, editMode, hintMode, showIriMode, checkSmt, tiCds?.CdSortOrder,
flyoutProvider: this,
appEventProvider: this,
hightlightField: hightlightField,
Expand Down Expand Up @@ -807,7 +807,8 @@ public void RedrawElementView(DispEditHighlight.HighlightFieldInfo hightlightFie
MainMenu?.IsChecked("EditMenu") == true,
MainMenu?.IsChecked("HintsMenu") == true,
MainMenu?.IsChecked("ShowIriMenu") == true,
hightlightField: hightlightField);
MainMenu?.IsChecked("CheckSmtElements") == true,
hightlightField: hightlightField);

}

Expand Down Expand Up @@ -1065,9 +1066,10 @@ private async void Window_Loaded(object sender, RoutedEventArgs e)
MainMenu?.SetChecked("AnimateElements", Options.Curr.AnimateElements);
MainMenu?.SetChecked("ObserveEvents", Options.Curr.ObserveEvents);
MainMenu?.SetChecked("CompressEvents", Options.Curr.CompressEvents);
MainMenu?.SetChecked("CheckSmtElements", Options.Curr.CheckSmtElements);

// the UI application might receive events from items in the package central
PackageCentral.ChangeEventHandler = (data) =>
// the UI application might receive events from items in the package central
PackageCentral.ChangeEventHandler = (data) =>
{
if (data.Reason == PackCntChangeEventReason.Exception)
Log.Singleton.Info("PackageCentral events: " + data.Info);
Expand Down Expand Up @@ -1487,6 +1489,11 @@ private async Task MainTimer_HandleLambdaAction(AnyUiLambdaActionBase lab)
currentFlyoutControl.LambdaActionAvailable(lamprr);
}

if (lab is AnyUiLambdaActionEntityPanelReRender larrep)
{
UiHandleReRenderAnyUiInEntityPanel("", larrep.Mode, larrep.UseInnerGrid,
updateElemsOnly: larrep.UpdateElemsOnly);
}
}

private async Task MainTimer_HandleEntityPanel()
Expand Down Expand Up @@ -1599,9 +1606,10 @@ private async Task<LoadFromFileRepositoryInfo> LoadFromFileRepository(PackageCon
}

private void UiHandleReRenderAnyUiInEntityPanel(
string pluginName, AnyUiRenderMode mode, bool useInnerGrid = false)
string pluginName, AnyUiRenderMode mode, bool useInnerGrid = false,
Dictionary<AnyUiUIElement, bool> updateElemsOnly = null)
{
// A plugin asks to re-render an exisiting panel.
// A plugin asks to re-render an existing panel.
// Can get this information?
var renderedInfo = DispEditEntityPanel.GetLastRenderedRoot();

Expand Down Expand Up @@ -1632,7 +1640,8 @@ private void UiHandleReRenderAnyUiInEntityPanel(
DispEditEntityPanel.RedisplayRenderedRoot(
renderedPanel,
mode: mode,
useInnerGrid: useInnerGrid);
useInnerGrid: useInnerGrid,
updateElemsOnly: updateElemsOnly);
}
else
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/AasxPackageExplorer/debug.MIHO.script
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
// Tool("exportsmtasciidoc", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\new.zip", "ExportHtml", "true");
// Tool("Exit");
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\BatteryPass-spiel.ttl");
Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Batch-MM-2_0_0.ttl");
// Tool("sammaspectimport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Batch-MM-2_0_0.ttl");
Tool("editkey");
Select("ConceptDescription", "First");
// Select("ConceptDescription", "First");
// Select("ConceptDescription", "Next");
// Select("ConceptDescription", "Next");
// Select("ConceptDescription", "Next");
// Select("ConceptDescription", "Next");
// Select("ConceptDescription", "Next");
// Tool("sammaspectexport", "File", "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\out.ttl");
Tool("submodelinstancefromsammaspect");
// Tool("submodelinstancefromsammaspect");
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\SMT_Sample_B.aasx",
// "AuxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\SMT_Sample_A.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\00_FestoDemoBox-Module-2-Kopie2.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\samm_spiel_empty.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\samm_spiel_empty-smt.aasx",
"WindowLeft": 200,
"WindowTop": -1,
"WindowWidth": 900,
Expand Down Expand Up @@ -63,6 +63,7 @@
"WorkDir": ".\\work",
"ObserveEvents": true,
"CompressEvents": true,
"CheckSmtElements": false,
"DefaultStayConnected": true,
"DefaultUpdatePeriod": 1000,
"StayConnectOptions": "REST-QUEUE", // SIM
Expand Down
16 changes: 11 additions & 5 deletions src/AasxPackageLogic/DispEditHelperBasics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ public void AddAction(
public void AddKeyListLangStr<T>(
AnyUiStackPanel view, string key, List<T> langStr, ModifyRepo repo = null,
Aas.IReferable relatedReferable = null,
Action<Aas.IReferable> emitCustomEvent = null) where T : IAbstractLangString
Func<Aas.IReferable, AnyUiLambdaActionBase> emitCustomEvent = null) where T : IAbstractLangString
{
// sometimes needless to show
if (repo == null && (langStr == null || langStr.Count < 1))
Expand All @@ -783,7 +783,10 @@ public void AddKeyListLangStr<T>(

// default
if (emitCustomEvent == null)
emitCustomEvent = (rf) => { this.AddDiaryEntry(rf, new DiaryEntryStructChange()); };
emitCustomEvent = (rf) => {
this.AddDiaryEntry(rf, new DiaryEntryStructChange());
return new AnyUiLambdaActionNone();
};

// Grid
var g = new AnyUiGrid();
Expand Down Expand Up @@ -837,7 +840,6 @@ public void AddKeyListLangStr<T>(
langStr.Add<T>("", "");

emitCustomEvent?.Invoke(relatedReferable);

return new AnyUiLambdaActionRedrawEntity();
});
}
Expand Down Expand Up @@ -884,7 +886,9 @@ public void AddKeyListLangStr<T>(
(o) =>
{
langStr[currentI].Language = o as string;
emitCustomEvent?.Invoke(relatedReferable);
var evt = emitCustomEvent?.Invoke(relatedReferable);
if (evt != null && !(evt is AnyUiLambdaActionNone))
return evt;
return new AnyUiLambdaActionNone();
});
// check here, if to hightlight
Expand All @@ -909,7 +913,9 @@ public void AddKeyListLangStr<T>(
(o) =>
{
langStr[currentI].Text = o as string;
emitCustomEvent?.Invoke(relatedReferable);
var evt = emitCustomEvent?.Invoke(relatedReferable);
if (evt != null && !(evt is AnyUiLambdaActionNone))
return evt;
return new AnyUiLambdaActionNone();
});
// check here, if to hightlight
Expand Down
Loading

0 comments on commit 8f79617

Please sign in to comment.