3 Replies Latest reply on Apr 12, 2007 7:11 PM by robjellinghaus

    User Interface Challenge: Possible, poor practice?

    spraguer

      Hi all,

      My team has a challenging UI problem as we consider going with Seam for our new project:

      1. All of our user interfaces are to be configurable at runtime via the application. This means that while the version we offer will have the standard pages with search, table results, and list of values, we need to user to be able to add things like new tables, new columns, new criteria and even new pages(maybe modal windows or new tabs) on the fly.

      2. We want to store all of these extensions in a meta-data type repository (probably xml) to store changes for future upgrades/easy extension.

      Now we're wondering if Seam is a possible fit for this. We would *really* love to keep things like conversations, the jpa-ejb managed layer, and JSF binding with facelets. However, this also implies to us being able to generate something like a Seam compatible facelets page on the fly. For example if a user adds a new column or search criteria, or chooses to display a new table, we need to have that reflected in the facelets page by inserting new tags.

      Specifically:

      A. We will build a filter that intercepts all seam/facelets urls

      B. If the meta-data has not been changed since last request, serve the seam backed facelets page that has already been generated.

      C. If the meta-data has been changed since the last request, read the meta-data, generate a facelets page inside the interceptor servlet, and redirect to that page. Store that copy away in the database or filesystem for subsequent use (case A).

      D. If the user changes the page on the fly (personalization/configuration) then basically repeat (B) by changing the facelets definition and redirecting.

      Now this seems potentially messy to us: Inserting tags for data-tables, new columns, new search criteria, etc.. on the fly, all while keeping the data-binding Seam compatible for our components.

      I'm sure there must be a better practice in JSf/Seam land, but we're rather new to this tech stack (we just finished evaluating GWT for this purpose) and are hoping for suggestions. We're very impressed with the capabilities offered by Seam OOTB, and really just want to know if we have a potential fit.

      Thanks for your time and best regards,
      Chris

        • 1. Re: User Interface Challenge: Possible, poor practice?

          I know one of the Seam users is working on GWT integration, though I don't know how far along it is. I'm not sure that facelets will cooperate with generating source on the fly -- you might be better served by writing custom facelets tags instead that dynamically insert JSF controls when rendered.

          • 2. Re: User Interface Challenge: Possible, poor practice?
            gavin.king

            Actually JSF also allows you to build views in Java code!

            You can manipulate the faces component tree in Java code, and add UIComponents. I believe that what you are trying to do is totally possible. All you would need to do is have some way to serialize/deserialize the faces component tree to the repository (definitely not an impossible problem).

            The coolest thing ever would be if you could take a tree of UIComponents, and generate facelets XML from that - then you could use plain facelets to parse the XML back to a faces component tree ;-)

            • 3. Re: User Interface Challenge: Possible, poor practice?
              robjellinghaus

              The GWT integration is coming along, though it is not my day job, so progress is slow. I should have a working Seam / GWT / JSF example (with some moderately interesting functionality) by end of May. Certainly GWT can do arbitrary amounts of runtime UI generation.

              Gavin, I dropped you an email (while you were ?vacationing?) about whether you'd be interested in a GWT-enhanced Seam blog example. Let me know. Michael Neale is working on a remoting-style integration example also. We know you probably don't want a full GWT distribution in Seam, so our examples will probably be "precompiled", and users can grab GWT themselves if they want to do a full compile from source.