Annotations

An important step of content modeling is defining data interactions—how users and databases interact with the Model. This section lists the annotations you can use to implement data interactions.

In addition to the annotations in this section, your Model can use annotations defined in the Dari @Recordable interface. Those annotations provide a wide variety of data validation, data processing, and string manipulation functionalities. For details, see Annotations.

See also:

@Content.Searchable

Applies to: Class

Excludes or includes instances of this content type from search results.

The following table lists the elements available with this annotation.

Element Description Valid Value
value

If true or absent, Brightspot’s search results include items of this content type.

If false, Brightspot’s search results exclude items of this content type.

true (default), false

By default, Models extending from Content are searchable, and Models extending from Record are not searchable.

This annotation is inherited, so Models extending from an annotated Model have the same setting for @Content.Searchable.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
package content.article;

import com.psddev.cms.db.Content;

@Content.Searchable(false)
public class Article extends Content {

    /* Fields, Getters, Setters ... */

}

In the previous snippet, line 5 excludes all matching instances of Article from search results.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.recipe;

import com.psddev.cms.db.Content;
import content.article

@Content.Searchable
public class Recipe extends Article {

    /* Fields, Getters, Setters ... */

}

In the previous snippet, line 7 specifies that Recipe extends from Article, which implies that Recipe objects are also excluded from search results. However, line 6 sets @Content.Searchable to true, reversing the effect of the inherited annotation.

@RichTextElement.Exclusive

Applies to: Class.

Ensures rich-text elements do not have nested markup.

When editors concatenate one rich-text element after another, Brightspot stores those elements as nested.

1
2
3
4
5
6
7
<div class="h1">
    Massive Rogue Asteroid
    <div class="h2">
        on Course to Destroy
    </div>
    All Life in Van Nuys, CA
</div>

In the previous snippet, the child element <div class="h2">on Course to Destroy</div> in lines 3–5 is nested within a parent element <div class="h1">Massive Rogue Asteroid All Life in Van Nuys, CA</div>.

Depending on the editors’ preferences and the CSS definitions, nesting may not provide predictable or desirable rendering. You can use the annotation @RichTextElement.Exclusive to prevent nesting.

Implementing this annotation requires the following steps.

Step 1: Annotate a Marker Interface

1
2
3
4
5
6
7
8
package content.article;

import com.psddev.cms.db.RichTextElement;
import com.psddev.dari.db.Recordable;

@RichTextElement.Exclusive
public interface ElementsWithoutNesting extends Recordable {
}

In the previous snippet—

  • Line 7 declares a marker interface.
  • Line 6 applies the annotation @RichTextElement.Exclusive to the interface.

Step 2: Implement Interface in Rich Text Element

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package content.article;

import com.psddev.cms.db.RichTextElement;
import com.psddev.dari.db.Recordable;

@Recordable.DisplayName("Heading 1")
@RichTextElement.Tag(
        value = "h1",
        preview = true,
        block = false)
public class HeadingOneRichTextElement extends RichTextElement implements ElementsWithoutNesting {

    @Required
    private String heading1;

    public String getHeading1() {
        return heading1;
    }

    public void setHeading1(String heading1) {
        this.heading1 = heading1;
    }
}

In the previous snippet, line 11 specifies the marker interface you created in Step 1. When editors concatenate an implementing rich-text element after another implementing rich-text element, Brightspot closes the original element and opens the new element. See the following snippet.

<div class="h1">
    Massive Rogue Asteroid on Course
</div>
<div class="h2">
    to Destroy All Life in Van Nuys, CA
</div>

@RichTextElement.Tag

Applies to: Class

Configures the appearance and behavior of a Rich-Text Element in a Rich-Text Editor.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Custom tag surrounding the rich-text element in published HTML. For example, for value ="quote", the rich-text element appears inside <quote> tags. Any string valid for an HTML tag. Required. No default.
initialBody Initial content for the rich-text element. Any string. If blank (default), there is no initial content for rich-text element.
block Offsets the rich-text element with blank lines in the Content Edit Form. true, false (default). When true, inline in the @ToolUi.RichText annotation must be false. See @ToolUi.RichText.
preview Displays a preview of the rich-text element inside the content edit form. The preview is generated by overriding RichTextElement#writePreviewHtml. true, false (default)
readOnly Prevents modification of an existing rich-text element. true, false (default)
root Indicates rich-text element can contain child elements. true, false (default)
children List of class instances that can be embedded in instances of this rich-text element. Array of classes.
menu Toolbar item under which this rich-text element appears. If absent, rich-text element appears directly on the toolbar. Any string. Default is string of length zero, in which case rich-text element appears on toolbar.
tooltip Displays a tool tip when the mouse hovers over the rich-text element’s menu item. Any string. If blank (default), no tool tip appears.
keymaps Shortcut keys associated with the rich-text item. The shortcut keys are active while the cursor is inside the edit area. Array of strings representing keyboard shortcuts, such as {"Ctrl-I","Cmd-I"}. Any string that complies with CodeMirror’s Key Maps is valid. Default is no keyboard shortcut.
position

Sort order in which menu items appear compared to other menu items in same level on the toolbar. The sort order is as follows:

  1. Sort those rich-text elements without this element in alphabetical order based on the value in the @Recordable.DisplayName annotation.
  2. Sort those rich-text elements with this element based on its numerical value. Break ties by sorting alphabetically based on the value in the annotation @Recordable.DisplayName.
Double. Default is 0.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package content.article;

import com.psddev.cms.db.RichTextElement;
import com.psddev.dari.db.Recordable;

@Recordable.DisplayName("Pull Quote")
@RichTextElement.Tag(
     value = "quote",
     initialBody = "Meaningful quote here",
     block = true,
     preview = true,
     menu = "Enhancement",
     tooltip = "Renders text as a pull quote.",
     keymaps = {"Ctrl-I","Cmd-I"})
public class PullQuoteRichTextElement extends RichTextElement {

}

In the previous snippet—

  • Line 6 specifies the label of the rich-text element’s menu item, and line 12 places that menu item under the top-level Enhancement menu.

    ../../../_images/rich-text-element-menu-items.svg
  • Line 8 generates <quote> tags around the rich-text element at run time.

    <quote>Meaningful quote here</quote>
    
  • Line 9 specifies the initial text in the rich-text element’s widget.

    ../../../_images/rich-text-initial-body.png
  • Line 10 offsets the rich-text element in the editing area with blank lines.

    ../../../_images/rich-text-element-block.svg
  • Line 13 displays a tool tip.

    ../../../_images/rich-text-element-tool-tip.png
  • Line 14 maps the keyboard shortcuts Ctrl+I and Cmd+I to opening the rich-text element’s widget.

@RichTextElement.Tags

Applies to: Field

Displays the Rich-Text Editor with a standard toolbar and additional custom Rich-Text Elements. Requires @ToolUi.RichText.

The following table lists the elements available with this annotation.

Element Description Valid Value
value RichTextElement classes appearing along with standard rich-text toolbar. Array of classes.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.cms.db.RichTextElement;

public class Article extends Content {

    @ToolUi.RichText(inline = false)
    @RichTextElement.Tags({BreakoutRichTextElement.class})
    private String body;

}

