gui::TreeItemPage Class Reference

Tree item containing CPage. More...

#include <treeitempage.h>

Inheritance diagram for gui::TreeItemPage:
gui::TreeItemAbstract

List of all members.

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< CPagegetObject ()
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 QSCObjectgetQSObject (BaseCore *_base)
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 ()
virtual QSCObjectgetQSObject ()
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< CPageobj
std::vector< boost::shared_ptr
< CContentStream > > 
streams
std::vector< boost::shared_ptr
< CAnnotation > > 
anots

Detailed Description

Tree item containing CPage.

Class holding CPage (one page) in tree


Constructor & Destructor Documentation

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

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

Parameters:
_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().


Member Function Documentation

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

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

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

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.

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

Implements gui::TreeItemAbstract.

boost::shared_ptr< CPage > gui::TreeItemPage::getObject (  ) 

return CPage stored inside this item

Returns:
stored object (CPage)

References obj.

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

Create and return object for scripting representing this tree item

Returns:
object for scripting

Implements gui::TreeItemAbstract.

References gui::TreeData::base(), gui::TreeItemAbstract::data, and obj.

QSCObject * gui::TreeItemPage::getQSObject ( BaseCore _base  )  [virtual]

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

Parameters:
_base BaseCore for the new object.
Returns:
object for scripting

Reimplemented from gui::TreeItemAbstract.

References obj.

bool gui::TreeItemPage::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, 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

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

References anots, obj, and streams.

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.

Parameters:
newPage new page to replace the old one
Returns:
true if page replaced, false on error.

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

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 anots, gui::TreeItemAnnotation::getObject(), gui::TreeItemContentStream::getObject(), gui::TreeItem::getObject(), obj, and streams.


Member Data Documentation

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


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