Hello everybody!

Can I use import enum in Ivy Designer? Example: like show case of primefaces extension http://www.primefaces.org/showcase-ext/sections/utils/importEnum.jsf

Thanks & Regards,

asked 29.07.2015 at 05:58

Hap%20Em's gravatar image

Hap Em
(suspended)
accept rate: 0%


To make it work you have to ensure, that <pe:importenum> can access the enum class it references in the type attribute.

Unfortunately ivy currently only supports the access to converters and managed beans from ivy projects. So the pe:importEnum will raise a classNotFoundException if your enum is defined in an ivyProject.

To work around this problem you could copy the compiled enum class into the global webapp classes container: designer/webapps/ivy/WEB-INF/classes or if you already have it in a JAR put it into designer/webapps/ivy/WEB-INF/lib.

A big drawback of this solution is, that you no longer can have different version of this classes in multiple PMVs. The class is global available for any PMV in your application. And of course you have to deploy it manually on the server side.


To support java sources which will be compiled directly into this global webapp classes you could do the following:

  1. Java Perspective -> Create a new Source Folder (e.g. src_webContent)
  2. Add the enum you wan't to access from the pe:importEnum to this source folder
  3. Add a virtual folder which references WEB-INF/classes into you project: Context Menu of Project -> New -> Folder -> Advanced -> Link to alternate Location -> Variables -> ECLIPSE_HOME -> Extend -> webapps/ivy/WEB-INF/classes -> OK alt text
  4. Configurate the src_webContent folder to use a specific output folder: Java Perspective -> Context Menu of Project -> Properties -> Java Build Path -> Source -> Check: Allow output folder for source folders -> Edit the output of src_webContent -> choose the virtual folder as target (which was create in step 3) alt text
  5. Done. Sources within this special src_webContent folder should be globally accessible within JSF views.

This adventurous project configuration can be inspected within this demo project: demoPrimeImportEnum-globalClasses_51.iar

link

answered 30.07.2015 at 13:39

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 07.03.2018 at 10:32

Alex%20Suter's gravatar image

Alex Suter ♦♦
3.1k122247

Hello Reguel,

Thank you very much for your support! But, the solution is not flexible for us (just like a work around) I hope that ivy can support like we do in eclipse! :)

Regards,

(07.09.2015 at 14:28) Hap Em Hap%20Em's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×3

Asked: 29.07.2015 at 05:58

Seen: 4,486 times

Last updated: 07.03.2018 at 10:32