Creating Tapestry Pages, Componenets, and Mixins
Tapestry items can be created only within the components
, pages
, or mixins
dedicated packages.
These packages, in their turn, should be located under the application root package.
In this topic:
To enable creation of Tapestry items in a module
- Open the Project tool window.
- Switch to the Project or Package view by doing one of the following:
- Select the application root package, and choose New | Package on the context menu.
-
In the New Package dialog box, that opens, specify the name of the dedicated package depending on the type of items to be created under it.
- pages for Tapestry pages.
- components for Tapestry components.
- mixins for Tapestry component mixins.
To create a Tapestry page
A Tapestry page normally consists of an HTML template that implements the page appearance and a Java class that implements the page functionality and behaviour.
The HTML file has the same name as the Java file and the .tml
extension.
IntelliJ IDEA generates two stubs, with the .tml
file containing the <header></header>
and <body></body>
sections.
- Open the Project tool window.
- Switch to the Tapestry view by choosing the Tapestry item from the list in the left-hand part of the title bar or clicking the Tapestry tab.
- Right-click the pages node and choose New | Tapestry | Page on the context menu.
-
In the New Tapestry Page dialog box, that opens, specify the page name and the parent folders to store the generated class and template sources in.
IntelliJ IDEA remembers the last selected directories and will automatically show them in the corresponding drop-down lists next time you create a page.
- Customize the page generation, if necessary:
To create a new component
A Tapestry component normally consists of an HTML template that implements the appearance of a piece of a page and a Java class that implements the behavior and functionality of this item.
The HTML file has the same name as the Java file and the .tml
extension.
IntelliJ IDEA generates two stubs, with the .tml
file containing a <div></div>
section.
- Open the Project tool window.
- Switch to the Tapestry view by choosing the Tapestry item from the list in the left-hand part of the title bar or clicking the Tapestry tab.
- Right-click the components node and choose New | Tapestry | Component on the context menu.
-
In the New Tapestry Component dialog box, that opens, specify the component name and the parent folders to store the generated class and template sources in.
IntelliJ IDEA remembers the last selected directories and will automatically show them in the corresponding drop-down lists next time you create a component.
- Customize the component generation, if necessary:
To create a new mixin
- Open the Project tool window.
- Switch to the Tapestry view by choosing the Tapestry item from the list in the left-hand part of the title bar or clicking the Tapestry tab.
- Right-click the mixins node and choose New | Tapestry | Mixin on the context menu.
-
In the New Tapestry Mixin dialog box, that opens, specify the mixin name and the parent folders to store the generated class in.
IntelliJ IDEA remembers the last selected directory and will automatically show them it in the drop-down list next time you create a mixin.
- Customize the mixin generation, if necessary: