Class UiOptionListEditorHelpers
Non-GUI editor helpers for UiOptionListInspectorGUI: generating a collision-free option id and traversing composite-view children to build "::"-qualified transition-path options. Split out of the GUI class so the ReorderableList drawing code isn't interleaved with this bookkeeping.
Inherited Members
Namespace: Serenity.Menu.Infrastructure.Settings.Editor
Assembly: Serenity.UnityMenu.Infrastructure.Editor.dll
Syntax
public static class UiOptionListEditorHelpers
Methods
AddCompositeChildPaths(List<string>, HashSet<string>, UnityCompositeViewDefinition, string, HashSet<string>)
Recursively appends every descendant child of composite to
paths as a "::"-joined transition path, so nested composite children are
selectable as menu transition targets. Guards against cycles via visited.
Declaration
public static void AddCompositeChildPaths(List<string> paths, HashSet<string> alreadyAddedPaths, UnityCompositeViewDefinition composite, string pathPrefix, HashSet<string> visited)
Parameters
| Type | Name | Description |
|---|---|---|
| List<string> | paths | The traversal-ordered path list being built (mutated in place). Order is the order the transition dropdown offers these entries in, so a set alone would not do. |
| HashSet<string> | alreadyAddedPaths | The paths already in |
| UnityCompositeViewDefinition | composite | The composite whose children to traverse. |
| string | pathPrefix | The "::"-joined path built so far, down to and including |
| HashSet<string> | visited | Composite ids already visited on this branch, to guard against cycles. |
GenerateUniqueOptionId(UiOption[], string)
Generates a new option id of the form "<viewId>_<n>" that does not collide with any id
already present in options.
Declaration
public static string GenerateUniqueOptionId(UiOption[] options, string viewId)
Parameters
| Type | Name | Description |
|---|---|---|
| UiOption[] | options | The view's current options (may be null). |
| string | viewId | The owning view id used as the id prefix. |
Returns
| Type | Description |
|---|---|
| string | A unique candidate id. |
GetOptionIds(UiOption[])
Returns every option's Id, in row order, including empty entries for options with no Id yet. Unlike GenerateUniqueOptionId(UiOption[], string) (which only needs a flat set of used ids), callers that validate a single row's Id against its siblings need the list index-aligned with the options array, so a row's own slot can be skipped by position (see Serenity.Global.Infrastructure.Editor.SerenityWizardFieldRules.UniqueWithinRows(System.Int32,System.Collections.Generic.IReadOnlyList{System.String},System.String,System.Func{System.Int32,System.String,System.String})).
Declaration
public static List<string> GetOptionIds(UiOption[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| UiOption[] | options | The view's current options (may be null). |
Returns
| Type | Description |
|---|---|
| List<string> | Each option's Id (empty string when unset), index-aligned with |