3 #include "GraphTypes.hpp"
6 #include "UIComponent.hpp"
25 class SHOWCASE_API
ContentNode :
public std::enable_shared_from_this<ContentNode>
35 typedef std::vector<std::shared_ptr<ContentNode> > Nodes;
36 typedef QList<MultiWidgets::OperatorPtr> Operators;
44 const QByteArray & slotNameInUiComponent,
bool contentRoot=
false);
54 void setSlots(
const Slots& slot);
70 bool isSlotReady(
const QByteArray & slotName);
75 QString componentName(
const QByteArray & slotName)
const;
81 MultiWidgets::WidgetPtr createWidgetInstance(
const QByteArray & slotName,
82 Valuable::Node::Uuid loggedParentId = 0);
89 MultiWidgets::OperatorPtr createOperatorInstance(
const QByteArray & slotName,
90 MultiWidgets::Widget & widget);
98 Operators createOperatorInstancesForSlot(
const QByteArray & slotName,
99 MultiWidgets::Widget & widget);
103 Nodes children()
const;
113 static QByteArray defaultContentNodeIdPrefix();
121 void notifyCachedProperties(std::shared_ptr<UIComponentInstance> instance);
124 void addListenerInstance(UIComponentInstancePtr instance);
131 PropertyValue propertyValue(
const PropertyKey & key);
135 QByteArray type()
const;
138 ComponentPtr createComponentWithoutLock(
const QByteArray& slotName);
140 MultiWidgets::OperatorPtr createOperatorInstanceWithoutLock(
const QByteArray & slotName,
141 MultiWidgets::Widget & widget);
143 void propertyReceived(
const Property & property, Source source);
144 void propertyLost(
const Property & property, Source source);
146 void childFound(
const NodeId &
id);
147 void childLost(
const NodeId &
id);
149 void childCompleted(
const NodeId &
id);
150 void childIncompleted(
const NodeId &
id);
155 void addEvents(CachedNodePtr node);
156 void addUiNodeEvents(CachedNodePtr node);
157 void addDefaultNodeEvents(CachedNodePtr node);
159 ComponentPtr createComponent(
const QByteArray & slotName);
160 void removeComponent(
const QByteArray & slotName);
162 void checkComplete();
166 QByteArray propertyPrefix()
const;
168 void prepareParentUiNodeCache();
169 void prepareOwnCache();
170 void prepareDefaultsCache();
172 bool checkFoundPropertyPriority(
const QByteArray & slotName,
173 const Property & property,
175 bool checkLostPropertyPriority(
const QByteArray & slotName,
178 void propertyFoundToComponents(
const Property & property);
179 void propertyLostToComponents(
const Property & property);
181 void createPlaceholder(
const QByteArray & slotName,
182 const Property & property);
184 bool haveUiSlot(
const QByteArray & name)
const;
186 void tryRestoreProperty(
const QByteArray & slotName,
188 bool tryRestorePropertyFromSource(
const QByteArray & slotName,
194 const QByteArray & key,
const PropertyValue & value,
199 void notifyCachedPropertiesToUiParent(UIComponentPtr ui);
203 UIComponentPtr uiComponent;
204 ComponentPlaceholderPtr placeholder;
205 CachedGraphPtr cachedGraph;
208 typedef std::unordered_map<QByteArray, ComponentData> SlotComponents;
216 UIComponentWeakPtr m_parentUiComponent;
218 QByteArray m_slotNameInUiComponent;
220 bool m_isGraphEntryPoint;
229 SlotComponents m_slotInstances;
232 mutable std::mutex m_slotInstanceMutex;
235 CachedNodePtr m_cachedNode;
237 CachedNodePtr m_cachedParentUiNode;
239 CachedNodePtr m_cachedDefaultsNode;
242 mutable std::mutex m_childMutex;
247 Nodes m_pendingChildren;
259 std::weak_ptr<ContentNode> m_parent;
261 std::map<QByteArray, Source> m_activePropertySources;
262 PropertyMap m_contentProperties;
264 mutable std::mutex m_propertyMutex;
266 std::vector<std::weak_ptr<UIComponentInstance> > m_listenerInstances;
268 typedef std::shared_ptr<ContentNode> ContentNodePtr;
269 typedef std::weak_ptr<ContentNode> ContentNodeWeakPtr;