#include <AdapterBuilder.h>
Public Member Functions | |
void | BeginNode (AZ::Name name) |
void | EndNode (AZ::Name expectedName) |
void | BeginAdapter () |
Convenience method, calls BeginNode<Nodes::Adapter>() | |
void | EndAdapter () |
Convenience method, calls EndNode<Nodes::Adapter>() | |
void | BeginRow () |
Convenience method, calls BeginNode<Nodes::Row>() | |
void | EndRow () |
Convenience method, calls EndNode<Nodes::Row>() | |
void | BeginLabel () |
Convenience method, calls BeginNode<Nodes::Label>() | |
void | EndLabel () |
Convenience method, calls EndNode<Nodes::Label>() | |
void | BeginPropertyEditor (AZStd::string_view type="", Dom::Value value={}) |
void | EndPropertyEditor () |
Convenience method, calls EndNode<Nodes::PropertyEditor>() | |
void | Label (AZStd::string_view text) |
Inserts a Label node with the specified text. | |
void | Value (Dom::Value value) |
Sets the value of the last node. Used for setting the current value of a property editor. | |
void | Attribute (Name attribute, Dom::Value value) |
void | OnEditorChanged (AZStd::function< void(const Dom::Path &, const Dom::Value &, Nodes::ValueChangeType)> onChangedCallback) |
void | AddMessageHandler (DocumentAdapter *adapter, AZ::Name messageName, const Dom::Value &contextData={}) |
Dom::Path | GetCurrentPath () const |
Gets the path to the DOM node currently being built within this builder's DOM. | |
void | SetCurrentPath (const Dom::Path &) |
bool | IsError () const |
Returns true if an error has been encountered during the build process,. | |
const AZStd::string & | GetError () const |
Returns the error information, if any, encountered during the build process. | |
Dom::Value && | FinishAndTakeResult () |
template<class PropertyEditorDefinition , class ValueType = AZ::Dom::Value> | |
void | BeginPropertyEditor (ValueType value={}) |
template<class NodeDefinition > | |
void | BeginNode () |
template<class NodeDefinition > | |
void | EndNode () |
template<class AttributeType > | |
void | Attribute (const AttributeDefinition< AttributeType > &definition, Dom::Value value) |
template<class AttributeType > | |
void | Attribute (const AttributeDefinition< AttributeType > &definition, AttributeType value) |
template<class CallbackType , class Functor > | |
void | CallbackAttribute (const CallbackAttributeDefinition< CallbackType > &definition, Functor value) |
void | Attribute (const AttributeDefinition< AZStd::string_view > &definition, AZStd::string_view value) |
template<class CallbackType > | |
void | AddMessageHandler (DocumentAdapter *adapter, const CallbackAttributeDefinition< CallbackType > &callback, const Dom::Value &contextData={}) |
Helper class that builds a DOM suitable for usage in a DocumentAdapter. Uses a visitor pattern to establish node elements.
void AZ::DocumentPropertyEditor::AdapterBuilder::AddMessageHandler | ( | DocumentAdapter * | adapter, |
AZ::Name | messageName, | ||
const Dom::Value & | contextData = {} |
||
) |
Adds a message handler bound to the given adapter for a given message name or callback attribute.
adapter | The adapter to bind this message to. |
messageName | The name of the message. |
contextData | If specified, is provided as additional message data when this message is sent. |
void AZ::DocumentPropertyEditor::AdapterBuilder::Attribute | ( | Name | attribute, |
Dom::Value | value | ||
) |
Sets an attribute of the last node. Rows, labels, and property editors all support different attributes.
void AZ::DocumentPropertyEditor::AdapterBuilder::BeginNode | ( | AZ::Name | name | ) |
Begins a new Node, pushing its value to the entry stack. Nodes may have child nodes, values, and attributes, as dictated by their node definiton. Calls to Attribute and Value will apply to the last BeginNode call. Each call to BeginNode must have a corresponding EndNode invocation.
void AZ::DocumentPropertyEditor::AdapterBuilder::BeginPropertyEditor | ( | AZStd::string_view | type = "" , |
Dom::Value | value = {} |
||
) |
Convenience method, calls BeginNode<Nodes::PropertyEditor>() If type and value are specified, the Nodes::PropertyEditor::Type attribute and the property editor value shall be set.
void AZ::DocumentPropertyEditor::AdapterBuilder::EndNode | ( | AZ::Name | expectedName | ) |
Ends the current node, popping its value from the entry stack. Once the last BeginNode call has had a corresponding EndNode invocation, this builder is in a finished state. The result may then be retrieved.
Dom::Value && AZ::DocumentPropertyEditor::AdapterBuilder::FinishAndTakeResult | ( | ) |
Ends the build operation and retrieves the builder result. Operations are no longer valid on this builder once this is called.
void AZ::DocumentPropertyEditor::AdapterBuilder::OnEditorChanged | ( | AZStd::function< void(const Dom::Path &, const Dom::Value &, Nodes::ValueChangeType)> | onChangedCallback | ) |
Adds a Nodes::PropertyEditor::OnChanged attribute that will get called with the path of the property value and its new value. This path can be used to generate a correct Replace patch for submitting NotifyContentsChanged.