In the previous snippet—

  • Line 9 renders the text field as a rich-text editor with the standard toolbar. The element inline = false is mandatory.
  • Line 10 adds a custom breakout rich-text element to the toolbar. For information about creating custom rich-text elements, see Rich Text.
../../../_images/rich-text-element-tags.svg

Note

This annotation may add duplicate buttons to the rich-text toolbar. In such cases, consider using a customized rich-text toolbar. For details, see Rich Text.

@Seo.DescriptionFields

Applies to: Class

Specifies the fields to be included in the published version’s <meta name="description" content="..." /> tag, as in the following example:

<meta name="description" content="Crippled by Earth's Gravity, Aliens Demand Submission" />

The following table lists the elements available with this annotation.

Element Description Valid Value
value Array of fields included in content attribute of the <meta> tag. Brightspot uses only the first element in the array to construct the description. Array of strings.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.Seo;

@Seo.DescriptionFields({"headline"})
public class Article extends Content {

    private String headline;

}

In the previous snippet, line 6 specifies using the value of the Model’s headline field as the value for the content attribute in the <meta> tag. In addition, this annotation causes Brightspot to automatically copy text from the Main tab’s Headline field into the SEO tab’s Description field.

../../../_images/seo-description.svg

If users manually change the value in the Description field, Brightspot disables the automatic copying between the two fields.

You can access the value of the field referred to in the annotation by calling the findDescription() method.

String seoDescription = model.as(Seo.ObjectModification.class).findDescription();

@Seo.KeywordsFields

Applies to: Class

Specifies the fields to be included in the published version’s <meta name="keywords" content="..." /> tag, as in the following example:

<meta name="keywords" content="Crippled by Earth's Gravity, Aliens Demand Submission" />

The following table lists the elements available with this annotation.

Element Description Valid Value
value Array of fields included in content attribute of the <meta> tag. Array of strings.

The contents of each field appears as a single keyword in the output. For example, if the contents of the headline field is Pizza Time, and the contents of the body field is Manny makes the best pies, then the result meta tag is <meta name="keywords" content="Pizza Time,Manny makes the best pies" />.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.Seo;

@Seo.KeywordsFields({"headline"})
public class Article extends Content {

    private String headline;

}

In the previous snippet, line 6 includes the value of the Model’s headline field in the value for the content attribute in the <meta> tag.

You can access the value of the field referred to in the annotation by calling the findKeywords() method.

Set<String> seoKeywords = model.as(Seo.ObjectModification.class).findKeywords();

@Seo.OpenGraphType

Applies to: Class

Specifies the type of object in the published version’s OpenGraph tag, as in the following example:

<meta property="og:title" content="Crippled by Earth's Gravity, Aliens Demand Submission" />

This annotation typically requires additional logic to populate the tag’s content attribute.

The following table lists the elements available with this annotation.

Element Description Valid Value
value String specifying the value of the OpenGraph property attribute. String.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.Seo;

@Seo.OpenGraphType("title")
public class Article extends Content {

    private String headline;

}

In the previous snippet, line 6 specifies the OpenGraph type is title.

You can access the value of the field referred to in the annotation by calling the getOpenGraphType() method.

String seoOpenGraphType = model.getState().getType().as(Seo.TypeModification.class).getOpenGraphType();

See also:

Adding Open Graph Fields

@Seo.TitleFields

Applies to: Class

Specifies the fields to be included in the published version’s <title> tag, as in the following example:

<title>Crippled by Earth's Gravity, Aliens Demand Submission</title>

If this annotation is absent, Brightspot places into the <title> tag the item’s ID.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Array of fields included in the <title> tag. Brightspot uses only the first element in the array to construct the title. Array of strings.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.Seo;

@Seo.TitleFields({"headline"})
public class Article extends Content {

    private String headline;

}

In the previous snippet, line 6 specifies using the value of the Model’s headline field as the value for the <title> tag. In addition, this annotation causes Brightspot to automatically copy text from the Main tab’s Headline field into the SEO tab’s Title field.

../../../_images/seo-title.svg

If users manually change the value in the Title field, Brightspot disables the automatic copying between the two fields.

You can access the value of the field referred to in the annotation by calling the findTitle() method.

String titleString = model.as(Seo.ObjectModification.class).findTitle();

@ToolUi.BulkUpload

Applies to: Field

Indicates the field is available for bulk uploading so that users can drag-and-drop files from their desktops onto the field. Applies to StorageItem and derived fields in a child Model, and requires annotating the child Model with @Recordable.PreviewField.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates field is available for bulk uploads. true (default), false

Implementing bulk upload requires two Models: the child Model containing the bulk-upload field, and the parent Model containing the child Model.

Bulk upload—child Model
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Recordable;
import com.psddev.dari.util.StorageItem;

@Recordable.PreviewField("image")
public class Image extends Content  {

    private String caption;

    @ToolUi.BulkUpload
    private StorageItem image;

    /* Setters and getters */

}

In the previous snippet—

  • Line 8 uses the annotation @Recordable.PreviewField to indicate which of the Model’s fields is the preview field. This annotation is required for bulk uploading.
  • Line 13 uses the annotation @ToolUi.BulkUpload to indicate users can drag-and-drop files from their desktops onto the field Image in the content edit form.

In a production environment, you should limit the types of files users can upload, either globally or at the field level. For details, see File Upload Restrictions and @MimeTypes.

Bulk upload—parent Model
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import java.util.List;

public class Gallery extends Content  {

    private String headline;

    private List<Image> image;

}

In the previous snippet, line 10 establishes the field image as a list of Images—the same field annotated with @ToolUi.BulkUpload in Bulk upload—child Model. At run time, Brightspot indicates the field Image is available for bulk upload by displaying the following labels:

  • Upload Files—indicating users can drag-and-drop multiple files from the desktop.
  • Add Item—indicating users can select a file existing in Brightspot.
../../../_images/bulk-upload-step1.png

Tip

Use the @ToolUi.Note annotation in the parent Model to provide a hint to users that a field accepts drag-and-drop.

After users drag-and-drop the files onto the field, Brightspot displays a preview of the dragged images along with the content edit form corresponding to the child Model.

../../../_images/bulk-upload-step2.png

In the previous image—

  • The bulk-uploaded images are part of the Image Model defined in Bulk upload—child Model.
  • As a result, Brightspot displays a preview of the dragged image using the field image.
  • Brightspot also displays the content edit form for the Model Image.

@ToolUi.Cluster

Applies to: Field

Groups fields under a heading for presentation on the Content Edit Form. You can use this annotation to provide explanatory information or as a label for closely related fields. Fields without a cluster label appear first in the content edit form before fields with a cluster label. Cluster labels are sorted in order of appearance; you can override this order using the annotation @ToolUi.ClusterDisplayOrder.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Cluster label under which this field appears in the content edit form. Any string.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Cluster("Summary text")
    private String headline;

    @ToolUi.Cluster("Summary text")
    private String headlineShort;

    @ToolUi.Cluster("Summary text")
    private String leadIn;

    private Author author;
}

In the previous snippet, lines 8, 11, and 14 specify a cluster heading Summary text around the fields headline, headlineShort, and leadIn. Because the field author has no cluster heading, it appears first in the content edit form.

../../../_images/cluster.png

