xentara-workbench-plugin v1.0.1
The Xentara Workbench Plugin Framework
Loading...
Searching...
No Matches
xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete > Class Template Referenceabstract

A placeholder element. More...

#include <xentara/workbench/skill/PlaceholderElement.hpp>

+ Inheritance diagram for xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >:

Classes

class  Binding
 
class  Class
 

Public Member Functions

virtual ~PlaceholderElement ()=0
 Require this to be derived.
 
- Public Member Functions inherited from xentara::workbench::skill::Element
virtual ~Element ()=0
 Virtual destructor.
 
auto name () const -> utils::string::StringView
 Gets the name of the element.
 
auto primaryKey () const -> std::string
 Gets the primary key of the element.
 
auto uuid () const -> utils::core::Uuid
 Gets the UUID of the element.
 
auto elementClass () const noexcept -> const Class &
 Gets the class of this element.
 
auto element () const noexcept -> const model::Element &
 Gets the Xentara element for this skill element.
 
auto childElements () const -> model::ChildElementAccessor
 Returns a list of all the element’s children.
 
auto parentElement () const -> const model::Element &
 Returns the element’s parent.
 
- Public Member Functions inherited from xentara::workbench::bindings::PropertyController
 PropertyController () noexcept=default
 Default constructor.
 
 PropertyController (const PropertyController &) noexcept
 Copy constructor that does not actually copy anything.
 
 PropertyController (PropertyController &&) noexcept
 Copy constructor that does not actually move anything.
 
constexpr auto operator= (const PropertyController &) noexcept -> PropertyController &
 Copy assignment operator that does not actually assign anything.
 
constexpr auto operator= (PropertyController &&) noexcept -> PropertyController &
 Move assignment operator that does not actually assign anything.
 
virtual ~PropertyController ()=0
 virtual destructor
 
template<typename Type , typename Value >
requires std::equality_comparable_with<const Type &, const Value &> && std::assignable_from<Type &, Value &&>
auto setProperty (Type &property, Value &&value) const -> bool
 Sets an address-based property, and publishes changes if necessary.
 
template<typename Type , PropertyChangedInvocable ChangeCallback>
auto subscribe (const Type &property, ChangeCallback &&changeCallback) -> Subscription
 Subscribes to an address-based property.
 
template<typename Type >
auto subscribe (const Type &property, SubscriptionCallbacks callbacks) -> Subscription
 Subscribes to an address-based property, with support for specialized callbacks.
 
template<typename Type >
auto publish (const Type &property, Action action=Action::ValueChanged, std::size_t index={}) const -> void
 Publishes a change to the value and state for an address-based property.
 
template<typename Type >
auto publishValue (const Type &property, Action action=Action::ValueChanged, std::size_t index={}) const -> void
 Publishes a change to only the value of an address-based property.
 
template<typename Type >
auto publishState (const Type &property) const -> void
 Publishes a change in only the state of an address-based property.
 
template<typename Type >
auto publishVisibility (const Type &property) const -> void
 Publishes a change in the visibility of an address-based property.
 
template<typename Type >
auto propertyState (const Type &property) const -> const utils::eh::expected< void, ui::String > &
 Gets the state of an address-based property.
 
template<typename Type >
auto propertyVisible (const Type &property) const -> bool
 Gets the visibility of an address-based property.
 
template<typename Type >
auto propertyId (const Type &property) const noexcept -> PropertyId
 Gets the ID of an address-based property.
 
template<typename Type >
auto propertyHandle (const Type &property) noexcept -> PropertyHandle
 Creates a handle for an address-based property.
 
template<PropertyChangedInvocable ChangeCallback>
auto subscribe (const PropertyId &propertyId, ChangeCallback &&changeCallback) -> Subscription
 Subscribes to a property.
 
auto subscribe (const PropertyId &propertyId, SubscriptionCallbacks callbacks) -> Subscription
 Subscribes to a property, with support for specialized callbacks.
 
auto publish (const PropertyId &propertyId, Action action=Action::ValueChanged, std::size_t index={}) const -> void
 Publishes a value and state change for a property.
 
auto publishValue (const PropertyId &propertyId, Action action=Action::ValueChanged, std::size_t index={}) const -> void
 Publishes a change to only the value of a property.
 
auto publishState (const PropertyId &propertyId) const -> void
 Publishes a change in the state of a property.
 
