[
http://jira.jboss.com/jira/browse/JBSEAM-1206?page=all ]
Pierre Raoul updated JBSEAM-1206:
---------------------------------
Description:
It would be great that seam-gen will generate crud pages and classes for an existing
Entity class:
- with all the literals replaced with #{messages['key']}
- and i18n default messages generated
was:
It would be great that seam-gen will generate crud pages and classes for an existing
Entity class:
- with all the literals replaced with #{messages['key']}
- and i18n default messages generated
Herewith files of a draft version (patches created from seam 1.2.1.GA)
I used the jpaconfiguration propositions from JBSEAM-843.
It works under Eclipse: the target "updatecrud" in the project build.xml can be
run from Eclipse.
Nota: to translated Enum type, test of this type had to be added. I did it through file
inclusion. So it can be used with any other project specific types, e.g. in the attached
zip with joda-time type.
Herewith a new patch, seam-gen.patch, to get 18n crud interface from entity classes (see
JBSEAM 843).
The patch is generated against today cvs. All the new files are in seam-gen.zip
The new ant target is "generate-ui". It can be run as often as wished.
To get a starting project:
- run "seam new-project"
- add the entity classes
- if wished, add any new language in {project}/resources/WEB-INF/faces-config.xml
* add the needed messages in {project}/resources/properties/success_label.xml:
they will be used as they are to create messages in "home_messages" files
* add the transleted static files in {project}/view/layout
* translate "base_entity_messages" and "messages" properties files
in {project}/resources
- fill the {project}/resources/properties/entity_label.xml. The tree syntaxe is:
<entity-names>
<entity1name>
<en>...</en>
<fr>...</fr>
...
<entity1property1name>
<en>...</en>
<fr>...</fr>
...
<entity1property1property1-1name>
<en>...</en>
<fr>...</fr>
...
</entity1property1property1-1name>
<entity1property1property1-2name>
...
</entity1property1name>
<entity1property2name>
...
</entity1name>
<entity2name>
...
If any leaf is not filled then the name of the entity/property is used.
These labels are used to created the messages in properties files
with "generated-ui".
- run "seam generate-ui"
- that's all.
I only tested it from entity pojos and for ear projects in dev mode.
I didn't try reverse engeneering from data bases.
I used some new materials:
- javassist for hibernate tools
- fmpp (
fmpp.sourceforge.net) to do batch jobs with freemarker
fmpp needs bsh.jar, oro.jar and resolver.jar
- tomahawk as I need "t:buffer" tag to deal with i18n messages in
some tags as s:buttonand rich:simpleTogglePanel
(yes I know, it's quite a heavy tool just for that, but it's the only
one I found ready to be used...)
tomahawk needs commons-fileupload.jar
- log4j to avoid some error messages from hibernate during "generated-ui"
Two issues:
- I didn't find how to avoid putting "hibernate.dialect"
in persistence-dev.xml
- With the current "seam.bat" under Windows, there is no way to work with
the right hibernate annotations and entitymanager libraries.
Ant is called with {seam_home}/lib in both "ant.home" and
"ant.library.dir".
As:
* hibernate-all.jar is in {seam_home}/lib,
* and HAN and HEM are in hibernate-all.jar,
the libraries in {seam_home}/hibernate/lib are never loaded.
But the HAN and HEM classes in hibernate-all.jar are too old:
version 3.2.0.CR3 or above is needed.
As turnaround, I use a new directory {seam_home}/ant/lib with
only ant.jar and I put it in "ant.home" and "ant.library.dir"
during "generated-ui".
improve i18n in seam-gen
------------------------
Key: JBSEAM-1206
URL:
http://jira.jboss.com/jira/browse/JBSEAM-1206
Project: JBoss Seam
Issue Type: Feature Request
Components: Tools
Affects Versions: 1.2.1.GA
Reporter: Pierre Raoul
Attachments: i18n.zip
It would be great that seam-gen will generate crud pages and classes for an existing
Entity class:
- with all the literals replaced with #{messages['key']}
- and i18n default messages generated
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira