Created
December 9, 2011 12:35
-
-
Save hugithordarson/1451368 to your computer and use it in GitHub Desktop.
ObjectLink
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 ComponentSource componentSource; | |
Object onActionFromSelect() { | |
Class pageClass = CRUDUtil.detailPageClass( object.getClass() ); | |
DetailPage<CayenneDataObject> t = (DetailPage<CayenneDataObject>)componentSource.getPage( pageClass ); | |
t.setSelectedObject( object ); | |
return t; | |
} | |
} |
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"><t:body /></t:actionLink> | |
</t:container> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment