You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Dennis Lundberg (JIRA)" <ji...@codehaus.org> on 2009/03/01 15:38:12 UTC

[jira] Commented: (MSITE-378) Support polymorphism for menu inheritance

    [ http://jira.codehaus.org/browse/MSITE-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=167475#action_167475 ] 

Dennis Lundberg commented on MSITE-378:
---------------------------------------

Thorsten,

Menus can be inherited, but you have to let Maven know that you want them to be inherited. See the section called "Inheritance" on http://maven.apache.org/plugins/maven-site-plugin/examples/sitedescriptor.html

In your example you would need to have this in site.xml of R:

{code:xml}
		<menu name="Main" inherit="top">
			<item name="Introduction" href="/index.html" />
			<item name="News" href="/news.html" />
			<item name="Overwrite" href="/documentation.html" />
		</menu>
{code}


> Support polymorphism for menu inheritance
> -----------------------------------------
>
>                 Key: MSITE-378
>                 URL: http://jira.codehaus.org/browse/MSITE-378
>             Project: Maven 2.x Site Plugin
>          Issue Type: New Feature
>          Components: inheritance
>    Affects Versions: 2.0-beta-7
>            Reporter: Thorsten Möller
>
> Inheritance of menus in an multimodule project environment does not work as intuitively expected (as in OO languages). The following excerpts try to illustrate this. Assume there is a root project R that has one module (project) S. Both contain a site descriptor. Let the site descriptor for R be as follows:
> {code:xml}
> <project name="${project.name}">
> 	<!-- ... -->
> 	<body>
> 		<menu name="Main">
> 			<item name="Introduction" href="/index.html" />
> 			<item name="News" href="/news.html" />
> 			<item name="Overwrite" href="/documentation.html" />
> 		</menu>
> 	</body>
> 	<!-- ... -->
> 	
> </project>
> {code}
> And let the site descriptor for S be:
> {code:xml}
> <project name="${project.name}">
> 	<!-- ... -->
> 	<body>
> 		<menu name="Main">
> 			<item name="Introduction" href="/index.html" />
> 			<item name="Overwrite" href="/overwrite.html" />
> 			<item name="Added" href="/added.html" />
> 		</menu>
> 	</body>
> 	<!-- ... -->
> 	
> </project>
> {code}
> As I'm used to the way inheritance and polymorphism are defined in OO languages such as Java, I would expect the following properties for the "Main" menu in S:
> - item "Introduction" is overwritten in S but refers to the same index.html file; of course, its path is relative to start directory of S
> - item "News" is missing for S but will be inherited from R, thus, it will be rendered to the site as in R
> - item "Overwrite" is overwritten in S and refers now to overwrite.html (instead of documentation.html as in R)
> - item "Added" is new in S, thus, it will be rendered to the site in addition
> Unfortunately, with the current implementation of the site plugin inheritance is as follows:
> - "Main" menu of R is inherited by S as-is, that is, all changes made to the menu in S are not visible/rendered to the site.
> I would like to propose to implement polymorphism regarding menu inheritance as described above. In addition, I would like to propose a new boolean parameter "inherited" (or "inherit") that can be added to menu items. Its semantics would be equivalent to the "inherited" tag in pom.xml. In the following one example for R:
> {code:xml}
> <project name="${project.name}">
> 	<!-- ... -->
> 	<body>
> 		<menu name="Main">
> 			<item name="Introduction" href="/index.html" />
> 			<item name="News 1" href="/news1.html"  inherited="false"/>
> 			<item name="News 2" href="/news2.html"  inherited="true"/>
> 			<item name="Overwrite" href="/documentation.html" />
> 		</menu>
> 	</body>
> 	<!-- ... -->
> 	
> </project>
> {code}
> With this example only menu item "News 2" would appear in S because its inheritance is not disabled, while menu item "News 1" appears only in R and not in S because its inheritance was disabled (false). The default if the parameter is missing should be "true".
> Btw, the same extension should be made to the <menu ... > tag to allow to enable or disable inheritance of menus entirely.
> Regards,
> Thorsten

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira