Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 218333 - Unable to set Web Module Version when using a JSF Preset
Summary: Unable to set Web Module Version when using a JSF Preset
Status: CLOSED FIXED
Alias: None
Product: Java Server Faces
Classification: WebTools
Component: JSF Tools (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Gerry Kessler CLA
QA Contact:
URL:
Whiteboard: fix_ready
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-08 11:32 EST by Gerry Kessler CLA
Modified: 2008-06-16 05:03 EDT (History)
4 users (show)

See Also:


Attachments
Patch (7.66 KB, patch)
2008-02-21 13:35 EST, Konstantin Komissarchik CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gerry Kessler CLA 2008-02-08 11:32:48 EST
With the I20080208081816 build, the Dynamic Web Module version setting is now on the first screen.  With Web module set to 2.4, the JSF v1.1 preset is (correctly) available.   Choosing that preset, the Web module version changes to 2.3.   Changing the web module version back to 2.4 resets the presets back to <custom>.  

The version can be set if one uses the Modify button for the configuration.  

Is it now necessary to create another preset for JSF v1.1 with Web v2.4, or is this a bug with the first facet installation page?   Problem with the preset itself?  Is there a new way that presets are defined?
Comment 1 Konstantin Komissarchik CLA 2008-02-08 11:42:58 EST
The spec version selection feature is not fully complete in M5. Eventually, the list of configurations on the first page will be filtered based on the spec version selected in the new combo. Assuming JSF 1.1 preset is defined to specify jst.web 2.3, that preset would not be available for selection if user chooses spec version 2.4. What is the behavior that you are after? What j2ee versions is JSF 1.1 compatible with?
Comment 2 Gerry Kessler CLA 2008-02-11 16:44:31 EST
The JSF versions 1.1 and 1.2 are both compatible with a range of Web module versions.   I think you have a tricky UI problem.

It seems to me that if a range could be defined on facet extensions like JSF, choosing any preset should leave the fixed facet versions alone.  For example, if JSF v1.1 preset was available because the Java and Web module versions were in the correct range (say Java 1.4 and Web 2.4), choosing the preset would not change those versions.  Also, once a preset is selected, that preset should remain selected should the user change the Web module version, but only if the preset is still valid for the new Web module version.   If not, the preset selection should be cleared.  This, at least, is how I would expect it to work for our use case.

I can also imagine that there are some adopters who would want the ability to set the Web and Java facet versions from their preset.  Perhaps the extension-point definition could also allow forcing a fixed facet version change?  In this case, the range of versions in the preset extension allows the preset  to become available, but choosing the preset sets the fixed facet version.  As a concrete example, let's say the JSF v1.1 preset has a range of Web versions of 2.3 and higher but forces the Web Module version to be 2.4.  The preset would be available for any 2.3 and higher Web module, but when selected, the preset would set the Web module to 2.4.   In this case, if the user now resets the Web module version back to 2.3, the preset would be cleared.   

If the user uses the modify configuration button, they should be allowed to configure it in anyway they choose with the available version ranges.

My 2 cents.
Comment 3 Konstantin Komissarchik CLA 2008-02-12 18:14:25 EST
Assigning this to myself. I will look into try to address this usecase and will attach a patch for JSF code as appropriate.
Comment 4 Konstantin Komissarchik CLA 2008-02-21 13:35:05 EST
Created attachment 90384 [details]
Patch

The attached patch coverts the JSF 1.1 preset into a dynamic preset that morphs depending on the the current jst.web facet version. Note that this patch depends on changes just released to core wtp plugins, so you will probably want to wait until next week's I-build before trying this out.
Comment 5 Konstantin Komissarchik CLA 2008-03-04 10:09:39 EST
Patch attached. Please review. Let me know if you have any questions.
Comment 6 Gerry Kessler CLA 2008-03-04 11:38:16 EST
The patch seems to work fine for our use case.   I will most likely commit for this week's IBuild.  Thanks.

Question1: what is the purpose of adding the Java facet versions in the preset?  commenting out seemed to have no effect.

Question2: <i>if</> we wanted to set an upper limit on the web module version for JSF 1.1, how would we do that in the preset?

Question3: can dynamic presets set the required facets versions?  
Comment 7 Konstantin Komissarchik CLA 2008-03-04 14:08:19 EST
> Question1: what is the purpose of adding the Java facet versions in the preset?
> commenting out seemed to have no effect.

I am surprised by this. In order for a preset to be available, it has to specify a version for all fixed facets. If a preset says: select web + jsf and that's it, that combination would not work for a dynamic web project, so the preset should have been filtered out. I will need to take a look.

> Question2: <i>if</> we wanted to set an upper limit on the web module version
> for JSF 1.1, how would we do that in the preset?

Return null from the createPreset call if the web facet version is too high.

> Question3: can dynamic presets set the required facets versions?  

Not sure what you are asking here. Every preset (dynamic or static) has to at the minimum specify versions for all of the fixed facets (I think that's what you are refering to as required). After that, it can specify which additional facets (and their versions) should be selected.
Comment 8 Gerry Kessler CLA 2008-03-05 12:21:34 EST
>> Question3: can dynamic presets set the required facets versions?  

> Not sure what you are asking here. Every preset (dynamic or static) has to at
the minimum specify versions for all of the fixed facets (I think that's what
you are refering to as required). After that, it can specify which additional
facets (and their versions) should be selected.

Once upon a time, the preset would configure the required facet version and not just check for minimum.   When a user selected JSF V1.1, for example, it would set the Web version to 2.4 and Java version to 1.4.   I am not saying that I wish to be able to do that anymore, but that what a preset does seems to have changed.
Comment 9 Konstantin Komissarchik CLA 2008-03-06 17:03:49 EST
> Once upon a time, the preset would configure the required facet version and 
> not just check for minimum.   When a user selected JSF V1.1, for example, it 
> would set the Web version to 2.4 and Java version to 1.4.   I am not saying 
> that I wish to be able to do that anymore, but that what a preset does seems 
> to have changed.

I am still confused. What is the behavior that you would like to see? There is a lot of flexibility with dynamic presets.
Comment 10 Gerry Kessler CLA 2008-03-24 13:31:53 EDT
Fix checked in 3/24/08.
Comment 11 Gerry Kessler CLA 2008-05-02 12:25:03 EDT
Verified in 3.0M7.   Closing.
Comment 12 Vincent Petry CLA 2008-06-16 05:03:00 EDT
Why couldn't this be possible with static presets instead of having to implement dynamic ones?

For example, a definition could be:

<static-preset id="preset.my.facet">
	<label>MyFacet</label>			
	<facet id="my.facet" version="1.0"/>
	<facet id="jst.java" version="[5.0"/>
	<facet id="jst.web" version="[2.4"/>
</static-preset>

This way the "MyFacet" preset would be available for all Java versions >= 5.0 and web modules >= 2.4