I'll try to get to it this weekend. I've been coding away trying to get this app ready for friendly testing...

David
On Jan 12, 2007, at 10:51 AM, Geert Bevin wrote:

Hi David,

did you have a chance to package a minimal example for me so that I look at this?

I agree that it would be nice to integrate something more intuitive for dynamic selects in 1.6. Your input on this is much appreciated, any suggestions to simplify the API, even if it doesn't work like you want now, are great to hear. A small code example of your ideal API for this will go a long way.

Take care,

Geert

On 05 Jan 2007, at 19:06, David HM Spector wrote:

Hi Geert,

I'm using IDEA 6.02 (build #6107) on a 3.0GHz DP Mac Pro using Apple's JDK 1.5.0_06.

Nope; the fragment is just as you see it; the rest of the code is just the other while clauses to deal with the next form pages. The selectListBuilder and supporting code is verbatim from the code Steve Grimm posted to the Wiki (the Dynamic Selects using Dynamic Constraints code). I'll try to pull together a minimal example over the weekend; my business partner is flying in from SF tonight for a weekend of intense brainstorming and pre-launch work... and to check out the app so it may not be before next week.

I have what I need for the moment with the simpler (Tyler) version of dynamic selects; but Steve's version is a bit more direct it seems to me; something like it -- since its pretty agnostic about how you keep the data and it's integrated into the meta-data model cleanly -- would seem to be to be a great way to go in 1.6.

best,
  David


On Jan 5, 2007, at 3:09 AM, Geert Bevin wrote:

Hi David,

do you somewhere use an list iterator in your element? I don't understand where it would come from by looking at the code you pasted yesterday. Also, which Java compiler are you using, Sun's or something else?

About the empty bean not working, that is weird. Would you mind creating a small self-contained example that manifests this behavior? The easiest is to just start from the jumpstart archive and add your element and template. You can just use static maps for the select box values instead of populating them from the datasource. This would make it much easier for be to trace and track down any possible problems.

There isn't a better way planned for 1.6 atm, but I'm open to any suggestion. If I think that it's a good idea I'll do my best to implement/include it.

Best regards,

Geert


On 04 Jan 2007, at 15:56, David HM Spector wrote:

Hi Geert,

Yeah, I tried it with an empty bean; no luck.

