Skip to content

Commit c62bb84

Browse files
committed
* intermediate save
1 parent 5fcfcd5 commit c62bb84

File tree

5 files changed

+81
-20
lines changed

5 files changed

+81
-20
lines changed

src/AasxCsharpLibrary/Extensions/ExtendQualifier.cs

+10
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ public static string ToStringExtended(this IQualifier q,
130130

131131
#region QualifierCollection
132132

133+
public static bool IsValid(this List<IQualifier> elems)
134+
{
135+
if (elems == null || elems.Count < 1)
136+
return false;
137+
foreach (var q in elems)
138+
if (q?.Type == null || q.Type.Trim().Length < 1)
139+
return false;
140+
return true;
141+
}
142+
133143
public static IQualifier FindQualifierOfType(this IEnumerable<IQualifier> qualifiers, string qualifierType)
134144
{
135145
if (qualifiers == null || qualifierType == null)

src/AasxPackageExplorer/options-debug.MIHO.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\Run2_DNP_plus_CD_SM_step_2.aasx",
3232
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Test1.aasx",
3333
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\samm-test\\SMT_and_SAMM_Showcase_v02.aasx",
34-
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\SMT_and_SAMM_Showcase_v02_spiel.aasx",
35-
"AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\00_FestoDemoBox-Module-2-Kopie.aasx",
34+
"AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\SMT_and_SAMM_Showcase_v02_spiel.aasx",
35+
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\00_FestoDemoBox-Module-2-Kopie.aasx",
3636
// "AasxToLoad": "C:\\Users\\homi0002\\Desktop\\tmp\\8001203_SPAU-P10R-T-R18M-L-PNLK-PNVBA-M8D_060ff64f-9fd2-422d-81ce-b17e49f007c5_work_spiel.aasx",
3737
// "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\SMT_and_SAMM_Showcase_v02.aasx",
3838
// "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\SMT_and_SAMM_Showcase_v01.aasx",

src/AasxPackageLogic/DispEditHelperBasics.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,7 @@ uc.ResultItem is AasxPredefinedConcepts.DefinitionsPoolReferableEntity pe
19921992
if (topContextMenu)
19931993
{
19941994
List<string> contextHeaders = new();
1995+
contextHeaders.AddRange(new[] { "\u2205", "Set all \u2192 blank" });
19951996
contextHeaders.AddRange(new[] { "\u2702", "Delete all" });
19961997

19971998
if (addEclassIrdi)
@@ -2028,10 +2029,21 @@ uc.ResultItem is AasxPredefinedConcepts.DefinitionsPoolReferableEntity pe
20282029
if (contextHeaders[2 * oi + 1].Contains("clipboard"))
20292030
return lambdaClipboard(o);
20302031

2031-
if (contextHeaders[2 * oi + 1].Contains("Delete"))
2032+
if (contextHeaders[2 * oi + 1].Contains("Set all")
2033+
|| (contextHeaders[2 * oi + 1].Contains("Delete")))
20322034
{
20332035
// re-init
2034-
keys.Clear();
2036+
if (contextHeaders[2 * oi + 1].Contains("Set all"))
2037+
{
2038+
keys.Clear();
2039+
keys.Add(Options.Curr.GetDefaultEmptyReference()?.Keys?.FirstOrDefault());
2040+
}
2041+
2042+
if (contextHeaders[2 * oi + 1].Contains("Delete"))
2043+
{
2044+
keys = null;
2045+
setKeysNull?.Invoke();
2046+
}
20352047

20362048
// change to the outside
20372049
emitCustomEvent?.Invoke(relatedReferable);

src/AasxPackageLogic/DispEditHelperMiniModules.cs

+50-13
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,27 @@ public void QualiferUpgradeReferable(List<QualifierPreset> presets, IReferable r
149149
public void QualifierHelper(
150150
AnyUiStackPanel stack, ModifyRepo repo,
151151
List<Aas.IQualifier> qualifiers,
152+
Action setQualifiersNull = null,
152153
Aas.IReferable relatedReferable = null,
153154
AasxMenu superMenu = null)
154155
{
156+
// access
157+
if (qualifiers == null)
158+
return;
159+
155160
if (editMode)
156161
{
162+
// some hints
163+
this.AddHintBubble(
164+
stack, hintMode,
165+
new[] {
166+
new HintCheck(
167+
() => qualifiers?.IsValid() != true,
168+
"According to the specification, an existing list of elements shall contain " +
169+
"at least one element and for each element all mandatory fields shall be " +
170+
"not empty.")
171+
});
172+
157173
// let the user control the number of references
158174
AddActionPanel(
159175
stack, "Qualifier entities:",
@@ -186,7 +202,7 @@ public void QualifierHelper(
186202
if (presets == null)
187203
{
188204
Log.Singleton.Error(
189-
$"JSON file for Quialifer presets not defined nor existing ({pfn}).");
205+
$"JSON file for Qualifier presets not defined nor existing ({pfn}).");
190206
return new AnyUiLambdaActionNone();
191207
}
192208

@@ -236,8 +252,14 @@ public void QualifierHelper(
236252
}
237253
}
238254

239-
if (buttonNdx == 3 && qualifiers.Count > 0)
240-
qualifiers.RemoveAt(qualifiers.Count - 1);
255+
if (buttonNdx == 3)
256+
{
257+
if (qualifiers.Count > 0)
258+
qualifiers.RemoveAt(qualifiers.Count - 1);
259+
260+
if (qualifiers.Count < 1)
261+
setQualifiersNull?.Invoke();
262+
}
241263

242264
return new AnyUiLambdaActionRedrawEntity();
243265
});
@@ -269,6 +291,11 @@ public void QualifierHelper(
269291
{
270292
case 0:
271293
qualifiers.Remove(qual);
294+
if (qualifiers.Count < 1)
295+
{
296+
qualifiers = null;
297+
setQualifiersNull?.Invoke();
298+
}
272299
action = true;
273300
break;
274301
case 1:
@@ -330,16 +357,6 @@ public void QualifierHelper(
330357

331358
// SemanticId
332359

333-
AddHintBubble(
334-
substack, hintMode,
335-
new[] {
336-
new HintCheck(
337-
() => {
338-
return (qual.SemanticId == null || qual.SemanticId.IsEmpty()) &&
339-
(qual.Type == null || qual.Type.Trim() == "");
340-
},
341-
"Either a semanticId or a type string specification shall be given!")
342-
});
343360
if (SafeguardAccess(
344361
substack, repo, qual.SemanticId, "semanticId:", "Create data element!",
345362
v =>
@@ -394,6 +411,15 @@ public void QualifierHelper(
394411
}
395412

396413
// Type
414+
AddHintBubble(
415+
substack, hintMode,
416+
new[] {
417+
new HintCheck(
418+
() => {
419+
return (qual.Type == null || qual.Type.Trim() == "");
420+
},
421+
"Type string specification shall be given!")
422+
});
397423

398424
AddKeyValueExRef(
399425
substack, "type", qual, qual.Type, null, repo,
@@ -1216,6 +1242,17 @@ public void AddKeyReference(
12161242
if (emitCustomEvent == null)
12171243
emitCustomEvent = (rf) => { this.AddDiaryEntry(rf, new DiaryEntryStructChange()); };
12181244

1245+
// some hints
1246+
this.AddHintBubble(
1247+
view, hintMode,
1248+
new[] {
1249+
new HintCheck(
1250+
() => refkeys != null && refkeys.IsValid() != true,
1251+
"According to the specification, an existing list of elements shall contain " +
1252+
"at least one element and for each element all mandatory fields shall be " +
1253+
"not empty.")
1254+
});
1255+
12191256
//
12201257
// extended Front panel
12211258
//

src/AasxPackageLogic/DispEditHelperModules.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1395,13 +1395,15 @@ public void DisplayOrEditEntityQualifierCollection(AnyUiStackPanel stack,
13951395
stack, repo, qualifiers, "Qualifiers:", "Create empty list of Qualifiers!",
13961396
v =>
13971397
{
1398-
setOutput?.Invoke(new List<Aas.IQualifier>());
1398+
setOutput?.Invoke(new List<Aas.IQualifier>(new[] { new Aas.Qualifier("", DataTypeDefXsd.String) }));
13991399
this.AddDiaryEntry(relatedReferable, new DiaryEntryStructChange());
14001400
return new AnyUiLambdaActionRedrawEntity();
14011401
}))
14021402
{
1403-
this.QualifierHelper(stack, repo, qualifiers, relatedReferable: relatedReferable,
1404-
superMenu: superMenu);
1403+
this.QualifierHelper(
1404+
stack, repo,
1405+
qualifiers, () => setOutput(null),
1406+
relatedReferable: relatedReferable, superMenu: superMenu);
14051407
}
14061408

14071409
}

0 commit comments

Comments
 (0)