Added tree management interface
authorThierry Florac <thierry.florac@onf.fr>
Wed, 15 Apr 2015 14:22:37 +0200
changeset 28 95b0d06b702d
parent 27 2a825d15513f
child 29 4bbddbc10590
Added tree management interface
src/pyams_utils/interfaces/tree.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_utils/interfaces/tree.py	Wed Apr 15 14:22:37 2015 +0200
@@ -0,0 +1,52 @@
+### -*- coding: utf-8 -*- ####################################################
+##############################################################################
+#
+# Copyright (c) 2012 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+
+# import standard packages
+
+# import Zope3 interfaces
+
+# import local interfaces
+
+# import Zope3 packages
+from zope.interface import Interface, Attribute
+
+# import local packages
+
+
+class INode(Interface):
+    """Tree node interface"""
+
+    context = Attribute("Node's context")
+
+    label = Attribute("Node's label")
+
+    css_class = Attribute("Node's CSS class")
+
+    def get_level(self):
+        """Get depth level of current node"""
+
+    def has_children(self, filter_value=None):
+        """Check if current node has children"""
+
+    def get_children(self, filter_value=None):
+        """Get list of node children"""
+
+
+class ITree(Interface):
+    """Tree interface"""
+
+    def get_root_nodes(self):
+        """Get list of root nodes"""