221 lines
6.2 KiB
C++
221 lines
6.2 KiB
C++
/*
|
||
* ParameterProperty.h
|
||
*
|
||
* Created on: 2011-9-19
|
||
* Author: dev
|
||
*/
|
||
|
||
#ifndef PAI_FRAME_WORKFLOWVIEW_PARAMETERPROPERTY_H
|
||
#define PAI_FRAME_WORKFLOWVIEW_PARAMETERPROPERTY_H
|
||
|
||
#include <QObject>
|
||
#include <QUuid>
|
||
#include "ParameterItem.h"
|
||
class QString;
|
||
|
||
namespace pai {
|
||
namespace graphics2d {
|
||
|
||
/**
|
||
* @class ParameterProperty
|
||
* @brief 参数面板树的数据模型,为树形结构,携带了参数信息
|
||
*/
|
||
class ParameterProperty : public QObject
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
ParameterProperty(pai::module::CParameterItem *parameterItem,const QString &categoryname = "");
|
||
virtual ~ParameterProperty();
|
||
|
||
/**
|
||
* @brief 设置当前工作流的ID
|
||
* @param workflowID 为工作流的ID
|
||
*/
|
||
void SetWorkflowID(QUuid workflowID);
|
||
/**
|
||
* @brief 获取当前工作流ID
|
||
*/
|
||
QUuid GetWorkflowID();
|
||
|
||
/**
|
||
* @brief 是否为根节点
|
||
*/
|
||
bool IsRoot() const;
|
||
/**
|
||
* @brief 是否为分类节点
|
||
*/
|
||
bool IsCategory() const;
|
||
/**
|
||
* @brief 是否为参数项节点
|
||
*/
|
||
bool IsParameterItem() const;
|
||
|
||
/**
|
||
* @brief 增加一个孩子,形成树形的下一级,如果下列两个函数参数都为空则是根节点
|
||
* @param paramItem 参数项句柄,如果不为空则是参数项节点
|
||
* @param categoryname 分类名,如果不等于""则为分类节点
|
||
*/
|
||
ParameterProperty *AddChild(pai::module::CParameterItem *paramItem,const QString & categoryname,int pos=-1);
|
||
/**
|
||
* @brief 得到指定索引的孩子
|
||
* @param index 指定索引
|
||
*/
|
||
ParameterProperty *GetChild(int index);
|
||
/**
|
||
* @brief 得到孩子的个数
|
||
*/
|
||
int GetChildCount() const {return m_child.size();}
|
||
/**
|
||
* @brief 得到父亲节点的句柄
|
||
*/
|
||
ParameterProperty * GetParent() const {return m_parent;}
|
||
/**
|
||
* @brief 得到参数项句柄
|
||
*/
|
||
pai::module::CParameterItem * GetParameterItem() const {return m_parameterItem;}
|
||
/**
|
||
* @brief 设置参数项句柄
|
||
* @param pParameterItem 参数项句柄
|
||
*/
|
||
void SetParameterItem(pai::module::CParameterItem * pParameterItem);
|
||
/**
|
||
* @brief 得到该节点所在的行数
|
||
*/
|
||
int GetRow() const;
|
||
|
||
/**
|
||
* @brief 得到参数项ID
|
||
*/
|
||
std::string GetParameterItemID() const;
|
||
/**
|
||
* @brief 得到指定ID对应的ParameterProperty,如果找不到,将其第一个具有合法输入类型的父亲参数项返回
|
||
* @param strParameterItemID 参数项ID
|
||
*/
|
||
ParameterProperty * GetParameterPropertyWithValidInputType(const std::string& strParameterItemID);
|
||
/**
|
||
* @brief 递归得到指定参数项对应的节点
|
||
* @param strParameterItemID 指定参数项ID
|
||
*/
|
||
ParameterProperty * GetParameterProperty(const std::string& strParameterItemID);
|
||
/**
|
||
* @brief 递归得到第一个具有指定输入控件数据的后代节点
|
||
* @param strParameterItemInputData 具有指定输入控件数据
|
||
*/
|
||
ParameterProperty * GetParameterPropertyByInputData(const std::string& strParameterItemInputData);
|
||
|
||
/**
|
||
* @brief 得到显示名称
|
||
*/
|
||
QString GetDisplayName() const;
|
||
void SetCategoryName(QString categoryName);
|
||
/**
|
||
* @brief 得到显示值
|
||
*/
|
||
QString GetDisplayValue() const;
|
||
/**
|
||
* @brief 该节点是否检验有错误
|
||
*/
|
||
bool IsError() const;
|
||
/**
|
||
* @brief 得到错误信息
|
||
*
|
||
*/
|
||
QString GetErrorMessage() const;
|
||
/**
|
||
* @brief 设置错误信息
|
||
* @param strErrMsg 错误信息
|
||
*/
|
||
void SetErrorMessage(const QString& strErrMsg);
|
||
|
||
/**
|
||
* @brief 得到节点类型
|
||
*/
|
||
pai::module::ParameterType GetType() const;
|
||
/**
|
||
* @brief 得到节点输入控件类型
|
||
*/
|
||
pai::module::ParameterInputType GetInputType() const;
|
||
/**
|
||
* @brief 得到参数项的编辑控件里可接受拖拽的数据类型集合
|
||
*/
|
||
QList<QUuid> GetAcceptDropTypes() const;
|
||
/**
|
||
* @brief 得到参数项句柄
|
||
*/
|
||
pai::module::CParameterItem *GetParamItem() const;
|
||
/**
|
||
* @brief 清空包括孩子在内的所有错误信息
|
||
*/
|
||
void ClearAllErrorMessage();
|
||
/**
|
||
* @brief 删除指定ID的孩子节点,目前仅适用于叶子节点
|
||
* @param strParameterItemID 孩子节点的ID
|
||
* @return 返回删除节点在父节点中的索引号
|
||
*/
|
||
int RemoveChild(const std::string& strParameterItemID);
|
||
/**
|
||
* @brief 对于含有"KeepOneRow"属性的Array节点处理删除按钮的出现与消失,如果孩子只剩一个就隐藏删除按钮,如果孩子变为两个则使第一个孩子出现删除按钮
|
||
*/
|
||
void HandleDeleteButton();
|
||
/**
|
||
* @brief 判断是否含有HDFSFILEBROWSER item.
|
||
*/
|
||
bool ContainFILEBROWSERItem();
|
||
/**
|
||
* @brief 判断是否含有Output Overwrite item.
|
||
*/
|
||
bool ContainsOverWriteItem();
|
||
private:
|
||
/**
|
||
* @brief 增加一个孩子,形成树形的下一级
|
||
* @param parameterItem 树形子节点
|
||
*/
|
||
void AddChild(ParameterProperty *parameterItem,int pos=-1);
|
||
|
||
/**
|
||
* @brief 比较两个ParameterProperty是否相等,相等条件是m_parameterItem和m_categoryName均相同
|
||
* @param srcParameterProperty 源对象
|
||
* @return 相等返回真,不等返回假。
|
||
*/
|
||
bool operator ==(const ParameterProperty& srcParameterProperty) const;
|
||
/**
|
||
* @brief 比较两个ParameterProperty是否不等,相等条件是m_parameterItem和m_categoryName均相同
|
||
* @param srcParameterProperty 源对象
|
||
* @return 不等返回真,相等返回假。
|
||
*/
|
||
bool operator !=(const ParameterProperty& srcParameterProperty) const;
|
||
/**
|
||
* @brief 判断这个结构里是否已经包含了指定的对象
|
||
* @param parameterProperty 指定的对象
|
||
* @return 包含返回真,不包含返回假。
|
||
*/
|
||
bool Contains(const ParameterProperty& parameterProperty) const;
|
||
signals:
|
||
void signalSetErrorMessage(const QString&);
|
||
void signalFinishValidation();
|
||
/**
|
||
* @brief 触发要求显示或隐藏行删除按钮的通知
|
||
* @param bShow true : 要求显示行删除按钮, false:要求隐藏行删除按钮
|
||
*/
|
||
void signalShouldShowDeleteButton(bool bShow);
|
||
/**
|
||
* @brief 触发要求显示或图标通知
|
||
*/
|
||
void signalHideShowItemsIcon(bool bShow);
|
||
public:
|
||
void HideShowItemsIcon(bool bshow) ;
|
||
private:
|
||
pai::module::CParameterItem *m_parameterItem;
|
||
QString m_categoryName;
|
||
QString m_strError;
|
||
ParameterProperty *m_parent;
|
||
QUuid m_workflowID;
|
||
|
||
QList<ParameterProperty *> m_child;
|
||
|
||
};
|
||
|
||
}
|
||
}
|
||
#endif
|