Skip to content

Commit

Permalink
Fix CP List viewmodels. Bus sadly, newly created CP objects in a list…
Browse files Browse the repository at this point in the history
… will be saved. Only the second time, when they are modified. This is a major bug
  • Loading branch information
arthurzaczek committed Jun 28, 2021
1 parent 7d64829 commit 7795a3f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Zetbox.API/TypeTransformations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ private InterfaceType(Type type, IInterfaceTypeChecker typeChecker)
typeof(IRelationEntry),
typeof(IValueCollectionEntry<,>),
typeof(IValueCollectionEntry),
typeof(IValueListEntry<,>),
typeof(IValueListEntry),
typeof(IPersistenceObject)
};

Expand Down
3 changes: 2 additions & 1 deletion Zetbox.API/Utils/ReadOnlyObservableProjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs args
{
if (CollectionChanged != null)
{
CollectionChanged(this, args);
// TODO: CollectionChanged(this, args);
CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}

Expand Down
9 changes: 9 additions & 0 deletions Zetbox.Assets/Zetbox.Assets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.BaseParameter.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Blob.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Blob.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.CompoundObject.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Constraint.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Constraint.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.DataType.resx" />
Expand All @@ -148,8 +149,10 @@
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Group.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.ICustomFulltextFormat.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.ICustomFulltextFormat.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.Identity.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.IInvocation.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.IInvocation.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.IMergeable.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.INamedObject.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.INamedObject.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Base.InstanceConstraint.resx" />
Expand Down Expand Up @@ -198,12 +201,15 @@
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.GUI.Template.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.GUI.ViewModelDescriptor.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.GUI.ViewModelDescriptor.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.LicenseManagement.License.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.LicenseManagement.PrivateKey.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Auftrag.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Auftrag.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Mitarbeiter.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Mitarbeiter.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Projekt.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Projekt.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.Projekte.Task.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.SchemaMigration.MigrationProject.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.SchemaMigration.MigrationProject.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Methods\Zetbox.App.SchemaMigration.SourceColumn.resx" />
Expand Down Expand Up @@ -410,6 +416,8 @@
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.GUI.Visual.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.GUI.YearFilterConfiguration.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.GUI.YearFilterConfiguration.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.LicenseManagement.License.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.LicenseManagement.PrivateKey.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Projekte.Auftrag.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Projekte.Auftrag.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Projekte.Kunde.resx" />
Expand Down Expand Up @@ -496,6 +504,7 @@
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.SecurityTestChild.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.SecurityTestParent.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.SecurityTestParent.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.TestCompany.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.TestCustomObject.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.TestCustomObject.x-zb-Pseudo.resx" />
<EmbeddedResource Include="ZetboxBase\Properties\Zetbox.App.Test.TestDecimal.resx" />
Expand Down
10 changes: 7 additions & 3 deletions Zetbox.Client/Models/ColumnDisplayModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,13 @@ private void BuildColumns(Zetbox.App.Base.DataType cls, IEnumerable<Property> pr
if (props == null) throw new ArgumentNullException("props");
if (methods == null) throw new ArgumentNullException("methods");

ShowIcon = cls.ShowIconInLists;
ShowId = cls.ShowIdInLists;
ShowName = cls.ShowNameInLists;
if (cls is ObjectClass)
{
// Makes no sense on CompoundObjects
ShowIcon = cls.ShowIconInLists;
ShowId = cls.ShowIdInLists;
ShowName = cls.ShowNameInLists;
}

this.Columns = new ObservableCollection<ColumnDisplayModel>(
props.Select(p => ColumnDisplayModel.Create(mode, p))
Expand Down
9 changes: 8 additions & 1 deletion Zetbox.Client/Models/PropertyValueModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,14 @@ public static IValueModel GetPropertyValueModel(this Property prop, INotifyingOb
var cop = (CompoundObjectProperty)prop;
if (cop.IsList)
{
return new CompoundCollectionPropertyValueModel(obj, cop);
if (cop.HasPersistentOrder)
{
return new CompoundListPropertyValueModel(obj, cop);
}
else
{
return new CompoundCollectionPropertyValueModel(obj, cop);
}
}
else
{
Expand Down

0 comments on commit 7795a3f

Please sign in to comment.