Exemplo n.º 1
0
    def getTag(self, paintable):
        class1 = self._widgetMappingCache.get(paintable.__class__)

        if class1 is None:
            # Client widget annotation is searched from component hierarchy
            # to detect the component that presumably has client side
            # implementation. The server side name is used in the
            # transportation, but encoded into integer strings to optimized
            # transferred data.
            class1 = paintable.__class__
            while not self.hasClientWidgetMapping(class1):
                superclass = getSuperClass(class1)
                if superclass is not None and issubclass(class1, IPaintable):
                    class1 = superclass
                else:
                    logger.warning(('No superclass of '
                            + clsname(paintable.__class__)
                            + ' has a @ClientWidget annotation. Component '
                            'will not be mapped correctly on client side.'))
                    break

            self._widgetMappingCache[paintable.__class__] = class1

        self._usedPaintableTypes.append(class1)
        return self._manager.getTagForType(class1)
Exemplo n.º 2
0
    def getTag(self, paintable):
        class1 = self._widgetMappingCache.get(paintable.__class__)

        if class1 is None:
            # Client widget annotation is searched from component hierarchy
            # to detect the component that presumably has client side
            # implementation. The server side name is used in the
            # transportation, but encoded into integer strings to optimized
            # transferred data.
            class1 = paintable.__class__
            while not self.hasClientWidgetMapping(class1):
                superclass = getSuperClass(class1)
                if superclass is not None and issubclass(class1, IPaintable):
                    class1 = superclass
                else:
                    logger.warning(
                        ('No superclass of ' + clsname(paintable.__class__) +
                         ' has a @ClientWidget annotation. Component '
                         'will not be mapped correctly on client side.'))
                    break

            self._widgetMappingCache[paintable.__class__] = class1

        self._usedPaintableTypes.append(class1)
        return self._manager.getTagForType(class1)
Exemplo n.º 3
0
 def getJavadocUrl(cls, baseUrl, clazz):
     if not baseUrl.endswith('/'):
         baseUrl += '/'
     #path = clazz.__name__.replace('\\.', '/')
     path = clsname(clazz)
     path = path.replace('\\$', '.')
     return baseUrl + path + '-class.html'
Exemplo n.º 4
0
    def getApplicationContext(cls, session, servlet):
        """Gets the application context for an HttpSession.

        @param session:
                   the HTTP session.
        @return: the application context for HttpSession.
        """
        cx = servlet.getSessionAttribute(session,
                clsname(WebApplicationContext), None)

        if cx is None:
            cx = WebApplicationContext()
            servlet.setSessionAttribute(session,
                clsname(WebApplicationContext), cx)

        if cx.session is None:
            cx.session = session

        return cx
Exemplo n.º 5
0
    def getApplicationContext(cls, session, servlet):
        """Gets the application context for an HttpSession.

        @param session:
                   the HTTP session.
        @return: the application context for HttpSession.
        """
        cx = servlet.getSessionAttribute(session,
                                         clsname(WebApplicationContext), None)

        if cx is None:
            cx = WebApplicationContext()
            servlet.setSessionAttribute(session,
                                        clsname(WebApplicationContext), cx)

        if cx.session is None:
            cx.session = session

        return cx
Exemplo n.º 6
0
    def findClassesNoTests(cls, baseClass, basePackage, ignoredPackages):
        classes = cls.findClasses(baseClass, basePackage, ignoredPackages)

        classesNoTests = list()
        for clazz in classes:
            if 'Test' not in clsname(clazz):
                testPresent = False
                #for method in clazz.getMethods():
                #    if method.isAnnotationPresent(Test):
                #        testPresent = True
                #        break
                if not testPresent:
                    classesNoTests.append(clazz)

        return classesNoTests
Exemplo n.º 7
0
    def findClassesNoTests(cls, baseClass, basePackage, ignoredPackages):
        classes = cls.findClasses(baseClass, basePackage, ignoredPackages)

        classesNoTests = list()
        for clazz in classes:
            if 'Test' not in clsname(clazz):
                testPresent = False
                #for method in clazz.getMethods():
                #    if method.isAnnotationPresent(Test):
                #        testPresent = True
                #        break
                if not testPresent:
                    classesNoTests.append(clazz)

        return classesNoTests
Exemplo n.º 8
0
    def findClasses(cls, baseClass, basePackage, ignoredPackages=None):
        if ignoredPackages == None:
            ignoredPackages = []

        classes = list()
        basePackageDirName = '/' + basePackage.replace('.', '/')
        location = cls.getResource(basePackageDirName)

        if not exists(location):
            raise IOError('Directory ' + location + ' does not exist')
        cls.findPackages(location, basePackage, baseClass, classes,
                ignoredPackages)

        classes.sort(key=lambda klass: clsname(klass))

        return classes
Exemplo n.º 9
0
    def findClasses(cls, baseClass, basePackage, ignoredPackages=None):
        if ignoredPackages == None:
            ignoredPackages = []

        classes = list()
        basePackageDirName = '/' + basePackage.replace('.', '/')
        location = cls.getResource(basePackageDirName)

        if not exists(location):
            raise IOError('Directory ' + location + ' does not exist')
        cls.findPackages(location, basePackage, baseClass, classes,
                ignoredPackages)

        classes.sort(key=lambda klass: clsname(klass))

        return classes
Exemplo n.º 10
0
 def main(cls, args):
     print 'ComponentContainers'
     print '==================='
     for c in cls.getComponentContainers():
         print clsname(c)
     print
     print 'Components'
     print '=========='
     for c in cls.getComponents():
         print clsname(c)
     print
     print 'Server side classes'
     print '==================='
     for c in cls.getAllServerSideClasses():
         print clsname(c)
Exemplo n.º 11
0
 def main(cls, args):
     print 'ComponentContainers'
     print '==================='
     for c in cls.getComponentContainers():
         print clsname(c)
     print
     print 'Components'
     print '=========='
     for c in cls.getComponents():
         print clsname(c)
     print
     print 'Server side classes'
     print '==================='
     for c in cls.getAllServerSideClasses():
         print clsname(c)
Exemplo n.º 12
0
 def getIdentifier(self):
     return clsname(TreeDropCriterion)
Exemplo n.º 13
0
 def getIdentifier(self):
     return clsname(TreeDropCriterion)
Exemplo n.º 14
0
 def getIdentifier(self):
     return clsname(self.__class__)  # FIXME: Python client-side