Tree item containing CRef. More...
#include <treeitemref.h>
Public Member Functions | |
| TreeItemRef (TreeData *_data, Q_ListView *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| TreeItemRef (TreeData *_data, Q_ListViewItem *parent, boost::shared_ptr< IProperty > pdfObj, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL) | |
| virtual | ~TreeItemRef () |
| QString | getRef () |
| virtual void | setOpen (bool open) |
| void | unOpen () |
| bool | isComplete () |
| virtual bool | deepReload (const QString &childName, Q_ListViewItem *oldItem) |
| virtual bool | validChild (const QString &name, Q_ListViewItem *oldChild) |
| virtual ChildType | getChildType (const QString &name) |
| virtual TreeItemAbstract * | createChild (const QString &name, ChildType typ, Q_ListViewItem *after=NULL) |
| virtual QStringList | getChildNames () |
| virtual bool | haveChild () |
| virtual void | reloadSelf () |
Protected Member Functions | |
| void | addData () |
Private Member Functions | |
| TreeItem * | parentCheck () |
Private Attributes | |
| bool | complete |
| QString | selfRef |
Tree item containing CRef.
class holding one CRef object (indirect reference) in tree
| gui::TreeItemRef::TreeItemRef | ( | TreeData * | _data, | |
| Q_ListView * | parent, | |||
| boost::shared_ptr< IProperty > | pdfObj, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL, |
|||
| const QString & | nameId = NULL | |||
| ) |
constructor of TreeItem - create root item from given object
| parent | Q_ListView in which to put item | |
| pdfObj | Object contained in this item | |
| nameId | Internal name of this item | |
| name | Caption of this item - will be shown in treeview | |
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| after | Item after which this one will be inserted |
References addData(), complete, gui::TreeItem::initObserver(), and gui::TreeItemAbstract::reload().
| gui::TreeItemRef::TreeItemRef | ( | TreeData * | _data, | |
| Q_ListViewItem * | parent, | |||
| boost::shared_ptr< IProperty > | pdfObj, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL, |
|||
| const QString & | nameId = NULL | |||
| ) |
constructor of TreeItem - create child item from given object
| parent | Q_ListViewItem which is parent of this object | |
| pdfObj | Object contained in this item | |
| nameId | Internal name of this item | |
| name | Caption of this item - will be shown in treeview | |
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| after | Item after which this one will be inserted |
References addData(), complete, gui::TreeItem::initObserver(), and gui::TreeItemAbstract::reload().
| gui::TreeItemRef::~TreeItemRef | ( | ) | [virtual] |
default destructor
References gui::TreeItemAbstract::data, gui::TreeData::remove(), and gui::TreeItem::uninitObserver().
| void gui::TreeItemRef::addData | ( | ) | [protected] |
Add some info into third column of treeview (mostly value)
References pdfobjects::IndiRef::gen, getRef(), pdfobjects::IndiRef::num, gui::TreeItem::obj, and selfRef.
Referenced by reloadSelf(), and TreeItemRef().
| TreeItemAbstract * gui::TreeItemRef::createChild | ( | const QString & | name, | |
| ChildType | typ, | |||
| Q_ListViewItem * | after = NULL | |||
| ) | [virtual] |
Create one subchild
| name | Name of child (the same as in list returned from getChildNames) | |
| typ | Type of TreeItemAbstract's child. (see ChildType) | |
| after | Q_ListViewItem after which will be this item added. If unspecified (or NULL), it is added before any other items |
Implements gui::TreeItemAbstract.
References gui::TreeItem::create(), gui::TreeItemAbstract::data, debug::DBG_DBG, pdfobjects::IndiRef::gen, pdfobjects::CObjectSimple< Tp >::getValue(), guiPrintDbg, pdfobjects::IndiRef::num, and gui::TreeItem::obj.
| bool gui::TreeItemRef::deepReload | ( | const QString & | childName, | |
| Q_ListViewItem * | oldItem | |||
| ) | [virtual] |
Attempt to "deep reload", i.e. exchange the item inside the tree for an actual (different) one, without destroying the object (destroying have unfortunate effect of losing information about which child were opened ...) oldChild should be modified to refrlect the new object If deep reload is supported and was sucessful, return true, otherwise false.
Note: oldItem should not check or reload its children in this method (at it might lead to multiple reloading of same part of tree) Also, it is guaranteed that reloadSelf will be called on that item, so explicitly reloading the item might be unnecessary too
| childName | name of (old and new) treeitem | |
| oldItem | reference to old child tree item |
Reimplemented from gui::TreeItemAbstract.
References pdfobjects::CObjectSimple< Tp >::getValue(), gui::TreeItem::obj, and gui::TreeItem::setObject().
| QStringList gui::TreeItemRef::getChildNames | ( | ) | [virtual] |
Get list of all item's childs names
Implements gui::TreeItemAbstract.
References complete.
| ChildType gui::TreeItemRef::getChildType | ( | const QString & | name | ) | [virtual] |
Get type of this items child, given its name.
| name | Name of child item |
Implements gui::TreeItemAbstract.
References util::dereference(), and gui::TreeItem::obj.
| QString gui::TreeItemRef::getRef | ( | ) |
Return reference target in text form.
References selfRef.
Referenced by addData(), and parentCheck().
| bool gui::TreeItemRef::haveChild | ( | ) | [virtual] |
Return true, if the item have at least one child
Implements gui::TreeItemAbstract.
| bool gui::TreeItemRef::isComplete | ( | ) |
Check if childs of this items are yet unknown and to be parsed/added
References complete.
| TreeItem * gui::TreeItemRef::parentCheck | ( | ) | [private] |
Checks if any parent is not CRef referencing the same CObject as this item
References gui::TreeItem::_parent, getRef(), gui::TreeItem::parent(), and selfRef.
Referenced by setOpen().
| void gui::TreeItemRef::reloadSelf | ( | ) | [virtual] |
Reload contents of itself and only itself (excluding any children)
Reimplemented from gui::TreeItem.
References addData(), complete, gui::TreeItemAbstract::data, debug::DBG_DBG, gui::TreeItemAbstract::eraseItems(), util::getTypeName(), guiPrintDbg, gui::TreeItem::obj, Q_OUT, gui::TreeData::remove(), selfRef, and setOpen().
| void gui::TreeItemRef::setOpen | ( | bool | open | ) | [virtual] |
Slot that will be called when item is opened/closed
| open | True if item is being opened, false if closed |
Reimplemented from gui::TreeItemAbstract.
References gui::TreeData::add(), complete, gui::TreeItemAbstract::data, debug::DBG_DBG, gui::TreeData::find(), guiPrintDbg, gui::TreeItemAbstract::moveAllChildsFrom(), parentCheck(), pdfobjects::pRef, Q_OUT, gui::TreeItemAbstract::reload(), selfRef, gui::TreeData::tree(), gui::TreeItem::typ, and unOpen().
Referenced by reloadSelf(), and unOpen().
| void gui::TreeItemRef::unOpen | ( | ) |
Remove itself from list of opened references and close itself
References complete, gui::TreeItemAbstract::data, pdfobjects::pRef, gui::TreeData::remove(), setOpen(), and gui::TreeItem::typ.
Referenced by setOpen().
| bool gui::TreeItemRef::validChild | ( | const QString & | name, | |
| Q_ListViewItem * | oldChild | |||
| ) | [virtual] |
Validate child, given its name and reference to old child Usually it is valid, since item with same name refer to same subitem (key-based items), but for value-based items (array) same keys can correspond to different values after reloading. In such cases, false should be returned. Also, similar problems can happen when switching revisions (with almost all types)
Note: false negative it not a problem (only unnecessary reloading), while false positive mean the tree is invalid/outdated
| name | name of (old and new) treeitem | |
| oldChild | reference to old child tree item |
Implements gui::TreeItemAbstract.
References gui::TreeItem::getObject(), and gui::TreeItem::obj.
bool gui::TreeItemRef::complete [private] |
False, if childs of this items are yet unknown and to be parsed/added, true if child are parsed
Referenced by getChildNames(), isComplete(), reloadSelf(), setOpen(), TreeItemRef(), and unOpen().
QString gui::TreeItemRef::selfRef [private] |
If this item contains a CRef, this string contain reference target in text form
Referenced by addData(), getRef(), parentCheck(), reloadSelf(), and setOpen().