cybertools/container
helmutm 7c8fbb6532 reporter.batch basically finished
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1237 fd906abe-77d9-0310-91a1-e0d9ade77398
2006-06-02 08:39:29 +00:00
..
__init__.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
configure.zcml reporter.batch basically finished 2006-06-02 08:39:29 +00:00
contents.pt reporter.batch basically finished 2006-06-02 08:39:29 +00:00
cybertools.container-configure.zcml Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
DEPENDENCIES.cfg Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
interfaces.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
ordered.py reporter.batch basically finished 2006-06-02 08:39:29 +00:00
README.txt Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:51:45 +00:00
SETUP.cfg Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00
tests.py Refactored ordered container stuff out of loops package and put into cybertools.container 2006-01-27 08:21:24 +00:00

Ordered Containers
==================

  ($Id$)

Let's add an ordered container and place some objects in it:
      
  >>> from zope.app.container.ordered import OrderedContainer
  >>> c1 = OrderedContainer()
  >>> c1['sub1'] = OrderedContainer()
  >>> c1['sub2'] = OrderedContainer()
  >>> c1['sub3'] = OrderedContainer()
  >>> c1['sub4'] = OrderedContainer()
  >>> c1.keys()
  ['sub1', 'sub2', 'sub3', 'sub4']
      
A special management view provides methods for moving objects down, up,
to the bottom, and to the top
      
  >>> from cybertools.container.ordered import OrderedContainerView
  >>> from zope.publisher.browser import TestRequest
  >>> view = OrderedContainerView(c1, TestRequest())
  >>> view.move_bottom(('sub3',))
  >>> c1.keys()
  ['sub1', 'sub2', 'sub4', 'sub3']
  >>> view.move_up(('sub4',), 1)
  >>> c1.keys()
  ['sub1', 'sub4', 'sub2', 'sub3']
  >>> view.move_top(('sub2',))
  >>> c1.keys()
  ['sub2', 'sub1', 'sub4', 'sub3']
  >>> view.move_down(('sub2',), 2)
  >>> c1.keys()
  ['sub1', 'sub4', 'sub2', 'sub3']