@ToolUi.ClusterDisplayOrder

Applies to: Class

Specifies the order in which clusters appear in the content edit form.

By default, Brightspot displays clusters (the headings you declare with @ToolUi.Cluster) in the order in which they first appear in the Model. Using this annotation, you can specify which cluster appears first, which cluster appears last, and if the clusters are sorted alphabetically. Regardless of this annotation, Brightspot always places fields without any cluster at the top of the content edit form.

The following table lists the elements available with this annotation.

Element Description Valid Value
tab Tab to which this cluster order applies. Main or any string appearing as a parameter to the annotation @ToolUi.Tab. Required.
alphabetize

If true, clusters are sorted alphabetically.

If false or absent, clusters sorted in order of first appearance in the Model.

true, false (default)
start Topmost clusters in the content edit form (after fields not associated with any cluster). Brightspot displays the clusters in order as they appear in the array, so start={"Soda Pop","Mineral Water"} displays the cluster Soda Pop above the cluster Mineral Water. Array of strings, the elements of which are parameters to the annotation @ToolUi.Cluster.
end

Bottommost clusters in the content edit form. Brightspot displays the clusters in order as they appear in the array, so start={"Soda Pop","Mineral Water"} displays the cluster Soda Pop above the cluster Mineral Water.

Overrides alphabetize = true. If the same cluster is passed to start and end, the layout specified by end has higher priority.

Array of strings, the elements of which are parameters to the annotation @ToolUi.Cluster.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.ClusterDisplayOrder(tab="Main",alphabetize=true)
public class Article extends Content {

    private String headline;

    private String body;

    private String author;

    @ToolUi.Cluster("Markets")
    private String state;

    @ToolUi.Cluster("Markets")
    private String county;

    @ToolUi.Cluster("Markets")
    private String city;

    @ToolUi.Cluster("Demographics")
    private String gender;

    @ToolUi.Cluster("Demographics")
    private String age;

    @ToolUi.Cluster("Demographics")
    private String occupation;

}

In the previous snippet—

  • Lines 9–13 define three fields without a @ToolUi.Cluster annotation; these fields appear first in the content edit form.
  • Lines 15–22 define three fields appearing under the cluster Markets. By default, Markets is the topmost cluster because it is appears first in the Model.
  • Lines 24–31 define three fields appearing under the cluster Demographics.
  • Line 6 specifies that the clusters are sorted alphabetically such that Demographics appears first, overriding the default that Markets be the topmost cluster.
../../../_images/cluster-display-order.svg

@ToolUi.ClusterDisplayOrders

Containing annotation for @ToolUi.ClusterDisplayOrder annotations. You don’t use this annotation explicitly; it implicitly allows for applying multiple @ToolUi.ClusterDisplayOrder annotations to the same Model and avoiding a Duplicate annotation error.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

import java.util.Date;

@ToolUi.ClusterDisplayOrder(tab="Main",alphabetize=true)
@ToolUi.ClusterDisplayOrder(tab="Marketing",alphabetize=true)
@ToolUi.ClusterDisplayOrder(tab="Sales History",start="First Contact Info", end="Latest Contact Info")
public class Article extends Content {

    /* Fields with annotations @ToolUi.Tab and @ToolUi.Cluster. */

}

In the previous snippet, lines 8–10 apply the annotation @ToolUi.ClusterDisplayOrder multiple times to the same Model.

@ToolUi.CodeType

Applies to: Field

Applies syntax highlighting to the text inside a String field.

The following table lists the elements available with this annotation.

Element Description Valid Value
value A code used to apply syntax highlighting. One of the CodeMirror language modes appearing in the table Language Modes for Syntax Highlighting.
Language Modes for Syntax Highlighting
Language Mode Example on CodeMirror
text/clike https://codemirror.net/mode/clike/index.html
text/xml https://codemirror.net/mode/xml/index.html
text/javascript https://codemirror.net/mode/javascript/index.html
text/css https://codemirror.net/mode/css/index.html
text/html https://codemirror.net/mode/xml/index.html
text/htmlembedded https://codemirror.net/mode/htmlembedded/index.html

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.CodeType("text/xml")
    private String xmlText;

}

In the previous snippet, line 8 applies XML syntax highlighting to text in the field xmlText.

../../../_images/code-type.png

@ToolUi.CollectionItemProgress

Applies to: Field

Displays a progress bar for each item in an embedded list of Records. Applies to a single field of type double.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates Brightspot renders annotated field with progress bar and label. true (default), false

The following snippet includes an example of implementing this annotation.

Parent Model
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import java.util.List;

public class Article extends Content  {

private String category;

    @Embedded
    private List<Headline> headlines;

}

The previous snippet declares a Model Article that has an embedded list of Headlines. This Model is one way of implementing A/B testing on different headlines for the same article.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package content.article;

import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Record;

public class Headline extends Record  {

    private String headline;

    @ToolUi.CollectionItemProgress
    private double progressBar;

}

In the previous snippet, line 10 displays a progress bar for every item in the Parent Model’s list of segmented headlines. You can use these progress bars to display the number of times the headline was viewed in A/B testing out of target number of times. For example, if Headline 1 has a target of 500 views, and to date appeared 300 times, the progress bar displays 60%.

../../../_images/progress.png

@ToolUi.CollectionItemToggle

Applies to: Field

Displays a toggle button for each item in an embedded list of Records. Applies to a single field of type boolean. Requires @ToolUi.CollectionItemWeight.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates toggle button appears with annotated field. true (default), false. When false, the field’s weight is allocated to the other fields based on their weights.

The following table shows the effect of toggling off Headline B in the weighing.

Headline Toggle On Toggle Off
A 10 20
B 50 0
C 40 80

Referring to the previous table, A and C have relative weights of 20% (10 ÷ 50) and 80% (40 ÷ 50). When Headline B is toggled off, its weight of 50 is allocated 10 points (0.2 × 50) to Headline A and 40 points (0.8 × 50) to Headline C.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package content.article;

import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Record;

public class Headline extends Record  {

    private String headline;

    @ToolUi.CollectionItemWeight(calculated = true)
    private double weight;

    @ToolUi.CollectionItemToggle
    private boolean onff;

}

In the previous snippet, line 13 displays a toggle button for every item in the Parent Model’s list of segmented headlines. You can use these toggles to preview the impact of canceling one component in an A/B test.

../../../_images/item-toggle.png

@ToolUi.CollectionItemWeight

Applies to: Field

Displays item bar containing one weight for each item in an embedded list. Optionally displays handles on the item bar to adjust the relative weights of each item. Applies to a double field inside a Model that extends from Record.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Activates this annotation true (default), false
calculated

If true, handles do not appear on the item bar.

If false or absent, handles appear on the item bar.

true, false (default)

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Record;

public class Headline extends Record  {

    @ToolUi.CollectionItemWeight(calculated = false)
    private double weight;

}

In the previous snippet, line 8 displays the item bar with handles. As users move the handles, Brightspot updates the percentages associated with each item. (For an example of a parent Model embedding this Model, see the Parent Model.)

../../../_images/item-weight.png

@ToolUi.CollectionItemWeightColor

Applies to: Field

