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

A custom UI display section container element that extends Unity's VisualElement with USO UI framework functionality and specialized content display capabilities. Provides enhanced styling, field validation, data binding capabilities, theme integration, and data source management for structured content presentation within the USO UI system. More...

Inheritance diagram for GWG.UsoUIElements.UsoUiDisplaySection:

Public Member Functions

 UsoUiDisplaySection ()
 Initializes a new instance of the UsoUiDisplaySection class with default settings. Creates a display section container with USO framework integration, theme loading, and flexible layout configuration.
 UsoUiDisplaySection (string fieldName)
 Initializes a new instance of the UsoUiDisplaySection class with the specified field name. Creates a display section container with custom identification for binding and reference purposes.
 UsoUiDisplaySection (string fieldName, Object fieldDatasource)
 Initializes a new instance of the UsoUiDisplaySection class with field name and initial data source. Creates a display section container with custom identification and establishes initial data binding relationships.
 UsoUiDisplaySection (string fieldName, Object fieldDatasource, out UsoUiDisplaySection newField)
 Initializes a new instance of the UsoUiDisplaySection class with field name, initial data source, and returns a reference. Creates a display section container with custom identification, establishes initial data binding, and provides an out parameter for immediate access.
 UsoUiDisplaySection (string fieldName, out UsoUiDisplaySection newField)
 Initializes a new instance of the UsoUiDisplaySection class with field name and returns a reference. Creates a display section container with custom identification 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 comprehensive styling and theme configuration. This method sets up the basic USO framework integration including theme loading, flexible layout, and styling application.
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.
void UpdateDatasource (Object fieldDatasource=null)
 Updates the display section's data source, establishing or clearing data binding relationships for dynamic content management. Manages the connection and disconnection of data sources with proper binding cleanup when necessary.
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 Attributes

FieldStatusTypes _fieldStatus
bool _fieldStatusEnabled = false

Static Private Attributes

const string DefaultBindProp = ""
 Default binding property used when applying data bindings to this field. Currently set to empty string as display sections typically manage child content rather than direct values.
const string ElementClass = "uso-display-section"
 CSS class name applied to all UsoUiDisplaySection instances for styling purposes. Uses "uso-display-section" to maintain consistency with the stylesheet configuration.
const string ElementStylesheet = "uso-display-section"
 CSS stylesheet name applied to all UsoUiDisplaySection instances for styling purposes. Uses "uso-display-section" for consistent section-based styling throughout the application.
const string ElementValidationClass = "uso-field-validation"
 CSS class name applied when field validation/status functionality is enabled.

Detailed Description

A custom UI display section container element that extends Unity's VisualElement with USO UI framework functionality and specialized content display capabilities. Provides enhanced styling, field validation, data binding capabilities, theme integration, and data source management for structured content presentation within 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 capabilities, and custom styling through CSS classes. The control serves as a specialized container for display-oriented content sections, featuring automatic theme loading and flexible layout configuration optimized for content presentation scenarios. It includes comprehensive data source management capabilities with methods for connecting and disconnecting data objects for dynamic content scenarios. Display sections are commonly used for organizing related content, creating structured layouts, and providing consistent presentation containers throughout USO applications. The control automatically loads the USO theme stylesheet and configures flexible growth properties suitable for adaptive content display requirements. The control has field status functionality disabled by default, focusing on its role as a presentation container.

Constructor & Destructor Documentation

◆ UsoUiDisplaySection() [1/5]

GWG.UsoUIElements.UsoUiDisplaySection.UsoUiDisplaySection ( )

Initializes a new instance of the UsoUiDisplaySection class with default settings. Creates a display section container with USO framework integration, theme loading, and flexible layout configuration.

◆ UsoUiDisplaySection() [2/5]

GWG.UsoUIElements.UsoUiDisplaySection.UsoUiDisplaySection ( string fieldName)

Initializes a new instance of the UsoUiDisplaySection class with the specified field name. Creates a display section container with custom identification for binding and reference purposes.

Parameters
fieldNameThe name to assign to this display section element.

