src/pyams_utils/interfaces/tree.py
changeset 289 c8e21d7dd685
child 292 b338586588ad
equal deleted inserted replaced
-1:000000000000 289:c8e21d7dd685
       
     1 ### -*- coding: utf-8 -*- ####################################################
       
     2 ##############################################################################
       
     3 #
       
     4 # Copyright (c) 2012 Thierry Florac <tflorac AT ulthar.net>
       
     5 # All Rights Reserved.
       
     6 #
       
     7 # This software is subject to the provisions of the Zope Public License,
       
     8 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
       
     9 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
       
    10 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
       
    11 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
       
    12 # FOR A PARTICULAR PURPOSE.
       
    13 #
       
    14 ##############################################################################
       
    15 
       
    16 from zope.interface import Interface, Attribute
       
    17 
       
    18 
       
    19 class INode(Interface):
       
    20     """Tree node interface"""
       
    21 
       
    22     context = Attribute("Node's context")
       
    23 
       
    24     label = Attribute("Node's label")
       
    25 
       
    26     css_class = Attribute("Node's CSS class")
       
    27 
       
    28     order = Attribute("Node's order")
       
    29 
       
    30     def get_level(self):
       
    31         """Get depth level of current node"""
       
    32 
       
    33     def has_children(self, filter_value=None):
       
    34         """Check if current node has children"""
       
    35 
       
    36     def get_children(self, filter_value=None):
       
    37         """Get list of node children"""
       
    38 
       
    39 
       
    40 class ITree(Interface):
       
    41     """Tree interface"""
       
    42 
       
    43     def get_root_nodes(self):
       
    44         """Get list of root nodes"""