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

Custom UI element template for creating additional Uso UI elements. More...

Inheritance diagram for GWG.UsoUIElements.Templates.UsoCustomElementTemplate:

Public Member Functions

 UsoCustomElementTemplate ()
 UsoCustomElementTemplate (string fieldName)
 UsoCustomElementTemplate (string fieldName, out UsoCustomElementTemplate newField)
 UsoCustomElementTemplate (string fieldName, string fieldLabelText)
 UsoCustomElementTemplate (string fieldName, string fieldLabelText, out UsoCustomElementTemplate newField)
void ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode)
 Applies data binding configuration to the specified property of this element using Unity's data binding system. Enables automatic synchronization between the UI element and data source properties.
UsoLineItem GetParentLineItem ()
void InitElement (string fieldName=null)
 Initializes the USO UI element with the specified field name and applies framework-specific configuration. Sets up the element for integration with the USO framework including styling, validation, and identification.
void SetFieldStatus (FieldStatusTypes fieldStatus)
 Updates the element's field status type, which affects its visual appearance and validation state. The status change is typically reflected through CSS class modifications and visual indicators.
void ShowFieldStatus (bool status)
 Controls the visibility and functionality of the field status/validation system for this element. When disabled, removes validation-related styling and status indicators from the element.
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 of the element. The status type automatically influences the element's appearance through CSS class modifications.
bool FieldStatusEnabled [get, private set]
 Gets a value indicating whether field status/validation functionality is enabled for this element. When enabled, the element can display validation states and apply appropriate styling classes.

Private Member Functions

void InitElement (string fieldName, string fieldLabelText)

Private Attributes

FieldStatusTypes _fieldStatus
bool _fieldStatusEnabled = true

Static Private Attributes

const string DefaultBindProp = "value"
const string ElementClass = "uso-button"
const string ElementValidationClass = "uso-field-validation"

Detailed Description

Custom UI element template for creating additional Uso UI elements.

Constructor & Destructor Documentation

◆ UsoCustomElementTemplate() [1/5]

GWG.UsoUIElements.Templates.UsoCustomElementTemplate.UsoCustomElementTemplate ( )

◆ UsoCustomElementTemplate() [2/5]

GWG.UsoUIElements.Templates.UsoCustomElementTemplate.UsoCustomElementTemplate ( string fieldName)

◆ UsoCustomElementTemplate() [3/5]

GWG.UsoUIElements.Templates.UsoCustomElementTemplate.UsoCustomElementTemplate ( string fieldName,
out UsoCustomElementTemplate newField )

◆ UsoCustomElementTemplate() [4/5]

GWG.UsoUIElements.Templates.UsoCustomElementTemplate.UsoCustomElementTemplate ( string fieldName,
string fieldLabelText )

◆ UsoCustomElementTemplate() [5/5]

GWG.UsoUIElements.Templates.UsoCustomElementTemplate.UsoCustomElementTemplate ( string fieldName,
string fieldLabelText,
out UsoCustomElementTemplate newField )

Member Function Documentation

◆ ApplyBinding()

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

Applies data binding configuration to the specified property of this element using Unity's data binding system. Enables automatic synchronization between the UI element and data source properties.

Parameters
fieldBindingPropThe name of the property on this element to bind to the data source.
fieldBindingPathThe property path in the data source to bind from.
fieldBindingModeThe binding mode that controls the direction and behavior of data flow.

This method provides a standardized way to establish data binding relationships across all USO UI elements. The default implementation is empty, allowing individual controls to override with specific binding logic. Binding modes typically include ToTarget (one-way to UI), ToSource (one-way from UI), and TwoWay (bidirectional).

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.Templates.UsoCustomElementTemplate.GetParentLineItem ( )

◆ InitElement() [1/2]

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

◆ InitElement() [2/2]

void GWG.UsoUIElements.Templates.UsoCustomElementTemplate.InitElement ( string fieldName = null)

Initializes the USO UI element with the specified field name and applies framework-specific configuration. Sets up the element for integration with the USO framework including styling, validation, and identification.

Parameters
fieldNameThe name to assign to this element for identification and binding purposes.

This method serves as the primary initialization point for USO framework integration. It typically includes setting the element name, applying CSS classes, configuring field status functionality, and any other framework-specific setup required for proper operation. The default implementation is empty, allowing individual controls to provide their specific initialization logic.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ SetFieldStatus()

void GWG.UsoUIElements.Templates.UsoCustomElementTemplate.SetFieldStatus ( FieldStatusTypes fieldStatus)

Updates the element's field status type, which affects its visual appearance and validation state. The status change is typically reflected through CSS class modifications and visual indicators.

Parameters
fieldStatusThe new FieldStatusTypes value to apply to this element.

This method provides a standardized way to update element validation states across the USO framework. Implementation typically involves updating the FieldStatus property and triggering appropriate visual changes through the UsoUiHelper.SetFieldStatus utility method.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ ShowFieldStatus()

void GWG.UsoUIElements.Templates.UsoCustomElementTemplate.ShowFieldStatus ( bool status)

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

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

This method allows dynamic control over whether an element participates in the validation system. When disabled, validation CSS classes are typically removed and status indicators are hidden, allowing elements to display in a neutral state without validation feedback.

Implements GWG.UsoUIElements.IUsoUiElement.

Member Data Documentation

◆ _fieldStatus

FieldStatusTypes GWG.UsoUIElements.Templates.UsoCustomElementTemplate._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.Templates.UsoCustomElementTemplate._fieldStatusEnabled = true
private

◆ DefaultBindProp

const string GWG.UsoUIElements.Templates.UsoCustomElementTemplate.DefaultBindProp = "value"
staticprivate

◆ ElementClass

const string GWG.UsoUIElements.Templates.UsoCustomElementTemplate.ElementClass = "uso-button"
staticprivate

◆ ElementValidationClass

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

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.Templates.UsoCustomElementTemplate.FieldStatus
getprivate set

Gets the current field status type, which determines the visual state and validation feedback of the element. The status type automatically influences the element's appearance through CSS class modifications.

A FieldStatusTypes value indicating the current validation or display state.

This property reflects the element's current status in the validation system and triggers appropriate visual changes through the UsoUiHelper.SetFieldStatus method implementation.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ FieldStatusEnabled

bool GWG.UsoUIElements.Templates.UsoCustomElementTemplate.FieldStatusEnabled
getprivate set

Gets a value indicating whether field status/validation functionality is enabled for this element. When enabled, the element can display validation states and apply appropriate styling classes.

True if field status functionality is active; otherwise, false.

This property controls whether the element participates in the USO validation and status system. When disabled, validation-related CSS classes are removed and status indicators are hidden.

Implements GWG.UsoUIElements.IUsoUiElement.