Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
39c0e4b
Add collection search matcher
tznind Apr 13, 2025
ee0748e
Fix naming
tznind Apr 13, 2025
4509780
fix naming
tznind Apr 13, 2025
b76212e
Move FileDialogCollectionNavigator to its own file (no longer private…
tznind Apr 13, 2025
bd364f7
Add ICollectionNavigator interface
tznind Apr 13, 2025
98383b4
Move to separate file IListCollectionNavigator
tznind Apr 13, 2025
9db1071
Update class diagram
tznind Apr 13, 2025
4b29940
update class diagram
tznind Apr 13, 2025
135d3c5
Add tests for overriding ICollectionNavigatorMatcher
tznind Apr 15, 2025
d1d5534
xmldoc and nullability warning fixes
tznind Apr 15, 2025
be56a8e
Code Cleanup
tznind Apr 15, 2025
26ff23d
Make requested changes to naming and terminology
tznind Apr 16, 2025
1f686f9
Move to seperate namespace
tznind Apr 16, 2025
dbeba5d
Update class diagram and change TreeView to reference the interface n…
tznind Apr 16, 2025
94219c6
Switch to implicit new
tznind Apr 16, 2025
18c3d90
Merge branch 'v2_develop' into collection-navigator-matcher
tig Apr 16, 2025
0511ad9
highlight that this class also works with tree view
tznind Apr 16, 2025
932c6aa
Merge branch 'collection-navigator-matcher' of https://github.com/tzn…
tznind Apr 16, 2025
58b0178
Apply tig patch to ensure keybindings get priority over navigator
tznind Apr 17, 2025
3ec5cc6
Apply 'keybinding has priority' fix to TreeView too
tznind Apr 17, 2025
41c9134
Apply 'keybindngs priority over navigation' fix to TableView
tznind Apr 17, 2025
0e29e04
Remove entire branch for selectively returning false now that it is d…
tznind Apr 17, 2025
d142ff1
Make classes internal and remove 'custom' navigator that was configur…
tznind Apr 17, 2025
35e402d
Fix merged conflicts
tznind Apr 24, 2025
ebecbc8
Change logging in collection navigator from Trace to Debug
tznind Apr 24, 2025
ab8c830
Switch to NewKeyDownEvent and directly setting HasFocus
tznind Apr 24, 2025
65a12da
Remove application top dependency
tznind Apr 26, 2025
d15bd12
Remove references to application
tznind Apr 27, 2025
e803d37
Remove Application
tznind Apr 27, 2025
1b8ab97
Merge branch 'v2_develop' into collection-navigator-matcher
tznind Apr 27, 2025
639b1d1
Move new tests to parallel
tznind Apr 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class CollectionNavigatorTester : Scenario
"$200.00",
"$210.99",
"$$",
"appricot",
"apricot",
"arm",
"丗丙业丞",
"丗丙丛",
Expand Down
15 changes: 0 additions & 15 deletions Examples/UICatalog/UICatalogTop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,6 @@ private void UpdateThemesMenu ()

public static ObservableCollection<Scenario>? CachedScenarios { get; set; }

// UI Catalog uses TableView for the scenario list instead of a ListView to demonstrate how
// TableView works. There's no real reason not to use ListView. Because we use TableView, and TableView
// doesn't (currently) have CollectionNavigator support built in, we implement it here, within the app.
private readonly CollectionNavigator _scenarioCollectionNav = new ();

// If set, holds the scenario the user selected to run
public static Scenario? CachedSelectedScenario { get; set; }

Expand Down Expand Up @@ -561,16 +556,6 @@ private void CategoryView_SelectedChanged (object? sender, ListViewItemEventArgs
}
);

// Create a collection of just the scenario names (the 1st column in our TableView)
// for CollectionNavigator.
List<object> firstColumnList = [];

for (var i = 0; i < _scenarioList.Table.Rows; i++)
{
firstColumnList.Add (_scenarioList.Table [i, 0]);
}

_scenarioCollectionNav.Collection = firstColumnList;
}