◆ UsoUiDisplaySection() [3/5]

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

Initializes a new instance of the UsoUiDisplaySection class with field name and returns a reference. Creates a display section container with custom identification and provides an out parameter for immediate access.

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

◆ UsoUiDisplaySection() [4/5]

GWG.UsoUIElements.UsoUiDisplaySection.UsoUiDisplaySection ( string fieldName,
Object fieldDatasource )

Initializes a new instance of the UsoUiDisplaySection class with field name and initial data source. Creates a display section container with custom identification and establishes initial data binding relationships.

Parameters
fieldNameThe name to assign to this display section element.
fieldDatasourceThe Unity Object to use as the initial data source for display content binding.

◆ UsoUiDisplaySection() [5/5]

GWG.UsoUIElements.UsoUiDisplaySection.UsoUiDisplaySection ( string fieldName,
Object fieldDatasource,
out UsoUiDisplaySection newField )

Initializes a new instance of the UsoUiDisplaySection class with field name, initial data source, and returns a reference. Creates a display section container with custom identification, establishes initial data binding, and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this display section element.
fieldDatasourceThe Unity Object to use as the initial data source for display content binding.
newFieldOutput parameter that receives a reference to the newly created display section.

Member Function Documentation

◆ ApplyBinding()

void GWG.UsoUIElements.UsoUiDisplaySection.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.

While display sections primarily manage content presentation, this method enables binding to container-level properties such as visibility, styling characteristics, or other display-related attributes.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.UsoUiDisplaySection.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()

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

Initializes the USO UI element with the specified field name and applies comprehensive styling and theme configuration. This method sets up the basic USO framework integration including theme loading, flexible layout, and styling application.

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

The initialization process includes setting flexible growth properties for adaptive sizing, loading the USO theme stylesheet from resources for consistent styling, and applying appropriate CSS classes for display section presentation. The method ensures proper integration with the USO framework's theming and styling system.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ SetFieldStatus()

void GWG.UsoUIElements.UsoUiDisplaySection.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.UsoUiDisplaySection.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.

◆ UpdateDatasource()

void GWG.UsoUIElements.UsoUiDisplaySection.UpdateDatasource ( Object fieldDatasource = null)

Updates the display section's data source, establishing or clearing data binding relationships for dynamic content management. Manages the connection and disconnection of data sources with proper binding cleanup when necessary.

Parameters
fieldDatasourceThe Unity Object to use as the new data source. Pass null to disconnect the current data source.

When a non-null data source is provided, the method establishes the binding relationship for content display. When null is provided, it clears all existing bindings and sets the data source to null, enabling clean disconnection of data relationships. This method enables dynamic data source management for scenarios where display content context needs to change during runtime, such as switching between different data objects or clearing content for reset operations.

Member Data Documentation

◆ _fieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoUiDisplaySection._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.UsoUiDisplaySection._fieldStatusEnabled = false
private

◆ DefaultBindProp

const string GWG.UsoUIElements.UsoUiDisplaySection.DefaultBindProp = ""
staticprivate

Default binding property used when applying data bindings to this field. Currently set to empty string as display sections typically manage child content rather than direct values.

◆ ElementClass

const string GWG.UsoUIElements.UsoUiDisplaySection.ElementClass = "uso-display-section"
staticprivate

CSS class name applied to all UsoUiDisplaySection instances for styling purposes. Uses "uso-display-section" to maintain consistency with the stylesheet configuration.

◆ ElementStylesheet

const string GWG.UsoUIElements.UsoUiDisplaySection.ElementStylesheet = "uso-display-section"
staticprivate

CSS stylesheet name applied to all UsoUiDisplaySection instances for styling purposes. Uses "uso-display-section" for consistent section-based styling throughout the application.

◆ ElementValidationClass

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

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

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoUiDisplaySection.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.UsoUiDisplaySection.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 false for display sections.

Display sections have field status functionality disabled by default since they primarily serve as content presentation containers rather than interactive or validatable elements.

Implements GWG.UsoUIElements.IUsoUiElement.