Skip to content

Commit

Permalink
* showing of side info
Browse files Browse the repository at this point in the history
   completely refactored
  • Loading branch information
festo-i40 committed Oct 13, 2024
1 parent af185d1 commit e3aaa4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
7 changes: 4 additions & 3 deletions src/AasxPackageLogic/DispEditHelperEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ public void DisplayOrEditAasEntitySubmodelOrRef(
Aas.IReference smref,
Action setSmRefNull,
Aas.ISubmodel submodel,
AasIdentifiableSideInfo sideInfo,
// AasIdentifiableSideInfo sideInfo,
bool editMode,
AnyUiStackPanel stack, bool hintMode = false, bool checkSmt = false,
AasxMenu superMenu = null)
Expand Down Expand Up @@ -2635,6 +2635,9 @@ public void DisplayOrEditAasEntitySubmodelOrRef(
}

// info about sideInfo
var sideInfo = OnDemandListIdentifiable<Aas.ISubmodel>
.FindSideInfoInListOfIdentifiables(
env.Submodels, submodel.GetReference());
DisplayOrEditEntitySideInfo(env, stack, submodel, sideInfo, "Submodel", superMenu);

// Submodel attributes
Expand Down Expand Up @@ -5376,7 +5379,6 @@ public bool DisplayOrEditCommonEntity(
vesmref.theAas.Remove(vesmref.theSubmodelRef);
},
vesmref.theSubmodel,
vesmref.theSideInfo,
editMode, stack,
hintMode: hintMode, checkSmt: checkSmt,
superMenu: superMenu);
Expand All @@ -5387,7 +5389,6 @@ public bool DisplayOrEditCommonEntity(
packages, vesm.theEnv,
aas: null, smref: null, setSmRefNull: null,
submodel: vesm.theSubmodel,
sideInfo: vesm.theSideInfo,
editMode: editMode, stack: stack,
hintMode: hintMode, checkSmt: checkSmt,
superMenu: superMenu);
Expand Down
26 changes: 8 additions & 18 deletions src/AasxPackageLogic/VisualAasxElements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,12 @@ public class VisualElementSubmodelRef : VisualElementGeneric, ITaintableIdentifi
public Aas.IAssetAdministrationShell theAas = null;
public Aas.IReference theSubmodelRef = null;
public Aas.ISubmodel theSubmodel = null;
public AasIdentifiableSideInfo theSideInfo = null;

public VisualElementSubmodelRef(
VisualElementGeneric parent, TreeViewLineCache cache, Aas.IEnvironment env,
AdminShellPackageEnvBase package,
Aas.IAssetAdministrationShell aas,
Aas.IReference smr, Aas.ISubmodel sm,
AasIdentifiableSideInfo sideInfo)
Aas.IReference smr, Aas.ISubmodel sm)
: base()
{
this.Parent = parent;
Expand All @@ -868,7 +866,6 @@ public VisualElementSubmodelRef(
this.theAas = aas;
this.theSubmodelRef = smr;
this.theSubmodel = sm;
this.theSideInfo = sideInfo;

this.Background = Options.Curr.GetColor(OptionsInformation.ColorNames.DarkAccentColor);
this.Border = Options.Curr.GetColor(OptionsInformation.ColorNames.DarkAccentColor);
Expand Down Expand Up @@ -927,21 +924,18 @@ public class VisualElementSubmodel : VisualElementGeneric, ITaintableIdentifiabl
public AdminShellPackageEnvBase thePackage = null;
public Aas.IEnvironment theEnv = null;
public Aas.ISubmodel theSubmodel = null;
public AasIdentifiableSideInfo theSideInfo = null;

public VisualElementSubmodel(
VisualElementGeneric parent, TreeViewLineCache cache, AdminShellPackageEnvBase package,
Aas.IEnvironment env,
Aas.ISubmodel sm,
AasIdentifiableSideInfo sideInfo)
Aas.ISubmodel sm)
: base()
{
this.Parent = parent;
this.Cache = cache;
this.thePackage = package;
this.theEnv = env;
this.theSubmodel = sm;
this.theSideInfo = sideInfo;

this.Background = new AnyUiColor(0xffd0d0d0u);
this.Border = new AnyUiColor(0xff606060u);
Expand Down Expand Up @@ -2014,7 +2008,6 @@ private void GenerateInnerElementsForSubmodelOrRef(
private VisualElementSubmodelRef GenerateVisuElemForVisualElementSubmodelRef(
Aas.IAssetAdministrationShell aas,
Aas.ISubmodel sm,
AasIdentifiableSideInfo sideInfo,
Aas.IReference smr,
VisualElementGeneric parent,
TreeViewLineCache cache, Aas.IEnvironment env, AdminShellPackageEnvBase package = null)
Expand All @@ -2024,7 +2017,7 @@ private VisualElementSubmodelRef GenerateVisuElemForVisualElementSubmodelRef(
return null;

// item (even if sm is null)
var tiSm = new VisualElementSubmodelRef(parent, cache, env, package, aas, smr, sm, sideInfo);
var tiSm = new VisualElementSubmodelRef(parent, cache, env, package, aas, smr, sm);
tiSm.SetIsExpandedIfNotTouched(OptionExpandMode > 1);

if (OptionLazyLoadingFirst && !tiSm.GetExpandedStateFromCache())
Expand Down Expand Up @@ -2102,14 +2095,14 @@ private VisualElementAdminShell GenerateVisuElemForAAS(

// make reference with NO submodel behind
var tiNoSm = new VisualElementSubmodelRef(
tiAas, cache, env, package, aas, smr, sm: null, sideInfo: si);
tiAas, cache, env, package, aas, smr, sm: null);
tiAas.Members.Add(tiNoSm);
}
else
{
// generate
var tiSm = GenerateVisuElemForVisualElementSubmodelRef(
tiAas.theAas, sm, si, smr, tiAas, cache, env, package);
tiAas.theAas, sm, smr, tiAas, cache, env, package);

// add
if (tiSm != null)
Expand Down Expand Up @@ -2558,7 +2551,7 @@ public void AddVisualElementsFromShellEnv(
}

// Submodel
var tiSm = new VisualElementSubmodel(tiAllSubmodels, cache, package, env, sm, si);
var tiSm = new VisualElementSubmodel(tiAllSubmodels, cache, package, env, sm);
tiSm.SetIsExpandedIfNotTouched(expandMode > 1);
tiAllSubmodels.Members.Add(tiSm);

Expand Down Expand Up @@ -3159,9 +3152,8 @@ public bool UpdateByEvent(
continue;

// generate
// TODO (MIHO, 2024-10-12): check, if to provide sideInfo
var tiSm = GenerateVisuElemForVisualElementSubmodelRef(
parentAas, thisSm, null, smr, parentVE, cache,
parentAas, thisSm, smr, parentVE, cache,
data.Container?.Env?.AasEnv, data.Container?.Env);

// add
Expand All @@ -3174,11 +3166,9 @@ public bool UpdateByEvent(
(ve is VisualElementEnvironmentItem veei
&& veei.theItemType == VisualElementEnvironmentItem.ItemType.AllSubmodels)))
{
// TODO (MIHO, 2024-10-12): check, if sideInfo would be available
var tiSm = new VisualElementSubmodel(tiAllSubmodels, cache,
data.Container?.Env,
data.Container?.Env?.AasEnv, thisSm,
sideInfo: null);
data.Container?.Env?.AasEnv, thisSm);
tiSm.SetIsExpandedIfNotTouched(false);
tiAllSubmodels.Members.Add(tiSm);
}
Expand Down

0 comments on commit e3aaa4d

Please sign in to comment.