#endregion Category List
Expand Down
124 changes: 124 additions & 0 deletions Terminal.Gui/Views/CollectionNavigation/CollectionNavigation.cd
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Comment CommentText="Views that use the CollectionNavigation system">
<Position X="0.5" Y="0.5" Height="0.458" Width="1.856" />
</Comment>
<Comment CommentText="Specialized navigators for each collection type (e.g. list, tree etc)">
<Position X="4.646" Y="0.5" Height="0.5" Width="3.169" />
</Comment>
<Comment CommentText="Shared matching component (users should provide alternative implementations of this class if they want to modify collection navigation behaviour)">
<Position X="9.448" Y="0.5" Height="0.708" Width="3.169" />
</Comment>
<Class Name="Terminal.Gui.CollectionNavigatorBase" Collapsed="true">
<Position X="6.25" Y="1.5" Width="2" />
<TypeIdentifier>
<HashCode>AAgEAAAAAAAQAAAIAAEAAgAAAAAABAAEAAAAACwAAAA=</HashCode>
<FileName>Views\CollectionNavigation\CollectionNavigatorBase.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="Matcher" />
</ShowAsAssociation>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.CollectionNavigator" Collapsed="true">
<Position X="4.5" Y="3.5" Width="2" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAQAAAAAAAAgAAAAAAAAAEAAAAAAAAAAA=</HashCode>
<FileName>Views\CollectionNavigation\CollectionNavigator.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.DefaultCollectionNavigatorMatcher">
<Position X="9.5" Y="2.5" Width="2.75" />
<TypeIdentifier>
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAQA=</HashCode>
<FileName>Views\CollectionNavigation\DefaultCollectionNavigatorMatcher.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.TableCollectionNavigator" Collapsed="true">
<Position X="4.75" Y="6.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAEAAAAIAAAAAA=</HashCode>
<FileName>Views\CollectionNavigation\TableCollectionNavigator.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Terminal.Gui.ListView" Collapsed="true">
<Position X="0.5" Y="4.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAE+ASAkEnAAABAAKGAggYAZJAIAABEAcBAaAwAQIAA=</HashCode>
<FileName>Views\ListView.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="KeystrokeNavigator" />
</ShowAsAssociation>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.FileDialog" Collapsed="true">
<Position X="0.5" Y="5.5" Width="1.75" />
<Compartments>
<Compartment Name="Nested Types" Collapsed="false" />
</Compartments>
<TypeIdentifier>
<HashCode>iIY4LQFUHDKVIHIESBgigQcFT6GxhBDABGJItBQAwAQ=</HashCode>
<FileName>Views\FileDialog.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.FileDialogCollectionNavigator" Collapsed="true">
<Position X="4.75" Y="5.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAA=</HashCode>
<FileName>Views\FileDialogCollectionNavigator.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Terminal.Gui.TableView" Collapsed="true" BaseTypeListCollapsed="true">
<Position X="0.5" Y="6.5" Width="1.5" />
<TypeIdentifier>
<HashCode>QwUeAxwgICIAcABIABeR0oBAkhoFGGOBDABgAN3oPEI=</HashCode>
<FileName>Views\TableView\TableView.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.TreeView" Collapsed="true">
<Position X="0.5" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAA=</HashCode>
<FileName>Views\TreeView\TreeView.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Terminal.Gui.TreeView&lt;T&gt;" Collapsed="true">
<Position X="0.5" Y="2" Width="1.5" />
<TypeIdentifier>
<HashCode>UwAGySBgBSBGMAQgIiCaBDUItJIBSAWwRMQOSgQCwJI=</HashCode>
<FileName>Views\TreeView\TreeView.cs</FileName>
</TypeIdentifier>
<ShowAsAssociation>
<Property Name="KeystrokeNavigator" />
</ShowAsAssociation>
<Lollipop Position="0.2" />
</Class>
<Interface Name="Terminal.Gui.ICollectionNavigatorMatcher" Collapsed="true">
<Position X="9.5" Y="1.5" Width="2.75" />
<TypeIdentifier>
<HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAA=</HashCode>
<FileName>Views\CollectionNavigation\ICollectionNavigatorMatcher.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="Terminal.Gui.IListCollectionNavigator" Collapsed="true">
<Position X="3.75" Y="2.25" Width="2" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Views\CollectionNavigation\IListCollectionNavigator.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="Terminal.Gui.ICollectionNavigator" Collapsed="true">
<Position X="3.75" Y="1.5" Width="2" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAAAIAAAAAAAAAAAABAAAAAAAACgAAAA=</HashCode>
<FileName>Views\CollectionNavigation\ICollectionNavigator.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Terminal.Gui;

/// <inheritdoc/>
/// <inheritdoc cref="CollectionNavigatorBase"/>
/// <remarks>This implementation is based on a static <see cref="Collection"/> of objects.</remarks>
public class CollectionNavigator : CollectionNavigatorBase
internal class CollectionNavigator : CollectionNavigatorBase, IListCollectionNavigator
{
/// <summary>Constructs a new CollectionNavigator.</summary>
public CollectionNavigator () { }
Expand All @@ -13,12 +13,12 @@ public CollectionNavigator () { }
/// <param name="collection"></param>
public CollectionNavigator (IList collection) { Collection = collection; }

/// <summary>The collection of objects to search. <see cref="object.ToString()"/> is used to search the collection.</summary>
/// <inheritdoc/>
public IList Collection { get; set; }

/// <inheritdoc/>
protected override object ElementAt (int idx) { return Collection [idx]; }

/// <inheritdoc/>
protected override int GetCollectionLength () { return Collection.Count; }
}
}
Loading
Loading