Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 # Copyright (c) 2005-2007
00002 # Authors: KSS Project Contributors (see docs/CREDITS.txt)
00003 #
00004 # This program is free software; you can redistribute it and/or modify
00005 # it under the terms of the GNU General Public License version 2 as published
00006 # by the Free Software Foundation.
00007 #
00008 # This program is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with this program; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00016 # 02111-1307, USA.
00017 
00018 from zope.interface import Interface, Attribute
00019 
00020 class IKSSCommands(Interface):
00021     'KSS commands'
00022 
00023     def addCommand(self, name, selector=None):
00024         'Add a command'
00025    
00026     def render(self, request):
00027         'All methods must use this to return their command set'
00028 
00029     def getSelector(self, type, selector):
00030         'Return selector'
00031 
00032     # more helpers for the basic selectors
00033 
00034     def getCssSelector(self, selector):
00035         'Return selector'
00036             
00037     def getHtmlIdSelector(self, selector):
00038         'Return selector'
00039 
00040 class IKSSCommand(Interface):
00041     'An KSS command'
00042 
00043     def addParam(self, name, content=''):
00044         'Add the param as is'
00045 
00046     #
00047     # Some helpers
00048     #
00049 
00050     def addUnicodeParam(self, name, content=''):
00051         'Add the param as unicode'
00052 
00053     def addStringParam(self, name, content='', encoding='utf'):
00054         'Add the param as an encoded string, by default UTF-8'
00055 
00056     def addHtmlParam(self, name, content=''):
00057         'Add the param as an HTML content.'
00058 
00059     def addXmlParam(self, name, content=''):
00060         'Add the param as XML content'
00061 
00062     def addCdataParam(self, name, content=''):
00063         'Add the param as a CDATA node'
00064 
00065     # --
00066     # Accessors, not sure if we need them
00067     # --
00068 
00069     def getName(self):
00070         ''
00071 
00072     def getSelector(self):
00073         ''
00074 
00075     def getSelectorType(self):
00076         ''
00077 
00078     def getParams(self):
00079         ''
00080 
00081 class IKSSCommandView(Interface):
00082     'View of a command set'
00083 
00084     def render():
00085         'This renders the command set'
00086 
00087 
00088 class IKSSParam(Interface):
00089     'An KSS parameter'
00090     
00091     def force_content_unicode(self):
00092         'Content must be str with ascii encoding, or unicode'
00093 
00094     def getName(self):
00095         ''
00096 
00097     def getContent(self):
00098         ''
00099 
00100 class IKSSView(Interface):
00101 
00102     commands = Attribute('An IKSSCommands object that keeps track of '
00103                          'all commands that are sent to the browser')
00104 
00105     def render(self):
00106         """Return a string representation of all KSS commands issued
00107         so far."""
00108 
00109     def getCommandSet(name):
00110         """Return the commandset called ``name`` bound to the current
00111         view."""
00112 
00113 # BBB deprecated
00114 IAzaxView = IKSSView
00115 
00116 class ICommandSet(Interface):
00117     'Methods of this class implement a command set'
00118 
00119     def getCommandSet(self, name):
00120         'Returns the command set for a given name'