1 2 3 Previous Next 38 Replies Latest reply on Mar 24, 2011 7:56 AM by waltc Go to original post
      • 15. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
        waltc

        http://seamframework.org/Documentation and do a find on linechart or barchart


        Yes, you were correct, I did not mean threads but tabs. I would have thought where the resultList size is reflected in both tabs by indicating the ArrayList.size() that merely by switching tabs the collection being iterated over would remain. Apparently not. Again, this falls into the 'magic' realm of Seam, as you said, things don't always behave as they would be expected to or are advertised to. As I mentioned, I think things seem to behave more predictably with ear. It is little things like that that cause frustration and inordinate hours. I am not a big UI guy, as I said earlier. So as far as things I have done, start with a seam-gen crud and add an action here, remove a column there etc, not too bad, very quick, lots of nice features like pagination and sortable columns, so management things hey, Walt can do web app and give me tasks that, well...aren't CRUD one offs. And it's like oh my fricken word! If this is what I did for a living (Web) I'd probably be really good by now and, like you, know the things that work right and the things that work wrong and avoid the later. Hey, have you done anything with Weld or Seam 3? Is it your experience that the percentage of weirdnesses are dropping? Are they very subtle mind bending bugs or just things not really well thought out?
        But, to your point, and other lurkers, Pete, Dan et al, I really like Seam too. I am struggling with how much of my issues are, well, self inflicted or it is just that difficult.


        Have you done much with tabs? Oh, and how about ajax? It would be nice to do away with the display button and when a control changes to have the grid/charts automatically update.


        I am thinking I know what the answer is, I think I have to use Integer, not int. I will change that in the morning. But that is what happens, oh I know what it is, I know what it is only to find out that, not only wasn't it, but it made it worse.

        • 16. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
          kragoth

          Well, there ya go...all the doco I had read said pdf only. That doco mentions the fact it will generate an image to embed in the html...cool :D


          What's the scope of your DailyActivity Seam bean?


          I think it's rare that Seam does not perform 'as advertised' the problem is that going from a simple example (advertisment) to a real app requires us to make what seems to be logical changes that should not effect the functionality of the framework. Only to find out that not only did it have an effect but it completely broke the functionality. So, the investigation begins into why it broke and eventually 99% of the time we find out that it was our own fault and that we were unintentially doing something stupid. The problem being of course that there's no feedback to tell you this and so the investigation takes a considerable time and generates a lot of frustation. There have been many times after days of research and investigation I have felt utterly stupid when I find out what the problem was.


          And to be fair...many times the problems are not really Seam's fault. Just the combination of Seam dealing with the JSF phases in a way I did not expect.


          I haven't touched Weld/Seam 3 very much. I've done some reading and investigation but I was too far down the path with Seam 2.x to change. So...can't help you much there either :S

          • 17. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
            waltc

            And that's the frustration of it....you start wishful thinking....anything to make the problem go away.


            Scope is a good question, if it is event? request? maybe that should reset the world but here is where I don't get servlet behavior vs browser behavior.  Both tabs we, at least partially, rendered as the label was populated with dynamic data. I would think switching tabs would be a browser operation.  That gets back to the whole ajax thing. I might have ajax specified for switchType? I am at home now so the code is not in front of me.


            Where I was going with the Weld/seam3 is given your experience which I gather has spanned several versions, is it getting better?


            I know I solved this problem before, I am sure I had a thread on it and, in the 11 threads of mine still showing I can't find the one with the guy from Europe very helpful that basically said what you initially said.  It's big, its very complex, it can be squirrelly, etc. But he was at the level of having daily conversations with Dan Allen.

            • 18. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
              waltc
              The above xhtml got past the index required >=0 exception once I added the rendered= to check the size of the value object was greater than 0. I believe this is a bug as if it were not injected as evidenced by the () closed parens on the tab it should have not failed and certainly not failed with such an esoteric exception showing no relation to the value object

              The next runtime exception I received "no children allowed"

              was resolved when I undid the formatting (nl) inserted by Eclipse source->format




              <p:linechart title="Activity" domainAxisLabel="Date" domainLabelPosition="UP_45" legend="true" rendered="#{DailyActivity.resultList.size() > 0}" height="800" width="3000">


              I am concerned with that situation and don't know quite where to point.

              But it is working now.
              • 19. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                kragoth

                If your Seam bean is EVENT scoped and your tab switch type is ajax then that could be part of your problem.


                Try making your switchType client if it isn't already.


                <rich:tabPanel switchType="client">
                



                • 20. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                  waltc
                  Holy Sh*t....

                  That works perfectly! Thank you.

                  Now for the lightning round...

                  Is there an easy way to get any change to any of the 3 controls to force the update?

                  What's interesting is the 3/4 controls originally used the display template. When I caught that the controls went from updating after the main grid to before. Something that simple caused completely different (and beneficial) action.

                  Walt
                  • 21. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                    waltc

                    I changed the h:form to a4j:form and on the display button I add


                    rerender=



                    pointing to the tab panel. The display refreshes much more cleanly now.

                    • 22. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                      waltc

                      Well, it works really well on Firefox.


                      It doesn't work at all on IE6. Even boilerplate Seam generated controls don't work properly.


                      The most glaring is the comboboxes don't work at all.


                      Here is a representative control that doesn't work




                           <s:decorate template="layout/display.xhtml">
                                <ui:define name="label">Language</ui:define>     
                                <rich:comboBox id="compositeActivityCountry" value="#{compositeActivityList.country}" label="Language">
                                   <f:selectItem itemValue="All"/>
                                 <f:selectItem itemValue="EN"/>
                                 <f:selectItem itemValue="FR"/>
                                 <f:selectItem itemValue="DE"/>
                                </rich:comboBox>
                           </s:decorate>     
                      



                      On the spinner trying to change the spinner forces a page refresh. This does not occur on Firefox




                           <s:decorate template="layout/display.xhtml">
                                <ui:define name="label">Smoothing</ui:define>     
                                <rich:inputNumberSpinner id="smoothingSpinner" label="Smoothing Period" maxValue="21" minValue="1" step="1" value="#{DailyActivity.smoothing}"/>          
                           </s:decorate>
                      



                      Any suggestions?

                      • 23. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                        kragoth

                        Walt Corey wrote on Mar 16, 2011 09:36:


                        Well, it works really well on Firefox.

                        It doesn't work at all on IE6. Even boilerplate Seam generated controls don't work properly.

                        The most glaring is the comboboxes don't work at all.

                        Here is a representative control that doesn't work



                             <s:decorate template="layout/display.xhtml">
                                  <ui:define name="label">Language</ui:define>     
                                  <rich:comboBox id="compositeActivityCountry" value="#{compositeActivityList.country}" label="Language">
                                     <f:selectItem itemValue="All"/>
                                   <f:selectItem itemValue="EN"/>
                                   <f:selectItem itemValue="FR"/>
                                   <f:selectItem itemValue="DE"/>
                                  </rich:comboBox>
                             </s:decorate>     
                        





                        I don't have time at the moment to look into this in much detail but, I'm pretty sure the problem lies in your code. I use IE6 and the rich:comboBox without an issue. Not to mention the examples on the demo page seem to work fine in IE6.


                        How does it fail anyway?


                        Take away the s:decorate and try it. Reduce the complexity of the xhtml and work back up till you find what is intefering.



                        On the spinner trying to change the spinner forces a page refresh. This does not occur on Firefox



                             <s:decorate template="layout/display.xhtml">
                                  <ui:define name="label">Smoothing</ui:define>     
                                  <rich:inputNumberSpinner id="smoothingSpinner" label="Smoothing Period" maxValue="21" minValue="1" step="1" value="#{DailyActivity.smoothing}"/>          
                             </s:decorate>
                        



                        Any suggestions?


                        Sounds like you've got an on change event that is getting in the way. Make sure you haven't got some rogue javascript. (Check you haven't loaded a javascript lib that conflicts with richfaces too). These problems are relatively easy to debug even in IE6. Get the IE debugger tool and tell your IE to break on next statement and then click the button. Follow the execution and find out what it's doing.


                        The component itself from what I can see is purely a client side script so, it must be your code that is changing the behavior. (Well, I say 'must be your code', but.....we all know that it could also just be one of those weird interactions :P)

                        • 24. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                          waltc

                          One thing I did not mention Tim is on FF, either Linux or Win, if the tabpanel was empty it would still display the full panel with two tabs ... in other words there would be a thin sliver of a group box (old Swing/Win MVS graphical app control. On IE6 the 'group' box wasn't even fully formed, it was one (top) horizontal line. I don't recall if it had to two verticals, but it definitely did not have the bottom horizontal.


                          On first rendering the combo boxes were populated with default settings. Upon depressing Display control the combo boxes went blank, they all were, even initially, dead, the actual control on the right didn't depress.  I also noticed that the reload wouldn't reload the image. If I wanted to refresh from the server I had to restart IE6. I installed IE8 and it works much better. I do have an issue with the spinner but the controls are no longer frozen, the graph and grid display. I didn't know if there wasn't something wrong with my controls above. Oh, both browsers were pointing to the same jboss web container. No javascript although I did make the form a4j:form instead of h:form and the Display button rendered only the bottom panel. Googling didn't turn up anything querying IE6 and seam or IE6 and richfaces.

                          • 25. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                            kragoth

                            You are certainly getting some odd behavior but, I'm very reluctant to point the finger at richfaces. You really need to build a simple page with those controls on it and prove to yourself that on their own they work fine, then introduce more of your application specific css/javascript etc and see if it eventually breaks. Check the richfaces live demo page in IE6. I'm using IE6 and it works perfectly fine.


                            A lot of the problems you are describing sound like some javascript is getting blocked or conflicting.


                            I've never used the a4j:form, everything of mine is done in a h:form. So, I don't think the form type is going to have that much impact on these components.

                            • 26. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                              waltc

                              While I don't know enough to disagree with you on this, that swapped form namespace and the a4j:support to define the render="" on the display are as close as this gets to javascript, there are no onblur or on anything. I don't know java script. I don't mean to implicate richfaces. If it works fine in firefox, and works almost find in IE8, and, as it turns out from my mgr's browser, works fine in IE7, I think it is IE6. I would feel more comfortable with someone telling me you have to get creative to work around IE6 idiosyncrasies. I believe, by loading IE8, I no longer even have IE6 on my machine. I am mostly Linux. Is there anything else you can point to for me to look at?

                              Walt

                              • 27. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                                kragoth

                                I think the problem I have is that if the richfaces demo page works in IE6 but your page doesn't then I don't know where else to look for the problem but in your application.


                                Unless it is a particular combination of richfaces/jsf/seam/facelets versions that could be doing this? I doubt it but....



                                I'll keep thinking about it, but I'm pretty sure I have not had to do anything special to get the comboBoxes working in IE6/FF or IE7

                                • 28. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                                  waltc

                                  I discovered something I did not realize was an IE 'feature'. There is a 'compatibility' button and, once pressed, everything worked fine except the width of the date column, which in IE line breaks at the - between year, month, and day.

                                  • 29. Re: java.util.Vector cannot be cast to javax.faces.model.DataModel
                                    waltc
                                    I discovered something else today Tim. When looking the page source I see that, indeed, richfaces does do javascript. BTW, effectively the facelet code is above. And, oddly, my app works fine in IE7 and 8 (compat mode0, save the  date column in the datagrid. In Win/Linux FF the column width is determined by the widest content, not so in IE where 2010-12-31 is the widest content but the column width was determined by the heading "Date". What I ended up doing, as blanks were trimmed appararently is "----Date----" and then it worked fine. Oh, the 'group box' surrounding the datagrid when value= was empty resulted in just the tabs showing not empty rectangle  that surrounds the TabPanel. My contempt for IE is renewed. I ought to try it with Chrome, which I have here, at home.