Index: code/branches/tutoriallevel3/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/tutoriallevel3/src/modules/notifications/NotificationManager.cc	(revision 8453)
+++ code/branches/tutoriallevel3/src/modules/notifications/NotificationManager.cc	(revision 8636)
@@ -411,5 +411,5 @@
     void NotificationManager::loadQueues(void)
     {
-        NotificationQueueCEGUI* allQueue = new NotificationQueueCEGUI("all");
+        /*NotificationQueueCEGUI* allQueue = new NotificationQueueCEGUI("all");
         allQueue->setDisplaySize(Vector2(0.5, 0));
         allQueue->setPosition(Vector4(0.0, 10, 0.3, 0));
@@ -420,5 +420,5 @@
         infoQueue->setFontColor(Vector4(1.0, 1.0, 0.0, 0.8));
         infoQueue->setAlignment("HorzCentred");
-        infoQueue->setDisplaySize(Vector2(0.6, 0.0));
+        infoQueue->setDisplaySize(Vector2(0.6, 0.0));*/
     }
 
Index: code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.cc	(revision 8453)
+++ code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.cc	(revision 8636)
@@ -38,4 +38,5 @@
 
 #include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
 #include "util/SubString.h"
 
@@ -43,12 +44,30 @@
 {
 
-    /**
-    @brief
-        Constructor. Creates and initializes the object.
+    CreateFactory(NotificationQueue);
+    
+    /**
+    @brief
+        Default constructor. Registers and initializes the object.
+    @param creator
+        The creator of the NotificationQueue.
+    */
+    NotificationQueue::NotificationQueue(BaseObject* creator) : BaseObject(creator), registered_(false)
+    {
+        RegisterObject(NotificationQueue);
+
+        this->initialize();
+    }
+
+    // TODO move to docu.
+    /**
+    @brief
+        Constructor. Registers and initializes the object.
+    @param creator
+        The creator of the NotificationQueue
     @param name
         The name of the new NotificationQueue. It needs to be unique
     @param senders
         The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
-        The senders need to be separated by commas.
+        The senders need to be seperated by commas.
     @param size
         The size (the maximum number of displayed Notifications) of this NotificationQueue.
@@ -56,20 +75,42 @@
         The time during which a Notification is (at most) displayed.
     */
-    NotificationQueue::NotificationQueue(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime)
-    {
-        this->registered_ = false;
-
-        RegisterRootObject(NotificationQueue);
-
-        // Initialize.
+
+    /**
+    @brief
+        Destructor.
+    */
+    NotificationQueue::~NotificationQueue()
+    {
+        this->targets_.clear();
+
+        if(this->isRegistered()) // If the NotificationQueue is registered.
+        {
+            this->clear(true);
+
+            // Unregister with the NotificationManager.
+            NotificationManager::getInstance().unregisterQueue(this);
+        }
+    }
+
+    /**
+    @brief
+        Initializes the NotificationQueue.
+    */
+    void NotificationQueue::initialize(void)
+    {
         this->size_ = 0;
         this->tickTime_ = 0.0f;
-
-        // Sets the input values.
-        this->setTargets(senders);
-        this->name_ = name;
-        this->maxSize_ = size;
-        this->setDisplayTime(displayTime);
-
+        this->maxSize_ = NotificationQueue::DEFAULT_SIZE;
+        this->displayTime_ = NotificationQueue::DEFAULT_DISPLAY_TIME;
+
+        this->creationTime_ = std::time(0);
+    }
+
+    /**
+    @brief
+        Creates the NotificationQueue.
+    */
+    void NotificationQueue::create(void)
+    {
         // Register the NotificationQueue with the NotificationManager.
         bool queueRegistered = NotificationManager::getInstance().registerQueue(this);
@@ -87,23 +128,4 @@
     /**
     @brief
-        Destructor.
-    */
-    NotificationQueue::~NotificationQueue()
-    {
-        this->targets_.clear();
-
-        if(this->registered_) // If the NotificationQueue is registered.
-        {
-            this->clear(true);
-
-            // Unregister with the NotificationManager.
-            NotificationManager::getInstance().unregisterQueue(this);
-        }
-        
-        COUT(3) << "NotificationQueue '" << this->getName() << "' destroyed." << std::endl;
-    }
-
-    /**
-    @brief
         Updates the queue from time to time.
     @param dt
@@ -115,5 +137,5 @@
         if(this->displayTime_ != INF && this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
         {
-            this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containig the current time.
+            this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containing the current time.
 
             std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = this->ordering_.begin();
@@ -129,4 +151,15 @@
     }
 
+    void NotificationQueue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueue, XMLPort, xmlelement, mode);
+
+        XMLPortParam(NotificationQueue, "targets", setTargets, getTargets, xmlelement, mode).defaultValues(NotificationListener::ALL);
+        XMLPortParam(NotificationQueue, "size", setMaxSize, getMaxSize, xmlelement, mode);
+        XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlelement, mode);
+
+        this->create();
+    }
+
     /**
     @brief
@@ -148,7 +181,10 @@
         if(!notifications->empty())
         {
-            // Add all Notifications.
+            // Add all Notifications that have been created after this NotificationQueue was created.
             for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
-                this->push(it->second, it->first);
+            {
+                if(it->first >= this->creationTime_)
+                    this->push(it->second, it->first);
+            }
         }
 
@@ -305,7 +341,13 @@
             return;
 
+        if(size == 0)
+        {
+            COUT(2) << "Trying to set maximal size of NotificationQueue '" << this->getName() << "' to 0. Ignoring..." << endl;
+            return;
+        }
+        
         this->maxSize_ = size;
 
-        if(this->registered_)
+        if(this->isRegistered())
             this->update();
     }
@@ -322,7 +364,12 @@
             return;
 
+        if(time != NotificationQueue::INF && time <= 0)
+        {
+            COUT(2) << "Trying to set display time of NotificationQueue '" << this->getName() << "' to non-positive value. Ignoring..." << endl;
+        }
+            
         this->displayTime_ = time;
 
-        if(this->registered_)
+        if(this->isRegistered())
             this->update();
     }
@@ -367,5 +414,5 @@
 
         // TODO: Why?
-        if(this->registered_)
+        if(this->isRegistered())
         {
             NotificationManager::getInstance().unregisterQueue(this);
Index: code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.h	(revision 8453)
+++ code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.h	(revision 8636)
@@ -45,4 +45,5 @@
 #include "NotificationManager.h"
 
+#include "core/BaseObject.h"
 #include "tools/interfaces/Tickable.h"
 
@@ -88,15 +89,17 @@
     @ingroup Notifications
     */
-    class _NotificationsExport NotificationQueue : public Tickable
+    class _NotificationsExport NotificationQueue : public BaseObject, public Tickable
     {
 
         public:
-            NotificationQueue(const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
+            NotificationQueue(BaseObject* creator);
+            NotificationQueue(BaseObject* creator, const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
             virtual ~NotificationQueue();
 
-            virtual void tick(float dt); //!< To update from time to time.
-
-            void update(void); //!< Updates the NotificationQueue.
-            void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification.
+            virtual void tick(float dt); // To update from time to time.
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+            void update(void); // Updates the NotificationQueue.
+            void update(Notification* notification, const std::time_t & time); // Updates the NotificationQueue by adding an new Notification.
 
             // tolua_begin
@@ -105,21 +108,21 @@
             @return Returns the name.
             */
-            inline const std::string& getName() const
-                { return this->name_; }
-
-            void setMaxSize(unsigned int size); //!< Sets the maximum number of displayed Notifications.
+            inline const std::string& getName(void) const
+                { return this->BaseObject::getName(); }
+
+            void setMaxSize(unsigned int size); // Sets the maximum number of displayed Notifications.
             /**
             @brief Returns the maximum number of Notifications displayed.
             @return Returns maximum size.
             */
-            inline unsigned int getMaxSize() const
+            inline unsigned int getMaxSize(void) const
                 { return this->maxSize_; }
 
-            void setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
+            void setDisplayTime(int time); // Sets the maximum number of seconds a Notification is displayed.
             /**
             @brief Returns the time interval the Notification is displayed.
             @return Returns the display time.
             */
-            inline int getDisplayTime() const
+            inline int getDisplayTime(void) const
                 { return this->displayTime_; }
             // tolua_end
@@ -129,5 +132,5 @@
             @return Returns the size of the NotificationQueue.
             */
-            inline unsigned int getSize() const
+            inline unsigned int getSize(void) const
                 { return this->size_; }
 
@@ -136,9 +139,16 @@
             @return Returns a set of strings holding the different targets.
             */
-            inline const std::set<std::string> & getTargetsSet()
+            inline const std::set<std::string> & getTargetsSet(void)
                 { return this->targets_; }
 
-            void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
-            const std::string& getTargets(void) const; //!< Returns a string consisting of the concatenation of the targets.
+            void setTargets(const std::string & targets); // Set the targets of this NotificationQueue.
+            const std::string& getTargets(void) const; // Returns a string consisting of the concatenation of the targets.
+
+            /**
+            @brief Check whether the NotificationQueue is registered with the NotificationManager.
+            @return Returns true if it is registered, false if not.
+            */
+            inline bool isRegistered(void)
+                { return this->registered_; }
 
             bool tidy(void); // Pops all Notifications from the NotificationQueue.
@@ -160,5 +170,5 @@
             virtual void notificationRemoved(unsigned int index) {}
             
-            virtual void clear(bool noGraphics = false); //!< Clears the NotificationQueue by removing all NotificationContainers.
+            virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers.
 
         protected:
@@ -167,7 +177,11 @@
             static const int INF = -1; //!< Constant denoting infinity.
 
+            virtual void create(void); // Creates the NotificationQueue.
+
         private:
-            std::string name_; //!< The name of the NotificationQueue.
-
+            void initialize(void); // Initializes the NotificationQueue.
+
+            time_t creationTime_; // The time this NotificationQueue was created.
+            
             unsigned int maxSize_; //!< The maximal number of Notifications displayed.
             unsigned int size_; //!< The number of Notifications displayed.
@@ -186,7 +200,7 @@
             void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
 
-            void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue.
-            void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue.
-            void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); //!< Removes the Notification that is stored in the input NotificationContainer.
+            void push(Notification* notification, const std::time_t & time); // Adds (pushes) a Notification to the NotificationQueue.
+            void pop(void); // Removes (pops) the least recently added Notification form the NotificationQueue.
+            void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); // Removes the Notification that is stored in the input NotificationContainer.
 
     };
Index: code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.cc
===================================================================
--- code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.cc	(revision 8453)
+++ code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.cc	(revision 8636)
@@ -47,4 +47,6 @@
 {
 
+    CreateFactory(NotificationQueueCEGUI);
+
     // Register tolua_open function when loading the library.
     DeclareToluaInterface(Notifications);
@@ -52,8 +54,23 @@
     /*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer");
 
-    NotificationQueueCEGUI::NotificationQueueCEGUI(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime) : NotificationQueue(name, senders, size, displayTime)
+    NotificationQueueCEGUI::NotificationQueueCEGUI(BaseObject* creator) : NotificationQueue(creator)
     {
         RegisterObject(NotificationQueueCEGUI);
 
+        this->initialize();
+    }
+    
+    NotificationQueueCEGUI::~NotificationQueueCEGUI()
+    {
+        if(GameMode::showsGraphics())
+            GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() +  "\")");
+    }
+
+    /**
+    @brief
+        Initializes The NotificationQueueCEGUI.
+    */
+    void NotificationQueueCEGUI::initialize(void)
+    {
         this->displaySize_ = Vector4(1.0, 0.0, 0.0, 0.0);
         this->position_ = Vector4(0.0, 0.0, 0.0, 0.0);
@@ -62,12 +79,15 @@
         this->fontColor_ = Vector4(1.0, 1.0, 1.0, 1.0);
         this->fontColorStr_ = "FFFFFFFF";
-        
-        // Create the NotificationQueueCEGUI in lua.
-        this->create();
-    }
-    
-    NotificationQueueCEGUI::~NotificationQueueCEGUI()
-    {
-        
+    }
+
+    void NotificationQueueCEGUI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(NotificationQueueCEGUI, XMLPort, xmlelement, mode);
+
+        XMLPortParam(NotificationQueueCEGUI, "position", setPosition, getPosition, xmlelement, mode);
+        XMLPortParam(NotificationQueueCEGUI, "fontSize", setFontSize, getFontSize, xmlelement, mode);
+        XMLPortParam(NotificationQueueCEGUI, "fontColor", setFontColor, getFontColor, xmlelement, mode);
+        XMLPortParam(NotificationQueueCEGUI, "alignment", setAlignment, getAlignment, xmlelement, mode);
+        XMLPortParam(NotificationQueueCEGUI, "displaySize", setDisplaySize, getDisplaySize, xmlelement, mode);
     }
 
@@ -266,5 +286,7 @@
     void NotificationQueueCEGUI::create(void)
     {
-        if(GameMode::showsGraphics())
+        this->NotificationQueue::create();
+        
+        if(this->isRegistered() && GameMode::showsGraphics())
             GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".createQueue(\"" + this->getName() +  "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");
     }
Index: code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.h
===================================================================
--- code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.h	(revision 8453)
+++ code/branches/tutoriallevel3/src/modules/notifications/NotificationQueueCEGUI.h	(revision 8636)
@@ -70,16 +70,13 @@
 
         public:
-            NotificationQueueCEGUI(const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
+            NotificationQueueCEGUI(BaseObject* creator);
             virtual ~NotificationQueueCEGUI();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
 
             void destroy(bool noGraphics = false); // Destroys the NotificationQueue.
 
-            /**
-            @brief Set the size of the window that displays the NotificationQueue.
-            @param size A vector whose first component is the relative width of the window (a value between 0 and 1) and whose second component is the absolute width in pixels (additional to the relative width, can be negative). The height is set such that exactly as many Notifications fit as is the maximum size of the NotificationQueue (in terms of the number of Notifications).
-            */
-            inline void setDisplaySize(const Vector2& size)
-                { this->setDisplaySize(Vector4(size.x, size.y, 0.0, 0.0)); }
             void setDisplaySize(const Vector4& size); // Set the size of the window that displays the NotificationQueue.
+            
             /**
             @brief Get the size of the window that displays the NotificationQueue.
@@ -130,4 +127,6 @@
             
         protected:
+            virtual void create(void); // Creates the NotificationQueue in lua.
+            
             virtual void notificationPushed(Notification* notification); // Is called by the NotificationQueue when a notification was pushed
             virtual void notificationPopped(void); // Is called by the NotificationQueue when a notification was popped.
@@ -146,6 +145,6 @@
             Vector4 fontColor_; //!< The font color of the Notifications text as a vector, in RGBA form, with values from 0 to 1.
             std::string fontColorStr_; //!< The font color of the Notifications text as a string with the ARGB hexadecimal values.
-            
-            void create(void); // Creates the NotificationQueue in lua.
+
+            void initialize(void); // Initializes The NotificationQueueCEGUI.
 
     }; // tolua_export
