UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
Loading...
Searching...
No Matches
GWG.UsoUIElements.UsoTreeView Class Reference

A custom tree view control that extends Unity's TreeView with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system. More...

Inheritance diagram for GWG.UsoUIElements.UsoTreeView:

Public Member Functions

 UsoTreeView ()
 Initializes a new instance of the UsoTreeView class with default settings. Creates a tree view with USO framework integration enabled.
 UsoTreeView (Action btnAction)
 Initializes a new instance of the UsoTreeView class with an action callback. Creates a tree view with predefined action behavior and USO framework integration.
 UsoTreeView (string fieldName)
 Initializes a new instance of the UsoTreeView class with the specified field name. Creates a tree view with custom identification for binding and reference purposes.
 UsoTreeView (string fieldName, Action btnAction)
 Initializes a new instance of the UsoTreeView class with field name and action callback. Creates a tree view with custom identification, predefined action behavior, and USO framework integration.
 UsoTreeView (string fieldName, Action btnAction, out UsoTreeView newField)
 Initializes a new instance of the UsoTreeView class with field name, action callback, and returns a reference. Creates a tree view with custom identification, predefined action behavior, and provides an out parameter for immediate access.
 UsoTreeView (string fieldName, out UsoTreeView newField)
 Initializes a new instance of the UsoTreeView class with field name and returns a reference. Creates a tree view with custom identification and provides an out parameter for immediate access.
 UsoTreeView (string fieldName, string fieldLabelText)
 Initializes a new instance of the UsoTreeView class with field name and label text. Creates a tree view with custom identification and label text for potential future labeling functionality.
 UsoTreeView (string fieldName, string fieldLabelText, Action btnAction)
 Initializes a new instance of the UsoTreeView class with field name, label text, and action callback. Creates a tree view with custom identification, label text, and predefined action behavior.
 UsoTreeView (string fieldName, string fieldLabelText, Action btnAction, out UsoTreeView newField)
 Initializes a new instance of the UsoTreeView class with complete configuration and returns a reference. Creates a tree view with custom identification, label text, predefined action behavior, and immediate access to the created instance.
 UsoTreeView (string fieldName, string fieldLabelText, out UsoTreeView newField)
 Initializes a new instance of the UsoTreeView class with field name, label text, and returns a reference. Creates a tree view with custom identification, label text, and provides an out parameter for immediate access.
void ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode)
 Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.
UsoLineItem GetParentLineItem ()
 Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.
void InitElement (string fieldName=null)
 Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control.
void SetFieldStatus (FieldStatusTypes fieldStatus)
 Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.
void ShowFieldStatus (bool status)
 Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.
Public Member Functions inherited from GWG.UsoUIElements.IUsoUiElement
void AddToClassList (string className)
 Adds the specified CSS class name to this element's class list. This method is inherited from Unity's VisualElement and enables dynamic styling modifications.
void ClearBindings ()
 Removes all data binding configurations from this element. This method is inherited from Unity's VisualElement and provides cleanup functionality for data bindings.
void RemoveFromClassList (string className)
 Removes the specified CSS class name from this element's class list. This method is inherited from Unity's VisualElement and provides dynamic styling capabilities.

Properties

FieldStatusTypes FieldStatus [get, private set]
 Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.
bool FieldStatusEnabled [get, private set]
 Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

Private Member Functions

void InitElement (string fieldName, string fieldLabelText)
 Private initialization method that combines element setup with label text configuration. This overload provides setup for constructors that need both element initialization and label text.

Private Attributes

FieldStatusTypes _fieldStatus
bool _fieldStatusEnabled = true

Static Private Attributes

const string DefaultBindProp = "value"
 Default binding property used when applying data bindings to this field. Binds to the 'value' property for potential future data binding scenarios.
const string ElementClass = "uso-tree-view"
 CSS class name applied to all UsoTreeView instances for styling purposes.
const string ElementValidationClass = "uso-field-validation"
 CSS class name applied when field validation/status functionality is enabled.

Detailed Description

A custom tree view control that extends Unity's TreeView with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system.

This control implements the IUsoUiElement interface to provide consistent behavior across the USO UI framework. It supports field status indicators, automatic data binding for hierarchical data structures, and custom styling through CSS classes. The control is designed for displaying hierarchical data in an expandable tree structure with enhanced USO framework integration. It supports various constructor overloads for different initialization scenarios including action callbacks and label text configuration. The control includes commented code indicating potential future label text functionality integration.

Constructor & Destructor Documentation