Assigns a single color to all weights inside an item bar. Without this annotation, Brightspot assigns colors to adjacent weights that optimize contrast. Requires @ToolUi.CollectionItemWeight. Applies to a String field inside a Model that extends from Record.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Color applied to fields annotated with @ToolUi.CollectionItemWeight. String representation of a hexadecimal triplet.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package content.article;

import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Record;

public class Headline extends Record  {

    @ToolUi.CollectionItemWeight(calculated = true)
    private double weight;

    @ToolUi.CollectionItemWeightColor
    private String weightColor = "#007D7D";

}

In the previous snippet, line 11 sets the color for all weights to #007D7D (close to teal).

../../../_images/item-color.png

@ToolUi.CollectionItemWeightMarker

Applies to: Field

Displays markers at specified points along the item bar. You can use the markers to indicate when certain events occur. Requires @ToolUi.CollectionItemWeight. Applies to a List<Double> field inside a Model that extends from Record.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates Brightspot applies weight markers to annotated field. true (default), false.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package content.article;

import com.psddev.cms.db.ToolUi;
import com.psddev.dari.db.Record;

public class Headline extends Record  {

    @ToolUi.CollectionItemWeight(calculated = false)
    private double weight;

    @ToolUi.CollectionItemWeightMarker
    private List<Double> markers;

}

In the previous snippet, line 11 displays the item bar with markers. One marker appears for each entry in the markers list. (For an example of a parent Model embedding this Model, see the Parent Model.)

../../../_images/item-markers.png

The previous illustration is a content edit form in Inspire Confidence. The item bar has 14 weights (one weight for each video in the list), and inside each weight there are markers. In this case, each marker represents the time at which an overlay appears during the running video.

@ToolUi.ColorPicker

Applies to: Field

Renders a String field as a color picker. When a user selects a color from the color picker, Brightspot inserts the corresponding hexadecimal value into the field.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates Brightspot renders annotated field as a color picker. true (default), false.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.ColorPicker
    private String hexColor;

}

In the previous snippet, line 8 renders the field hexColor as a color picker.

../../../_images/color-picker.png

@ToolUi.CompatibleTypes

Applies to: Class

Lists the Models into which the annotated Model can be transformed.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Content types into which the annotated class can be transformed. Array of superclasses from which the annotated class is derived.

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.CompatibleTypes({LongArticle.class,ReallyLongArticle.class})
public class Article extends Content  {

}

In the previous snippet, line 6 indicates that Article Models can be transformed to LongArticle and ReallyLongArticle Models.

@ToolUi.CssClass

Applies to: Field, Class

Renders objects on the content edit form using the provided CSS class. When applied to a field, Brightspot renders the field using the provided CSS class; when applied to a class, Brightspot renders the class’s entire content edit form using the provided CSS class.

The following table lists the elements available with this annotation.

Element Description Valid Value
value CSS class with which annotated class or field is rendered. String representing a CSS class.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.CssClass("text-large")
    private String breakingHeadline;

}

In the previous snippet, line 8 renders the field breakingHeadline in the content edit form using the CSS class text-large.

../../../_images/css-class.png

@ToolUi.DefaultSearchResult

Applies to: Field

Displays the field in search results when filtering on the current Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field appears in search results. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.DefaultSearchResult
    private Author author;

}

In the previous snippet, line 8 ensures that when an editor filters search results by Article, the results include a column for author.

../../../_images/default-search-result.svg

@ToolUi.DefaultSortField

Applies to: Class

Sets the initial field by which search results are displayed when filtering on the current Model. Requires the field have the @Indexed annotation. For example, when an editor filters search results by Article, you can set the initial sort field for the results to author.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Sort field by which search results are displayed. String representing one of the Model’s fields.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.DefaultSortField("author")
public class Article extends Content  {

    @Indexed
    private String author;

}

In the previous snippet—

  • Line 6 states that when users filter on Articles in the search panel, the initial sort is by the author field.
  • Line 9 provides the annotation that indexes the author field.
../../../_images/default-sort-field.svg

@ToolUi.DisplayAfter

Applies to: Field

By default, Brightspot displays fields in the content edit form in the order as they appear in your Model. This annotation overrides that sequence, and specifies the order of fields after which the annotated field appears.

See also @ToolUi.FieldDisplayOrder.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Fields after which annotated field appears. Array of strings representing one or more of the Model’s other fields.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.dari.util.StorageItem;

public class Article extends Content  {

    private String headline;
    private String body;

    @ToolUi.DisplayAfter({"lastName","body"})
    private String firstName;

    private String lastName;
    private String middleName;

    private StorageItem image;

}

In the previous snippet, the default order of fields in the content edit form is headline, body, firstName, lastName, middleName, and image. The annotation in line 12 overrides that order, and places the fields lastName and body (in that order) after firstName.

../../../_images/display-after.png

@ToolUi.DisplayBefore

Applies to: Field

By default, Brightspot displays fields in the content edit form in the order as they appear in your Model. This annotation overrides that sequence, and specifies the order of fields before the annotated field.

See also @ToolUi.FieldDisplayOrder.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Fields appearing before the annotated field. Array of strings representing one or more of the Model’s other fields.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.dari.util.StorageItem;

public class Article extends Content  {

    private String headline;
    private String body;

    @ToolUi.DisplayBefore({"lastName","body"})
    private String firstName;

    private String lastName;
    private String middleName;

    private StorageItem image;

}

In the previous snippet, the default order of fields in the content edit form is headline, body, firstName, lastName, middleName, and image. The annotation in line 12 overrides that order, and places the fields lastName and body (in that order) before firstName.

../../../_images/display-before.png

@ToolUi.DisplayFirst

Applies to: Field

By default, Brightspot displays fields in the content edit form in the order as they appear in your Model. This annotation overrides that sequence, and specifies which field appears first. If more than one field has the DisplayFirst annotation, Brightspot orders them by occurrence, placing the first annotated field at the top of the form, followed by the second annotated field, and so on.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field appears first in content edit form. true (default), false

See also @ToolUi.FieldDisplayOrder.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    private String headline;

    private String body;

    @ToolUi.DisplayFirst
    private String author;

}

In the previous snippet, the default order of fields in the content edit form is headline, body, and author. The annotation in line 12 overrides that order, and places the author field first.

../../../_images/display-first.png

@ToolUi.DisplayGlobalFilters

Applies to: Class

Provides filtering controls for other Models with the @ToolUi.GlobalFilter annotation when filtering on this Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates filtering controls for other Models appear when filtering on annotated class. true (default), false

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.DisplayGlobalFilters
public class Author extends Content  {

}

In the previous snippet, line 6 specifies that when an editor filters on Authors, a control appears for filtering on any other Model with the @ToolUi.GlobalFilter annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.GlobalFilter
public class Article extends Content  {

}

In the previous snippet, line 6 specifies that a control for filtering on Articles appears when editors filter on Authors (or on All Content Types).

../../../_images/display-global-filter.svg

Clicking on the filter displays a Content Picker listing items with the same type as in the filter.

../../../_images/content-picker-from-global-filter.svg

@ToolUi.DisplayGrid

Applies to: Field

Specifies that the field appears as a grid. Applies to Sets and Lists. In the absence of this annotation, the field’s members appear vertically. If the field is derived from a Model with a @Recordable.PreviewField annotation, the field specified in that class annotation also appears in the grid.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field appears as a grid. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import java.util.List;

