gui::TreeItemAnnotation Class Reference

Tree item containing CAnnotation. More...

#include <treeitemannotation.h>

Inheritance diagram for gui::TreeItemAnnotation:
gui::TreeItemAbstract

List of all members.

Public Member Functions

 TreeItemAnnotation (TreeData *_data, Q_ListView *parent, boost::shared_ptr< CAnnotation > pdfObj, boost::shared_ptr< CPage > _page, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL)
 TreeItemAnnotation (TreeData *_data, Q_ListViewItem *parent, boost::shared_ptr< CAnnotation > pdfObj, boost::shared_ptr< CPage > _page, const QString name=QString::null, Q_ListViewItem *after=NULL, const QString &nameId=NULL)
virtual ~TreeItemAnnotation ()
boost::shared_ptr< CAnnotationgetObject ()
virtual bool haveChild ()
virtual TreeItemAbstractcreateChild (const QString &name, ChildType typ, Q_ListViewItem *after=NULL)
virtual void reloadSelf ()
virtual ChildType getChildType (const QString &name)
virtual QStringList getChildNames ()
virtual QSCObjectgetQSObject ()
virtual void remove ()
virtual bool validChild (const QString &name, Q_ListViewItem *oldChild)

Private Member Functions

void init ()

Private Attributes

boost::shared_ptr< CAnnotationobj
boost::shared_ptr< CPagepage
QString title

Detailed Description

Tree item containing CAnnotation.

Class holding one Annotation in tree.


Constructor & Destructor Documentation

gui::TreeItemAnnotation::TreeItemAnnotation ( TreeData _data,
Q_ListView *  parent,
boost::shared_ptr< CAnnotation pdfObj,
boost::shared_ptr< CPage _page,
const QString  name = QString::null,
Q_ListViewItem *  after = NULL,
const QString &  nameId = NULL 
)

constructor of TreeItemAnnotation - root item

Parameters:
_data TreeData containing necessary information about tree in which this item will be inserted
parent Q_ListView which holds this object
pdfObj Annotation contained in this item
_page Page holding this annotation
nameId Internal name of this item
name Caption of this item - will be shown in treeview
after Item after which this one will be inserted
gui::TreeItemAnnotation::TreeItemAnnotation ( TreeData _data,
Q_ListViewItem *  parent,
boost::shared_ptr< CAnnotation pdfObj,
boost::shared_ptr< CPage _page,
const QString  name = QString::null,
Q_ListViewItem *  after = NULL,
const QString &  nameId = NULL 
)

constructor of TreeItemAnnotation - child item

Parameters:
_data TreeData containing necessary information about tree in which this item will be inserted
parent Q_ListViewItem which is parent of this object
pdfObj Annotation contained in this item
_page Page holding this annotation
nameId Internal name of this item
name Caption of this item - will be shown in treeview
after Item after which this one will be inserted
gui::TreeItemAnnotation::~TreeItemAnnotation (  )  [virtual]

default destructor


Member Function Documentation

TreeItemAbstract * gui::TreeItemAnnotation::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.

QStringList gui::TreeItemAnnotation::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.

ChildType gui::TreeItemAnnotation::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 init().

boost::shared_ptr< CAnnotation > gui::TreeItemAnnotation::getObject (  ) 

Return CAnnotation inside this tree items

Returns:
stored annotation

Referenced by gui::TreeItemPage::validChild().

QSCObject * gui::TreeItemAnnotation::getQSObject (  )  [virtual]

Create and return object for scripting representing this tree item

Returns:
object for scripting

Implements gui::TreeItemAbstract.

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

Return true, if the item have at least one child

Returns:
Presence of at least one child

Implements gui::TreeItemAbstract.

References gui::TreeItemAbstract::data, and gui::TreeData::showODict().

void gui::TreeItemAnnotation::init (  )  [private]

Initialize the item

Referenced by getChildType().

void gui::TreeItemAnnotation::reloadSelf (  )  [virtual]

Reload contents of itself and only itself (excluding any children)

Implements gui::TreeItemAbstract.

References util::annotTypeName(), obj, and title.

void gui::TreeItemAnnotation::remove (  )  [virtual]

Remove itself from document (including any children) Do not remove the treeitem itself in this method -> this may lead to crash! If desired, you may call reload() on parent to get rid of the item correctly

Implements gui::TreeItemAbstract.

bool gui::TreeItemAnnotation::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 obj, and page.


Member Data Documentation

boost::shared_ptr<CAnnotation> gui::TreeItemAnnotation::obj [private]

Annotation stored inside

Referenced by reloadSelf(), and validChild().

boost::shared_ptr<CPage> gui::TreeItemAnnotation::page [private]

CPage containing this annotation

Referenced by validChild().

QString gui::TreeItemAnnotation::title [private]

Annotation title (name)

Referenced by reloadSelf().


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