Created
December 9, 2011 14:02
-
-
Save hugithordarson/1451639 to your computer and use it in GitHub Desktop.
ObjectLink 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo.components; | |
import org.apache.cayenne.CayenneDataObject; | |
import org.apache.tapestry5.annotations.Parameter; | |
import org.apache.tapestry5.annotations.Property; | |
import org.apache.tapestry5.ioc.annotations.Inject; | |
import org.apache.tapestry5.services.ComponentSource; | |
import foo.components.parents.DetailPage; | |
import foo.components.parents.LVComponent; | |
import foo.util.CRUDUtil; | |
public class ObjectLink extends LVComponent { | |
@Property | |
@Parameter( required = true ) | |
private CayenneDataObject object; | |
/* | |
@Inject | |
private PageRenderLinkSource linkSource; | |
*/ | |
@Inject | |
private ComponentSource componentSource; | |
Object onActionFromSelect( CayenneDataObject context ) { | |
Class pageClass = CRUDUtil.detailPageClass( context.getClass() ); | |
DetailPage<CayenneDataObject> t = (DetailPage<CayenneDataObject>)componentSource.getPage( pageClass ); | |
t.setSelectedObject( object ); | |
return t; | |
} | |
/* | |
public String getLink() { | |
Class pageClass = CRUDUtil.detailPageClass( object.getClass() ); | |
Link link = linkSource.createPageRenderLinkWithContext( pageClass, object ); | |
String uri = link.toURI(); | |
return uri; | |
} | |
*/ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> | |
<t:actionLink t:id="select" context="object"><t:body /></t:actionLink> | |
<!-- a href="${link}"><t:body /></a--> | |
</t:container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment