» Jease » Documentation

Want to contribute?

1970-01-01

Do you want to contribute to Jease? Writing documentation is a good place to get started and will help to get people becoming more familiar with Jease. Any contribution is appreciated.

Properties

You can extend existing content objects by additional properties at runtime directly through the CMS. Properties are revisioned and searchable automatically.

You have the choice of adding properties to single instances of content-types or to use a Factory which allows to define a prototype which is used to synchronize properties for all guarded content items.

To edit properties you have to open a content object and switch into edit mode by clicking the Button labeled "Properties". Now select a property type of your choice and enter a name for the new property. Click "+" to add the property to the content object.

When you're in edit mode, you can also alter existing properties:

- If you want to rename an existing property, simply click on the label and enter a new name. - If you want to reorder properties, simply drag them around via their labels. - If you want to remove a property, drag it onto the trash icon.

Using a Factory to define a Prototype

In order to use a Factory, add a Factory to your CMS and enter it. If you want to create unique ids for content-types created via the Factory, you can specify a name of a sequence for the Factory.

Then create a content type of your choice within the Factory and add additional properties. When you are now editing content-types in your CMS for which a prototype is defined inside the Factory, the properties from the prototype will automatically synchronized with the properties of the edited content object.

Please note: Properties from a Factory are only synchronized when you edit a content-object.

Using Properties in Templates

If you want to make use of properties in your templates, you can use a simple API:

- Content#getProperty(name) returns the first property with given name. - Content#getProperty(name, default) returns the first property with given name converted as string or the default string value. - Content#getProperties(name) returns an array of properties with given name.

All properties define a meaningful toString-method which returns the value of the property, so it is easy to use it in templates without casting. You can also specify a default value:

<div style="color: 
        <%= content.getProperty("Color", "red") %>">
  ...
</div>

Available Property Types

- Boolean - Choice (Multiple) - Date - Double - File - Html - Integer - Lines - Script - Selection (Single) - String - Text

Configuration for "Choice" and "Selection"

In order to define reference lists for Choice and Selection, you'll need to add a Lines-Property somewhere in your CMS and fill it with reference values (so called provider). If you later on create a Choice/Selection, you'll need to select one of the existing providers for the selection before you can select values.

If you want to provide the options for "Choice" or "Selection" dynamically, you can create a ScriptProperty and put some Java code into it which needs to implement the following interface:

package jease.cms.domain.property;

public interface Provider {

  public String[] getValue();
  
}

Last modified on 2011-12-27 by Maik Jablonski