Messages posted by hildo
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icesoft.org  [Login] Login 
Messages posted by: hildo  XML
Profile for hildo -> Messages posted by hildo [111] Go to Page: Previous  1, 2, 3, 4, 5, 6, 7, 8 Next 
Author Message
If you're building from scratch, you'd need to make sure the component can be handled by the Direct2DOM renderer. You'd also need to define a taglib so they can be accessed from the JSP page.

The source code is available. So you should be able to see how it's all set up. This will help when creating your own, or extending the existing ICEfaces components.

Apart from the Direct2DOM renderer, this should be just straight JSF component development. There are any number of books that detail the required effort for UIComponent development. I'm a big fan of "JavaServer Faces: The Complete Reference" by Chris Schalk and Ed Burns, but there's heaps of other doco that will show what you need to do.
Can't you just get the standard Faces servlet handler to process the jspx? Can you organise the filters so, for this particular jspx file, it doesn't get handled by the Asynchronous thread?
A short answer is look for the Managed Bean in the sessionMap attribute of the External Context. That is where it stores any session-scoped variables.

The Faces framework uses implementations of the abstract class javax.el.ELResolver to load managed beans from the various scopes. The VariableResolver is what is used to find scoped Variables. You can decorate the default VariableResolver with your own that will, for example, log when a specific variable has been retrieved (typically when it's about to be used).

If you implement your own resolver with a resolver of the same type in the constructor, the framework will pass the default instance to your custom one. If you store it, you can defer all the functionality to the default instance, decorating any of the function calls with your required logic. This would be a more robust solution to what you're after, I think.
The only difference I've done is use FacesContext.getCurrentInstance() to retrieve the FacesContext, rather than use the state. Or try PersistentFacesState.getInstance() instead?

Is this occuring during the normal lifecycle of an HTTP request? You said that you're attempting to use this on a Thread. Have you spawned off another thread during the process of an HTTP Request? Many of these classes have ThreadLocal variables. The PersistentFacesState does have one, although I'm not sure whether it affects the FacesContext associated with it.

Ed
Yes, it should. Unfortunately, it's not my code attempting to get/use the FacesContext. From the call stack, it's the com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer class.
I've since worked around this, but I'd still be curious if it's possible to navigate to another page one the background thread finishes

kurtcobain wrote:
Hi ,

How do i get a component reference from method which is called through 'action' of a button or link???....

My need to do methodbinding to the component on call of action method..

Thanks,

Kurt 


If the target component is bound back to the same managed bean (via the binding attribute), then it's available as an attribute of the object.

Or, you can get the view root from the FacesContext. Once you have the UIViewRoot, you can find the component using findComponent or invokeOnComponent

Hope this helps,
Ed

tomlux wrote:
Hy,
how can I generate dynamically a new "panelCollapsible".

I want to generate dynamically panelCollapsible's based on user login in the Java code. The content of the panel is generated based on a panel-config coming from a db.

I don't want to pre-generate the panel and work with "rendered" because I want to build the panel based on dynamic database records.

Thanks,
Tom 

Hi Tom. I haven't used these components specifically. I've looked at the Component Overview documentation for the panelCollapsible component. According to the tag summary, the Component class that you would need to create is com.icesoft.faces.component.panelcollapsible.PanelCollapsible. Once you know the specific class, you can look at the Components API documentation for all the specifics about what you can do programmatically.

I imagine that the PanelCollapsible component will have all sorts of Child objects, which will be the UIComponents that are displayed on the specific panel. All the various child UIComponents would be added to the collapsiblePanel's children (accessible via the getChildren() method). I don't know if there are any tricks to it, but some components depend on children UIComponents are Facet definitions. The best I can suggest is define a collapsiblePanel statically and then examine what UIComponents are child components. Then you can get an idea of how to build up the UIComponent hierarchy programmatically.

Unless the dynamically-generated UIComponents are to be the only components on the form, you'd still want a statically-defined Panel bound back to the Managed bean, in order to have a starting point of where the dynamically-generated UIComponents are displayed on the form.

Hope this helps,
Ed
It is possible to dynamically create controls at runtime. I have been doing specifically this for the last few months as an investigation. To be fair, the ability to do this is part of the JSF functionality, and not specifically provided by ICEfaces. However, you can create ICEfaces components (thankfully, I need them).

I have been doing this by:

1) Statically define an HtmlPanelGroup in the View that will display the dynamically-controlled page. The panelGroup is bound to the backing bean using the "binding" attribute. So it looks something like:

Code:
<ice:panelGroup binding="#{Main_Backing.detailPanel}"/>


So, my Main_Backing bean contains a getter and setter for the DetailPanel (using a component of UIPanel as the return value / parameter type).

Once you have the UIPanel, use the getChildren() method to add child components to it. You would create and add components to the parents, similar to how they would be defined were they statically defined in the page itself. The child UIComponents would be configured using the setters. Get to know your JSF and ICEfaces API documentation. :)

I haven't found a lifecycle stage where you're not allowed to add/remove UIComponents. Although I imagine that you'd want to ensure all the components are maintained by the time you get to the RENDER_RESPONSE Lifecycle phase.

In its sample applications, ICEfaces has an example of switching UIComponents based on server state. Look at the address-demo.

Hope this helps,
Ed
Hi all. I'd like to use a caption with a Data Table. According to the HTML specification, http://www.w3.org/TR/html401/struct/tables.html#h-11.2.2, a Caption can be rendered for a table. And in the standard JSF component, it allows the DataTable to define a facet named "caption" to define one. However, it doesn't look like the Ice DataTable renders this.

Has anyone been able to do this? I've tried wrapped the DataTable in a FieldSet, but that ended up not rendering the contained DataTable correctly.

