Added feature #16033: API for Trees and ContextMenus (Thanks to Stefan Galinski)
authorSteffen Kamper <info@sk-typo3.de>
Mon, 18 Oct 2010 21:15:42 +0000 (21:15 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Mon, 18 Oct 2010 21:15:42 +0000 (21:15 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9149 709f56b5-9817-0410-a4d7-c38de5d9e867

23 files changed:
ChangeLog
t3lib/contextmenu/class.t3lib_contextmenu_abstractcontextmenu.php [new file with mode: 0644]
t3lib/contextmenu/class.t3lib_contextmenu_abstractdataprovider.php [new file with mode: 0644]
t3lib/contextmenu/class.t3lib_contextmenu_action.php [new file with mode: 0644]
t3lib/contextmenu/class.t3lib_contextmenu_actionCollection.php [new file with mode: 0644]
t3lib/contextmenu/extdirect/class.t3lib_contextmenu_extdirect_contextmenu.php [new file with mode: 0644]
t3lib/core_autoload.php
t3lib/interfaces/tree/interface.t3lib_tree_comparablenode.php [new file with mode: 0644]
t3lib/interfaces/tree/interface.t3lib_tree_draggableanddropable.php [new file with mode: 0644]
t3lib/interfaces/tree/interface.t3lib_tree_labeleditable.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_abstractdataprovider.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_abstractstateprovider.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_abstracttree.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_node.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_nodecollection.php [new file with mode: 0644]
t3lib/tree/class.t3lib_tree_sortednodecollection.php [new file with mode: 0644]
t3lib/tree/extdirect/class.t3lib_tree_extdirect_abstractextjstree.php [new file with mode: 0644]
t3lib/tree/renderer/class.t3lib_tree_renderer_abstract.php [new file with mode: 0644]
t3lib/tree/renderer/class.t3lib_tree_renderer_unorderedlist.php [new file with mode: 0644]
tests/t3lib/tree/fixtures/serialized.txt [new file with mode: 0644]
tests/t3lib/tree/t3lib_tree_nodeTest.php [new file with mode: 0644]
tests/t3lib/tree/t3lib_tree_nodecollectionTest.php [new file with mode: 0644]
tests/t3lib/tree/t3lib_tree_sortednodecollectionTest.php [new file with mode: 0644]

index 901d0f5..21cb657 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-10-18  Steffen Kamper  <steffen@typo3.org>
+
+       * Added feature #16033: API for Trees and ContextMenus (Thanks to Stefan Galinski)
+
 2010-10-18  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Added feature #16047: htmlArea RTE: Add word count in the status bar
diff --git a/t3lib/contextmenu/class.t3lib_contextmenu_abstractcontextmenu.php b/t3lib/contextmenu/class.t3lib_contextmenu_abstractcontextmenu.php
new file mode 100644 (file)
index 0000000..44c7582
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Context Menu
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_contextmenu_AbstractContextMenu {
+       /**
+        * Data Provider
+        *
+        * @var t3lib_contextmenu_AbstractDataProvider
+        */
+       protected $dataProvider = NULL;
+
+       /**
+        * @param t3lib_tree_AbstractDataProvider $dataProvider
+        * @return void
+        */
+       public function setDataProvider(t3lib_tree_AbstractDataProvider $dataProvider) {
+               $this->dataProvider = $dataProvider;
+       }
+
+       /**
+        * @return t3lib_tree_AbstractDataProvider
+        */
+       public function getDataProvider() {
+               return $this->dataProvider;
+       }
+
+       /**
+        * Returns the actions for the given node informations
+        *
+        * @param t3lib_tree_Node $node
+        * @return array
+        */
+       abstract public function getActionsForNode(t3lib_tree_Node $node);
+}
diff --git a/t3lib/contextmenu/class.t3lib_contextmenu_abstractdataprovider.php b/t3lib/contextmenu/class.t3lib_contextmenu_abstractdataprovider.php
new file mode 100644 (file)
index 0000000..0feba18
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Context Menu Data Provider
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_contextmenu_AbstractDataProvider {
+       /**
+        * Context Menu Type (e.g. records.pages, records.tt_content)
+        *
+        * @var string
+        */
+       protected $contextMenuType = '';
+
+       /**
+        * Returns the context menu type
+        *
+        * @return string
+        */
+       public function getContextMenuType() {
+               return $this->contextMenuType;
+       }
+
+       /**
+        * Sets the context menu type
+        *
+        * @param string $contextMenuType
+        * @return void
+        */
+       public function setContextMenuType($contextMenuType) {
+               $this->contextMenuType = $contextMenuType;
+       }
+
+       /**
+        * Returns the root node
+        *
+        * @return t3lib_contextmenu_ActionCollection
+        */
+       abstract public function getActionsForNode(t3lib_tree_Node $node);
+
+       /**
+        * Returns the configuration of the specified context menu type
+        *
+        * @return array
+        */
+       protected function getConfiguration() {
+               $contextMenuAction = $GLOBALS['BE_USER']->getTSConfig(
+                       'options.contextMenu.' . $this->contextMenuType . '.items'
+               );
+
+               return $contextMenuAction;
+       }
+}
diff --git a/t3lib/contextmenu/class.t3lib_contextmenu_action.php b/t3lib/contextmenu/class.t3lib_contextmenu_action.php
new file mode 100644 (file)
index 0000000..a8f01b6
--- /dev/null
@@ -0,0 +1,142 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Context Menu Action
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_contextmenu_Action {
+       /**
+        * Label
+        *
+        * @var string
+        */
+       protected $label = '';
+
+       /**
+        * Identifier
+        *
+        * @var string
+        */
+       protected $id = '';
+
+       /**
+        * Icon
+        *
+        * @var string
+        */
+       protected $icon = '';
+
+       /**
+        * Class
+        *
+        * @var string
+        */
+       protected $class = '';
+
+       /**
+        * Callback Action
+        *
+        * @var string
+        */
+       protected $callbackAction = '';
+
+       /**
+        * Returns the label
+        *
+        * @return string
+        */
+       public function getLabel() {
+               return $this->label;
+       }
+
+       /**
+        * Sets the label
+        *
+        * @param string $label
+        */
+       public function setLabel($label) {
+               $this->label = $label;
+       }
+
+       /**
+        * Returns the identifier
+        *
+        * @return string
+        */
+       public function getId() {
+               return $this->id;
+       }
+
+       /**
+        * Sets the identifier
+        *
+        * @param string $id
+        */
+       public function setId($id) {
+               $this->id = $id;
+       }
+
+       /**
+        * Returns the class
+        *
+        * @return string
+        */
+       public function getClass() {
+               return $this->class;
+       }
+
+       /**
+        * Sets the class
+        *
+        * @param string $class
+        */
+       public function setClass($class) {
+               $this->class = $class;
+       }
+
+       /**
+        * Returns the callback action
+        *
+        * @return string
+        */
+       public function getCallbackAction() {
+               return $this->callbackAction;
+       }
+
+       /**
+        * Sets the callback action
+        *
+        * @param string $callbackAction
+        */
+       public function setCallbackAction($callbackAction) {
+               $this->callbackAction = $callbackAction;
+       }
+}
diff --git a/t3lib/contextmenu/class.t3lib_contextmenu_actionCollection.php b/t3lib/contextmenu/class.t3lib_contextmenu_actionCollection.php
new file mode 100644 (file)
index 0000000..ada0499
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Context Menu Action Collection
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_contextmenu_ActionCollection extends ArrayObject {
+}
diff --git a/t3lib/contextmenu/extdirect/class.t3lib_contextmenu_extdirect_contextmenu.php b/t3lib/contextmenu/extdirect/class.t3lib_contextmenu_extdirect_contextmenu.php
new file mode 100644 (file)
index 0000000..3ff02f2
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Context Menu for ExtDirect
+ *
+ * This is a concrete implementation that should stay here to be shared
+ * between the different ExtDirect implementation. Just create a subclass
+ * for adding specific purposes.
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_contextmenu_extdirect_ContextMenu extends t3lib_contextmenu_AbstractContextMenu {
+       /**
+        * Returns the actions for the given node informations
+        *
+        * Note: This method should be overriden to fit your specific needs.
+        *
+        * The informations should contain the basic informations of a
+        * t3lib_tree_Node for further processing. Also the classname (property type)
+        * of the node should be given, because we need this information
+        * to create the ndoe.
+        *
+        * @param array $nodeInfo
+        * @return array
+        */
+       public function getActionsForNodeArray(array $nodeInfo) {
+               if ($this->dataProvider === NULL) {
+                       $dataProvider = t3lib_div::makeInstance(
+                               't3lib_contextmenu_AbstractDataProvider'
+                       );
+                       $this->setDataProvider($dataProvider);
+               }
+
+               $node = t3lib_div::makeInstance($nodeInfo['type'], $nodeInfo);
+               $actions = $this->dataProvider->getActionsForNode($node);
+
+               return $actions;
+       }
+}
index 794d564..b717b0f 100644 (file)
@@ -144,6 +144,25 @@ $t3libClasses = array(
        't3lib_spritemanager_simplehandler' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_simplehandler.php',
        't3lib_spritemanager_abstracthandler' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_abstracthandler.php',
        't3lib_extjs_extdirectdebug' => PATH_t3lib . 'extjs/class.t3lib_extjs_extdirectdebug.php',
+       't3lib_tree_abstracttree' => PATH_t3lib . 'tree/class.t3lib_tree_abstracttree.php',
+       't3lib_tree_abstractdataprovider' => PATH_t3lib . 'tree/class.t3lib_tree_abstractdataprovider.php',
+       't3lib_tree_abstractstateprovider' => PATH_t3lib . 'tree/class.t3lib_tree_abstractstateprovider.php',
+       't3lib_tree_node' => PATH_t3lib . 'tree/class.t3lib_tree_node.php',
+       't3lib_tree_representationnode' => PATH_t3lib . 'tree/class.t3lib_tree_representationnode.php',
+       't3lib_tree_nodecollection' => PATH_t3lib . 'tree/class.t3lib_tree_nodecollection.php',
+       't3lib_tree_sortednodecollection' => PATH_t3lib . 'tree/class.t3lib_tree_sortednodecollection.php',
+       't3lib_tree_extdirect_abstractextjstree' => PATH_t3lib . 'tree/extdirect/class.t3lib_tree_extdirect_abstractextjstree.php',
+       't3lib_tree_comparablenode' => PATH_t3lib . 'interfaces/tree/interface.t3lib_tree_comparablenode.php',
+       't3lib_tree_draggableanddropable' => PATH_t3lib . 'interfaces/tree/interface.t3lib_tree_draggableanddropable.php',
+       't3lib_tree_labeleditable' => PATH_t3lib . 'interfaces/tree/interface.t3lib_tree_labeleditable.php',
+       't3lib_tree_renderer_abstract' => PATH_t3lib . 'tree/renderer/class.t3lib_tree_renderer_abstract.php',
+       't3lib_tree_renderer_unorderedlist' => PATH_t3lib . 'tree/renderer/class.t3lib_tree_renderer_unorderedlist.php',
+       't3lib_contextmenu_abstractcontextmenu' => PATH_t3lib . 'contextmenu/class.t3lib_contextmenu_abstractcontextmenu.php',
+       't3lib_contextmenu_abstractdataprovider' => PATH_t3lib . 'contextmenu/class.t3lib_contextmenu_abstractdataprovider.php',
+       't3lib_contextmenu_action' => PATH_t3lib . 'contextmenu/class.t3lib_contextmenu_action.php',
+       't3lib_contextmenu_actioncollection' => PATH_t3lib . 'contextmenu/class.t3lib_contextmenu_actioncollection.php',
+       't3lib_contextmenu_renderer_abstract' => PATH_t3lib . 'contextmenu/renderer/class.t3lib_contextmenu_renderer_abstract.php',
+       't3lib_contextmenu_extdirect_contextmenu' => PATH_t3lib . 'contextmenu/extdirect/class.t3lib_contextmenu_extdirect_contextmenu.php',
 );
 
 $tslibClasses = require(PATH_typo3 . 'sysext/cms/ext_autoload.php');
diff --git a/t3lib/interfaces/tree/interface.t3lib_tree_comparablenode.php b/t3lib/interfaces/tree/interface.t3lib_tree_comparablenode.php
new file mode 100644 (file)
index 0000000..a48b0bc
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Interface that defines the comparison of nodes
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface t3lib_tree_ComparableNode {
+       /**
+        * Compare Node against another one
+        *
+        * Returns:
+        * 1 if the current node is greater than the $other,
+        * -1 if $other is greater than the current node and
+        * 0 if the nodes are equal
+        *
+        * <strong>Example</strong>
+        * <pre>
+        *      if ($this->sortValue > $other->sortValue) {
+        *              return 1;
+        *      } elseif ($this->sortValue < $other->sortValue) {
+        *              return -1;
+        *      } else {
+        *              return 0;
+        *      }
+        * </pre>
+        *
+        * @param t3lib_tree_Node $other
+        * @return integer see description
+        */
+       public function compareTo($other);
+}
diff --git a/t3lib/interfaces/tree/interface.t3lib_tree_draggableanddropable.php b/t3lib/interfaces/tree/interface.t3lib_tree_draggableanddropable.php
new file mode 100644 (file)
index 0000000..9b4450f
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Describes necessary methods if the nodes are draggable and dropable
+ * within the tree.
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface t3lib_tree_DraggableAndDropable {
+       /**
+        * Moves given node inside a destination node
+        *
+        * @param t3lib_tree_Node $node
+        * @param t3lib_tree_Node $destination
+        * @return void
+        */
+       public function moveNodeInDestinationNode($node, $destination);
+
+       /**
+        * Moves given node after a destination node
+        *
+        * @param t3lib_tree_Node $node
+        * @param t3lib_tree_Node $destination
+        * @return void
+        */
+       public function moveNodeAfterDestinationNode($node, $destination);
+
+       /**
+        * Copies given node inside a destination node
+        *
+        * @param t3lib_tree_Node $node
+        * @param t3lib_tree_Node $destination
+        * @return void
+        */
+       public function copyNodeInDestinationNode($node, $destination);
+
+       /**
+        * Copies given node after a destination node
+        *
+        * @param t3lib_tree_Node $node
+        * @param t3lib_tree_Node $destination
+        * @return void
+        */
+       public function copyNodeAfterDestinationNode($node, $destination);
+
+}
diff --git a/t3lib/interfaces/tree/interface.t3lib_tree_labeleditable.php b/t3lib/interfaces/tree/interface.t3lib_tree_labeleditable.php
new file mode 100644 (file)
index 0000000..ff5277c
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Describes necessary methods if the node label should be editable
+ * within the tree.
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+interface t3lib_tree_LabelEditable {
+       /**
+        * Sets the new label
+        *
+        * @param string $label
+        * @return void
+        */
+       public function setLabel($label);
+}
diff --git a/t3lib/tree/class.t3lib_tree_abstractdataprovider.php b/t3lib/tree/class.t3lib_tree_abstractdataprovider.php
new file mode 100644 (file)
index 0000000..53aef04
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Tree Data Provider
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_tree_AbstractDataProvider {
+       /**
+        * Root Node
+        *
+        * @var t3lib_tree_Node
+        */
+       protected $rootNode = NULL;
+
+       /**
+        * Returns the root node
+        *
+        * @abstract
+        * @return t3lib_tree_Node
+        */
+       abstract public function getRoot();
+
+       /**
+        * Fetches the subnodes of the given node
+        *
+        * @abstract
+        * @param t3lib_tree_Node $node
+        * @return t3lib_tree_NodeCollection
+        */
+        abstract public function getNodes(t3lib_tree_Node $node);
+}
diff --git a/t3lib/tree/class.t3lib_tree_abstractstateprovider.php b/t3lib/tree/class.t3lib_tree_abstractstateprovider.php
new file mode 100644 (file)
index 0000000..4bcb768
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract State Provider
+ *
+ * @TODO This class is incomplete, because the methods still need
+ * some variables or other state object
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_tree_AbstractStateProvider {
+       /**
+        * Sets the current tree state
+        * @return void
+        */
+       abstract public function setState();
+
+       /**
+        * Returns the last tree state
+        * @return something
+        */
+       abstract public function getState();
+}
diff --git a/t3lib/tree/class.t3lib_tree_abstracttree.php b/t3lib/tree/class.t3lib_tree_abstracttree.php
new file mode 100644 (file)
index 0000000..22a7f55
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Tree
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_tree_AbstractTree {
+       /**
+        * Data Provider
+        *
+        * @var t3lib_tree_AbstractDataProvider
+        */
+       protected $dataProvider = NULL;
+
+       /**
+        * Tree Node Decorator
+        *
+        * @var t3lib_tree_renderer_Abstract
+        */
+       protected $nodeRenderer = NULL;
+
+       /**
+        * @param t3lib_tree_AbstractDataProvider $dataProvider
+        * @return void
+        */
+       public function setDataProvider(t3lib_tree_AbstractDataProvider $dataProvider) {
+               $this->dataProvider = $dataProvider;
+       }
+
+       /**
+        * @return t3lib_tree_AbstractDataProvider
+        */
+       public function getDataProvider() {
+               return $this->dataProvider;
+       }
+       /**
+        * @param t3lib_tree_renderer_Abstract $dataProvider
+        * @return void
+        */
+       public function setNodeRenderer(t3lib_tree_renderer_Abstract $nodeRenderer) {
+               $this->nodeRenderer = $nodeRenderer;
+       }
+
+       /**
+        * @return t3lib_tree_renderer_Abstract
+        */
+       public function getNodeRenderer() {
+               return $this->nodeRenderer;
+       }
+
+       /**
+        * Returns the root node
+        *
+        * @return t3lib_tree_Node
+        */
+       abstract public function getRoot();
+}
+
+?>
diff --git a/t3lib/tree/class.t3lib_tree_node.php b/t3lib/tree/class.t3lib_tree_node.php
new file mode 100644 (file)
index 0000000..bf5d388
--- /dev/null
@@ -0,0 +1,259 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Tree Node
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_Node implements t3lib_tree_ComparableNode, Serializable {
+       /**
+        * Node Identifier
+        *
+        * @var string
+        */
+       protected $id = '';
+
+       /**
+        * Parent Node
+        *
+        * @var t3lib_tree_Node
+        */
+       protected $parentNode = NULL;
+
+       /**
+        * Child Nodes
+        *
+        * @var t3lib_tree_NodeCollection
+        */
+       protected $childNodes = NULL;
+
+       /**
+        * Constructor
+        *
+        * You can move an initial data array to initialize the instance and further objects.
+        * This is useful for the deserialization.
+        *
+        * @param array $data
+        * @return void
+        */
+       public function __construct(array $data = array()) {
+               if (count($data)) {
+                       $this->dataFromArray($data);
+               }
+       }
+
+       /**
+        * Sets the child nodes collection
+        *
+        * @param t3lib_tree_NodeCollection $childNodes
+        * @return void
+        */
+       public function setChildNodes (t3lib_tree_NodeCollection $childNodes) {
+               $this->childNodes = $childNodes;
+       }
+
+       /**
+        * Removes child nodes collection
+        *
+        * @return void
+        */
+       public function removeChildNodes() {
+               if ($this->childNodes !== NULL) {
+                       unset($this->childNodes);
+                       $this->childNodes = NULL;
+               }
+       }
+
+       /**
+        * Returns child nodes collection
+        *
+        * @return t3lib_tree_NodeCollection
+        */
+       public function getChildNodes() {
+               return $this->childNodes;
+       }
+
+       /**
+        * Returns true if the node has child nodes attached
+        *
+        * @return boolean
+        */
+       public function hasChildNodes() {
+               if ($this->childNodes !== NULL) {
+                       return TRUE;
+               }
+
+               return FALSE;
+       }
+
+
+       /**
+        * Sets the identifier
+        *
+        * @param string $id
+        * @return void
+        */
+       public function setId($id) {
+               $this->id = $id;
+       }
+
+       /**
+        * Returns the identifier
+        *
+        * @return string
+        */
+       public function getId() {
+               return $this->id;
+       }
+
+       /**
+        * Sets the parent node
+        *
+        * @param t3lib_tree_Node $parentNode
+        * @return void
+        */
+       public function setParentNode (t3lib_tree_Node $parentNode = NULL) {
+               $this->parentNode = $parentNode;
+       }
+
+       /**
+        * Returns the parent node
+        *
+        * @return t3lib_tree_Node
+        */
+       public function getParentNode () {
+               return $this->parentNode;
+       }
+
+       /**
+        * Compares a node if it's identical to another node by the id property.
+        *
+        * @param t3lib_tree_Node $other
+        * @return boolean
+        */
+       public function equals(t3lib_tree_Node $other) {
+               return $this->id == $other->getId();
+       }
+
+       /**
+        * Compares a node to another one.
+        *
+        * Returns:
+        * 1 if its greater than the other one
+        * -1 if its smaller than the other one
+        * 0 if its equal
+        *
+        * @param t3lib_tree_Node $other
+        * @return int see description above
+        */
+       public function compareTo($other) {
+               if ($this->equals($other)) {
+                       return 0;
+               }
+
+               return ($this->id > $other->getId()) ? 1 : -1;
+       }
+
+       /**
+        * Returns the node in an array representation that can be used for serialization
+        *
+        * @param bool $addChildNodes
+        * @return array
+        */
+       public function toArray($addChildNodes = TRUE) {
+               $arrayRepresentation = array(
+                       'serializeClassName' => get_class($this),
+                       'id' => $this->id
+               );
+
+               if ($this->parentNode !== NULL) {
+                       $arrayRepresentation['parentNode'] = $this->parentNode->toArray(FALSE);
+               } else {
+                       $arrayRepresentation['parentNode'] = '';
+               }
+
+               if ($this->hasChildNodes() && $addChildNodes) {
+                       $arrayRepresentation['childNodes'] = $this->childNodes->toArray();
+               } else {
+                       $arrayRepresentation['childNodes'] = '';
+               }
+
+               return $arrayRepresentation;
+       }
+
+       /**
+        * Sets data of the node by a given data array
+        *
+        * @param array $data
+        * @return void
+        */
+       public function dataFromArray($data) {
+               $this->setId($data['id']);
+
+               if (isset($data['parentNode']) && $data['parentNode'] !== '') {
+                       $this->setParentNode(t3lib_div::makeInstance(
+                               $data['parentNode']['serializeClassName'],
+                               $data['parentNode']
+                       ));
+               }
+
+               if (isset($data['childNodes']) && $data['childNodes'] !== '') {
+                       $this->setChildNodes(t3lib_div::makeInstance(
+                               $data['childNodes']['serializeClassName'],
+                               $data['childNodes']
+                       ));
+               }
+       }
+
+       /**
+        * Returns the serialized instance
+        *
+        * @return string
+        */
+       public function serialize() {
+               return serialize($this->toArray());
+       }
+
+       /**
+        * Fills the current node with the given serialized informations
+        *
+        * @throws t3lib_exception if the deserialized object type is not identical to the current one
+        * @param string $serializedString
+        * @return void
+        */
+       public function unserialize($serializedString) {
+               $arrayRepresentation = unserialize($serializedString);
+               if ($arrayRepresentation['serializeClassName'] !== get_class($this)) {
+                       throw new t3lib_exception('Deserialized object type is not identical!');
+               }
+               $this->dataFromArray($arrayRepresentation);
+       }
+}
diff --git a/t3lib/tree/class.t3lib_tree_nodecollection.php b/t3lib/tree/class.t3lib_tree_nodecollection.php
new file mode 100644 (file)
index 0000000..3dc9037
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Tree Node Collection
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_NodeCollection extends ArrayObject {
+       /**
+        * Constructor
+        *
+        * You can move an initial data array to initialize the instance and further objects.
+        * This is useful for the deserialization.
+        *
+        * @param array $data
+        */
+       public function __construct(array $data = array()) {
+               if (count($data)) {
+                       $this->dataFromArray($data);
+               }
+       }
+
+       /**
+        * Sorts the internal nodes array
+        *
+        * @return void
+        */
+       public function asort() {
+               $this->uasort(array($this, 'nodeCompare'));
+       }
+
+       /**
+        * Compares a node with another one
+        *
+        * @noapi
+        * @see t3lib_tree_Node::compareTo
+        * @return void
+        */
+       public function nodeCompare(t3lib_tree_Node $node, t3lib_tree_Node $otherNode) {
+               return $node->compareTo($otherNode);
+       }
+
+       /**
+        * Returns the serialized instance
+        *
+        * @return string
+        */
+       public function serialize() {
+               return serialize($this->toArray());
+       }
+
+       /**
+        * Initializes the current object with a serialized instance
+        *
+        * @throws t3lib_exception if the deserialized is not identical to the current class
+        * @param string $serializedString
+        * @return void
+        */
+       public function unserialize($serializedString) {
+               $arrayRepresentation = unserialize($serializedString);
+               if ($arrayRepresentation['serializeClassName'] !== get_class($this)) {
+                       throw new t3lib_exception('Deserialized object type is not identical!');
+               }
+               $this->dataFromArray($arrayRepresentation);
+       }
+
+       /**
+        * Returns the collection in an array representation for e.g. serialization
+        *
+        * @return array
+        */
+       public function toArray() {
+               $arrayRepresentation = array(
+                       'serializeClassName' => get_class($this),
+               );
+
+               $iterator = $this->getIterator();
+               while ($iterator->valid()) {
+                       $arrayRepresentation[] = $iterator->current()->toArray();
+                       $iterator->next();
+               }
+
+               return $arrayRepresentation;
+       }
+
+       /**
+        * Sets the data of the node collection by a given array
+        *
+        * @param array $data
+        * @return void
+        */
+       public function dataFromArray($data) {
+               unset($data['serializeClassName']);
+               foreach ($data as $index => $nodeArray) {
+                       $node = t3lib_div::makeInstance($nodeArray['serializeClassName'], $nodeArray);
+                       $this->offsetSet($index, $node);
+               }
+       }
+}
diff --git a/t3lib/tree/class.t3lib_tree_sortednodecollection.php b/t3lib/tree/class.t3lib_tree_sortednodecollection.php
new file mode 100644 (file)
index 0000000..667f32e
--- /dev/null
@@ -0,0 +1,127 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Sorted Tree Node Collection
+ *
+ * Note: This collection works only with integers as offset keys and not
+ * with much datasets. You have been warned!
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_SortedNodeCollection extends t3lib_tree_NodeCollection {
+       /**
+        * Checks if a specific node is inside the collection
+        *
+        * @param t3lib_tree_Node $node
+        * @return boolean
+        */
+       public function contains(t3lib_tree_Node $node) {
+               return $this->offsetOf($node) !== -1;
+       }
+
+       /**
+        * Returns the offset key of given node
+        *
+        * @param t3lib_tree_Node $node
+        * @return int
+        */
+       protected function offsetOf(t3lib_tree_Node $node) {
+               return $this->binarySearch($node, 0, $this->count() - 1);
+       }
+
+       /**
+        * Binary search that returns the offset of a given node
+        *
+        * @param t3lib_tree_Node $node
+        * @param int $start
+        * @param int $end
+        * @return int
+        */
+       protected function binarySearch(t3lib_tree_Node $node, $start, $end) {
+               if ((!$start && ($end - $start) >= 2) || ($end - $start) > 2) {
+                       $divider = ceil(($end - $start) / 2);
+                       if ($this->offsetGet($divider)->equals($node)) {
+                               return $divider;
+                       } elseif ($this->offsetGet($divider)->compareTo($node) > 0) {
+                               return $this->binarySearch($node, $start , $divider - 1);
+                       } else {
+                               return $this->binarySearch($node, $divider + 1 , $end);
+                       }
+               } else {
+                       if ($this->offsetGet($start)->equals($node)) {
+                               return $start;
+                       } elseif ($this->offsetGet($end)->equals($node)) {
+                               return $end;
+                       } else {
+                               return -1;
+                       }
+               }
+       }
+
+       /**
+        * Normalizes the array by reordering the keys
+        *
+        * @return void
+        */
+       protected function normalize() {
+               $nodes = array();
+               foreach ($this as $node) {
+                       $nodes[] = $node;
+               }
+               $this->exchangeArray($nodes);
+       }
+
+       /**
+        * Adds a node to the internal list in a sorted approach
+        *
+        * @param t3lib_tree_Node $node
+        * @return void
+        */
+       public function addNode(t3lib_tree_Node $node) {
+               $this->append($node);
+               $this->asort();
+               $this->normalize();
+       }
+
+       /**
+        * Removes a specific node from the internal array
+        *
+        * @param t3lib_tree_Node $node
+        * @return void
+        */
+       public function removeNode(t3lib_tree_Node $node) {
+               $offset = $this->offsetOf($node);
+               if ($offset !== -1) {
+                       $this->offsetUnset($offset);
+                       $this->normalize();
+               }
+       }
+}
diff --git a/t3lib/tree/extdirect/class.t3lib_tree_extdirect_abstractextjstree.php b/t3lib/tree/extdirect/class.t3lib_tree_extdirect_abstractextjstree.php
new file mode 100644 (file)
index 0000000..866c03f
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract ExtJS tree based on ExtDirect
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_tree_extdirect_AbstractExtJsTree extends t3lib_tree_AbstractTree {
+       /**
+        * State Provider
+        *
+        * @var t3lib_tree_AbstractStateProvider
+        */
+       protected $stateProvider = NULL;
+
+       /**
+        * @param t3lib_tree_AbstractStateProvider $stateProvider
+        * @return void
+        */
+       public function setStateProvider(t3lib_tree_AbstractStateProvider $stateProvider) {
+               $this->stateProvider = $stateProvider;
+       }
+
+       /**
+        * @return t3lib_tree_AbstractStateProvider
+        */
+       public function getStateProvider() {
+               return $this->stateProvider;
+       }
+
+       /**
+        * Fetches the next tree level
+        *
+        * @abstract
+        * @param t3lib_tree_Node $node
+        * @return array
+        */
+       abstract public function getNextTreeLevel(t3lib_tree_Node $node);
+}
diff --git a/t3lib/tree/renderer/class.t3lib_tree_renderer_abstract.php b/t3lib/tree/renderer/class.t3lib_tree_renderer_abstract.php
new file mode 100644 (file)
index 0000000..9ab9731
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract Renderer
+ *
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+abstract class t3lib_tree_renderer_Abstract {
+       /**
+        * Renders a node recursive or just a single instance
+        *
+        * @param t3lib_tree_RepresentationNode $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       abstract public function renderNode(t3lib_tree_RepresentationNode $node, $recursive = TRUE);
+
+       /**
+        * Renders a node collection recursive or just a single instance
+        *
+        * @param t3lib_tree_NodeCollection $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       abstract public function renderNodeCollection(t3lib_tree_NodeCollection $collection, $recursive = TRUE);
+
+       /**
+        * Renders an tree recursive or just a single instance
+        *
+        * @param t3lib_tree_AbstractTree $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       abstract public function renderTree(t3lib_tree_AbstractTree $tree, $recursive = TRUE);
+}
diff --git a/t3lib/tree/renderer/class.t3lib_tree_renderer_unorderedlist.php b/t3lib/tree/renderer/class.t3lib_tree_renderer_unorderedlist.php
new file mode 100644 (file)
index 0000000..92f21e4
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 TYPO3 Tree Team <http://forge.typo3.org/projects/typo3v4-extjstrees>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Renderer for unordered lists
+ *
+ * @author Steffen Ritter <info@steffen-ritter.net>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_renderer_UnorderedList extends t3lib_tree_renderer_Abstract {
+       /**
+        * recursion level
+        *
+        * @var int
+        */
+       protected $recursionLevel = 0;
+
+       /**
+        * Renders a node recursive or just a single instance
+        *
+        * @param t3lib_tree_RepresentationNode $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       public function renderNode(t3lib_tree_RepresentationNode $node, $recursive = TRUE) {
+               $code = '<li><span class="' . $node->getIcon() .'">&nbsp;</span>' . $node->getLabel();
+               if ($recursive && $node->getChildNodes() !== NULL) {
+                       $this->recursionLevel++;
+                       $code .= $this->renderCollection($node->getChildNodes());
+                       $this->recursionLevel--;
+
+               }
+               $code .= '</li>';
+               return $code;
+       }
+
+       /**
+        * Renders a node collection recursive or just a single instance
+        *
+        * @param t3lib_tree_NodeCollection $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       public function renderTree(t3lib_tree_AbstractTree $tree, $recursive = TRUE) {
+               $this->recursionLevel = 0;
+               $code = '<ul class="level' . $this->recursionLevel . '" style="margin-left:10px">';
+               $code .= $this->renderNode($tree->getRoot(), $recursive);
+               $code .= '</ul>';
+               return $code;
+       }
+
+       /**
+        * Renders an tree recursive or just a single instance
+        *
+        * @param t3lib_tree_AbstractTree $node
+        * @param bool $recursive
+        * @return mixed
+        */
+       public function renderNodeCollection(t3lib_tree_NodeCollection $collection, $recursive = TRUE) {
+               $code = '<ul class="level' . $this->recursionLevel . '" style="margin-left:10px">';
+               foreach($collection as $node) {
+                       $code .= $this->renderNode($node, $recursive);
+               }
+               $code .= '</ul>';
+               return $code;
+       }
+}
diff --git a/tests/t3lib/tree/fixtures/serialized.txt b/tests/t3lib/tree/fixtures/serialized.txt
new file mode 100644 (file)
index 0000000..4efe3e3
--- /dev/null
@@ -0,0 +1 @@
+a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";a:11:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:1;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:2;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:3;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:4;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:5;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:5;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:6;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:6;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:7;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:7;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:8;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:8;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}i:9;a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";a:6:{s:18:"serializeClassName";s:25:"t3lib_tree_NodeCollection";i:0;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:0;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:1;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:1;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:2;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:2;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:3;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:3;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}i:4;a:9:{s:18:"serializeClassName";s:29:"t3lib_tree_RepresentationNode";s:2:"id";i:4;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";i:9;s:10:"parentNode";a:4:{s:18:"serializeClassName";s:15:"t3lib_tree_Node";s:2:"id";s:4:"Root";s:10:"parentNode";s:0:"";s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";}s:10:"childNodes";s:0:"";s:5:"label";s:7:"SubTest";s:4:"type";s:4:"Type";s:5:"class";s:5:"Class";s:4:"icon";s:4:"Icon";s:14:"callbackAction";s:15:"Callback Action";}}}}}
diff --git a/tests/t3lib/tree/t3lib_tree_nodeTest.php b/tests/t3lib/tree/t3lib_tree_nodeTest.php
new file mode 100644 (file)
index 0000000..88a9d10
--- /dev/null
@@ -0,0 +1,108 @@
+<?php\r
+/***************************************************************\r
+*  Copyright notice\r
+*\r
+*  (c) 2010 Stefan Galinski <stefan.galinski@gmail.com>\r
+*  All rights reserved\r
+*\r
+*  This script is part of the TYPO3 project. The TYPO3 project is\r
+*  free software; you can redistribute it and/or modify\r
+*  it under the terms of the GNU General Public License as published by\r
+*  the Free Software Foundation; either version 2 of the License, or\r
+*  (at your option) any later version.\r
+*\r
+*  The GNU General Public License can be found at\r
+*  http://www.gnu.org/copyleft/gpl.html.\r
+*\r
+*  This script is distributed in the hope that it will be useful,\r
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+*  GNU General Public License for more details.\r
+*\r
+*  This copyright notice MUST APPEAR in all copies of the script!\r
+***************************************************************/\r
+\r
+/**\r
+ * Testcase for class t3lib_tree_Node.\r
+ *\r
+ * @author Stefan Galinski <stefan.galinski@gmail.com>\r
+ * @package TYPO3\r
+ * @subpackage t3lib\r
+ */\r
+class t3lib_tree_NodeTest extends tx_phpunit_testcase {\r
+       public function setUp() {\r
+       }\r
+\r
+       public function tearDown() {\r
+       }\r
+\r
+       protected function setUpNodeTestData() {\r
+               $fixture = new t3lib_tree_Node;\r
+               $fixture->setId('Root');\r
+\r
+               $nodeCollection = new t3lib_tree_NodeCollection;\r
+               for ($i = 0; $i < 10; ++$i) {\r
+                       $node = new t3lib_tree_Node;\r
+                       $node->setId($i);\r
+                       $node->setParentNode($fixture);\r
+\r
+                       $subNodeCollection = new t3lib_tree_NodeCollection;\r
+                       for ($j = 0; $j < 5; ++$j) {\r
+                               $subNode = new t3lib_tree_RepresentationNode;\r
+                               $subNode->setId($j);\r
+                               $subNode->setLabel('SubTest');\r
+                               $subNode->setType('Type');\r
+                               $subNode->setClass('Class');\r
+                               $subNode->setIcon('Icon');\r
+                               $subNode->setCallbackAction('Callback Action');\r
+                               $subNode->setParentNode($node);\r
+                               $subNodeCollection->append($subNode);\r
+                       }\r
+                       $node->setChildNodes($subNodeCollection);\r
+                       $nodeCollection->append($node);\r
+               }\r
+               $fixture->setChildNodes($nodeCollection);\r
+\r
+\r
+               return $fixture;\r
+       }\r
+\r
+       /**\r
+        * @test\r
+        */\r
+       public function serializeFixture() {\r
+               $expected = trim(file_get_contents(PATH_site . 'tests/t3lib/tree/fixtures/serialized.txt'));\r
+               $fixture = $this->setUpNodeTestData();\r
+               $serializedString = trim($fixture->serialize());\r
+               $this->assertSame($expected, $serializedString);\r
+       }\r
+\r
+       /**\r
+        * @test\r
+        */\r
+       public function deserializeFixture() {\r
+               $source = trim(file_get_contents(PATH_site . 'tests/t3lib/tree/fixtures/serialized.txt'));\r
+               $node = new t3lib_tree_Node;\r
+               $node->unserialize($source);\r
+               $serializedString = $node->serialize();\r
+               $this->assertSame($source, $serializedString);\r
+       }\r
+\r
+       /**\r
+        * @test\r
+        */\r
+       public function compareNodes() {\r
+               $node = new t3lib_tree_Node(array('id' => '15'));\r
+               $otherNode = new t3lib_tree_Node(array('id' => '5'));\r
+               $compareResult = $node->compareTo($otherNode);\r
+\r
+               $otherNode->setId('25');\r
+               $compareResult = $node->compareTo($otherNode);\r
+               $this->assertSame(-1, $compareResult);\r
+\r
+               $otherNode->setId('15');\r
+               $compareResult = $node->compareTo($otherNode);\r
+               $this->assertSame(0, $compareResult);\r
+       }\r
+}\r
+?>\r
diff --git a/tests/t3lib/tree/t3lib_tree_nodecollectionTest.php b/tests/t3lib/tree/t3lib_tree_nodecollectionTest.php
new file mode 100644 (file)
index 0000000..852076c
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Stefan Galinski <stefan.galinski@gmail.com>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Testcase for class t3lib_tree_NodeCollection.
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_NodeCollectionTest extends tx_phpunit_testcase {
+       public function setUp() {
+       }
+
+       public function tearDown() {
+       }
+
+       /**
+        * @test
+        */
+       public function sortNodes() {
+               $nodeCollection = new t3lib_tree_NodeCollection(array(
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 15),
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 25),
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 5),
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 2),
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 150),
+                       array('serializeClassName' => 't3lib_tree_Node', 'id' => 67),
+               ));
+               $nodeCollection->asort();
+
+               $expected = array(2, 5, 15, 25, 67, 150);
+               $ids = array();
+               foreach ($nodeCollection as $node) {
+                       $ids[] = $node->getId();
+               }
+               $this->assertSame($expected, $ids);
+       }
+}
+?>
diff --git a/tests/t3lib/tree/t3lib_tree_sortednodecollectionTest.php b/tests/t3lib/tree/t3lib_tree_sortednodecollectionTest.php
new file mode 100644 (file)
index 0000000..4d7b7b7
--- /dev/null
@@ -0,0 +1,124 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Stefan Galinski <stefan.galinski@gmail.com>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Testcase for class t3lib_tree_SortedNodeCollection.
+ *
+ * @author Stefan Galinski <stefan.galinski@gmail.com>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+class t3lib_tree_SortedNodeCollectionTest extends tx_phpunit_testcase {
+       public function setUp() {
+       }
+
+       public function tearDown() {
+       }
+
+       protected function createTestCollection() {
+               $nodeCollection = new t3lib_tree_SortedNodeCollection();
+
+               $node = new t3lib_tree_Node(array('id' => 5));
+               $nodeCollection->addNode($node);
+
+               $node = new t3lib_tree_Node(array('id' => 15));
+               $nodeCollection->addNode($node);
+
+               $node = new t3lib_tree_Node(array('id' => 3));
+               $nodeCollection->addNode($node);
+
+               return $nodeCollection;
+       }
+
+       protected function createTestCollectionWithTwoNodes() {
+               $nodeCollection = new t3lib_tree_SortedNodeCollection();
+
+               $node = new t3lib_tree_Node(array('id' => 5));
+               $nodeCollection->addNode($node);
+
+               $node = new t3lib_tree_Node(array('id' => 3));
+               $nodeCollection->addNode($node);
+
+               return $nodeCollection;
+       }
+
+       /**
+        * @test
+        */
+       public function addNodesSorted() {
+               $nodeCollection = $this->createTestCollection();
+
+               $expected = array(3, 5, 15);
+               $ids = array();
+               foreach ($nodeCollection as $node) {
+                       $ids[] = $node->getId();
+               }
+               $this->assertSame($expected, $ids);
+       }
+
+       /**
+        * @test
+        */
+       public function removeNodeByNodeId() {
+               $nodeCollection = $this->createTestCollection();
+               $node = new t3lib_tree_Node(array('id' => '5'));
+               $nodeCollection->removeNode($node);
+
+               $expected = array(3, 15);
+               $ids = array();
+               foreach ($nodeCollection as $node) {
+                       $ids[] = $node->getId();
+               }
+               $this->assertSame($expected, $ids);
+       }
+
+       /**
+        * @test
+        */
+       public function collectionContainsNode() {
+               $nodeCollection = $this->createTestCollection();
+               $node = new t3lib_tree_Node(array('id' => 5));
+               $this->assertTrue($nodeCollection->contains($node));
+       }
+
+       /**
+        * @test
+        */
+       public function searchDataWithBinarySearch() {
+               $nodeCollection = $this->createTestCollection();
+               $node = new t3lib_tree_Node(array('id' => 15));
+               $this->assertTrue($nodeCollection->contains($node));
+
+               $node = new t3lib_tree_Node(array('id' => 99));
+               $this->assertFalse($nodeCollection->contains($node));
+
+               $nodeCollection = $this->createTestCollectionWithTwoNodes();
+               $node = new t3lib_tree_Node(array('id' => 3));
+               $this->assertTrue($nodeCollection->contains($node));
+
+               $node = new t3lib_tree_Node(array('id' => 99));
+               $this->assertFalse($nodeCollection->contains($node));
+       }
+}
+?>