Representation of a node in a content graph.
More...
#include <ContentNode.hpp>
Inherits enable_shared_from_this< ContentNode >.
|
| | ContentNode (const GraphNode &node, UIComponentWeakPtr parentUiComponent, const QByteArray &slotNameInUiComponent, bool contentRoot=false) |
| | Create a new content node. More... |
| |
|
virtual | ~ContentNode () |
| | Destroys this content node. |
| |
| void | setSlots (const Slots &slot) |
| | Set component slots for this content node. More... |
| |
|
void | init () |
| | Initialize this content node. This will prepare graph cache for this node. |
| |
| NodeId | nodeId () const |
| | Returns the id of this content node's graph node. More... |
| |
| bool | isReady () const |
| | Checks if this content node is ready, i.e. More... |
| |
| bool | isSlotReady (const QByteArray &slotName) |
| | Check if a slot with the given name is filled and ready. More... |
| |
| QString | componentName (const QByteArray &slotName) const |
| | Get the name of the component that is assigned to given slot. More... |
| |
| MultiWidgets::WidgetPtr | createWidgetInstance (const QByteArray &slotName, Valuable::Node::Uuid loggedParentId=0) |
| | Create a new widget instance of a component assigned to given slot. More... |
| |
| MultiWidgets::OperatorPtr | createOperatorInstance (const QByteArray &slotName, MultiWidgets::Widget &widget) |
| | Create a new operator instance of a component assigned to given slot, and add it to the given widget. More... |
| |
| Operators | createOperatorInstancesForSlot (const QByteArray &slotName, MultiWidgets::Widget &widget) |
| | If a slot has property 'multiple' set to true, it can have multiple components defined. More... |
| |
| Nodes | children () const |
| | Get all content nodes that are children of this node. More... |
| |
| float | order () const |
| | Order can be used to sort the content nodes in UI, get the order of this node. More... |
| |
| void | rewritePropertyKey (PropertyKey &key) const |
| | Mangle given property key and rename certain prefixes. More... |
| |
| void | notifyCachedProperties (std::shared_ptr< UIComponentInstance > instance) |
| | Send a notification to given instance about new cached properties. More... |
| |
|
void | addListenerInstance (UIComponentInstancePtr instance) |
| | Add given instance as a listener for properties from this content node. |
| |
| PropertyValue | propertyValue (const PropertyKey &key) |
| | Get the value of given property for this content node. More... |
| |
| QByteArray | type () const |
| | Get the node type of this content node, for example 'asset' or 'url'. More... |
| |
Representation of a node in a content graph.
UI component can have one or more 'graph' type slots, referred to as 'content sets' in the Showcase Editor. A content node represents a single node in such a content graph. Content node can not exist on its own, it's always tied to a parent UI component that owns the content graph. Content nodes hold data such as attributes and child nodes, that are fed to the related UI components. They can also have slots that hold other UI components. The UI components in content node's slots gain attributes from the content node. For example finger menu content has a slot for menu bubble type, and created bubble gains attributes like content name and preview image from the content node.
- See Also
- UIComponentInstance::setContent
| Showcase::ContentNode::ContentNode |
( |
const GraphNode & |
node, |
|
|
UIComponentWeakPtr |
parentUiComponent, |
|
|
const QByteArray & |
slotNameInUiComponent, |
|
|
bool |
contentRoot = false |
|
) |
| |
Create a new content node.
- Parameters
-
| node | the graph node that corresponds to this content node |
| parentUiComponent | UIComponent that owns this content node |
| slotNameInUiComponent | name of the content slot in parent UIComponent |
| contentRoot | is this the root node in content set |
| ContentNode::Nodes Showcase::ContentNode::children |
( |
| ) |
const |
Get all content nodes that are children of this node.
- Returns
- children of this node
| QString Showcase::ContentNode::componentName |
( |
const QByteArray & |
slotName | ) |
const |
Get the name of the component that is assigned to given slot.
- Parameters
-
- Returns
- name of component
| MultiWidgets::OperatorPtr Showcase::ContentNode::createOperatorInstance |
( |
const QByteArray & |
slotName, |
|
|
MultiWidgets::Widget & |
widget |
|
) |
| |
Create a new operator instance of a component assigned to given slot, and add it to the given widget.
- Parameters
-
| slotName | name of the slot |
| widget | the target widget that will get the operator |
- Returns
- created operator
| ContentNode::Operators Showcase::ContentNode::createOperatorInstancesForSlot |
( |
const QByteArray & |
slotName, |
|
|
MultiWidgets::Widget & |
widget |
|
) |
| |
If a slot has property 'multiple' set to true, it can have multiple components defined.
Create a new operator instance of each component assigned to given slot, and add them to the given widget
- Parameters
-
| slotName | name of the slot |
| widget | the target widget that will get the operators |
- Returns
- created operators
| MultiWidgets::WidgetPtr Showcase::ContentNode::createWidgetInstance |
( |
const QByteArray & |
slotName, |
|
|
Valuable::Node::Uuid |
loggedParentId = 0 |
|
) |
| |
Create a new widget instance of a component assigned to given slot.
- Parameters
-
| slotName | name of the slot |
| loggedParentId | id of the parent widget, for data gathering |
- Returns
- created widget
| QByteArray Showcase::ContentNode::defaultContentNodeIdPrefix |
( |
| ) |
|
|
static |
Content nodes can have default attributes, for example a default content viewer for given content type.
These are generated with a custom node id identified with this prefix
- Returns
- prefix that identifies content node defaults id
| bool Showcase::ContentNode::isReady |
( |
| ) |
const |
Checks if this content node is ready, i.e.
all required slots are filled
- Returns
- true if every slot set to required is filled
| bool Showcase::ContentNode::isSlotReady |
( |
const QByteArray & |
slotName | ) |
|
Check if a slot with the given name is filled and ready.
- Parameters
-
- Returns
- true if the slot is ready
| NodeId Showcase::ContentNode::nodeId |
( |
| ) |
const |
Returns the id of this content node's graph node.
- Returns
- node id of graph node
| void Showcase::ContentNode::notifyCachedProperties |
( |
std::shared_ptr< UIComponentInstance > |
instance | ) |
|
Send a notification to given instance about new cached properties.
- Parameters
-
| float Showcase::ContentNode::order |
( |
| ) |
const |
Order can be used to sort the content nodes in UI, get the order of this node.
- Returns
- numeric order of this content node
| PropertyValue Showcase::ContentNode::propertyValue |
( |
const PropertyKey & |
key | ) |
|
Get the value of given property for this content node.
Will return an empty property value if the content node doesn't have this property
- Parameters
-
| key | identifies the property |
- Returns
- value of the requested property or empty value
| void Showcase::ContentNode::rewritePropertyKey |
( |
PropertyKey & |
key | ) |
const |
Mangle given property key and rename certain prefixes.
- Parameters
-
| void Showcase::ContentNode::setSlots |
( |
const Slots & |
slot | ) |
|
Set component slots for this content node.
- See Also
- Slot
- Parameters
-
| QByteArray Showcase::ContentNode::type |
( |
| ) |
const |
Get the node type of this content node, for example 'asset' or 'url'.
- Returns
- type of the content node