Tree item containing CPage. More...
#include <treeitempage.h>
Public Member Functions | |
| TreeItemPage (TreeData *_data, boost::shared_ptr< CPage > _page, Q_ListView *parent, const QString name=QString::null, Q_ListViewItem *after=NULL) | |
| TreeItemPage (TreeData *_data, boost::shared_ptr< CPage > _page, Q_ListViewItem *parent, const QString name=QString::null, Q_ListViewItem *after=NULL) | |
| virtual | ~TreeItemPage () |
| boost::shared_ptr< CPage > | getObject () |
| bool | setObject (boost::shared_ptr< CPage > newPage) |
| virtual bool | deepReload (const QString &childName, Q_ListViewItem *oldItem) |
| virtual bool | validChild (const QString &name, Q_ListViewItem *oldChild) |
| virtual QSCObject * | getQSObject (BaseCore *_base) |
| 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 () |
| virtual QSCObject * | getQSObject () |
| virtual void | remove () |
| void | initObserver () |
| void | uninitObserver () |
Private Member Functions | |
| void | init (boost::shared_ptr< CPage > page, const QString &name) |
Private Attributes | |
| boost::shared_ptr < TreeItemPageObserver > | observer |
| boost::shared_ptr< CPage > | obj |
| std::vector< boost::shared_ptr < CContentStream > > | streams |
| std::vector< boost::shared_ptr < CAnnotation > > | anots |
Tree item containing CPage.
Class holding CPage (one page) in tree
| gui::TreeItemPage::TreeItemPage | ( | TreeData * | _data, | |
| boost::shared_ptr< CPage > | _page, | |||
| Q_ListView * | parent, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL | |||
| ) |
constructor of TreeItemPage - create root item from given object
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| parent | Q_ListView in which to put item | |
| _page | CPage Object contained in this item | |
| name | Name of this item - will be shown in treeview | |
| after | Item after which this one will be inserted |
References init().
| gui::TreeItemPage::TreeItemPage | ( | TreeData * | _data, | |
| boost::shared_ptr< CPage > | _page, | |||
| Q_ListViewItem * | parent, | |||
| const QString | name = QString::null, |
|||
| Q_ListViewItem * | after = NULL | |||
| ) |
constructor of TreeItemPage - create child item from given object
| _data | TreeData containing necessary information about tree in which this item will be inserted | |
| parent | Q_ListViewItem which is parent of this object | |
| _page | CPage Object contained in this item | |
| name | Name of this item - will be shown in treeview | |
| after | Item after which this one will be inserted |
References init().
| gui::TreeItemPage::~TreeItemPage | ( | ) | [virtual] |
default destructor
References uninitObserver().
| TreeItemAbstract * gui::TreeItemPage::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 anots, gui::TreeItem::create(), gui::TreeItemAbstract::data, obj, and streams.
| bool gui::TreeItemPage::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 debug::DBG_DBG, gui::TreeItem::getObject(), guiPrintDbg, obj, and gui::TreeItem::setObject().
| QStringList gui::TreeItemPage::getChildNames | ( | ) | [virtual] |
Get list of all item's childs names
Implements gui::TreeItemAbstract.
References anots, gui::TreeItemAbstract::data, obj, gui::TreeData::showAnnot(), gui::TreeData::showODict(), gui::TreeData::showStream(), and streams.
| ChildType gui::TreeItemPage::getChildType | ( | const QString & | name | ) | [virtual] |
Get type of this items child, given its name.
| name | Name of child item |
Implements gui::TreeItemAbstract.
| boost::shared_ptr< CPage > gui::TreeItemPage::getObject | ( | ) |
| QSCObject * gui::TreeItemPage::getQSObject | ( | ) | [virtual] |
Create and return object for scripting representing this tree item
Implements gui::TreeItemAbstract.
References gui::TreeData::base(), gui::TreeItemAbstract::data, and obj.
Create and return object for scripting representing this tree item, relocated in different base If the object cannot be copied into new base, return NULL
| _base | BaseCore for the new object. |
Reimplemented from gui::TreeItemAbstract.
References obj.
| bool gui::TreeItemPage::haveChild | ( | ) | [virtual] |
Return true, if the item have at least one child
Implements gui::TreeItemAbstract.
References gui::TreeItemAbstract::data, gui::TreeData::showAnnot(), gui::TreeData::showODict(), and gui::TreeData::showStream().
| void gui::TreeItemPage::init | ( | boost::shared_ptr< CPage > | page, | |
| const QString & | name | |||
| ) | [private] |
Initialize item from given CPage
| page | Object used to initialize this item | |
| name | Name of this item - will be shown in treeview |
References initObserver(), obj, and gui::TreeItemAbstract::reload().
Referenced by TreeItemPage().
| void gui::TreeItemPage::initObserver | ( | ) |
Sets observer for this item
References debug::DBG_DBG, guiPrintDbg, obj, observer, and REGISTER_SHAREDPTR_OBSERVER.
Referenced by init().
| void gui::TreeItemPage::reloadSelf | ( | ) | [virtual] |
Reload contents of itself and only itself (excluding any children)
Implements gui::TreeItemAbstract.
| void gui::TreeItemPage::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.
References obj.
| bool gui::TreeItemPage::setObject | ( | boost::shared_ptr< CPage > | newPage | ) |
This method is needed for "deep reload" to work Try to replace page inside this treeitem with a new one.
| newPage | new page to replace the old one |
References obj.
| void gui::TreeItemPage::uninitObserver | ( | ) |
Unsets observer for this item
References debug::DBG_DBG, guiPrintDbg, obj, observer, and UNREGISTER_SHAREDPTR_OBSERVER.
Referenced by ~TreeItemPage().
| bool gui::TreeItemPage::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 anots, gui::TreeItemAnnotation::getObject(), gui::TreeItemContentStream::getObject(), gui::TreeItem::getObject(), obj, and streams.
std::vector<boost::shared_ptr<CAnnotation> > gui::TreeItemPage::anots [private] |
Vector with anotations
Referenced by createChild(), getChildNames(), reloadSelf(), and validChild().
boost::shared_ptr<CPage> gui::TreeItemPage::obj [private] |
CPage stored in this TreeItem
Referenced by createChild(), deepReload(), getChildNames(), getObject(), getQSObject(), init(), initObserver(), reloadSelf(), remove(), setObject(), uninitObserver(), and validChild().
boost::shared_ptr<TreeItemPageObserver> gui::TreeItemPage::observer [private] |
Observer registered for this item
Referenced by initObserver(), and uninitObserver().
std::vector<boost::shared_ptr<CContentStream> > gui::TreeItemPage::streams [private] |
Vector with content streams
Referenced by createChild(), getChildNames(), reloadSelf(), and validChild().