root/cpsskins/branches/jmo-perspectives/controllers/slot.py

Revision 2702, 1.5 kB (checked in by jmorliaguet, 3 years ago)

- copyright year update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 ##############################################################################
2 #
3 # Copyright (c) 2005-2006 Nuxeo and Contributors.
4 # All Rights Reserved.
5 #
6 # This software is subject to the provisions of the Zope Public License,
7 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11 # FOR A PARTICULAR PURPOSE.
12 #
13 ##############################################################################
14 """
15
16 $Id$
17 """
18 __docformat__ = "reStructuredText"
19
20 from zope.interface import implements
21
22 from cpsskins.controllers import Controller
23 from cpsskins.controllers.interfaces import IController
24 from cpsskins.elements.interfaces import IDisplayable, IPresentable
25 from cpsskins.utils import getThemeManager
26
27 class SlotController(Controller):
28     """Event handler for slots.
29     """
30     implements(IController)
31
32     def added(self):
33         """What to do when the element has been added.
34         """
35         IPresentable(self.element).addPresentation()
36
37     def removed(self):
38         """What to do when the element has been removed.
39         """
40         tmutil = getThemeManager()
41         tmutil.removeDisplays(self.element)
42
43     def modified(self):
44         """What to do when the element has been modified.
45         """
46         if IDisplayable(self.element).getDisplay() is None:
47             IPresentable(self.element).addPresentation()
Note: See TracBrowser for help on using the browser.