◆ UsoTreeView() [1/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( )

Initializes a new instance of the UsoTreeView class with default settings. Creates a tree view with USO framework integration enabled.

◆ UsoTreeView() [2/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName)

Initializes a new instance of the UsoTreeView class with the specified field name. Creates a tree view with custom identification for binding and reference purposes.

Parameters
fieldNameThe name to assign to this tree view element.

◆ UsoTreeView() [3/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
out UsoTreeView newField )

Initializes a new instance of the UsoTreeView class with field name and returns a reference. Creates a tree view with custom identification and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this tree view element.
newFieldOutput parameter that receives a reference to the newly created tree view.

◆ UsoTreeView() [4/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( Action btnAction)

Initializes a new instance of the UsoTreeView class with an action callback. Creates a tree view with predefined action behavior and USO framework integration.

Parameters
btnActionThe action to associate with tree view interactions or events.

◆ UsoTreeView() [5/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
Action btnAction )

Initializes a new instance of the UsoTreeView class with field name and action callback. Creates a tree view with custom identification, predefined action behavior, and USO framework integration.

Parameters
fieldNameThe name to assign to this tree view element.
btnActionThe action to associate with tree view interactions or events.

◆ UsoTreeView() [6/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
Action btnAction,
out UsoTreeView newField )

Initializes a new instance of the UsoTreeView class with field name, action callback, and returns a reference. Creates a tree view with custom identification, predefined action behavior, and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this tree view element.
btnActionThe action to associate with tree view interactions or events.
newFieldOutput parameter that receives a reference to the newly created tree view.

◆ UsoTreeView() [7/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
string fieldLabelText )

Initializes a new instance of the UsoTreeView class with field name and label text. Creates a tree view with custom identification and label text for potential future labeling functionality.

Parameters
fieldNameThe name to assign to this tree view element.
fieldLabelTextThe label text for potential future labeling functionality.

The label text is currently not applied to the tree view due to commented implementation, but the parameter structure is maintained for future enhancement possibilities.

◆ UsoTreeView() [8/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
string fieldLabelText,
out UsoTreeView newField )

Initializes a new instance of the UsoTreeView class with field name, label text, and returns a reference. Creates a tree view with custom identification, label text, and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this tree view element.
fieldLabelTextThe label text for potential future labeling functionality.
newFieldOutput parameter that receives a reference to the newly created tree view.

The label text is currently not applied to the tree view due to commented implementation, but the parameter structure is maintained for future enhancement possibilities.

◆ UsoTreeView() [9/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
string fieldLabelText,
Action btnAction )

Initializes a new instance of the UsoTreeView class with field name, label text, and action callback. Creates a tree view with custom identification, label text, and predefined action behavior.

Parameters
fieldNameThe name to assign to this tree view element.
fieldLabelTextThe label text for potential future labeling functionality.
btnActionThe action to associate with tree view interactions or events.

The label text is currently not applied to the tree view due to commented implementation, but the parameter structure is maintained for future enhancement possibilities.

◆ UsoTreeView() [10/10]

GWG.UsoUIElements.UsoTreeView.UsoTreeView ( string fieldName,
string fieldLabelText,
Action btnAction,
out UsoTreeView newField )

Initializes a new instance of the UsoTreeView class with complete configuration and returns a reference. Creates a tree view with custom identification, label text, predefined action behavior, and immediate access to the created instance.

Parameters
fieldNameThe name to assign to this tree view element.
fieldLabelTextThe label text for potential future labeling functionality.
btnActionThe action to associate with tree view interactions or events.
newFieldOutput parameter that receives a reference to the newly created tree view.

The label text is currently not applied to the tree view due to commented implementation, but the parameter structure is maintained for future enhancement possibilities.

Member Function Documentation

◆ ApplyBinding()

void GWG.UsoUIElements.UsoTreeView.ApplyBinding ( string fieldBindingProp,
string fieldBindingPath,
BindingMode fieldBindingMode )

Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.

Parameters
fieldBindingPropThe property name on this control to bind to.
fieldBindingPathThe path to the data source property to bind from.
fieldBindingModeThe binding mode that determines how data flows between source and target.
Exceptions
ExceptionThrown when binding setup fails. Original exception is preserved and re-thrown.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.UsoTreeView.GetParentLineItem ( )

Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.

Returns
The parent UsoLineItem if found; otherwise, null.

◆ InitElement() [1/2]

void GWG.UsoUIElements.UsoTreeView.InitElement ( string fieldName,
string fieldLabelText )
private

Private initialization method that combines element setup with label text configuration. This overload provides setup for constructors that need both element initialization and label text.

Parameters
fieldNameThe name to assign to this tree view element.
fieldLabelTextThe label text for potential future labeling functionality.

The label text parameter is currently not applied due to commented code, but the method structure is maintained for future enhancement possibilities.

◆ InitElement() [2/2]

void GWG.UsoUIElements.UsoTreeView.InitElement ( string fieldName = null)

Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control.

Parameters
fieldNameOptional name to assign to the element. If null, no name is set.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ SetFieldStatus()

void GWG.UsoUIElements.UsoTreeView.SetFieldStatus ( FieldStatusTypes fieldStatus)

Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.

Parameters
fieldStatusThe new field status type to apply.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ ShowFieldStatus()

void GWG.UsoUIElements.UsoTreeView.ShowFieldStatus ( bool status)

Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.

Parameters
statusTrue to enable field status functionality; false to disable it.

Implements GWG.UsoUIElements.IUsoUiElement.

Member Data Documentation

◆ _fieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoTreeView._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.UsoTreeView._fieldStatusEnabled = true
private

◆ DefaultBindProp

const string GWG.UsoUIElements.UsoTreeView.DefaultBindProp = "value"
staticprivate

Default binding property used when applying data bindings to this field. Binds to the 'value' property for potential future data binding scenarios.

◆ ElementClass

const string GWG.UsoUIElements.UsoTreeView.ElementClass = "uso-tree-view"
staticprivate

CSS class name applied to all UsoTreeView instances for styling purposes.

◆ ElementValidationClass

const string GWG.UsoUIElements.UsoTreeView.ElementValidationClass = "uso-field-validation"
staticprivate

CSS class name applied when field validation/status functionality is enabled.

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoTreeView.FieldStatus
getprivate set

Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.

The current FieldStatusTypes value indicating the field's validation state.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ FieldStatusEnabled

bool GWG.UsoUIElements.UsoTreeView.FieldStatusEnabled
getprivate set

Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

True if field status functionality is enabled; otherwise, false. Default is true.

Implements GWG.UsoUIElements.IUsoUiElement.