I don't need send code, since all sources accessible by my SVN repository. I can point links to code locations ( all inside of http://svn.demi.spb.ru/repository/my faces-Ajax/src/ ). Also, You can see JavaDoc at http://smirnov.org.ru/api/
In short , 3 main parts of code :
AjaxContainer - interface for controlled component. At most, all HTML code ( may be except html/body tags ) must  be generated inside of component, implemented this interface. Such component have rendersChildren property set to "true", and maintain parts of view Tree, rendered at current request. Most of methods in interface targeted to maintain list of such parts.
I have two implementations - UIAjaxViewComponent for usual JSF applications, and JabberClient , for in-page instant messaging client. JabberClient designed for render necessary parts in PhaseListener, and set responseComplete in FacesContext.
Crazy idea - make subclass From UIViewRoot, what implements interface and replace class for UIViewRoot in FacesConfig ...
Since all children components of AjaxConteainer renders in usual render response phase, we don't need any modifications to components. In any cases, may be used custom renderer. For maintain rendered parts , was created special Listener and JSP tag for it - <ajax:update> for Action or DataChange Events. If event occurs, Id's targets, updated in current request, appended to list of rendered areas in AjaxContainer ( in format of findComponent method ).
Second part - filter Servlet, maintained format of information, sent to client. In case of simple http request, filter do nothing. In case of AJAX request, filter parse output html with nekkoHtml parser, and serialize to client as valid XML ( in case of request produced by XmlHttpRequest or Microsoft ActiveX XMLHTTP ), or , as _javascript_ text for "_javascript_"HttpRequest - reserved technology for case if xml objects don't supported.
Third part - client _javascript_ code. For special AJAX requests, script imitate normal form submit ( build  application/x-www-form-urlencoded request string ), create supported version of request object ( xmlhttpRequest, MS ActiveX or special _javascript_ Request, original idea by
Dmitry Koterov, http://forum.dklab.ru/users/DmitryKoterov/  ) and send information to server.
On completed request, onreadystate handler get from response id's of elements, included in response, find appropriate in DOM tree and replace it content by new information from response. It part was most hard for me , and, at present time, only _javascript_ Request version worked. For Mozilla XMLhttpRequest, after inserting new information in DOM tree, nothing of external resources ( images, scripts etc. ) shown...
For Microsoft ... I don't understand, what mean XML letters in name of object ??? Since no relations to "eXtensible Markup Language" was found :-). I don't know, how find in responseXML element with given id, and how insert it content to window.document. Any of DOM functions not exist or don't working.
Other parts of _javascript_ code - error and request status handling.
 
As result, we have two-way communications between client DOM Tree and Java Server Faces View tree. Most of navigation in this trees based by ID's properties, since both have like well-powerfull navigation methods.
 
-----Original Message-----
From: Martin Marinschek [mailto:[EMAIL PROTECTED]
Sent: Friday, August 05, 2005 7:49 PM
To: MyFaces Development
Subject: Re: Demo for AJAX faces componets

Great thing to see!

now it would be good to start a discussion with code snippets about what you have done...

don't post all at once, just a short code snippet at a time and show us how you achieved what you wanted to achieve.

regards,

Martin

On 8/5/05, ir. ing. Jan Dockx <[EMAIL PROTECTED]> wrote:
Sorry, Alexander, on Safari, Mac OS X, it doesn't do didly.
After a minute, I get a dialog that says "Reqest error, status :
504Message: Gateway timeout".

On 5 Aug 2005, at 15:53, Enrique Medina wrote:

> Great example using an AJAX-enabled dataTable. This can be really
> helpfull! I think that Martin's students are also working on something
> similar...
>
>  Alexander, could you please post some reviews about your examples, I
> mean, some kind of explanation of how is it done? Or better a wiki in
> MyFaces?
>
> 2005/8/5, Alexandr J. Smirnov <[EMAIL PROTECTED]>:
>> After any little problems,my demo/test application visible from
>> internet.
>> You can see it by :
>> http://smirnov.org.ru/myfaces-ajax/ .
>>  At present, it was tested with Firefox 1.06, Microsoft IE 6.0 and
>> 5.0 (
>> from default install of Windows 2000 ) and Opera 8.02
>> I will be very glad for report of success/failure test on other
>> browsers.
>>
>> My skills in _javascript_ less then 1 month, but long time I worked
>> with java,
>> c, c++ - as result,I was surprised many times by unexpected work of
>> any
>> code...
>> I don't have any problems for server side part, but need any help for
>> build
>> client-side scripts... Most in creating portable code for different
>> clients.
>>
>> ???
>> Do you have a demo of this technology up and running?
>>
>> Can you start a discussion with code snippets on the mailing list how
>> you
>> implemented that?
>>
>> How many changes would it take to get My Faces to use your approach?
>>
>> regards,
>>
>> Martin
>>
>>
>> On 8/2/05, Alexandr J. Smirnov <[EMAIL PROTECTED]> wrote:
>> I have worked ( as alpha-alpha-alpha .. ) set of custom components for
>> create AJAX-like user interfaces for Java Server Faces Applications.
>> Main
>> idea - in faces lifecycle, ve have view tree on server side and DOM
>> tree in
>> client browser ( at present, saving tree on client side don't used ).
>> For
>> ajax request, client send all user input of current form ( as normal
>> submit
>> request ). Request phases work as usual, but on render responce phase
>> server
>> send ONLY CHANGED parts of view ( i don't create full compare, but
>> send only
>> fo pre-defined parts, or submitted form ). For this I created special
>> AjaxContainer component, wich render it's children ( or part of
>> children )
>> components. List of clientId's for rendered components included in
>> response
>> for client-side part of framework.
>> For other cases ( for example, such will work in-page Jabber client)
>> component can render updated xml in custom Listener, and set
>> responseCompleteto FacesContext.
>>
>> On client side, _javascript_ get list of rendered parts and update page
>> DOM
>> Tree.
>> In result, we have two-way communications between client browser and
>> JSF
>> view, and have sync tree's on client and server side. It's work like
>> common
>> desctop applications.
>> Such arch don't need create special RenderKit or change most of
>> components - for example, at present, I have only custom
>> tag's-renderers for
>> UICommand ( link & Button ) components, and have worked all standart
>> and
>> most of custom ( tree2 and any other Myfaces components ) as AJAX ...
>> On
>> other hand, custom renderersbased on usual Html renderers, and work
>> also
>> in non-_javascript_ environment as simple html...
>>
>> For client side script use XMLHttpRequest object, and, if it don't
>> exist,
>> special "_javascript_"HttpRequest. It's worked same as XMLHttpRequest (
>> designed with same properies and methods ), but use other idea. For
>> perform
>> request, It appended to page <script> tag. Browser load script ( url
>> maked
>> from form action url with query string as normal GET request ), but
>> script
>> produced by special Filter on server from Html code of JSF Response -
>> as
>> pseudo-Dom tree of objects. Loaded script call handler function for
>> update
>> page - same as XMLHttpRequest. Not need any iframe or other
>> incompatible
>> technologies for non XMLHttpRequest browsers.
>> It can work in wide range of browsers, even in 4+ IE & Netscape???
>> ( in theory. At present tested with Mozilla Firefox and IE 5.5+
>> browsers. I
>> need help for make _javascript_ compatible with others. )
>> At present, XMLHttpRequest work only in Mozilla. Code for MS ActiveX
>> was
>> disabled since I don't can get any functionality of XML part for
>> microsoft
>> object ! Xml parsed withowt errors. ( For xml request, i use in
>> servlet
>> Filter nekkohtml parser, and make valid xml, with all declarations and
>> mime-type headers ). It make responseXML Tree, but any methods for
>>  navigate/manipulate don't worked ! Also, elements from responseXML
>> can't be
>> inserted to page, don't produce event handlers etc.
>> Current view of code repository -
>>   http://svn.demi.spb.ru/repository/myfaces-ajax/ Project created in
>> Eclipse.
>> Sorry for possible mistakes - my native language is Russian.
>> ========================================
>> Alexander J. Smirnov
>>
>
>
Met vriendelijke groeten,

Jan Dockx

PeopleWare NV - Head Office
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66

PeopleWare NV - Branch Office Geel
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25

http://www.peopleware.be/
http://www.mobileware.be/



Reply via email to