Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2012 Vaadin Ltd. 2 # Copyright (C) 2012 Richard Lincoln 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 1618 """Annotation defining the default client side counterpart in GWT 19 terminal for L{Component}. 20 21 With this annotation server side Muntjac component is marked to have 22 a client side counterpart. The value of the annotation is the class 23 of client side implementation. 24 25 Note, even though client side implementation is needed during 26 development, one may safely remove them from the classpath of the 27 production server. 28 """ 2976 7731 32 #: the client side counterpart for the annotated component 33 self.widget = widget 34 35 # Depending on the used WidgetMap generator, these optional hints 36 # may be used to define how the client side components are loaded 37 # by the browser. The default is to eagerly load all widgets 38 # L{EagerWidgetMapGenerator}, but if the 39 # L{WidgetMapGenerator} is used by the widgetset, these load 40 # style hints are respected. 41 # 42 # Lazy loading of a widget implementation means the client side 43 # component is not included in the initial JavaScript application 44 # loaded when the application starts. Instead the implementation 45 # is loaded to the client when it is first needed. Lazy loaded 46 # widget can be achieved by giving L{LoadStyle#LAZY} value 47 # in ClientWidget annotation. 48 # 49 # Lazy loaded widgets don't stress the size and startup time of 50 # the client side as much as eagerly loaded widgets. On the other 51 # hand there is a slight latency when lazy loaded widgets are first 52 # used as the client side needs to visit the server to fetch the 53 # client side implementation. 54 # 55 # The L{LoadStyle#DEFERRED} will also not stress the initially 56 # loaded JavaScript file. If this load style is defined, the widget 57 # implementation is preemptively loaded to the browser after the 58 # application is started and the communication to server idles. 59 # This load style kind of combines the best of both worlds. 60 # 61 # Fine tunings to widget loading can also be made by overriding 62 # L{WidgetMapGenerator} in the GWT module. Tunings might be 63 # helpful if the end users have slow connections and especially if 64 # they have high latency in their network. The 65 # L{CustomWidgetMapGenerator} is an abstract generator 66 # implementation for easy customization. Muntjac package also 67 # includes L{LazyWidgetMapGenerator} that makes as many 68 # widgets lazily loaded as possible. 69 70 #: the hint for the widget set generator how the client side 71 # implementation should be loaded to the browser 72 if loadStyle is None: 73 self.loadStyle = LoadStyle.DEFERRED 74 else: 75 self.loadStyle = loadStyle79 #: The widget is included in the initial JS sent to the client. 80 EAGER = 'EAGER' 81 82 #: Not included in the initial set of widgets, but added to queue from 83 # which it will be loaded when network is not busy or the 84 # implementation is required. 85 DEFERRED = 'DEFERRED' 86 87 #: Loaded to the client only if needed. 88 LAZY = 'LAZY'89
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Aug 31 14:06:53 2013 | http://epydoc.sourceforge.net |