IntelliJ IDEA 2016.3 Help

Creating Tapestry Pages, Componenets, and Mixins

This feature is supported in the Ultimate edition only.

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

  1. Open the Project tool window.
  2. Switch to the Project or Package view by doing one of the following:
    • Select the necessary view from the list in the left-hand part of the title bar.
    • If the views are represented by tabs, click the corresponding tab.
  3. Select the application root package, and choose New | Package on the context menu.
  4. 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.

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.

  1. Open the Project tool window.
  2. 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.
  3. Right-click the pages node and choose New | Tapestry | Page on the context menu.
  4. 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.

  5. Customize the page generation, if necessary:
    • If you already have a page with the specified name and you want IntelliJ IDEA to overwrite it, select the Replace existing files check box.
    • To have only a Java class stub generated, select the Do not create template check box.

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.

  1. Open the Project tool window.
  2. 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.
  3. Right-click the components node and choose New | Tapestry | Component on the context menu.
  4. 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.

  5. Customize the component generation, if necessary:
    • If you already have a component with the specified name and you want IntelliJ IDEA to overwrite it, select the Replace existing files check box.
    • To have only a Java class stub generated, select the Do not create template check box.

To create a new mixin

  1. Open the Project tool window.
  2. 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.
  3. Right-click the mixins node and choose New | Tapestry | Mixin on the context menu.
  4. 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.

  5. Customize the mixin generation, if necessary:
    • If you already have a mixin with the specified name and you want IntelliJ IDEA to overwrite it, select the Replace existing files check box.

See Also

Last modified: 21 March 2017