Vega Value Type

The Vega value type is intended to render graphics that have been authored using the Vega-Lite grammar.

A common use case is to render dashboards and other simple graphics.

Although properties of this type can be edited, the Wicket viewer does not provide any specialized authoring environment. It is therefore most suitable for read-only values.

Setup

Dependency Management

In your application’s top level pom.xml, add a dependency for this module’s own bill of materials (BOM):

pom.xml
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.causeway.valuetypes</groupId>
            <artifactId>causeway-valuetypes-vega</artifactId>
            <scope>import</scope>
            <type>pom</type>
            <version>2.0.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Dependencies / Imports

In those modules where there are domain objects that use the Vega value type:

  • add this dependency:

    pom.xml
    <dependencies>
        <dependency>
            <groupId>org.apache.causeway.valuetypes</groupId>
            <artifactId>causeway-valuetypes-vega-applib</artifactId>
        </dependency>
    </dependencies>
  • and @Import this module:

    MyModule.java
    @Configuration
    @Import({
        CausewayModuleValVegaApplib.class,
        // ...
    })
    public class MyModule { ... }

In addition, in the webapp module of your application, add the following dependencies:

  • for the Wicket viewer:

    pom.xml
    <dependency>
        <groupId>org.apache.causeway.valuetypes</groupId>
        <artifactId>causeway-valuetypes-vega-ui-wkt</artifactId>
    </dependency>
  • and for persistence:

    pom.xml
    <dependency>
        <groupId>org.apache.causeway.valuetypes</groupId>
        <artifactId>causeway-valuetypes-vega-xxx</artifactId>   (1)
    </dependency>
    1 where xxx is jpa (if using JPA/Eclipselink) or jdo (if using JDO/DataNucleus).

And in your application’s App Manifest, import the extension’s implementation module:

AppManifest.java
@Configuration
@Import({
        CausewayModuleValVegaUiWkt.class,
        CausewayModuleValVegaPersistenceXxx.class,  (1)
        ...
})
public class AppManifest {
}
1 where Xxx is Jpa (if using JPA/Eclipselink) or Jdo (if using JDO/DataNucleus).

Usage

The property can be declared and used in both entities and view models. If declared in an entity, then it should most likely be mapped to a CLOB:

  • if declared in an JPA entity:

    @Property
    @PropertyLayout
    @Column(nullable = false) @Lob @Basic(fetch=FetchType.LAZY) (1)
    @Getter @Setter
    private Vega helpText;
    1 maps to a (c)lob
  • if declared in an JDO entity:

    @Property
    @PropertyLayout
    @Column(allowsNull = "false", jdbcType = "CLOB")        (1)
    @Getter @Setter
    private Vega helpText;
    1 maps to a CLOB
  • if declared in a JAXB view model:

    @Property
    @PropertyLayout
    @XmlElement(required = true)
    @Getter @Setter
    private Vega helpText;