COPASI API  4.16.103
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
ObjectBrowserItem Class Reference

#include <ObjectBrowserItem.h>

Inheritance diagram for ObjectBrowserItem:
Inheritance graph
[legend]
Collaboration diagram for ObjectBrowserItem:
Collaboration graph
[legend]

Public Member Functions

void attachKey ()
 
CBrowserObjectgetObject ()
 
objectType getType ()
 
bool isChecked () const
 
virtual QString key (int C_UNUSED(column), bool C_UNUSED(ascending)) const
 
QTreeWidgetItem * nextSibling ()
 
int nUserChecked ()
 
 ObjectBrowserItem (QTreeWidget *parent=NULL, ObjectBrowserItem *after=NULL, const CCopasiObject *mObject=NULL, ObjectList *pList=NULL)
 
 ObjectBrowserItem (ObjectBrowserItem *parent, ObjectBrowserItem *after=NULL, const CCopasiObject *mObject=NULL, ObjectList *pList=NULL)
 
void reverseChecked ()
 
void setBrowserObject (CBrowserObject *updateObject)
 
void setObjectType (objectType newType)
 
virtual ~ObjectBrowserItem ()
 

Static Public Member Functions

static long getKeySpace ()
 
static void resetKeySpace ()
 

Private Attributes

QString mKey
 
objectType mType
 
CBrowserObjectpBrowserObject
 

Static Private Attributes

static long KeySpace = 0
 

Detailed Description

Definition at line 76 of file ObjectBrowserItem.h.

Constructor & Destructor Documentation

ObjectBrowserItem::ObjectBrowserItem ( QTreeWidget *  parent = NULL,
ObjectBrowserItem after = NULL,
const CCopasiObject mObject = NULL,
ObjectList pList = NULL 
)

Constructs a new ObjectBrowserItem

Definition at line 64 of file ObjectBrowserItem.cpp.

References ObjectList::insert(), CBrowserObject::mChecked, mKey, pBrowserObject, CBrowserObject::pCopasiObject, and CBrowserObject::referenceList.

65  : QTreeWidgetItem(parent, after)
66 {
67  if (mObject != NULL)
68  {
69  /* To change
70  ObjectListItem* pTmp = pList->getRoot();
71  while (pTmp != NULL)
72  {
73  if (pTmp->pItem->getObject()->pCopasiObject == mObject) // already be pointed in the list
74  break;
75  pTmp = pTmp->pNext;
76  }
77  if (pTmp && pTmp->pItem->getObject()->pCopasiObject == mObject) //exist already in list
78  {
79  pBrowserObject = pTmp->pItem->getObject();
80  pBrowserObject->referenceList->insert(this);
81  }
82  else
83  To change */
84  {
85  CBrowserObject* newBrowserObject = new CBrowserObject();
86  newBrowserObject->pCopasiObject = mObject;
87  newBrowserObject->mChecked = false;
88  pBrowserObject = newBrowserObject;
90  }
91  }
92  else //this is not an ending node
93  {
94  CBrowserObject* newBrowserObject = new CBrowserObject();
95  newBrowserObject->pCopasiObject = mObject;
96  newBrowserObject->mChecked = false;
97  pBrowserObject = newBrowserObject;
99  }
100 
101  if (pList)
102  pList->insert(this);
103 
104  mKey = " ";
105 }
void insert(ObjectBrowserItem *pItem)
const CCopasiObject * pCopasiObject
ObjectList * referenceList
CBrowserObject * pBrowserObject
ObjectBrowserItem::ObjectBrowserItem ( ObjectBrowserItem parent,
ObjectBrowserItem after = NULL,
const CCopasiObject mObject = NULL,
ObjectList pList = NULL 
)

Definition at line 107 of file ObjectBrowserItem.cpp.

References ObjectList::insert(), CBrowserObject::mChecked, mKey, pBrowserObject, CBrowserObject::pCopasiObject, and CBrowserObject::referenceList.

108  : QTreeWidgetItem(parent, after)
109 {
110  if (mObject != NULL)
111  {
112  /* To change
113  ObjectListItem* pTmp = pList->getRoot();
114  while (pTmp != NULL)
115  {
116  if (pTmp->pItem->getObject()->pCopasiObject == mObject)
117  break;
118  pTmp = pTmp->pNext;
119  }
120  if (pTmp && pTmp->pItem->getObject()->pCopasiObject == mObject) //exist already in list
121  {
122  pBrowserObject = pTmp->pItem->getObject();
123  pBrowserObject->referenceList->insert(this);
124  }
125  else
126  To change */
127  {
128  CBrowserObject* newBrowserObject = new CBrowserObject();
129  newBrowserObject->pCopasiObject = mObject;
130  newBrowserObject->mChecked = false;
131  pBrowserObject = newBrowserObject;
133  }
134  }
135  else //this is not an ending node
136  {
137  CBrowserObject* newBrowserObject = new CBrowserObject();
138  newBrowserObject->pCopasiObject = mObject;
139  newBrowserObject->mChecked = false;
140  pBrowserObject = newBrowserObject;
142  }
143 
144  if (pList)
145  pList->insert(this);
146 
147  mKey = " ";
148 }
void insert(ObjectBrowserItem *pItem)
const CCopasiObject * pCopasiObject
ObjectList * referenceList
CBrowserObject * pBrowserObject
virtual ObjectBrowserItem::~ObjectBrowserItem ( )
inlinevirtual

