Add OutletContainer and check to renderer of Outlet.
This commit is contained in:
parent
369dc51779
commit
2b3cd3120c
@ -1,6 +1,7 @@
|
||||
package groowt.view.component.web.lib
|
||||
|
||||
import groowt.view.View
|
||||
import groowt.view.component.ComponentRenderException
|
||||
import groowt.view.component.runtime.DefaultComponentWriter
|
||||
|
||||
class Outlet extends DelegatingWebViewComponent {
|
||||
@ -14,6 +15,11 @@ class Outlet extends DelegatingWebViewComponent {
|
||||
@Override
|
||||
protected View getDelegate() {
|
||||
return { Writer w ->
|
||||
if (!context.hasAncestor(OutletContainer)) {
|
||||
throw new ComponentRenderException(
|
||||
"<Outlet> is being used outside of a component implementing OutletContainer."
|
||||
)
|
||||
}
|
||||
def cw = new DefaultComponentWriter(w, context.renderContext, context)
|
||||
givenChildren.each { cw << it }
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package groowt.view.component.web.lib
|
||||
|
||||
import groowt.view.component.web.WebViewComponent
|
||||
|
||||
interface OutletContainer extends WebViewComponent {}
|
Loading…
Reference in New Issue
Block a user