auto publishVisibility (const PropertyId &propertyId) const -> void
 Publishes a change in the visibility of a property.
 
auto propertyState (const PropertyId &propertyId) const -> const utils::eh::expected< void, ui::String > &
 Gets the state of a property.
 
auto propertyVisible (const PropertyId &propertyId) const -> bool
 Gets the visibility of a property.
 
auto propertyHandle (const PropertyId &propertyId) noexcept -> PropertyHandle
 Creates a handle for a property.
 
- Public Member Functions inherited from xentara::workbench::bindings::PropertyContainer
 PropertyContainer () noexcept=default
 Default constructor.
 
 PropertyContainer (const PropertyContainer &other)
 Copy constructor.
 
 PropertyContainer (PropertyContainer &&other) noexcept
 Move constructor.
 
auto operator= (const PropertyContainer &rhs) -> PropertyContainer &
 Copy assignment operator.
 
auto operator= (PropertyContainer &&rhs) noexcept -> PropertyContainer &
 Move assignment operator that does not actually assign anything.
 
virtual ~PropertyContainer ()=0
 Virtual destructor.
 
auto setEnclosingPropertyContainer (PropertyContainer &enclosingContainer, SetEnclosingPropertyContainerOptions options={}) -> void
 Sets the enclosing container.
 
auto resetEnclosingPropertyContainer (SetEnclosingPropertyContainerOptions options={}) -> void
 Resets the enclosing container.
 
auto enclosingPropertyContainer () const -> PropertyContainer *
 Gets the enclosing container.
 
auto propertyErrorCount () const -> std::size_t
 Gets the number of error properties, including those of sub containers.
 
template<std::invocable Callback>
auto subscribeToPropertyErrorCount (Callback &&callback) -> ErrorCountSubscription
 Subscribes to a property.
 
auto forEachCrossReference (const ForEachCrossReferenceFunction &function, ForEachCrossReferenceOptions options={}) noexcept -> void
 Calls a function for each cross reference contained within the container.
 

Private Member Functions

auto load (utils::json::decoder::Object &jsonObject, config::Context &context) -> void final
 Called by the framework to load the element’s configuration from a JSON object.
 
auto save (utils::json::encoder::Object &jsonObject) const -> void final
 Called by the framework to save the element’s configuration to a JSON object.
 
auto makeBinding () -> std::unique_ptr< bindings::AbstractElementBinding > final
 Called by the framework to create a binding for editing the element’s properties.
 

Additional Inherited Members

- Public Types inherited from xentara::workbench::skill::Element
using ForEachAttributeFunction = utils::functional::function_ref< auto(const model::Attribute &) ->bool >
 A callback for iterating over all attributes.
 
using ForEachEventFunction = utils::functional::function_ref< auto(const process::Event &) ->bool >
 A callback for iterating over all events.
 
using ForEachTaskFunction = utils::functional::function_ref< auto(const process::Task &) ->bool >
 A callback for iterating over all tasks.
 
- Protected Member Functions inherited from xentara::workbench::skill::Element
auto publishElementMembers () const -> void
 Publishes a change in the list of attributes, events, and/or tasks.
 
auto publishSyntheticChildren () const -> void
 Publishes a change in the list of synthetic children.
 
- Protected Member Functions inherited from xentara::workbench::bindings::PropertyContainer
auto subPropertyContainerAdded (const PropertyContainer &container) -> void
 Must be called by derived classes if a sub container was added.
 
auto subPropertyContainerRemoved (const PropertyContainer &container) -> void
 Must be called by derived classes if a sub container was removed.
 
auto subPropertyContainerListChanged (SubPropertyContainerListChangedOptions options={}) -> void
 Must be called by derived classes if the list of sub containers changed completely.
 
