What is your use case? Why do you want to do that? Juergen
On 8/16/06, Petr Sakar <[EMAIL PROTECTED]> wrote: > Hello, > can you please give some hint how to create component, which does not nead > markup and to which I can add children ? > The intent is to be able create pages without need to create html for such > pages at all - basically rendering driven by component structure and not > by markup. > > I've tryied it like following and it is working for me now, but most > probably there is better / more elegant way or some problem I do not see. > > > Thank you in advance for any hints and comments. > > saki > > > > public class Panel extends WebMarkupContainer > { > > ... > > /** > * Renders this container. > */ > protected void onRender(MarkupStream markupStream) > { > Response response = getResponse(); > boolean writeTag = !getRenderBodyOnly(); > if (writeTag) { > response.write(markupStream.get().toCharSequence()); > } > layoutManager.startLayout(response); > > > int currentIndex = markupStream.getCurrentIndex(); > int iteration = 0; > // Iterate through children on this container > for (Iterator iterator = iterator(); iterator.hasNext();) > { > iteration ++; > // Get next child component > final Component component = (Component)iterator.next(); > > if (component == null) > { > throw new WicketRuntimeException( > "Loop item is null. Probably > the number of loop iterations were > changed between onBeginRequest and render time."); > } > layoutManager.startLayout(response, component); > > // Rewind to start of markup for kids > markupStream.setCurrentIndex(currentIndex); > if (component instanceof Panel) { > component.render(markupStream); > } else if (component instanceof > WebMarkupContainerWithAssociatedMarkup) { > WebMarkupContainerWithAssociatedMarkup > markupContainer = > (WebMarkupContainerWithAssociatedMarkup) component; > markupContainer.renderAssociatedMarkup("panel", > "exceptionMessage");//(" saki exceptionMessage"); > } else if (component instanceof MarkupContainer) { > MarkupContainer markupContainer = > (MarkupContainer) component; > MarkupStream markupStream2 = > getApplication().getMarkupCache().getMarkupStream(markupContainer); > component.render(markupStream2); > } else { > component.render(); > } > layoutManager.endLayout(response, component); > } > layoutManager.endLayout(response); > > > > markupStream.setCurrentIndex(currentIndex); > while (!markupStream.atCloseTag()) > markupStream.next(); > if (writeTag) { > response.write(markupStream.get().toCharSequence()); > } > } > > ... > > } > > > > Notes: > - layoutManager is just just to write some markup around children (for > example table) > - html files must be created for components whose markup is normally in > parent component (eg. TextField, Form, ...). > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wicket-develop mailing list > Wicket-develop@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-develop > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop