001 package org.tynamo.jpa.sample.components;
002
003 import org.apache.tapestry5.*;
004 import org.apache.tapestry5.annotations.*;
005 import org.apache.tapestry5.ioc.annotations.*;
006 import org.apache.tapestry5.BindingConstants;
007
008 /**
009 * Layout component for pages of application sample.
010 */
011 @IncludeStylesheet("context:layout/layout.css")
012 public class Layout
013 {
014 /** The page title, for the <title> element and the <h1> element. */
015 @Property
016 @Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
017 private String title;
018
019 @Property
020 private String pageName;
021
022 @Property
023 @Parameter(defaultPrefix = BindingConstants.LITERAL)
024 private String sidebarTitle;
025
026 @Property
027 @Parameter(defaultPrefix = BindingConstants.LITERAL)
028 private Block sidebar;
029
030 @Inject
031 private ComponentResources resources;
032
033 public String getClassForPageName()
034 {
035 return resources.getPageName().equalsIgnoreCase(pageName)
036 ? "current_page_item"
037 : null;
038 }
039
040 public String[] getPageNames()
041 {
042 return new String[] { "Index", "About", "Contact" };
043 }
044 }