From: <tri...@us...> - 2009-02-08 17:18:46
|
Revision: 1010 http://equanda.svn.sourceforge.net/equanda/?rev=1010&view=rev Author: triathlon98 Date: 2009-02-08 17:18:42 +0000 (Sun, 08 Feb 2009) Log Message: ----------- EQ-297 navigation module, pagelink component Modified Paths: -------------- trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/services/NavigationModule.java Added Paths: ----------- trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/components/ trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/components/PageLink.java trunk/equanda-t5navigation/src/main/resources/ trunk/equanda-t5navigation/src/main/resources/org/ trunk/equanda-t5navigation/src/main/resources/org/equanda/ trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/ trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/components/ trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/components/PageLink.tml Added: trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/components/PageLink.java =================================================================== --- trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/components/PageLink.java (rev 0) +++ trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/components/PageLink.java 2009-02-08 17:18:42 UTC (rev 1010) @@ -0,0 +1,67 @@ +/** + * This file is part of the equanda project. + * + * The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF + * ANY KIND, either express or implied. See the License for the specific language governing rights and + * limitations under the License. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + */ + +package org.equanda.t5nav.components; + +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry5.Link; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.equanda.t5nav.services.NavigationManager; + +/** + * Page link which allows linking to a page and either creating a new navigation of starting a new mini-conversation. + * + * @author <a href="mailto:jo...@pr...">Joachim Van der Auwera</a> + */ +public class PageLink +{ + @Parameter( defaultPrefix = BindingConstants.LITERAL, required = true ) + private String page; + + @Parameter( defaultPrefix = BindingConstants.PROP ) + private String title; + + @Parameter( defaultPrefix = BindingConstants.PROP ) + private Object context; + + @Inject + private ComponentResources resources; + + @Inject private NavigationManager navigationManager; + + public Link onActionFromPageLink() + { + if ( resources.isBound( "title" ) ) + { + navigationManager.beginNavigation( resources.createPageLink( resources.getPageName(), false ), title ); + } + else + { + navigationManager.beginNavigation( false ); + } + return resources.createPageLink( page, resources.isBound( "context" ), context ); + } +} Modified: trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/services/NavigationModule.java =================================================================== --- trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/services/NavigationModule.java 2009-02-07 16:57:35 UTC (rev 1009) +++ trunk/equanda-t5navigation/src/main/java/org/equanda/t5nav/services/NavigationModule.java 2009-02-08 17:18:42 UTC (rev 1010) @@ -26,13 +26,11 @@ import org.apache.tapestry5.internal.services.LinkFactoryListener; import org.apache.tapestry5.internal.services.PersistentFieldManager; +import org.apache.tapestry5.ioc.Configuration; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.services.ApplicationStateManager; -import org.apache.tapestry5.services.Dispatcher; -import org.apache.tapestry5.services.MarkupRendererFilter; -import org.apache.tapestry5.services.PersistentFieldStrategy; +import org.apache.tapestry5.services.*; import org.equanda.t5nav.internal.*; /** @@ -43,6 +41,11 @@ */ public class NavigationModule { + public static void contributeComponentClassResolver( Configuration<LibraryMapping> configuration ) + { + configuration.add( new LibraryMapping( "t5nav", "org.equanda.t5nav" ) ); + } + public static void bind( ServiceBinder binder ) { binder.bind( NavigationDispatcher.class ); Added: trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/components/PageLink.tml =================================================================== --- trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/components/PageLink.tml (rev 0) +++ trunk/equanda-t5navigation/src/main/resources/org/equanda/t5nav/components/PageLink.tml 2009-02-08 17:18:42 UTC (rev 1010) @@ -0,0 +1,3 @@ +<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> + <t:actionlink t:id="pagelink"><t:body/></t:actionlink> +</t:container> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |