| Author |
Message |
|
|
Post subject: Cannot customize menu generation, spring mvc scaffold
Posted: Mar 23, 2012 - 09:10 PM
|
|
Registered Member


Joined: Mar 08, 2012
Posts: 33
|
|
Hi ,
I was doing some changes on the template crudMenuSegment.jet in order to modify the menu on the dashboard (spring mvc scaffolding) but none of the changes are reflected, I tried also to rename the JET template (Expecting some error on the scaffolding) but nothing happens.
The steps are:
1-Create a new web project
2-Create a new customize template project
3-Modify the template
crudCommon\templates\crud\springmvc\crudMenuSegment.jet
4-Add the customization to the web project
5-Run the mvc scaffold (database option)
Please help.
| Code: |
<%@ jet
package="com.skyway.scaffolding.crud.templates.springmvc"
class="CrudMenuSegmentTemplate"
%>
<%@taglib prefix="jet" id="org.eclipse.jet.controlTags"%>
<%@taglib prefix="f" id="org.eclipse.jet.formatTags"%>
<%@taglib prefix="sw" id="org.skyway.integration.java.skywayCodeGenTags"%>
<\%@page language="java" isELIgnored="false" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<jsp:directive.include file="/WEB-INF/sitemesh-decorators/include.jsp"/>
<fmt:setBundle basename="bundles.<jet:get select="lower-case($dataType/@name)"/>-resources"/>
<div id="contentarea">
<div id="lb"><div id="rb"><div id="bb"><div id="blc">
<div id="brc"><div id="tb"><div id="tlc"><div id="trc">
<div id="content">
<h1>Spring MVC</h1>
TEST TEST TEST TEST TEST TEST
<p class="line"> </p>
<div class="clear"> </div>
</div>
</div></div></div></div>
</div></div></div></div>
</div> |
|
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 26, 2012 - 11:50 AM
|
|

Joined: Apr 04, 2011
Posts: 196
|
|
This is working for me if I modify the template. If you rename the template, it will just be ignored. It is expected that no error will occur.
Are the steps listed the exact steps or are there other customization projects associated with the web project? If there are multiple customization projects selected, the subsequent ones may be overriding the template.
As you're probably aware, the output is in WEB-INF/pages/menu.jsp. If you look in that file are the changes there? |
_________________ Cindy
MyEclipse for Spring Support
|
| |
|
|
|
 |
|
|
Post subject: follow up
Posted: Mar 26, 2012 - 04:32 PM
|
|
Registered Member


Joined: Mar 08, 2012
Posts: 33
|
|
I have 1 customization project attached to the scaffold , please notice that on the body of crudMenuSegment.jet there is no JET code to generate the JSP includes, as you can see there is only HTML code , how does the scaffold knows that inside the <div id="content"> there must be a jsp:include ? below the steps :
1- Create a custom code template
2- Modify the template crudMenuSegment.jet (i just added the word TEST)
3- Include the customization on the web project (MyEclipse->Customization->Location)
4- Run the scaffold
5-See the results
Please advise. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 28, 2012 - 12:31 AM
|
|

Joined: Apr 04, 2011
Posts: 196
|
|
The includes are injected by the scaffolding engine. They are specified in the plugin.xml of the com.skyway.scaffolding.crud.spring plugin.
The relevant segments of the plugin.xml are:
| Code: | <jsp
id="menu.jsp"
name="/menu.jsp"
location="WEB-INF/pages"
template="templates/crud/springmvc/crudMenuSegment.jet"
overwrite="false" />
<inject
id="inject.menu.jsp"
targetPath="/WEB-INF/pages/menu.jsp"
textToInject="$function{concat('<jsp:include page="/WEB-INF/pages/', lowerCase($dataType.name), '/menu.jsp" />')}"
matchText="<div class="clear""
beforeFlag="true"/>
|
|
_________________ Cindy
MyEclipse for Spring Support
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 28, 2012 - 04:54 PM
|
|
Registered Member