public class Article extends Content  {

    @ToolUi.DisplayGrid
    private List<StorageItem> slides;

}

In the previous snippet, line 9 specifies that the files in a slides field are laid out as a grid in the content edit form.

../../../_images/display-grid.png

@ToolUi.DisplayLast

Applies to: Field

By default, Brightspot displays fields in the content edit form in the order as they appear in your Model. This annotation overrides that sequence, and specifies which field appears last. If more than one field has the DisplayLast annotation, Brightspot orders them by occurrence, placing the first annotated field at the end of the form, followed by the second annotated field, and so on.

See also @ToolUi.FieldDisplayOrder.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field appears last in content edit form. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.DisplayLast
    private String author;

    private String headline;

    private String body;

}

In the previous snippet, the default order of fields in the content edit form is author, headline, and body. The annotation in line 8 overrides that order, and places the author field last.

../../../_images/display-last.png

@ToolUi.DropDown

Applies to: Field

Renders the field’s options as a drop-down list instead of a selection widget.

If a Model’s field is another referenced Model, Brightspot renders the field similar to an HTML <select>. When users open the control, by default Brightspot displays the available objects in a Content Picker. If this annotation is present, Brightspot instead displays the available objects as a traditional list of options.

The following table lists the elements available with this annotation.

Element Description Valid Value
value If true, control rendered as traditional drop-down list. true (default), false
sortField Field by which drop-down options are sorted. Any field name in the Model.
sortDescending If true, options sorted in descending order. true, false (default)

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.DropDown(value=true,sortField="lastName",sortDescending=true)
    private Author author;

}

In the previous snippet, line 8 specifies that the Author field be rendered as a traditional drop-down list. The options in the drop-down list are ordered by last name in descending order.

../../../_images/drop-down.png

@ToolUi.Expanded

Applies to: Field

Ensures the field is visible when the containing embedded field is collapsed on the content edit form. You can use this field to provide the user a hint of the object’s content even when the entire object is not visible in the content edit form.

This annotation applies to fields with the following characteristics:

  • Field is within a child Model.
  • Child Model is cast as Set or List in the parent Model.
  • Child Model has the @Embedded annotation in the parent Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field is always visible in content edit form. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Author extends Content {

    @ToolUi.Expanded
    private String lastName;

    private String firstName;

}

In the previous snippet, line 8 specifies that lastName always be visible even when the corresponding Author record is collapsed on the content edit form.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import java.util.List;

public class Article extends Content  {

    @Embedded
    private List<Author> authorSet;

}

The previous snippet defines a Model that contains an embedded list of Authors.

../../../_images/expanded.png

In the previous image, the lastName field is visible even though the corresponding Author object is collapsed.

@ToolUi.FieldDisplayOrder

Applies to: Class

Indicates the order in which fields appear in the content edit form. Overrides @ToolUi.DisplayLast. Fields not appearing in this annotation appear in the order as in the Model or as otherwise annotated.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Order by which fields appear in the content edit form. Array of strings representing the Model’s fields.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.FieldDisplayOrder({"author", "headline", "body"})
public class Article extends Content  {

    private String headline;

    private String body;

    private String author;

}

In the previous snippet, line 6 specifies that the first three fields in the content edit form are author, headline, and body (in that order).

../../../_images/field-display-order.png

@ToolUi.FieldDisplayType

Applies to: Field

Overrides the field’s default rendering with that of another type. You can use this annotation to perform pre-processing on the field before committing it to the database.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Data type by which annotated field is rendered. String representing one of the available field types, such as boolean and date.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Author extends Content  {

    @ToolUi.FieldDisplayType("password")
    private String yourPassword;

}

In the previous snippet, line 8 renders the String field as a password changer.

../../../_images/field-display-type.png

@ToolUi.FieldSorted

Applies to: Field

Freezes the order in which entries in a Set field appear. By default, the order is random.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates members of annotated field appear in a fixed sort order. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.FieldSorted
    private Set<Author> authors;
}

In the previous snippet, line 8 specifies that when displaying an Article in the content edit form, the order of listed authors does not change.

../../../_images/field-sorted.png

The previous illustration indicates that when displaying authors, Dickens always appears before Tolstoy.

@ToolUi.Filterable

Applies to: Field

Displays in the Search Panel a filtering option for this field when filtering on the field’s Model. Requires the @Indexed annotation.

By default, non-string fields with the @Indexed annotation appear as a filter in the search panel. You can show or hide the filter with this annotation.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates if filtering is available on this field. true (default), false. Use true to show the filter for string fields with the @Indexed annotation.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Author extends Content  {

    @ToolUi.Filterable
    @Indexed
    private String lastName;

    @ToolUi.Filterable(false)
    @Indexed
    private Date datePublished;

}

In the previous snippet—

  • Line 8 displays in the search panel a filtering option for the field lastName when filtering on Authors.
  • Line 12 suppresses the non-string field datePublished as a filtering option when filtering on Authors.
../../../_images/filterable.svg

@ToolUi.GlobalFilter

Applies to: Class

Provides a control for filtering on the Model when filtering by All Content Types in the search panel. Clicking the control displays a Content Picker containing pre-filtered results for the Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates filtering control is available for annotated Model when filtering by All Content Types. true (default), false

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.GlobalFilter
public class Article extends Content  {

}

In the previous snippet, line 6 displays a control for filtering by Articles when an editor is filtering search results by All Content Types.

../../../_images/global-filter.svg

You can also have the control appear when filtering on specific Models; for details, see @ToolUi.DisplayGlobalFilters.

@ToolUi.Heading

Deprecated. Use @ToolUi.Cluster.

@ToolUi.Hidden

Applies to: Field, Class

Suppresses display of the annotated field or class. When applied to a field, Brightspot suppresses display of the field in the content edit form; when applied to a class, Brightspot suppresses display of the Model in the Create drop-down list—preventing editors from creating a new instance of the current Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates Brightspot suppresses display of annotated class or field. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    private String headline;

    @ToolUi.Hidden
    private String author;

    private String body;

}

In the previous snippet, line 10 suppresses display of the author field in the content edit form.

../../../_images/hidden.png

@ToolUi.InputProcessorPath

Applies to: Field

Specifies path to the processor used to render and update the target field. This annotation is typically used for customized field processing and rendering instead of using the default field renderer.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Path to servlet. String.
application Component for constructing path to appropriate servlet. At run time, Brightspot typically prepends this value to the value for value to construct the entire path to the servlet. String. Default is a zero-length string ("").

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Video extends Content {

    @ToolUi.InputProcessorPath("/path/duration.jsp")
    @ToolUi.ReadOnly
    private Long duration;

}

In the previous snippet, line 8 specifies the path to the widget used to compute a video’s duration.

@ToolUi.InputSearcherPath

Applies to: Field

Specifies path to the widget that provides search results for the target field.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content {

    @ToolUi.InputSearcherPath("/path/searchWidget.jsp")
    private Author author;
}

In the previous snippet, line 8 specifies the path to the widget for retrieving matching authors.

@ToolUi.LanguageTag

Applies to: Field