Upon further inspection (read it's no longer 2:30AM :) the clonable errors seem to be happening independent of the instance of the Venue object but inside the template processing somewhere due to the List<> I am passing to selectListHelper. The cookbook page(s) don't state anywhere that you need to implement a cloneable list or Iterator... so I guess it could be that something changed between the time the cookbook entry was written and now (I'm using the Rife-1.5.1 jar)...

Is there a better way to implements dynamic SELECTs coming say in 1.6 (hint, hint :) as its really a useful feature and quite common in forms (wink, wink, nudge, nudge :) ..?


Anyway, here's what I get:

com.uwyn.rife.engine.exceptions.EngineException

com.uwyn.rife.engine.exceptions.ElementLocalVariableUncloneableExce ption: The implementation 'com.zeitgeist.nela.implementations.AddVenue' of element uses a local method variable of type 'java.util.AbstractList$Itr' which is not cloneable.

at com.uwyn.rife.engine.RequestState getContinuationContext ( RequestState.java : 151 ) at com.uwyn.rife.engine.RequestState getElementContext ( RequestState.java : 228 ) at com.uwyn.rife.engine.RequestState service ( RequestState.java : 335 ) at com.uwyn.rife.engine.Gate handleRequest ( Gate.java : 421 ) at sun.reflect.GeneratedMethodAccessor10 invoke ( <unknown> ) at sun.reflect.DelegatingMethodAccessorImpl invoke ( DelegatingMethodAccessorImpl.java : 25 )
at  java.lang.reflect.Method       invoke       ( Method.java : 585 )
at com.uwyn.rife.servlet.RifeFilter doFilter ( RifeFilter.java : 142 ) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain doFilter ( WebApplicationHandler.java : 823 ) at org.mortbay.jetty.servlet.WebApplicationHandler dispatch ( WebApplicationHandler.java : 473 ) at org.mortbay.jetty.servlet.ServletHandler handle ( ServletHandler.java : 567 ) at org.mortbay.http.HttpContext handle ( HttpContext.java : 1565 ) at org.mortbay.jetty.servlet.WebApplicationContext handle ( WebApplicationContext.java : 635 ) at org.mortbay.http.HttpContext handle ( HttpContext.java : 1517 ) at org.mortbay.http.HttpServer service ( HttpServer.java : 954 ) at org.mortbay.http.HttpConnection service ( HttpConnection.java : 814 ) at org.mortbay.http.HttpConnection handleNext ( HttpConnection.java : 981 )
4 more ...

com.uwyn.rife.engine.exceptions.ElementLocalVariableUncloneableExce ption

The implementation 'com.zeitgeist.nela.implementations.AddVenue' of element uses a local method variable of type 'java.util.AbstractList$Itr' which is not cloneable.

at com.uwyn.rife.engine.ContinuationContext clone ( ContinuationContext.java : 408 ) at com.uwyn.rife.engine.ContinuationManager cloneContext ( ContinuationManager.java : 221 ) at com.uwyn.rife.engine.ContinuationManager createNewContext ( ContinuationManager.java : 161 ) at com.uwyn.rife.engine.RequestState getContinuationContext ( RequestState.java : 147 ) at com.uwyn.rife.engine.RequestState getElementContext ( RequestState.java : 228 ) at com.uwyn.rife.engine.RequestState service ( RequestState.java : 335 ) at com.uwyn.rife.engine.Gate handleRequest ( Gate.java : 421 ) at sun.reflect.GeneratedMethodAccessor10 invoke ( <unknown> ) at sun.reflect.DelegatingMethodAccessorImpl invoke ( DelegatingMethodAccessorImpl.java : 25 )
at  java.lang.reflect.Method       invoke       ( Method.java : 585 )
at com.uwyn.rife.servlet.RifeFilter doFilter ( RifeFilter.java : 142 ) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain doFilter ( WebApplicationHandler.java : 823 ) at org.mortbay.jetty.servlet.WebApplicationHandler dispatch ( WebApplicationHandler.java : 473 ) at org.mortbay.jetty.servlet.ServletHandler handle ( ServletHandler.java : 567 ) at org.mortbay.http.HttpContext handle ( HttpContext.java : 1565 ) at org.mortbay.jetty.servlet.WebApplicationContext handle ( WebApplicationContext.java : 635 ) at org.mortbay.http.HttpContext handle ( HttpContext.java : 1517 )
7 more ...

java.lang.CloneNotSupportedException

java.util.AbstractList$Itr

at com.uwyn.rife.tools.ObjectUtils deepClone ( ObjectUtils.java : 233 ) at com.uwyn.rife.engine.ContinuationStack clone ( ContinuationStack.java : 365 ) at com.uwyn.rife.engine.ContinuationContext clone ( ContinuationContext.java : 403 ) at com.uwyn.rife.engine.ContinuationManager cloneContext ( ContinuationManager.java : 221 ) at com.uwyn.rife.engine.ContinuationManager createNewContext ( ContinuationManager.java : 161 ) at com.uwyn.rife.engine.RequestState getContinuationContext ( RequestState.java : 147 ) at com.uwyn.rife.engine.RequestState getElementContext ( RequestState.java : 228 ) at com.uwyn.rife.engine.RequestState service ( RequestState.java : 335 ) at com.uwyn.rife.engine.Gate handleRequest ( Gate.java : 421 ) at sun.reflect.GeneratedMethodAccessor10 invoke ( <unknown> ) at sun.reflect.DelegatingMethodAccessorImpl invoke ( DelegatingMethodAccessorImpl.java : 25 )
at  java.lang.reflect.Method       invoke       ( Method.java : 585 )
at com.uwyn.rife.servlet.RifeFilter doFilter ( RifeFilter.java : 142 ) at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain doFilter ( WebApplicationHandler.java : 823 ) at org.mortbay.jetty.servlet.WebApplicationHandler dispatch ( WebApplicationHandler.java : 473 ) at org.mortbay.jetty.servlet.ServletHandler handle ( ServletHandler.java : 567 ) at org.mortbay.http.HttpContext handle ( HttpContext.java : 1565 )
9 more ...






On Jan 4, 2007, at 4:35 AM, Geert Bevin wrote:

Hi David,

I never used this helper class, but it seems to me that you can create a new Venue object when the element is instantiated (private Venue mVenue = new Venue();). This will be your 'starting state', ie. an empty bean instance.

Also, I'm wondering which errors you get exactly about non- clonable objects. I suppose it's for the Venue instances. When using continuations, RIFE has to be able to clone your state for each continuation step for the back button to work correctly.

You have several options here:

* you don't care about the back button snapping back to previous state

Then you can just use setCloneContinuations(false) in your element, or override the cloneContinuations() method to return false.

* you want to carry around some state in between continuation steps (for example the venue data that they're filling in)

You can then implement the clone() method of your element and preserve the current venue instance for each clone, you can find an example of this here: http://rifers.org/ 08_advanced_continuations/src/==%20syntax%20highlighted%20==/ Order.java.html Note that you'll then probably use fillSubmissionBean when the data of each step comes in and not getSubmissionBean. This goes together well with the empty bean instance suggestion I made at the start of this message. It's also perfect to use with stepBack continuations.

* you want to clone each individual venue instance for the corresponding continuations

You'll have to implement the clone method of the Venue class. Chances are though that you can use the standard Object clone method that the JDK provides which creates a shallow copy and is perfect for the immutable basic Java types.
protected Object clone() throws CloneNotSupportedException {
    Venue new_venue = (Venue)super.clone();
    return new_venue;
}


When you have more complex data structures (collections, maps, arrays, ...), the ObjectUtils.deepClone method will allow you to create deep copies of most of the typical types that you use as bean properties.

Hope this helps.

Geert


I've been trying to follow the recipe for creating the dynamic select elements (http://tinyurl.com/y4ssym) but there's something I'm not understanding... the selectListHelper method wants the bean with the item to be the select target ("item" in the example) as part of its argument list ... which would need to be already populated ... which would mean that the form would already be posted so that getSubmissionBean() would have to have been called already so as to have a non-null bean to pass to selectListHelper().

--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

------------------------------------------------------------------- ------------------------
                                          David HM Spector
spector (at) zeitgeist.com http://www.zeitgeist.com/ voice: +1 631.261.5013 fax: +1 212.656.1443
                                                    ~ ~ ~
"New and stirring things are belittled because if they are not belittled, the humiliating question arises, 'Why then are you not taking part in them?'" --H. G. Wells

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

--------------------------------------------------------------------- ----------------------
                                          David HM Spector
spector (at) zeitgeist.com http://www.zeitgeist.com/ voice: +1 631.261.5013 fax: +1 212.656.1443
                                                    ~ ~ ~
"New and stirring things are belittled because if they are not belittled, the humiliating question arises, 'Why then are you not taking part in them?'" --H. G. Wells

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users


--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

------------------------------------------------------------------------ -------------------
                                          David HM Spector
spector (at) zeitgeist.com http://www.zeitgeist.com/ voice: +1 631.261.5013 fax: +1 212.656.1443
                                                    ~ ~ ~
"New and stirring things are belittled because if they are not belittled, the humiliating question arises, 'Why then are you not taking part in them?'" --H. G. Wells

_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to