Tnx for the example Juergen, I'm sure this will be useful.


Juergen Donnerstag wrote:

That that is true as well. You can not render a component inside a
view, because these component by default get removed onEndRequest for
optimization reason. I think you can avoid it by calling
listView.setOptimizedxxxx()

Juergen

On 12/16/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi,

I did some more testing. Instead of my original case, I tried to render a 
component
hiearchy which is at upper level in my application and it works !

Could the problem in my original case be that the component I'm trying
to render is inside pageable listview ?

  Ari S.

----- Original Message -----
From: "Ari Suutari" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 2:29 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Ok,

(Sorry for horrible formatting of this e-mail)

I took code from AjaxHandler.java to my TestAjaxHandler, so it looks
like this:

import wicket.*;
import wicket.protocol.http.*;
import wicket.protocol.http.servlet.ServletWebRequest;
import wicket.response.StringResponse;
import wicket.util.resource.*;

public class TestAjaxHandler extends AjaxHandler
{
protected String getImplementationId()
{
return "test";
}


protected IResourceStream getResponse()
{
Component[] components = new Component[1];
components[0] = getComponent();

return render(components);
}

public IResourceStream render(final Component[] components)
{

StringBufferResourceStream response = new 
StringBufferResourceStream("text/xml");
response.append("<?xml version='1.0' encoding='utf-8'?>");
response.append("<components>");
if (components != null)
{
 Response resp = new StringResponse();
 RequestCycle requestCycle = RequestCycle.get();
 Response origResponse = requestCycle.getResponse();
 try
 {
  requestCycle.setResponse(resp);
  for (int i=0; i < components.length; i++)
  {
   resp.write("<component cssid=''><![CDATA[");
   Component component = components[i];
   boolean renderBodyOnly = component.getRenderBodyOnly();
   try
   {
    component.setRenderBodyOnly(true);
    component.render();
   }
   catch (Exception ex)
   {
    resp.write(ex.toString());
   }
   finally
   {
    component.setRenderBodyOnly(renderBodyOnly);
   }
   resp.write("]]<component>");
  }
 }
 finally
 {
  requestCycle.setResponse(origResponse);
 }
 response.append(resp.toString());
}
response.append("</components>");

return response;
}
}
-------------------------------

On my panel, I have a Label, like this:

Label l = new Label("ajaxTest");
l.add(new TestAjaxHandler());
add(l);

When I invoke the ajax handler, the xml I got back is:

<?xml version='1.0' encoding='utf-8'?><components><component 
cssid=''><![CDATA[java.lang.IndexOutOfBoundsException: Index: 28,
Size: 17]]<component></components>

The exception occurs somewhere where markup stream is initialized (I can try to 
debug there is is helpful).
Wicket is compiled from cvs as of today about 14:00 EET.

  Ari S.




----- Original Message -----
From: "Ari Suutari" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 1:38 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Got it.

  Ari S.

----- Original Message -----
From: "Juergen Donnerstag" <[EMAIL PROTECTED]>
To: <wicket-user@lists.sourceforge.net>
Sent: Friday, December 16, 2005 1:35 PM
Subject: Re: [Wicket-user] How to render part of page (with ajax maybe)


Try http://www.wicket-library.com/wicket-phonebook.zip to download it.

Juergen

On 12/16/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
sourceforge is currently blocking all mails with .zip attachments.
I'll make it available for download tonight.

Juergen

On 12/16/05, Juergen Donnerstag <[EMAIL PROTECTED]> wrote:
Please find attached a extended version of the phonebook example which
uses an AjaxHandler to handle the CheckBox and the Counter. Note: this
example is only working with a very recent version of wicket CVS HEAD.
And please note this is a starting point only (which is why it is not
in cvs). It is not a sophisticated solution.

I guess you found the dojo and scriptacoulous examples in wicket-stuff already?

Juergen

On 12/16/05, Ari Suutari <[EMAIL PROTECTED]> wrote:
Hi,

okay I'm kinda lost and I think i'm either doing somehting fundamentally wrong 
or missing something really stupid......
  Me too. I tried to study the junit test that (re)renders a component, but
  cannot get it working with browser. What I tried was to create AjaxHandler to
  component and attempt to render that component in ajax handler's respond 
method:

protected void respond()
{
RequestCycle cycle = RequestCycle.get();
cycle.setRequestTarget(new ComponentRequestTarget(c));
}

     It spits out following exception:

