Skip to content

Commit

Permalink
Remove INonChildContainerElement interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper committed Aug 24, 2023
1 parent 8c0fa00 commit a12cb31
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 29 deletions.
13 changes: 0 additions & 13 deletions src/BlazorBindings.Core/INonChildContainerElement.cs

This file was deleted.

8 changes: 2 additions & 6 deletions src/BlazorBindings.Core/NativeComponentAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ private int ApplyPrependFrame(RenderBatch batch, int componentId, int siblingInd
var typeName = _targetElement?.TargetElement?.GetType()?.Name;
throw new NotImplementedException($"Element {typeName} does not support markup content: " + frame.MarkupContent);
}
#pragma warning disable CA2000 // Dispose objects before losing scope; adapters are disposed when they are removed from the adapter tree
var childAdapter = CreateAdapter(_targetElement ?? _closestPhysicalParent);
#pragma warning restore CA2000 // Dispose objects before losing scope
childAdapter.Name = $"Markup, sib#={siblingIndex}";
AddChildAdapter(siblingIndex, childAdapter);
return 1;
Expand All @@ -235,9 +233,7 @@ private int ApplyPrependFrame(RenderBatch batch, int componentId, int siblingInd
var typeName = _targetElement?.TargetElement?.GetType()?.Name;
throw new NotImplementedException($"Element {typeName} does not support text content: " + frame.MarkupContent);
}
#pragma warning disable CA2000 // Dispose objects before losing scope; adapters are disposed when they are removed from the adapter tree
var childAdapter = CreateAdapter(_targetElement ?? _closestPhysicalParent);
#pragma warning restore CA2000 // Dispose objects before losing scope
childAdapter.Name = $"Text, sib#={siblingIndex}";
AddChildAdapter(siblingIndex, childAdapter);
return 1;
Expand Down Expand Up @@ -387,7 +383,7 @@ private static NativeComponentAdapter GetEarlierSiblingMatch(NativeComponentAdap
for (var i = indexOfParentsChildAdapter - 1; i >= 0; i--)
{
var sibling = parentAdapter.Children[i];
if (sibling._targetElement is INonChildContainerElement)
if (sibling._targetElement is INonPhysicalChild)
{
continue;
}
Expand All @@ -406,7 +402,7 @@ private static NativeComponentAdapter GetEarlierSiblingMatch(NativeComponentAdap

private NativeComponentAdapter GetLastDescendantWithPhysicalElement()
{
if (_targetElement is INonChildContainerElement)
if (_targetElement is INonPhysicalChild)
{
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/BlazorBindings.Maui/Elements/GridCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace BlazorBindings.Maui.Elements;

public class GridCell : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
public class GridCell : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
{
[Parameter] public int? Column { get; set; }
[Parameter] public int? ColumnSpan { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BlazorBindings.Maui.Elements.Handlers;
/// </summary>
/// <remarks>Experimental API, subject to change.</remarks>
[RequiresPreviewFeatures]
public class RootContainerHandler : IContainerElementHandler, INonChildContainerElement
public class RootContainerHandler : IContainerElementHandler, INonPhysicalChild
{
private TaskCompletionSource<object> _taskCompletionSource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace BlazorBindings.Maui.Elements.Internal;

internal class ContentPropertyComponent<TControl> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class ContentPropertyComponent<TControl> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
{
private TControl _parent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace BlazorBindings.Maui.Elements.DataTemplates;
/// This ControlTemplate implementation wraps the content in an additional View, therefore it is not suitable in cases when non-View content
/// is expected from template.
/// </summary>
internal class ControlTemplateItemsComponent<T> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class ControlTemplateItemsComponent<T> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
where T : MC.BindableObject
{
protected override RenderFragment GetChildContent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace BlazorBindings.Maui.Elements.DataTemplates;

#pragma warning disable CA1812 // Avoid uninstantiated internal classes. Class is used as generic parameter.
internal class DataTemplateItemsComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class DataTemplateItemsComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
#pragma warning restore CA1812 // Avoid uninstantiated internal classes
{
protected override RenderFragment GetChildContent() => builder =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace BlazorBindings.Maui.Elements.DataTemplates;

internal class DataTemplateSelectorComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class DataTemplateSelectorComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
{
protected override RenderFragment GetChildContent() => builder =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace BlazorBindings.Maui.Elements.DataTemplates;
/// This makes it possible to use when returning a View from template is not an option.
/// However, it requires a DataTemplate to render synchronously, which does not always work with Blazor.
/// </summary>
internal class SyncControlTemplateItemsComponent<T> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class SyncControlTemplateItemsComponent<T> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
where T : MC.BindableObject
{
protected override RenderFragment GetChildContent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace BlazorBindings.Maui.Elements.DataTemplates;
/// This makes it possible to use when returning a View from template is not an option.
/// However, it requires a DataTemplate to render synchronously, which does not always work with Blazor.
/// </summary>
internal class SyncDataTemplateItemsComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class SyncDataTemplateItemsComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
{
protected override RenderFragment GetChildContent() => builder =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace BlazorBindings.Maui.Elements.Internal;

internal class ListContentPropertyComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class ListContentPropertyComponent<TControl, TItem> : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
where TItem : class
{
private TControl _parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace BlazorBindings.Maui.Elements.Internal;

internal class RootContainerComponent : NativeControlComponentBase, IContainerElementHandler, INonChildContainerElement
internal class RootContainerComponent : NativeControlComponentBase, IContainerElementHandler, INonPhysicalChild
{
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public EventCallback<object> OnElementAdded { get; set; }
Expand Down

0 comments on commit a12cb31

Please sign in to comment.