1

My objective is to generate a graphic layout (made of Richfaces components) based on some input configuration (like an XML file) and display it in my web app. The layout is composed of graphic symbols representing various entities in the system: each symbol should be mapped to an entity in the system, in order to display its state. The XML configuration file is used to define the symbol connections and positions within the layout, and their mapping rules to an entity. How can I achieve this?

I was thinking to create a symbol library in a technology such as SVG, where you can define both the aspect and the behaviour, and then simply "wrap" each SVG symbol in a dynamically created richfaces component, which would allow me to handle both the user interactions and the mapping rules defined in the symbol. Unfortunately JSF/Richfaces don't support SVG images, therefore I would have to use plain HTML without Richfaces features.

Another way to achieve that would be to simply define generic symbols in the XML file, each one of them with an attribute specifying the related image, the mapping rule, etc., and then generate the corresponding richfaces component from within the web-app. By doing so, would I be able to then display all the symbols in the right position and therefore generate the complete dynamic layout?

Could you suggest a better approach? Thank you very much.

1 Answers1

0

I believe that HTML5 has direct support for SVG images, however it is still an embedded object in regular HTML after all. This too is something I have been waiting for however I don't believe any of the current JSF2 component libraries have an offerring for this yet.

Here is a good explanation of a possible workaround:

Getting started with SVG graphics objects in JSF 2.0 pages

Potentially you could build a custom facelet component utilizing this workaround?

My thought though is that when your only tool is a hammer, everything looks like a nail. I would try to utilize an RIA (Rich Internet Application) technology better suited for display and manipulation of vector graphics like HTML5, Flash+Flex, Silverlight, etc..

Community
  • 1
  • 1
maple_shaft
  • 10,435
  • 6
  • 46
  • 74
  • 1
    Thanks for your reply. I followed BalusC suggestion in the above mentioned post, but I couldn't make it work. In the end I think I'm going to migrate to a technology like Flex+Flash, which apparently lets you create a library of graphic symbols, including their behaviour, and is well suited for all my other needs...Thanks again. – Antonio de Donato Aug 03 '11 at 07:57