Sets the lang attribute of the div containing a String field.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Language-region pair applied to the annotated field. Any language-region par as listed in IANA Language Subtag Registry.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.LanguageTag("en-US")
    private String body;

}

In the previous snippet, line 8 sets the lang attribute of the div containing the body’s textarea element to en-US.

<div lang="en-US">
    <div>
        <!-- Definition of field label -->
    </div>
    <div>
        <textarea></textarea>
    </div>
</div>

@ToolUi.LayoutField

Applies to: Field

Provides a preview of the Model’s published layout, and dynamically updates the Content Edit Form.

The following table lists the elements available with this annotation.

Element Description Valid Value
top Distance between the field’s top edge and the top edge of its containing block. Integer ≥ 0.
left Distance between the field’s left edge and the left edge of its containing block. Integer ≥ 0.
width Width of the field. Integer ≥ 1.
height Height of the field. Integer ≥ 1.
dynamicText Text appearing in the layout for this field. If absent, the field name appears in the layout. String.

The values you provide in this annotation are unitless and are relative to each other. For example, if you annotate one field with height=1 and another field with height=2, then Brightspot renders the second field’s layout twice as tall as the first field’s layout.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.LayoutField(top = 0, left = 0, width = 8, height = 1)
    private String header;

    @ToolUi.LayoutField(top = 1, left = 0, width = 5, height = 3)
    private String body;

    @ToolUi.LayoutField(top = 1, left = 5, width = 3, height = 3, dynamicText = "Reader Comments")
    private String rail;

    @ToolUi.LayoutField(top = 4, left = 0, width = 8, height = 1)
    private String footer;

}

In the previous snippet, the @ToolUi.Layout annotations provide the coordinate of the top and left corner and the width and height for the associated fields. Line 14 specifies placeholder text for the rail field.

../../../_images/layout-fields.svg

When you annotate fields with @ToolUi.LayoutField, Brightspot displays only one of them at a time. Clicking on the annotated field in the preview displays its corresponding field in the content edit form. Referring to the previous illustration, clicking on Header in the preview displays the field Header.

See also:

@ToolUi.LayoutPlaceholder

Applies to: Class

Defines a placeholder in the preview of a Model’s published layout. At run time, Brightspot typically populates the placeholder with external content such as an advertisement. The placeholder must be implemented separately using Styleguide. For details, see Templating.

Requires @ToolUi.LayoutPlaceholders.

The following table lists the elements available with this annotation.

Element Description Valid Value
name Text appearing in the preview for this placeholder. String.
top Distance between the placeholder’s top edge and the top edge of its containing block. Integer ≥ 0.
left Distance between the placeholder’s left edge and the left edge of its containing block. Integer ≥ 0.
width Width of the placeholder. Integer ≥ 1.
height Height of the placeholder. Integer ≥ 1.
dynamicText Text appearing in the preview for this placeholder. Overrides value in name element. String.

The values you provide in this annotation are unitless and are relative to each other. For example, if you annotate one field with height=1 and another field with height=2, then Brightspot renders the second field’s layout twice as tall as the first field’s layout.

For an example of using this annotation, see @ToolUi.LayoutPlaceholders.

@ToolUi.LayoutPlaceholders

Applies to: Class

Includes placeholders in the preview of the Model’s published layout.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Displays placeholders in the Model’s preview. Array of @ToolUi.LayoutPlaceholders.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.LayoutPlaceholders({
    @ToolUi.LayoutPlaceholder(name = "Advertisement", top = 1, left = 5, width = 3, height = 3)
})
public class Article extends Content  {

    @ToolUi.LayoutField(top = 0, left = 0, width = 8, height = 1)
    private String header;

    @ToolUi.LayoutField(top = 1, left = 0, width = 5, height = 3)
    private String body;

    @ToolUi.LayoutField(top = 4, left = 0, width = 8, height = 1)
    private String footer;

}

In the previous snippet—

  • Lines 6–8 declare an array of placeholders appearing in the Model’s preview. The array has a single element defined by the annotation @ToolUi.LayoutPlaceholder.
  • Lines 11–18 define three fields in the Model’s layout.
../../../_images/layout-placeholders.svg

Referring to the previous illustration, Advertisement is a placeholder defined by the annotation @ToolUi.LayoutPlaceholder; Header, Body, and Footer are fields corresponding to the fields annotated with @ToolUi.LayoutField.

@ToolUi.Main

Applies to: Class

Places a Model in the MAIN CONTENT TYPES group of the Search Panel’s Create drop-down list.

By default, Brightspot places any Model implementing Directory.Item in the MAIN CONTENT TYPES group of the Create drop-down list, and places Models not implementing that interface in the MISC CONTENT TYPES group. This annotation places Models not implementing Directory.Item in the MAIN CONTENT TYPES group.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Lists Model in the Main Content Types in the Create drop-down list. true (default), false

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.cms.db.Directory;

public class Author extends Content implements Directory.Item {

}

In the previous snippet, line 7 indicates that Author appears in the MAIN CONTENT TYPES group of the Create drop-down list, because this Model implements Directory.Item.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.Main
public class Article extends Content  {

}

In the previous snippet, line 6 indicates that Article appears in the MAIN CONTENT TYPES group of the Create drop-down list, even though this Model does not implement Directory.Item.

../../../_images/main.png

@ToolUi.Note

Applies to: Field, Class

Displays a note. You can use this annotation to provide a tool tip or explanatory information. When applied to a field, Brightspot displays the note above the annotated field; when applied to a class, Brightspot displays the note above the Model’s content edit form.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Explanatory text appearing above annotated class or field. Any string.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.dari.util.StorageItem;

@ToolUi.Note("Please, no more articles about asteroid impacts...")
public class Article extends Content  {

    @ToolUi.Note("Drag files here")
    @ToolUi.BulkUpload
    private StorageItem image;

}

In the previous snippet—

  • Line 7 displays a note at the top of the content edit form for Articles.
  • Line 10 displays a note above the image field.
../../../_images/note.png

@ToolUi.NoteHtml

Applies to: Field, Class

Displays a note in HTML format. You can use this annotation to provide a tool tip or explanatory information. When applied to a field, Brightspot displays the note above the annotated field; when applied to a class, Brightspot displays the note above the Model’s content edit form.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Explanatory text appearing above annotated class or field. Any string.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;
import com.psddev.dari.util.StorageItem;

@ToolUi.NoteHtml("Editors may contact you at <span data-dynamic-html=\"${toolPageContext.getUser().getEmail()}\"></span>.")
public class Article extends Content  {

    @ToolUi.NoteHtml("<b>Hint </b> Drag files here")
    @ToolUi.BulkUpload
    private StorageItem image;

}

In the previous snippet—

  • Line 7 displays a note at the top of the content edit form for Articles. This line also shows how to display dynamic text with this annotation using a Java Expression Language (EL) statement. For details about using EL in annotations, see Using Expression Language in Annotations.
  • Line 10 displays a note above the image field.
../../../_images/note-html.png

@ToolUi.NoteRendererClass

Applies to: Field, Class

Specifies the class used to render a note. You can use this annotation to provide dynamic notes. The rendering class must implement ToolUi.NoteRenderer. When applied to a field, Brightspot displays the note above the annotated field; when applied to a class, Brightspot displays the note above the Model’s content edit form.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Class used to render a note. Any class implementing ToolUi.NoteRenderer.

