# How to install the view package

This How-To describes the setup of the plugins (needed to work with forrest:views and forrest:contracts) and a fresh seed.

Intended Audience

"Views" are a new functionality which is still in development phase. That is why it is in the "whiteboard" section of the Forrest distribution. This HowTo is a good start but still needs proof-reading.

Users/devs who wants to get started with view development. This setup guide is valid for both users and devs.

Purpose

To help users install views. This is the "getting started" setup-guide.

Prerequisites

- You have to use the trunk version of forrest to use views because it is in an early stage of development.

Steps

The process of setting up the plugin is quite involved. We promise it will be easier in the future. Some of the instructions have to be modified with your local settings.

# Build the view and the viewHelper plugins

The first step is to build the view and the viewHelper plugins. Change to a console of your choice and go (cd) to the trunk version of forrest {forrest-trunk}. Then do an update and after this deploy both plugins locally.

    cd {forrest-trunk}
    svn up
    cd whiteboard/plugins/org.apache.forrest.plugin.internal.view/
    ant local-deploy
    cd ../org.apache.forrest.plugin.output.viewHelper.xhtml/
    ant local-deploy

# Seed a new project

Go to the dir where you want to seed a new project and seed it. Next we have to prepare a default.fv directory ("conf") in project.conf-dir (forrest.properties) of the fresh seed. This will be needed as soon you modify the default view of your project. A "templates" directory is needed as well, for your project-specific contract implementations.

    cd ~/src/newSeed
    forrest seed
    mkdir src/documentation/conf
    mkdir src/documentation/resources/templates

# Modifying forrest.properties

Now we have to tell forrest that we are planning to use the view plugins. We will do that by editing to the forrest.properties to add the plugins:

    project.required.plugins=org.apache.forrest.plugin.output.viewHelper.xhtml,org.apache.forrest.plugin.internal.view

We also have to change the project skin to leather-dev. The reason for this is that the plugins are still not independent from the "old fashion skins".

We are exchanging only site2xhtml.xsl of leather-dev skin by the plugins and some contracts are based on e.g. document2html.xsl output of leather-dev.

    project.skin=leather-dev

# Test your new view-based project

Now you have finished the preparation and the setup to finally try

    forrest run

then point to http://localhost:8888/ and you should see the default view-based skin.

When developing styles with views 'forrest run' is the quickest way. You will see you do not have to build your project to see the changes on your pages when working with *.fv.

# Available contracts

To start working with views you need to know which contracts you can use. For this we will install another plugin `org.apache.forrest.plugin.input.viewHelper.xhtml.ls`. The setup is:

    cd {forrest-trunk}
    svn up
    cd whiteboard/plugins/org.apache.forrest.plugin.input.viewHelper.xhtml.ls/
    ant local-deploy

The newly installed plugin will show the available contracts listed in an html page. First we have to tell forrest that we are planning to use the new plugin. We will do that by editing the forrest.properties of the newSeed to add the plugin:

    project.required.plugins=org.apache.forrest.plugin.input.viewHelper.xhtml.ls

Now point your browser to `http://localhost:8888/ls.contracts.html`. On this page you will find all contracts that you can use in your project.

Further Reading

Congratulations, you are now able to work with views. From here we recommend reading the following How-To's:

- Getting started with forrest:view DSL
- Create your own contract implementation

Feedback

Please provide feedback about this document via the mailing lists.