Definition at line 107 of file ObjectBrowserItem.h.

References pBrowserObject, and pdelete.

108  {
109  // if (getType() != FIELDATTR) //To avoid cross reference/multi deletion
111  }
#define pdelete(p)
Definition: copasi.h:215
CBrowserObject * pBrowserObject

Member Function Documentation

void ObjectBrowserItem::attachKey ( )

Definition at line 150 of file ObjectBrowserItem.cpp.

References KeySpace, and mKey.

Referenced by ObjectBrowserWidget::loadChild(), ObjectBrowserWidget::loadData(), and ObjectBrowserWidget::loadField().

151 {
152  mKey = QString::number(KeySpace++);
153 }
static long ObjectBrowserItem::getKeySpace ( )
inlinestatic

Definition at line 90 of file ObjectBrowserItem.h.

References KeySpace.

Referenced by ObjectBrowserWidget::updateUI().

91  {
92  return KeySpace;
93  }
CBrowserObject* ObjectBrowserItem::getObject ( )
inline
objectType ObjectBrowserItem::getType ( )
inline

Definition at line 128 of file ObjectBrowserItem.h.

References mType.

Referenced by ObjectBrowserWidget::eXport(), and ObjectBrowserWidget::selectObjects().

129  {
130  return mType;
131  }
bool ObjectBrowserItem::isChecked ( ) const
virtual QString ObjectBrowserItem::key ( int   C_UNUSEDcolumn,
bool   C_UNUSEDascending 
) const
inlinevirtual
QTreeWidgetItem * ObjectBrowserItem::nextSibling ( )

Definition at line 210 of file ObjectBrowserItem.cpp.

Referenced by ObjectBrowserWidget::eXport(), nUserChecked(), ObjectBrowserWidget::selectObjects(), ObjectBrowserWidget::setCheck(), and ObjectBrowserWidget::setUncheck().

211 {
212  if (this->parent() == NULL)
213  return NULL;
214  else
215  {
216  int indexOfThisChild = this->parent()->indexOfChild(this);
217 
218  if (this->parent()->child(indexOfThisChild + 1))
219  return this->parent()->child(indexOfThisChild + 1);
220  }
221 
222  return NULL;
223 }
int ObjectBrowserItem::nUserChecked ( )

Definition at line 155 of file ObjectBrowserItem.cpp.

References ALLCHECKED, isChecked(), nextSibling(), NOCHECKED, nUserChecked(), and PARTCHECKED.

Referenced by nUserChecked(), and ObjectBrowserWidget::setCheckMark().

156 {
157  int condition;
158 
159  if (child(0))
160  {
161  ObjectBrowserItem* pChild = (ObjectBrowserItem *)child(0);
162  condition = pChild->nUserChecked();
163 
164  for (; pChild != NULL; pChild = (ObjectBrowserItem *)pChild->nextSibling())
165  {
166  switch (pChild->nUserChecked())
167  {
168  case ALLCHECKED:
169 
170  if (condition == NOCHECKED)
171  condition = PARTCHECKED;
172 
173  break;
174  case PARTCHECKED:
175 
176  if (condition == NOCHECKED || condition == ALLCHECKED)
177  condition = PARTCHECKED;
178 
179  break;
180  case NOCHECKED:
181 
182  if (condition == ALLCHECKED)
183  condition = PARTCHECKED;
184 
185  break;
186  }
187  }
188  }
189  else //it has no child
190  {
191  if (isChecked())
192  condition = ALLCHECKED;
193  else
194  condition = NOCHECKED;
195  }
196 
197  return condition;
198 }
QTreeWidgetItem * nextSibling()
#define NOCHECKED
#define PARTCHECKED
#define ALLCHECKED
static void ObjectBrowserItem::resetKeySpace ( )
inlinestatic

Definition at line 85 of file ObjectBrowserItem.h.

References KEYBASE, and KeySpace.

Referenced by ObjectBrowserWidget::ObjectBrowserWidget().

86  {
87  KeySpace = KEYBASE;
88  }
#define KEYBASE
void ObjectBrowserItem::reverseChecked ( )
void ObjectBrowserItem::setBrowserObject ( CBrowserObject updateObject)
inline

Definition at line 123 of file ObjectBrowserItem.h.

References pBrowserObject.

Referenced by ObjectBrowserWidget::removeDuplicate(), and CBrowserObject::~CBrowserObject().

124  {
125  pBrowserObject = updateObject;
126  }
CBrowserObject * pBrowserObject
void ObjectBrowserItem::setObjectType ( objectType  newType)
inline

Definition at line 118 of file ObjectBrowserItem.h.

References mType.

Referenced by ObjectBrowserWidget::loadChild(), ObjectBrowserWidget::loadData(), and ObjectBrowserWidget::loadField().

119  {
120  mType = newType;
121  }

Member Data Documentation

long ObjectBrowserItem::KeySpace = 0
staticprivate

Definition at line 79 of file ObjectBrowserItem.h.

Referenced by attachKey(), getKeySpace(), and resetKeySpace().

QString ObjectBrowserItem::mKey
private

Definition at line 82 of file ObjectBrowserItem.h.

Referenced by attachKey(), key(), and ObjectBrowserItem().

objectType ObjectBrowserItem::mType
private

Definition at line 81 of file ObjectBrowserItem.h.

Referenced by getType(), and setObjectType().

CBrowserObject* ObjectBrowserItem::pBrowserObject
private

The documentation for this class was generated from the following files: