I'll give it a shot and see how it goes, thanks for your help Igor
appreciate it!
Regards
Vyas, Anirudh
On Fri, Jul 25, 2008 at 3:03 PM, Igor Vaynberg <[EMAIL PROTECTED]>wrote:
> my advice to you, if you want to go this way, is to use wickettester
> to render the component. it is really easy to pull out the output from
> that.
>
> -igor
>
> On Fri, Jul 25, 2008 at 11:51 AM, Ricky <[EMAIL PROTECTED]> wrote:
> > Hi Igor,
> > Thanks for replying again and bearing with me, appreciate your help.
> >
> > Here is what i have so far :
> > =======================================================
> > public static final String generatePlainTextFromContainer(final
> > MarkupContainer sourceContainer) {
> > sourceContainer.visitChildren(new Component.IVisitor() {
> >
> > // Loop through each child of the markup container to do
> > setRenderBodyOnly to true.
> > public final Object component(final Component component) {
> > if (component != null) {
> > component.setRenderBodyOnly(true);
> > }
> > return CONTINUE_TRAVERSAL;
> > }
> > });
> >
> > if (!sourceContainer.hasBeenRendered()) {
> > throw new IllegalStateException("Source container has not been
> > rendered."); *// <---- Is this right?*
> > }
> >
> > // uses REGEX to strip off all HTML etc.
> > // container.getResponse( ) gives me the content and HTML that i
> > need.
> > return
> > convertHTMLToPlainText(sourceContainer.getResponse().toString());
> > }
> >
> > Now a part that i am missing is knowing "WHEN" and "WHERE" exactly should
> i
> > call this method, so that a panel or Page can be converted to plain text
> > (With COMPLETE markup). Right now, i get some markup, but some of the
> markup
> > (ESPECIALLY refreshing views) are missing altogether.
> >
> > I tried to call it onBeforeRender( ) and as well as onAfterRender( ); but
> it
> > gives an empty response. I could replace if sourceContainer has not been
> > rendered if block contents with sourceContainer.render( ) to forcefully
> > render it, but it screws other things up in the page.
> >
> > My goal is have this method being passed any PANEL or Page and be able to
> > generate plain text from it. When i pass in the panel it is UNABLE to get
> > the page so it throws an exception. So in work around i am thinking if i
> > create a Page and pass in the markup container to the constructor of the
> > page, i could add that to the page hierarchy and then get what i what i
> > want; but the issue with that is, that What ID will i put in my markup
> > HTML??
> >
> >
> > I would sincerely appreciate ideas / suggestion / responses on whether i
> am
> > going on the right track or is there a better way??
> >
> > Thanks and Regards
> > Vyas, Anirudh
> >
> > On Thu, Jul 24, 2008 at 1:47 PM, Igor Vaynberg <[EMAIL PROTECTED]>
> > wrote:
> >
> >> application.init() {
> >> getrequestcyclesettngs().addresponsefilter(new iresponsefilter() {
> >> public appendingatringbuffer filter(appendingstringbuffer
> responsebuffer)
> >> {
> >> return responsebuffer.append("<!-- generated at: "+new Date()+"
> -->");
> >> }
> >> }
> >>
> >> that is an example filter that adds a comment at the end of the html
> >>
> >> -igor
> >>
> >> On Thu, Jul 24, 2008 at 10:42 AM, Ricky <[EMAIL PROTECTED]> wrote:
> >> > Hi Igor,
> >> >
> >> > Thanks for reply!
> >> > My apologies, but could elaborate a little on IResponseFilter usage
> as a
> >> > skeletal example. I am not following Java documentation's verbiage
> that
> >> well
> >> > (sorry if i come across as dumb).
> >> >
> >> > Regards
> >> > Vyas, Anirudh
> >> >
> >> > On Wed, Jul 23, 2008 at 11:40 AM, Igor Vaynberg <
> [EMAIL PROTECTED]
> >> >
> >> > wrote:
> >> >
> >> >> see IResponseFilter.
> >> >>
> >> >> as far as spitting out text, wicket works with xml not plain text.
> but
> >> >> if you call setrenderbodyonly(true) on all components there wont be
> >> >> any xml tags left in the output.
> >> >>
> >> >> -igor
> >> >>
> >> >> On Wed, Jul 23, 2008 at 8:20 AM, Ricky <[EMAIL PROTECTED]> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > I have two questions (related) :
> >> >> > 1.) Is there a way in wicket to get Not the raw markup but markup
> >> >> > *AFTER*the actual data has been inserted? (meaning the final HTML
> as
> >> >> > we see it on
> >> >> > the page?).
> >> >> > 2.) Similar to above scenario, can you use container to spit out
> >> markup
> >> >> in
> >> >> > some other form, for example Plain Text or XML form ? (the markup
> with
> >> >> > actual data).
> >> >> >
> >> >> > I prepared a test case for the same, which used a TestPage and
> Wicket
> >> >> Tester
> >> >> > to start the page and then called
> testPage.getAssociateMarkup(true);
> >> and
> >> >> > testPage.getMarkup(). I tried to call it after doing
> testPage.render()
> >> >> but
> >> >> > no change.
> >> >> >
> >> >> >
> >> >> > Regards
> >> >> > Vyas, Anirudh
> >> >> >
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> >>
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>