Package muntjac :: Package ui :: Package treetable :: Module collapsible
[hide private]
[frames] | no frames]

Source Code for Module muntjac.ui.treetable.collapsible

 1  # Copyright (C) 2012 Vaadin Ltd.  
 2  # Copyright (C) 2012 Richard Lincoln 
 3  #  
 4  # Licensed under the Apache License, Version 2.0 (the "License");  
 5  # you may not use this file except in compliance with the License.  
 6  # You may obtain a copy of the License at  
 7  #  
 8  #     http://www.apache.org/licenses/LICENSE-2.0  
 9  #  
10  # Unless required by applicable law or agreed to in writing, software  
11  # distributed under the License is distributed on an "AS IS" BASIS,  
12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13  # See the License for the specific language governing permissions and  
14  # limitations under the License. 
15   
16  from muntjac.data import container 
17   
18   
19 -class ICollapsible(container.IHierarchical, container.IOrdered):
20 """Container needed by large lazy loading hierarchies displayed in 21 TreeTable. 22 23 Container of this type gets notified when a subtree is opened/closed 24 in a component displaying its content. This allows container to lazy 25 load subtrees and release memory when a sub-tree is no longer displayed. 26 27 Methods from L{IOrdered} (and from L{IIndexed} if implemented) are 28 expected to work as in "preorder" of the currently visible hierarchy. 29 This means for example that the return value of size method changes 30 when subtree is collapsed/expanded. In other words items in collapsed 31 sub trees should be "ignored" by container when the container is accessed 32 with methods introduced in L{IOrdered} or L{IIndexed}. From the accessors 33 point of view, items in collapsed subtrees don't exist. 34 """ 35
36 - def setCollapsed(self, itemId, collapsed):
37 """Collapsing the L{Item} indicated by C{itemId} hides all 38 children, and their respective children, from the L{Container}. 39 40 If called on a leaf L{Item}, this method does nothing. 41 42 @param itemId: 43 the identifier of the collapsed L{Item} 44 @param collapsed: 45 True if you want to collapse the children below 46 this L{Item}. False if you want to uncollapse the 47 children. 48 """ 49 raise NotImplementedError
50 51
52 - def isCollapsed(self, itemId):
53 """Checks whether the L{Item}, identified by C{itemId} is 54 collapsed or not. 55 56 If an L{Item} is "collapsed" its children are not included in 57 methods used to list Items in this container. 58 59 @param itemId: 60 The L{Item}'s identifier that is to be checked. 61 @return: C{True} iff the L{Item} identified by C{itemId} is 62 currently collapsed, otherwise C{False}. 63 """ 64 raise NotImplementedError
65