Envision
A visual programming IDE for object-oriented languages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes
Visualization::InfoNode Class Reference

An InfoNode is the base class of all nodes which display some sort of information on a target node. More...

Inheritance diagram for Visualization::InfoNode:
Core::Reflect< Base >

Classes

struct  InfoGetterStruct
 

Public Types

using InfoGetter = QString(*)(Model::Node *target)
 

Public Member Functions

 InfoNode (Model::Node *target)
 
 InfoNode (Model::Node *target, QJsonArray enabledInfos)
 
virtual ~InfoNode ()
 
virtual void automaticUpdate ()
 Updates the InfoNode automatically, meaning it only updates the results from the info getters which are set to update automatically. More...
 
virtual void fullUpdate ()
 Updates the InfoNode fully, meaning it gets the result from all info getters. More...
 
QString infoHtml () const
 If the infos can be represented as a string, use this to represent them as HTML text. More...
 
bool isEnabled (const QString name) const
 Returns whether the info getter with the given name is enabled for this node. More...
 
void move (const QString &name, bool moveUp)
 Move an info getter up or down in the node. More...
 
void setEnabled (const QString name, bool isEnabled)
 Enable or disable the info getter identified by the given name. More...
 
const Model::Nodetarget () const
 
virtual QJsonValue toJson () const override
 

Static Public Member Functions

static QStringList registeredInfoGetters ()
 Returns a list with the names of all registered info getters. More...
 
static void registerInfoGetter (const QString &name, const InfoGetter getter, bool updatesAutomatically, bool enabledByDefault)
 Registers a new method to get information. More...
 

Protected Member Functions

void setInfoHtml (QString content)
 
virtual void updateInfo (bool isAutoUpdate)
 Updates the node's stored information. More...
 

Private Attributes

QHash< QString, QString > cachedInfoStrings_
 
QList< QString > enabledInfoGetters_
 
QString infoHtml_
 
Model::Nodetarget_ {}
 

Static Private Attributes

static QHash< QString, InfoGetterStructallInfoGetters
 
static QList< InfoNode * > allInfoNodes
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Detailed Description

An InfoNode is the base class of all nodes which display some sort of information on a target node.

There is a registry which keeps track of all possible informations to be displayed.

Member Typedef Documentation

◆ InfoGetter

Constructor & Destructor Documentation

◆ InfoNode() [1/2]

Visualization::InfoNode::InfoNode ( Model::Node target)

◆ InfoNode() [2/2]

Visualization::InfoNode::InfoNode ( Model::Node target,
QJsonArray  enabledInfos 
)

◆ ~InfoNode()

Visualization::InfoNode::~InfoNode ( )
virtual

Member Function Documentation

◆ automaticUpdate()

void Visualization::InfoNode::automaticUpdate ( )
inlinevirtual

Updates the InfoNode automatically, meaning it only updates the results from the info getters which are set to update automatically.

◆ fullUpdate()

void Visualization::InfoNode::fullUpdate ( )
inlinevirtual

Updates the InfoNode fully, meaning it gets the result from all info getters.

◆ infoHtml()

QString Visualization::InfoNode::infoHtml ( ) const
inline

If the infos can be represented as a string, use this to represent them as HTML text.

Then the same visualization can be used for multiple statistics nodes.

◆ isEnabled()

bool Visualization::InfoNode::isEnabled ( const QString  name) const
inline

Returns whether the info getter with the given name is enabled for this node.

◆ move()

void Visualization::InfoNode::move ( const QString &  name,
bool  moveUp 
)

Move an info getter up or down in the node.

◆ registeredInfoGetters()

QStringList Visualization::InfoNode::registeredInfoGetters ( )
inlinestatic

Returns a list with the names of all registered info getters.

◆ registerInfoGetter()

void Visualization::InfoNode::registerInfoGetter ( const QString &  name,
const InfoGetter  getter,
bool  updatesAutomatically,
bool  enabledByDefault 
)
static

Registers a new method to get information.

Parameters
nameThe name of the getter.
getterThe getter method itself, taking a node and returning a string. If this method is not applicable for the node supplied, it should return an empty string.
updatesAutomaticallyWhether this info should always update.
enabledByDefaultWhether this info is visible by default.

◆ setEnabled()

void Visualization::InfoNode::setEnabled ( const QString  name,
bool  isEnabled 
)

Enable or disable the info getter identified by the given name.

◆ setInfoHtml()

void Visualization::InfoNode::setInfoHtml ( QString  content)
protected

◆ target()

const Model::Node * Visualization::InfoNode::target ( ) const
inline

◆ toJson()

QJsonValue Visualization::InfoNode::toJson ( ) const
overridevirtual

◆ updateInfo()

void Visualization::InfoNode::updateInfo ( bool  isAutoUpdate)
protectedvirtual

Updates the node's stored information.

Parameters
isAutoUpdateIs this an automatic update, or a forced update? A forced update will update everything.

Member Data Documentation

◆ allInfoGetters

QHash< QString, InfoNode::InfoGetterStruct > Visualization::InfoNode::allInfoGetters
staticprivate

◆ allInfoNodes

QList< InfoNode * > Visualization::InfoNode::allInfoNodes
staticprivate

◆ cachedInfoStrings_

QHash<QString, QString> Visualization::InfoNode::cachedInfoStrings_
private

◆ enabledInfoGetters_

QList<QString> Visualization::InfoNode::enabledInfoGetters_
private

◆ infoHtml_

QString Visualization::InfoNode::infoHtml_
private

◆ target_

Model::Node* Visualization::InfoNode::target_ {}
private