Joined: Mar 08, 2012
Posts: 33
|
|
Ok, is there any way to extend the fragment in order to change the text inside textToInject property, I want to add a DIV id on that portion, currently I have one extension for controling the attribute names for the domain class.
The fragment id is <fragment id="springMvcWebClientModule">
| Code: |
<extension
point="org.skyway.core.generate.generationRepository">
<advice
id="table"
elementAdapterType="dataTypeAdapter"
elementAdapterId="table"
adviceType="merge"
label="Database Schema"
groupName="table"
priority="10"
provider="org.custom.provider.CustomTableDataTypeInputProvider"
>
</advice>
</extension> |
|
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Mar 30, 2012 - 11:53 AM
|
|

Joined: Apr 04, 2011
Posts: 196
|
|
I don't see a way to override the inject, but depending on what you're trying to do, you may be able to still get the effect.
The inject is looking for the <div class="clear"> tag. If you wanted to put a div around the include, you could just put it around that tag. If you didn't want the include at all, try removing the div. |
_________________ Cindy
MyEclipse for Spring Support
|
| |
|
|
|
 |
|
|
Post subject: Similar problem
Posted: Apr 10, 2012 - 06:02 PM
|
|
Joined: Feb 20, 2012
Posts: 11
|
|
Hi, I am having a similar "ignoring" problem on another customization template, no matter what I type in crudCommon/template/crud/common/crudEditField.jet it will never be compiled into its respective class com.skyway.scaffolding.crud.templates.common.CrudEditFieldTemplate, this class is always the same and so my changes are never generated.
Any help would be highly appreciated |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: Similar problem
Posted: Apr 10, 2012 - 11:54 PM
|
|
Joined: Feb 20, 2012
Posts: 11
|
|
| ryouji_shiki wrote: | Hi, I am having a similar "ignoring" problem on another customization template, no matter what I type in crudCommon/template/crud/common/crudEditField.jet it will never be compiled into its respective class com.skyway.scaffolding.crud.templates.common.CrudEditFieldTemplate, this class is always the same and so my changes are never generated.
Any help would be highly appreciated |
Also I've edited crudViewField.jet [ in the same path ] and ../springmvc/crudEdit.jet and it works perfectly... but with that particular one there is nothing I can do... I'm really desperate about this :( |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: Similar problem
Posted: Apr 11, 2012 - 12:32 AM
|
|
Joined: Feb 20, 2012
Posts: 11
|
|
| ryouji_shiki wrote: | | ryouji_shiki wrote: | Hi, I am having a similar "ignoring" problem on another customization template, no matter what I type in crudCommon/template/crud/common/crudEditField.jet it will never be compiled into its respective class com.skyway.scaffolding.crud.templates.common.CrudEditFieldTemplate, this class is always the same and so my changes are never generated.
Any help would be highly appreciated |
Also I've edited crudViewField.jet [ in the same path ] and ../springmvc/crudEdit.jet and it works perfectly... but with that particular one there is nothing I can do... I'm really desperate about this :( |
I think after a day of fighting against it I finally found it: the thing is that my jsf template [ jsf/templates/jsf/crud/common/crudEditField.jet ] is also pointing to the same class that the jet template I was modifying [ com.skyway.scaffolding.crud.templates.common.CrudEditFieldTemplate ]. Now if I change the JSF template the class gets updated BUT! the generated code is not updated [ maybe because I am not using JSF? ]. |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Apr 11, 2012 - 02:50 AM
|
|

Joined: Apr 04, 2011
Posts: 196
|
|
Hi ryouji_shiki,
If you're not using JSF, then just delete that whole jsf folder from the customization project. Then your customization in the original template will be compiled and used.
The customization project just dumps all of the templates into a project to make them available for use. I've seen a few fringe cases like this where one will override the other. Typically in the customization project, you'd only want it to contain exactly the files you want to override. You can delete the rest of the templates and they'll be picked up from the plugins. |
_________________ Cindy
MyEclipse for Spring Support
|
| |
|
|
|
 |
|
|