[http-80-Processor24] ERROR Index: 30, Size: 17
java.lang.IndexOutOfBoundsException: Index: 30, Size: 17
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at java.util.Collections$UnmodifiableList.get(Collections.java:1155)
at wicket.markup.Markup.get(Markup.java:143)
at wicket.markup.MarkupStream.get(MarkupStream.java:324)
at wicket.markup.MarkupStream.setCurrentIndex(MarkupStream.java:202)
at wicket.Component.validateMarkupStream(Component.java:1442)
at wicket.markup.html.panel.Panel.onRender(Panel.java:79)

  When I look at markupStream members in debugger, the don't look like markup 
of my panel.
  I would really appreciate a list of steps required to get a component 
rendered so that
  result goes back to browser. I don't need a complete implementation as I can 
use cvs version
  of wicket and fill in missing parts myself (if they are not of huge) but 
currently I must admit that I don't
  know where to start from.

      Ari S.


this is the error I get when i call someRequestCycle.request(myLabel) .... I 
studied the simplepageTest rerender calls, I
created
a ComponentRequestTarget, set the target, and tried a lot of other things...... 
i keep getting the session error.

10:52:51.477 WARN!! Exception for /dojo/app?path=2:link1&interface=ILinkListener
java.lang.IllegalStateException: Internal Error: Page not attached to session.

the generated page is

<span wicket:id="wid">replaced</span><html>
<head>
<title>Error 500 Internal+Error%3A+Page+not+attached+to+session</title>
</head>
<body>
<h2>HTTP ERROR: 500 Internal+Error%3A+Page+not+attached+to+session</h2>
<p>RequestURI=/dojo/app</p>
<p><i><small><a href="http://jetty.mortbay.org";>Powered by 
Jetty://</a></small></i></p>
                                                                               
</body>
</html>



Eelco Hillenius wrote:

Yeah. I'm just saying that you /should/ work with request targets
instead of trying to render the component directly.

Eelco

On 12/2/05, Johan Compagner <[EMAIL PROTECTED]> wrote:

that is what RequestCycle.request(component) does (and how the
SimplePageTest works)


On 12/2/05, Eelco Hillenius < [EMAIL PROTECTED]> wrote:

you should use requestcycle.setResponseTarget with ComponentRequestTarget

Eelco

On 12/2/05, Marco van de Haar <[EMAIL PROTECTED]> wrote:

Is there any concrete (simple) code example for rerendering a part of a
page? I tried myRequestCycle.request(myComponent), but all I got were
huge errors in my console.


Ari Suutari wrote:


Hi,


Project wicket-stuff contains already some AJAX components
(scriptaculous and dojo based ones). Wicket core contain a

AjaxHandler

and we provide a yet experimental component level re-render
(requestcycle.render(component). Though the latter one is no yet
accessible through a URL (that piece of code is missing; we've only
tested it with junit tests). So, yes some parts have been done, it is
not ready yet, but I think we are on a good way and some features can
be used already. Because it is in an dev stage, feedback is very much
welcome.

 So, If I create my own component (that I'm going to re-render
 with ajax) and add an interface based on IRequestListener I
 could build an URL that calls my component via that interface
 and returns re-rendering of component using
requestcycle.render(this) ?

 Or is there a better way ? I took a look how IOnChangeListener is
 implemented on DropDownChoice and it looks rather simple to
 implement such a thing (although DropDownChoice uses it
 for different purposes)

     Ari S.


Juergen

On 11/25/05, Ari Suutari < [EMAIL PROTECTED]> wrote:


Hi,

We are developing applications, which have kind of a content 'push'
system,
ie. data arrives from factory automation and we visualize it

on-line.

Our traditional approach to this has been to send the data to

browser

(via applet and additional tcp socket) and use javascript to render

it.

However, I'm a little bit tempted to adjust our architecture so that
we would only push a notification of change and then use ajax
to re-render part of page.

Would it be possible with wicket ? Typically, the part that
would be re-rendered with ajax is just a text field or a table
(rendering whole page is too slow, since the data rate
can be quite fast; also flashes too much for slower cases).

There was some discussion on mailing list that something like
this would be in 1.2 ?

 Ari S.







-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click

_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD

SPLUNK!

http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log

files

for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log

files

for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op�k
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&opclick
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to