292 self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs) |
292 self._cw.view(__vid, rset, __fallback_vid, w=self.w, **kwargs) |
293 self.wview = wview |
293 self.wview = wview |
294 self.call(**kwargs) |
294 self.call(**kwargs) |
295 return |
295 return |
296 getlayout = self._cw.vreg['components'].select |
296 getlayout = self._cw.vreg['components'].select |
|
297 layout = getlayout('layout', self._cw, **self.layout_select_args()) |
|
298 layout.render(w) |
|
299 |
|
300 def layout_select_args(self): |
297 try: |
301 try: |
298 # XXX ensure context is given when the component is reloaded through |
302 # XXX ensure context is given when the component is reloaded through |
299 # ajax |
303 # ajax |
300 context = self.cw_extra_kwargs['context'] |
304 context = self.cw_extra_kwargs['context'] |
301 except KeyError: |
305 except KeyError: |
302 context = self.cw_propval('context') |
306 context = self.cw_propval('context') |
303 layout = getlayout('layout', self._cw, rset=self.cw_rset, |
307 return dict(rset=self.cw_rset, row=self.cw_row, col=self.cw_col, |
304 row=self.cw_row, col=self.cw_col, |
308 view=self, context=context) |
305 view=self, context=context) |
|
306 layout.render(w) |
|
307 |
309 |
308 def init_rendering(self): |
310 def init_rendering(self): |
309 """init rendering callback: that's the good time to check your component |
311 """init rendering callback: that's the good time to check your component |
310 has some content to display. If not, you can still raise |
312 has some content to display. If not, you can still raise |
311 :exc:`EmptyComponent` to inform it should be skipped. |
313 :exc:`EmptyComponent` to inform it should be skipped. |
385 try: |
387 try: |
386 entity = kwargs['entity'] |
388 entity = kwargs['entity'] |
387 except KeyError: |
389 except KeyError: |
388 entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0) |
390 entity = self.cw_rset.get_entity(self.cw_row or 0, self.cw_col or 0) |
389 self.entity = entity |
391 self.entity = entity |
|
392 |
|
393 def layout_select_args(self): |
|
394 args = super(EntityCtxComponent, self).layout_select_args() |
|
395 args['entity'] = self.entity |
|
396 return args |
390 |
397 |
391 @property |
398 @property |
392 def domid(self): |
399 def domid(self): |
393 return domid(self.__regid__) + unicode(self.entity.eid) |
400 return domid(self.__regid__) + unicode(self.entity.eid) |
394 |
401 |