Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 252861

Summary: [WPE] Add tag converter transform operation in WPE to support generating markup depending on view mode
Product: [WebTools] Java Server Faces Reporter: Carlin Rogers <carlin.rogers>
Component: UIAssignee: Carlin Rogers <carlin.rogers>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: cameron.bateman, david_williams, raghunathan.srinivasan
Version: unspecifiedKeywords: plan
Target Milestone: 3.2 RC1Flags: david_williams: pmc_approved+
raghunathan.srinivasan: pmc_approved? (naci.dai)
raghunathan.srinivasan: pmc_approved? (deboer)
raghunathan.srinivasan: pmc_approved? (neil.hauge)
raghunathan.srinivasan: pmc_approved? (kaloyan)
raghunathan.srinivasan: review+
Hardware: PC   
OS: Windows XP   
URL: ORACLE_P1
See Also: https://git.eclipse.org/r/114213
https://git.eclipse.org/r/114214
https://git.eclipse.org/c/jsf/webtools.jsf.git/commit/?id=598da983ba6149e5d65a06052d61457989bb0803
https://git.eclipse.org/c/jsf/webtools.jsf.git/commit/?id=e91b1489fa98bb207be2f72ff1ebda0aa2a8e3b8
Whiteboard: PMC_approved Extensibility
Attachments:
Description Flags
patch with new transform operation and addition to the operations registered in the plugin.xml
none
additional patch containing the junit test none

Description Carlin Rogers CLA 2008-10-30 14:18:12 EDT
Build ID: M20080911-1700

Steps To Reproduce:
Currently there is no way to create markup specific or unique to a given view (design/preview) using the available transform operations. The decorator options provide a mechanism to make the markup distinct, but this is limited for some scenarios.

For example, some tag libs have logic or conditional tags (JSTL, Struts) that have child element content in the body of the tag...

<c:catch var="ex">
    ...
</c:catch>
<c:if test="${not empty ex}">
    <c:out value="${ex}"/>
</c:if>

Would be great for a developer creating Design Time tag converter meta-data to be able to display a place holder with an image and label describing the logic tag in the design view, as well as display the markup for the child element contents, but only display the child contents in the preview mode - without an image or label for the parent logic tag.

Would be great to enhance the set of tag converter transform operations in WPE tag support with a new one that would execute child operations depending on a given view mode (a parameter to the new operation).

More information:
If the proposed transform operation does not belong with the WPE tag support, it would be great if the Design Time meta-data framework for tag support and transform operations exposed the view mode from the ITagConverter object so that a developer can write their own transform operation that can check the view mode.

Currently, an instance of DTTagConverter contains the value of the mode, but DTTagConverter is an internal class. Also, there is no public way to get the tag converter. The ITagConverterContext does not provide a method to get the tag converter (though the internal implementation, DTTagConverterContext, does have the protected member data, DTTagConverter).
Comment 1 Raghunathan Srinivasan CLA 2009-08-19 14:58:21 EDT
Plan for 3.1.2/3.2
Comment 2 Carlin Rogers CLA 2010-05-06 13:45:14 EDT
Created attachment 167352 [details]
patch with new transform operation and addition to the operations registered in the plugin.xml

This patch includes the new CheckModeOperation implementation along with the addition of the class in the list of transform operations in the plugin.xml. The fix requires the addition of a new public method to get the mode from an internal class, the DTTagConverterContext.

In the future, we might want to expose getMode() as part of public API. The interface ITagConverter declares a setMode() operation but does not have a getMode() exposed. Might be useful to expose getMode() there as well as on the ITagConverterContext. However, for this stage in the release, best not to change these interfaces.

Will add a second patch with a JUnit test.
Comment 3 Carlin Rogers CLA 2010-05-06 14:02:21 EDT
Raghu, please consider for PMC approval.
Comment 4 Raghunathan Srinivasan CLA 2010-05-06 15:13:36 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug"
(requested by an adopter) please document it as such. 
This is 'hotbug' request from Oracle. The patch enables the adopter product to enhance design-time rendering of tags in the Web Page Editor based on the current view: design or preview.
* Is there a work-around? If so, why do you believe the work-around is
insufficient? 
No workaorund
* How has the fix been tested? Is there a test case attached to the bugzilla
record? Has a JUnit Test been added? 
Manual testing. Junit test will be added
* Give a brief technical overview. Who has reviewed this fix? 
See description and comment 2
* What is the risk associated with this fix? 
low-medium
Comment 5 Carlin Rogers CLA 2010-05-07 14:18:33 EDT
Created attachment 167521 [details]
additional patch containing the junit test 

I'll apply the junit patch along with the original patch.
Comment 6 Carlin Rogers CLA 2010-05-07 16:09:47 EDT
Patches checked into head for 3.2RC1.
Comment 7 Eclipse Genie CLA 2017-12-18 20:15:30 EST
New Gerrit change created: https://git.eclipse.org/r/114213
Comment 8 Eclipse Genie CLA 2017-12-18 20:15:35 EST
New Gerrit change created: https://git.eclipse.org/r/114214