Thanks,
Ed
Is this using 1.6.2? When I upgraded from 1.6.1 to 1.6.2, I started getting some Javascript errors which looked like this issue (http://jira.icefaces.org/browse/ICE-2312). When I upgraded again to 1.7.0 DR#3a, my error went away.

It looks like it's been fixed in 1.6.3 as well, but that hasn't been released yet.

Hope this helps
OK, I'll be more specific with what I've been playing around with. I've been making small changes to the 1.6.2 source code. Specifically, I've added a single parameter to the iceSubmitPartial method. It looks like this):

Code:
 //New parameter: rqstParams
 function iceSubmitPartial(form, component, evt, rqstParams) {
     form = (form ? form : component.form);
     Ice.Parameter.Query.create(function(query) {
         //START - changes
     	if (rqstParams) {
     	    for (i=0;i<=rqstParams.length;i=i+1) {
     	    	var rqstParam = rqstParams[i];
     	    	if (rqstParam) {
     	    	    //rqstParam.serializeOn(query) fails.
     	    	    //Most likely my Javascript inexperience.
     	    	    //But this works
     	    	    query.add(rqstParam.name, rqstParam.value);
     	    	}
     	    }
     	}
         //END - changes
     	
         query.add('ice.submit.partial', true);
 
         $event(evt, component).serializeOn(query);
         if (form && form.id) {
             var f = $element(form);
             f.serializeOn(query);
             f.serializeViewOn(query);
         }
         if (component && component.id) {
             var c = $element(component);
             if (c.isSubmit()) {
                 c.serializeOn(query);
                 c.serializeViewOn(query);
             }
         }
     }).send();
     resetHiddenFieldsFor(form);
 }
 


This allows my Web page's Javascript to provide custom Request parameters, for which my JSF application can look for (using a PhaseListener, for example). Again, working with a specific example, the Javascript in my onblur handler looks like:

Code:
    if (!(changesOnly) || fieldHasChanged) {
         var myParams = new Array();
         myParams.push(new Ice.Parameter.Association("sv.next.field", receivingFieldId));
         iceSubmitPartial(event.form, losingField, event, myParams);
     }
 


This is working fine, and I can see the parameter in the request on the server. I've written this in such a way, so that

  • existing calls to iceSubmitPartial, without additional parameters, still work as expected
  • existing ice.* parameters are defined after the extra parameters, so they are always set the way they expect to be set
  • I can now use the existing ICEfaces Ajax bridge, but provide some extra parameters my application needs

    I didn't seen any mechanism for doing this in the 1.7 sources, either.

    Now, my experience in Javascript is new, so I don't know if this is the most efficient way of doing this. There could be a better way of doing this, and I'm happy to hear alternatives. But is it possible for something like this in an upcoming release? I've pretty much submitted what I've changed to this topic (not to any repository). The changes seem, to me at least, to be unobtrusive. But would help me out in a big way.

    Thanks for any input.

    Ed
  • For this particular problem, I need to know when field's are exited, entered and changed. When a field is exited, I also need to know which field will be entered next. From what I can tell (although I'm happy to be corrected), the JSF model doesn't tell me this. The Browser's Javascript Event model does.

    I really like the DirectToDOM setup for processing updates to the client after the page has been initially rendered. That is going to help my applicaiton immensly, as some of those updates on field exit can return additional data. Unfortunately, my requirements require me to use a lot of Javascript event handlers.

    If I could use the partialSubmit mechanism to provide some extra request parameters that the current code doesn't provide (for example, the "next" field during the onblur event when a field has changed), I could happily use the rest. Just something like iceSubmitPartial(form, component, event, additionalParams)?
    Trying a redirect causes a Null pointer exception

    Caused by: java.lang.NullPointerException
    at com.icesoft.faces.context.DOMResponseWriter.endElement(DOMResponseWriter.java:192)
    at com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer.encodeEnd(XMLRenderer.java:65)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:570)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:535)
    at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)

    I'll keep digging....
    I am doing that already (of course, I never described in detail what I was doing, so my apologies). Here's what I am currently doing..

    1) Display my Login page (with it's own Backing Bean).
    2) After successfully logging into the back in, before I navigate to the Main page, I make the call to the JavascriptContext.includeLib. The original logon request is initiated by a button with a type of "submit"
    3) User navigates to the Main form. Exiting/entering fields on this page can't find the functions.
    4) Click a "Logout" button on the Main page, which disconnects from the server and returns to the Logon page.
    5) Login as the same user, go back to the Main page.
    6) Now the javascript events can be found.

    I thought I read in another topic that one of two options are needed to include Javascript. Either redirect to the page (as you suggest) or call the includeLib method. Maybe I read it wrong. I'll see if I can redirect to the Main page from the Login and see if that makes any difference.

    As for your issue, couldn't you use the Focus API for select the field you would like to receive the focus? Each control as a "requestFocus() method" which, if you go by the doco, will move focus to that control?

    Perhaps use a View listener to manage this for a view. If the view is being created, the the RestoreView phase is never called. Then, after the InvokeApplication phase, it could call the reuqestFocus method for the control you want to contain the focus. I don't know how useful this is. :)

    Thanks,
    Ed
    *sigh* OK, even weirder, is that no matter what happens, I get a script error in an IE browser. So, even if I log out and log back in, the scripts can never be found.

    I'm really confused now. And the windows script editor doesn't seem to be able to show me the info I need (either it doesn't show it, or I don't know where to look.. both equally possible).
     
    Profile for hildo -> Messages posted by hildo [111] Go to Page: Previous  1, 2, 3, 4, 5, 6, 7, 8 Next 
    Go to:   
    Powered by JForum 2.1.7ice © JForum Team