auto subPropertyContainerListCopied (const PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void
 Must be called by derived classes if the list of sub containers was copied from another container.
 
auto subPropertyContainerListMoved (PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void
 Must be called by derived classes if the list of sub containers was moved from another container.
 
auto subPropertyContainerListSwapped (PropertyContainer &other, SubPropertyContainerListChangedOptions options={}) -> void
 Must be called by derived classes if the list of sub containers was swapped with another container.
 
auto localPropertyErrorCountChanged () -> void
 Must be called by derived classes if the value returned by localPropertyErrorCount() has changed.
 
auto raisePropertyNotification (const PropertyId &propertyId) const -> void
 Passes a property notification to the enclosing container.
 

Detailed Description

template<typename DerivedElement, utils::tparam::String kClassName, utils::tparam::Uuid kUuid, i18n::tparam::String DisplayName, i18n::tparam::String MenuText, utils::tparam::String kNewElementName, model::ElementCategory kCategory, bool kIsIncomplete = kCategory == model::ElementCategory::CustomElement>
class xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >

A placeholder element.

Constructor & Destructor Documentation

◆ ~PlaceholderElement()

template<typename DerivedElement , utils::tparam::String kClassName, utils::tparam::Uuid kUuid, i18n::tparam::String DisplayName, i18n::tparam::String MenuText, utils::tparam::String kNewElementName, model::ElementCategory kCategory, bool kIsIncomplete>
xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::~PlaceholderElement ( )
pure virtualdefault

Require this to be derived.

Member Function Documentation

◆ load()

template<typename DerivedElement , utils::tparam::String kClassName, utils::tparam::Uuid kUuid, i18n::tparam::String DisplayName, i18n::tparam::String MenuText, utils::tparam::String kNewElementName, model::ElementCategory kCategory, bool kIsIncomplete>
auto xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::load ( utils::json::decoder::Object jsonObject,
config::Context context 
) -> void
finalprivatevirtual

Called by the framework to load the element’s configuration from a JSON object.

The standard configuration parameters "name", "UUID", "ACL", and "children" are handled automatically by the framework using a JSON object filter. The corresponding JSON members are filtered out, and will not be enumerated when you iterate over the JSON object’s members.

This function is called before the framework subscribes to any of the element’s properties via the base class bindings::PropertyController. It is therefore not necessary to publish any property changes as the properties are loaded.

Note
Prior to Xentara version 2.0, the configuration parameters "id" and "uuid" (lowercase) were used for the element’s name and UUID instead of "name" and "UUID" (uppercase). To retain backwards compatibility, the old names are filtered out instead of the new ones if the element type is specified using the old-style prefixes @IOComponent, @IO, @IOBatch, or @Microservice, instead of the new-style @Skill.
Parameters
jsonObjectThe JSON object. The object has a filter installed that will filter out and handle the standard configuration parameters.
contextA context that can be used to resolve cross-references.
Exceptions
std::runtime_errorThe function must throw this exception (or a suitable subclass) if an error occurs. The loading function should be as permissive as possible, to allow faulty model files to be repaired using the Workbench.
Default Implementation
The default implementation does not load any custom configuration and only allows the standard configuration parameters.

Reimplemented from xentara::workbench::skill::Element.

◆ makeBinding()

template<typename DerivedElement , utils::tparam::String kClassName, utils::tparam::Uuid kUuid, i18n::tparam::String DisplayName, i18n::tparam::String MenuText, utils::tparam::String kNewElementName, model::ElementCategory kCategory, bool kIsIncomplete>
auto xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::makeBinding ( ) -> std::unique_ptr< bindings::AbstractElementBinding >
finalprivatevirtual

Called by the framework to create a binding for editing the element’s properties.

This callback is called whenever the user tries to edit the properties of the element. The binding defines the UI elements that should be shown, and how these UI elements affect the properties of the skill element.

The binding will normally bind the user interface to member functions or member variables of the element being edited. To facilitate this, you can derive your binding class from bindings::ElementBinding rather than bindings::AbstractElementBinding.

Default Implementation
The default implementation returns an empty binding that does not add any custom configuration fields.
Returns
A user interface binding for the element.

Reimplemented from xentara::workbench::skill::Element.

◆ save()

template<typename DerivedElement , utils::tparam::String kClassName, utils::tparam::Uuid kUuid, i18n::tparam::String DisplayName, i18n::tparam::String MenuText, utils::tparam::String kNewElementName, model::ElementCategory kCategory, bool kIsIncomplete>
auto xentara::workbench::skill::PlaceholderElement< DerivedElement, kClassName, kUuid, DisplayName, MenuText, kNewElementName, kCategory, kIsIncomplete >::save ( utils::json::encoder::Object jsonObject) const -> void
finalprivatevirtual

Called by the framework to save the element’s configuration to a JSON object.

The standard configuration parameters "name", "UUID", "ACL", and "children" are handled automatically by the framework and must not be written to the object.

Parameters
jsonObjectThe JSON object.
Default Implementation
The default implementation does not save any custom configuration, so that only the standard configuration parameters will be saved.

Reimplemented from xentara::workbench::skill::Element.