Logo Search packages:      
Sourcecode: zope-cmfplone version File versions

OrderedContainer.py

from interface import Interface, Attribute

##class IOrderedContainer(Interface):
##    """ An interface for folders that support ordering
##    of items """
##
##    def moveObject(id, position):
##        """ Move an object to a given position """
##
##    def getObjectPosition(id):
##        """ Get the position (order) of an object given its id """
##
##    def moveObjectUp(id, steps=1, RESPONSE=None):
##        """ Move the object up 'steps' number of steps """
##
##    def moveObjectDown(id, steps=1, RESPONSE=None):
##        """ Move the object down 'steps' number of steps """
##
##    def moveObjectTop(id, RESPONSE=None):
##        """ Move the object the first position """
##
##    def moveObjectBottom(id, RESPONSE=None):
##        """ Move the object to the last position """

from Interface import Interface

#Portions of this class was copy/pasted from the OFS.IOrderSupport from
#Zope2.7.  This class is licensed under the ZPL 2.0 as stated here:
#http://www.zope.org/Resources/ZPL
#Zope Public License (ZPL) Version 2.0
#This software is Copyright (c) Zope Corporation (tm) and Contributors. All rights reserved.

00033 class IOrderedContainer(Interface):
    """ Ordered Container interface.

    This interface provides a common mechanism for maintaining ordered
    collections.
    """

00040     def moveObjectsByDelta(ids, delta, subset_ids=None):
        """ Move specified sub-objects by delta.

        If delta is higher than the possible maximum, objects will be moved to
        the bottom. If delta is lower than the possible minimum, objects will
        be moved to the top.

        If subset_ids is not None, delta will be interpreted relative to the
        subset specified by a sequence of ids. The position of objects that
        are not part of this subset will not be changed.

        The order of the objects specified by ids will always be preserved. So
        if you don't want to change their original order, make sure the order
        of ids corresponds to their original order.

        If an object with id doesn't exist an error will be raised.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00062     def moveObjectsUp(ids, delta=1):
        """ Move specified sub-objects up by delta in container.

        If no delta is specified, delta is 1. See moveObjectsByDelta for more
        details.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00073     def moveObjectsDown(ids, delta=1):
        """ Move specified sub-objects down by delta in container.

        If no delta is specified, delta is 1. See moveObjectsByDelta for more
        details.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00084     def moveObjectsToTop(ids):
        """ Move specified sub-objects to top of container.

        See moveObjectsByDelta for more details.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00094     def moveObjectsToBottom(ids):
        """ Move specified sub-objects to bottom of container.

        See moveObjectsByDelta for more details.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00104     def orderObjects(key, reverse=None):
        """ Order sub-objects by key and direction.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

00112     def getObjectPosition(id):
        """ Get the position of an object by its id.

        Permission -- Access contents information

        Returns -- Position
        """

00120     def moveObjectToPosition(id, position):
        """ Moves specified object to absolute position.

        Permission -- Manage properties

        Returns -- Number of moved sub-objects
        """

Generated by  Doxygen 1.6.0   Back to index