# HG changeset patch # User Thierry Florac # Date 1429100557 -7200 # Node ID 95b0d06b702d5004686c0a00f4ef10337f2a1710 # Parent 2a825d15513f406eec3579e1fe323c3b2490e5d7 Added tree management interface diff -r 2a825d15513f -r 95b0d06b702d 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 +# 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"""