Repository navigation
LT-22691: Answer the reorder-vector menu natively in the Avalonia detail view - #1143
Conversation
db9c83f to
a382684
Compare
The Avalonia detail view builds a hidden WinForms DataTree so xCore menu commands can be answered by its slices and DTMenuHandler through the mediator. This is the first menu id to leave that path. XCoreMenuBridge gains an IDetailMenuAuthority: for every leaf under a menu id the authority owns, it is consulted before the mediator, so those leaves cost no Display round trip and never reach the hidden tree. An owned id must be answered in full: an unknown leaf throws instead of leaking as a visible-but-disabled item. XCoreMenuBridge.OwnsAll lets RecordEditView skip EnsureMenuCommandAdapter when every id in a request is owned; the label menu still merges mnuDataTree-Object, so the skip is inert until that id is native. Tests render the label menu through the adapter and through the authority and assert the trees are identical. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
a382684 to
751bea1
Compare
jasonleenaylor
left a comment
There was a problem hiding this comment.
Approving. The adapter-versus-native equivalence tests are the right way to prove a swap like this. One divergence in the Move visibility rule, not for this PR:
CanReorderItems is (real ReferenceSequence && !virtual) || node.Reorder (DetailComposer.cs:2369-2374). VectorReferenceView.cs:348-350 hides the moves for three more cases: m_rootFieldName == "Complex Forms", == "Compare", and the LexReferenceCollectionView / LexReferenceTreeBranchesView views. m_rootFieldName is the localized label (ReferenceSlice.cs:55), and LexEntryParts.xml:824 is label="Complex Forms" menu="mnuReorderVector" reorder="true" — so WinForms hides Move Left and Move Right on that row and the authority's rule does not.
Not reachable today — that row composes as read-only Text, CanReorderRow is false, and both paths hide the moves, which is what ReorderVectorLabelMenu_ReadOnlyComplexFormsRow_RendersTheSameTreeAsTheAdapter pins. It bites only if ComplexFormEntries ever composes editable.
Not a straight port either: that condition matches on a localized label, so it already misses under a non-English UI. Noting it as something to either say at the rule or carry into a Jira issue when the next menu id moves across.
mark-sil
left a comment
There was a problem hiding this comment.
If I understand this correctly, the divergence is theoretical today, and from what I know there are no plans for ComplexFormEntries to compose editable.
If that is correct, then I think this falls in the category of 'busy work'. The Complex Forms equivalence test already asserts that the row composes read-only and that the moves are hidden. If that row ever composes editable, the test fails and points at exactly this.
Claude confirmed a note at the rule would add nothing the test does not already do, and logging a Jira issue for a theoretical problem doesn't seem like a good idea.
My preference would be to do nothing with issues like this. If you see a reason this one is different I'm glad to hear it, but otherwise I'd like to treat divergences that are unreachable today as needing no follow-up.
@mark-sil made 1 comment.
Reviewable status: 0 of 15 files reviewed, all discussions resolved.
The first step of retiring the hidden DataTree command adapter one menu id at a time: each menu id gets a native authority, proven equivalent, then flipped.
What changes
The Avalonia detail view still builds a hidden WinForms DataTree so xCore menu commands can be answered by its slices and DTMenuHandler through the mediator. This PR gives one menu id, mnuReorderVector (Move Left, Move Right, Alphabetical Order on reference-vector rows), a native authority that owns display and execution, so the mediator and the hidden tree play no part in it.
IDetailMenuAuthority: answers every leaf under the menu ids it owns. A hidden leaf is null; a leaf it does not know throws, so an owned id can never leak an item as visible-but-disabled.XCoreMenuBridgeconsults the authority before the mediator display query, so owned leaves cost no Display round trip.OwnsAlllets the host skip building the adapter when every id in a request is owned. Today the label menu always merges mnuDataTree-Object, so that skip is inert until the shared menu is native.ReorderVectorMenuAuthorityanswers from the row: Move Left and Right fromCanReorderItemsand the request's current item, Alphabetical Order from the newDetailField.CanResetItemOrder(the layout'sreorder="true"). Alphabetical Order executes natively through the newIDetailEditContext.TryResetReferenceOrder, backed byVirtualOrderingServices.ResetVO.Tests (xWorksTests, the two touched fixtures: 36 pass)
Known and deferred (recorded in the retirement notes, to be decided with the next menu ids)
🤖 Generated with Claude Code
This change is