The following snippet includes an example of implementing this annotation.

package content.article;

import java.util.Date;
import java.text.SimpleDateFormat;
import com.psddev.cms.db.ToolUi;

class BodyNoteRenderer implements ToolUi.NoteRenderer {

    @Override
    public String render(Object object) {

        Date today = new Date();
        System.out.println(today.toString());
        SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMMM dd, yyyy");
        String date = DATE_FORMAT.format(today);
        return ("Ensure your facts are correct as of " + date.toString());
    }

}

The previous snippet returns a string Ensure your facts are correct as of <current_date>.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package content.article;

import java.util.Date;
import java.text.SimpleDateFormat;
import com.psddev.cms.db.ToolUi;

class ArticleNoteRenderer implements ToolUi.NoteRenderer {

    @Override
    public String render(Object object) {

        Integer numStories = methodReturningNumberRelatedStories("asteroids");
        return "We already have " + numStories.toString() + " on asteroids. Please focus on a different topic.";
    }

}

The previous snippet returns a string indicating the number of stories related to asteroids.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.NoteRendererClass(ArticleNoteRenderer.class)
public class Article extends Content  {

    @ToolUi.NoteRendererClass(BodyNoteRenderer.class)
    private String body;

}

In the previous snippet—

  • Line 6 displays a note at the top of the content edit form for articles.
  • Line 9 displays a note above the body field.
../../../_images/note-renderer.png

@ToolUi.OnlyPathed

Applies to: Field

Displays in the search panel only those items with a permalink—guaranteeing that an editor references a live item and does not create a dead link. For information about implementing a Model with a permalink, see Automatically Creating Permalinks.

This annotation applies to fields satisfying the following conditions:

  • Reference Models that implement Directory.Item.
  • Reference instances with a saved and published permalink.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates selections for annotated field must have a permalink. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.OnlyPathed
    private Author author;

}

In the previous snippet, line 8 displays in the search panel only those published authors with permalinks.

../../../_images/onlypathed.svg

@ToolUi.Placeholder

Applies to: Field

Displays default placeholder text inside a String field. You can use this annotation to provide a default value or explanatory information about the field.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Text initially appearing in field. Any string
clearOnChange If true, placeholder text disappears when user types in the field. true, false (default)
dynamicText Text computed each time placeholder is rendered. Replaces text specified in value. Java Expression Language (EL) statement. For details, see Using Expression Language in Annotations.
editable

If true, placeholder text remains when user types in field, and user can modify the placeholder text.

If false, placeholder text disappears when user types in the field.

Overrides clearOnChange.

true, false (default)

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Placeholder(value="Today's headline: ", editable=true)
    private String headline;

}

In the previous snippet, when the user creates a new article, line 8 inserts placeholder text inside the field headline. When clicking inside the field, the user can modify the existing placeholder text.

../../../_images/placeholder.png

@ToolUi.Publishable

Applies to: Class

Indicates if the Model is publishable. If this annotation is absent, the Model is publishable.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated Model is publishable. true (default), false

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.Publishable(false)
public class Article extends Content  {

}

In the previous snippet, line 6 indicates that no articles are publishable. The text inside the Publish widget changes to Save.

../../../_images/save-widget.png

@ToolUi.PublishButtonText

Applies to: Class

Specifies the text appearing on the publish button in the Model’s content edit form. If annotation is absent, Brightspot uses the default text Publish.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Label for Publish button. Any string.

The following snippet includes an example of implementing this annotation.

1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.PublishButtonText("Print it!")
public class Article extends Content  {

}

In the previous snippet, line 6 specifies that Print It! appears on the publish button for Articles.

../../../_images/pub-btn-text.png

@ToolUi.ReadOnly

Applies to: Field, Class

Specifies the annotated item is read-only. When applied to a field, the annotated field is read only. When applied to a class, the Model is read only: editors cannot modify existing instances of the Model, and cannot create new instances.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated class or field is read-only on content edit form. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    private String headline;

    private String body;

    @ToolUi.ReadOnly
    private String author;

}

In the previous snippet, line 12 specifies that Author is read-only on the content edit form.

../../../_images/read-only.png
1
2
3
4
5
6
7
8
9
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.ReadOnly
public class Author extends Content {

}

In the previous snippet, line 6 specifies that the Author Model is read only.

../../../_images/read-only-model.png

@ToolUi.RichText

Applies to: Field

Renders a String field as a rich-text editor.

The following table lists the elements available with this annotation.

Element Description Valid Value
value If true, field rendered as a rich-text editor. true (default), false
inline

If true, includes controls for inline markup, such as typeface and comments.

If false, includes controls for inline markup and for paragraph formatting, such as alignment and tables.

true (default), false. Must be false if block in the @RichTextElement.Tag annotation is true.
toolbar Renders the rich-text editor’s toolbar using the specified class. Any class that implements RichTextToolbar. Defaults to DefaultRichTextToolbar.class. For information about creating your own rich-text toolbars and elements, see Rich Text.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    private String headline;

    @ToolUi.RichText
    private String body;

}

In the previous snippet, line 10 renders the field body as a rich-text editor using the default toolbar.

../../../_images/rich-text.png

@ToolUi.Secret

Applies to: Field

Hides the annotated String field’s value; a Show Secret/Hide Secret control toggles the field’s value in cleartext.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates annotated field toggles between a password and cleartext display. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Secret
    private String password;

}

In the previous snippet, line 8 hides the password field’s value.

../../../_images/secret.png

This annotation does not provide encryption when sending to or receiving from the server. To encrypt a password, use @ToolUi.FieldDisplayType("password"). For details, see @ToolUi.FieldDisplayType.

@ToolUi.Sortable

Applies to: Field

Indicates search results can be sorted by the annotated String field when filtering on the corresponding Model.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates search results can be sorted by annotated field. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Sortable
    private String headline;

}

In the previous snippet, line 8 indicates users can sort search results by headline when filtering on Articles.

../../../_images/sortable.svg

@ToolUi.StoragePreviewProcessorPath

Applies to: Field

Specifies path to the servlet used to generate a StorageItem’s preview in the content edit form. If absent, Brightspot uses the processField method of the FileField class.

Note

The recommended implementation for customizing an image’s preview is to implement the writePreview method of the FileContentType interface.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Path to servlet. String.
application Component for constructing path to appropriate servlet. At run time, Brightspot typically prepends this value to the value for value to construct the entire path to the servlet. String. Default is a zero-length string ("").

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.StoragePreviewProcessorPath("/WEB-INF/_plugins/myCustomFilePreview.jsp")
    private StorageItem leadImage;

}

In the previous snippet, line 8 specifies the path to the JSP servlet that generates the leadImage’s preview in the content edit form.

@ToolUi.StorageSetting

Applies to: Field

Specifies the storage location for uploadable files. This annotation is useful if you want to save specific StorageItems on a dedicated server. This annotation requires a string identifying the storage location.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Storage location for files uploaded through the annotated field. String representation of a storage location configured in context.xml.

Some Brightspot deployments declare two locations for storing StorageItems. For example, the following snippet from a context.xml declares two storage locations: primary and secondary.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
<!-- Storage Item Settings  -->
<Environment name="dari/defaultStorage" type="java.lang.String" value="primary" />

