gui::TreeItemRef Class Reference

Tree item containing CRef. More...

#include <treeitemref.h>

Inheritance diagram for gui::TreeItemRef:
gui::TreeItem gui::TreeItemAbstract

List of all members.

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 TreeItemAbstractcreateChild (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

TreeItemparentCheck ()

Private Attributes

bool complete
QString selfRef

Detailed Description

Tree item containing CRef.

class holding one CRef object (indirect reference) in tree


Constructor & Destructor Documentation

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

Parameters:
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

Parameters:
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]

Member Function Documentation

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

Parameters:
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
Returns:
Pointer to subchild. If returned NULL, the subchild can not be created
See also:
getChildNames

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

Parameters:
childName name of (old and new) treeitem
oldItem reference to old child tree item
Returns:
true if successful, false otherwise

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

Returns:
list of child names. Names in the list must be unique and the list may be empty.

Implements gui::TreeItemAbstract.

References complete.

ChildType gui::TreeItemRef::getChildType ( const QString &  name  )  [virtual]

Get type of this items child, given its name.

Parameters:
name Name of child item
Returns:
type of specified child

Implements gui::TreeItemAbstract.

References util::dereference(), and gui::TreeItem::obj.

QString gui::TreeItemRef::getRef (  ) 

Return reference target in text form.

Returns:
Refence target

References selfRef.

Referenced by addData(), and parentCheck().

bool gui::TreeItemRef::haveChild (  )  [virtual]

Return true, if the item have at least one child

Returns:
Presence of 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

Returns:
true if item is expanded, false if it is incomplete

References complete.

TreeItem * gui::TreeItemRef::parentCheck (  )  [private]

Checks if any parent is not CRef referencing the same CObject as this item

Returns:
TreeItem with same reference as this TreeItem or NULL if no such item found

References gui::TreeItem::_parent, getRef(), gui::TreeItem::parent(), and selfRef.

Referenced by setOpen().

void gui::TreeItemRef::reloadSelf (  )  [virtual]
void gui::TreeItemRef::setOpen ( bool  open  )  [virtual]

Slot that will be called when item is opened/closed

Parameters:
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

Parameters:
name name of (old and new) treeitem
oldChild reference to old child tree item
Returns:
True, if the old child is pointing to same item as item "name", false, if the child item "name" no longer point to same item as oldChild.

Implements gui::TreeItemAbstract.

References gui::TreeItem::getObject(), and gui::TreeItem::obj.


Member Data Documentation

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().


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