<Environment name="dari/storage/primary/class" type="java.lang.String" value="com.psddev.dari.util.LocalStorageItem" />
<Environment name="dari/storage/primary/rootPath" type="java.lang.String" value="/servers/mysite/www/primary" />
<Environment name="dari/storage/primary/baseUrl" type="java.lang.String" value="/primary" />

<Environment name="dari/storage/secondary/class" type="java.lang.String" value="com.psddev.dari.util.LocalStorageItem" />
<Environment name="dari/storage/secondary/rootPath" type="java.lang.String" value="/servers/mysite/www/secondary" />
<Environment name="dari/storage/secondary/baseUrl" type="java.lang.String" value="/secondary" />

In the previous snippet—

  • Line 2 specifies primary as the default storage location.
  • Lines 4–6 define the URL for storage location primary.
  • Lines 8–10 define the URL for storage location secondary.

Because primary is the default storage location, Brightspot never uses secondary unless overridden in a @ToolUi.StorageSetting annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.StorageSetting("secondary")
    private StorageItem image;

}

In the previous snippet, line 8 specifies that all objects associated with the image field are stored in the secondary location specified in the project’s context.xml file.

@ToolUi.SuggestedMaximum

Applies to: Field

Suggested maximal number of characters in a String field. Brightspot retains the entire string even if longer than the suggested maximum.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Suggested maximal number of characters in annotated field. Any double ≥ 0.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.SuggestedMaximum(30)
    private String headline;

}

In the previous snippet, line 8 specifies a suggested maximal length of 30 characters in the headline. When a user types more than 30, Brightspot displays a warning message.

../../../_images/suggested-max.png

@ToolUi.SuggestedMinimum

Applies to: Field

Suggested minimal number of characters in a String field. Brightspot retains the string even if shorter than the suggested minimum.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Suggested minimal number of characters in annotated field. Any double ≥ 0.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.SuggestedMinimum(10)
    private String headline;

}

In the previous snippet, line 8 specifies a suggested minimal length of 10 characters for the headline. Brightspot displays a warning message in the field until the user types 10 characters.

../../../_images/suggested-min.png

@ToolUi.Suggestions

Applies to: Field

Based on an object’s content, this annotation a) provides suggested selections for drop-down lists, and b) provides recommended results in the Content Picker. Applies to fields referencing other Models.

When the user opens a drop-down list with this annotation, Brightspot sends the current state of the object to the search platform for analysis. The server responds with suggested selections based on the Model’s content and active drop-down list. For example, an editor enters the headline Bravest Soldiers I've Known and opens the Section drop-down list. Brightspot provides a list of suggested sections in which to publish the article based on other articles already published in those sections.

This annotation becomes active after your Brightspot project reaches a certain volume of content.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Indicates Brightspot provides suggestions for the annotated field based on existing published content. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Suggestions
    private Section section;

}

In the previous snippet, line 8 provides suggested selections when the user opens the Section field. In the following illustration, Brightspot displays suggested names of sections. The suggested names are influenced by the story’s content.

../../../_images/suggestions-annotation-2.svg

@ToolUi.Tab

Applies to: Field

Indicates under which custom tab the field appears in the content edit form. If the tab does not exist, Brightspot creates it. Fields without this annotation appear in the Main tab. Tabs appear left-to-right in the order they first appear in the Model; you can override this order using the annotation @ToolUi.TabDisplayOrder.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Label for tab under which annotated field appears. Any string.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Article extends Content  {

    @ToolUi.Tab("Markets")
    private String state;

    @ToolUi.Tab("Markets")
    private String county;

    @ToolUi.Tab("Markets")
    private String city;

}

In the previous snippet, lines 8–15 specify that the fields state, county, and city appear under the Markets tab in the content edit form.

../../../_images/tab.png

@ToolUi.TabDisplayOrder

Applies to: Class

Specifies the order in which custom tabs appear in the content edit form.

By default, Brightspot displays custom tabs (the tabs you declare with @ToolUi.Tab) in the order in which they appear in the Model. Using this annotation, you can specify which tab appears first and which tab appears last. Regardless of these annotations, Brightspot always places the tab Main first, and displays other system-level tabs such as SEO last.

The following table lists the elements available with this annotation.

Element Description Valid Value
start Leftmost tabs on the content edit form (after the Main tab). Brightspot displays the tabs in order as they appear in the array, so start={"Soda Pop","Mineral Water"} displays the tab Soda Pop and then the tab Mineral Water. Array of strings, the elements of which are parameters to the annotation @ToolUi.Tab.
end

Rightmost tabs on the content edit form. Brightspot displays the tabs in order as they appear in the array, so end={"Soda Pop","Mineral Water"} displays the tab Soda Pop and then the tab Mineral Water.

If the same tab is passed to start and end, the layout specified by end has higher priority.

Array of strings, the elements of which are parameters to the annotation @ToolUi.Tab.

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

@ToolUi.TabDisplayOrder(end = {"Markets"})
public class Article extends Content{

    private String headline;

    private String body;

    private String author;

    @ToolUi.Tab("Markets")
    private String state;

    @ToolUi.Tab("Markets")
    private String county;

    @ToolUi.Tab("Markets")
    private String city;

    @ToolUi.Tab("Demographics")
    private String gender;

    @ToolUi.Tab("Demographics")
    private String age;

    @ToolUi.Tab("Demographics")
    private String occupation;
}

In the previous snippet—

  • Lines 9–13 define three fields without a @ToolUi.tab annotation; these fields appear under the tab Main.
  • Lines 15–22 define three fields appearing under the custom tab Markets. By default, Markets is the leftmost tab because it is appears first in the Model.
  • Lines 24–31 define three fields appearing under the custom tab Demographics.
  • Line 6 specifies that the rightmost custom tab is Markets, overriding the default that Demographics is the rightmost custom tab.
../../../_images/tab-display-order.svg

@ToolUi.Unlabeled

Applies to: Field

Removes a field’s label in the content edit form.

The following table lists the elements available with this annotation.

Element Description Valid Value
value Suppresses annotated field’s label. true (default), false

The following snippet includes an example of implementing this annotation.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package content.article;

import com.psddev.cms.db.Content;
import com.psddev.cms.db.ToolUi;

public class Author extends Content  {

    private String lastName;

    @ToolUi.Unlabeled
    private String firstName;

}

In the previous snippet, line 10 removes the label from the firstName field in the content edit form.

../../../_images/unlabeled.png

Viewing a Model’s Available Annotations

You can view the list of annotations used in or available for a Model.

  1. Open an existing content type, or create a new content type, based on the Model whose annotations you want to view. The content edit form appears.

  2. In the Publish widget, click . The Tools widget appears.

    ../../../_images/wrench.svg
  3. Under the For Developers tab, scroll down to Present Annotations and Possible Annotations.

../../../_images/annotations-dev-tab.png

Using Expression Language in Annotations

Some annotations can generate dynamic text using Java’s Expression Language (EL). Brightspot provides the following objects you can use in EL statements:

  • content—Reference to the object that contains the annotated field.
  • ObjectField field—Annotated field’s ObjectField.
  • ToolPageContext toolPageContext—General object for accessing the UI.