1. Introduction

This plugin provides a coverflow component useful for displaying an image set. The component is based on Romain Guy’s work explained at A Music Shelf in Java2D. In 2008 Kevin Long refactored the code to be more generic and component-like. See ImageFlow Swing Component.

1.1. Example

Here’s a basic usage of the coverflow components in a Groovy view

org.example.SampleView.groovy
package org.example

import griffon.core.artifact.GriffonView
import griffon.metadata.ArtifactProviderFor
import javax.swing.SwingConstants
import static java.awt.BorderLayout.*

@ArtifactProviderFor(GriffonView)
class SampleView {
  FactoryBuilderSupport builder

  void initUI() {
    builder.with {
      application(size: [520, 320], id: 'mainWindow',
          title: application.configuration['application.title'],
          iconImage:   imageIcon('/griffon-icon-48x48.png').image,
          iconImages: [imageIcon('/griffon-icon-48x48.png').image,
                       imageIcon('/griffon-icon-32x32.png').image,
                        imageIcon('/griffon-icon-16x16.png').image]) {
        borderLayout()
        panel(constraints: CENTER) {
          stackLayout()
          gradientPanel(constraints: BOTTOM)
          imageFlow(id: "flow", constraints: TOP) {
            (1..10). each { i ->
              imageFlowItem(resource: "/griffon-icon-128x128.png", label: "Icon $i")
            }
          }
        }
        panel(constraints: WEST) {
          borderLayout()
          button("<",  actionPerformed: { flow.previous() })
        }
        panel(constraints: EAST) {
          borderLayout()
          button(">",  actionPerformed: { flow.next() })
        }
      }
    }
  }
}

Which results in the following screen

griffon coverflow

Griffon version: 2.2.0

2. Configuration

The plugin delivers artifacts for both Swing and JavaFX. It also contains Groovy enhancements that can be used in combination with the respective UI toolkit DSL (SwingBuilder and GroovyFX).

2.1. Gradle

You have two options for configuring this plugin: automatic and manual.

2.1.1. Automatic

As long as the project has the org.codehaus.griffon.griffon plugin applied to it you may include the following snippet in build.gradle

dependencies {
    griffon 'org.codehaus.griffon.plugins:griffon-coverflow-plugin:1.0.0'
}

The griffon plugin will take care of the rest given its configuration.

2.1.2. Manual

You will need to configure any of the following blocks depending on your setup

Java + Swing
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-coverflow-swing:1.0.0'
}
Groovy + Swing
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-coverflow-swing-groovy:1.0.0'
}

2.2. Maven

First configure the griffon-coverflow-plugin BOM in your POM file, by placing the following snippet before the <build> element

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.griffon.plugins</groupId>
            <artifactId>griffon-coverflow-plugin</artifactId>
            <version>1.0.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Next configure dependencies as required by your particular setup

Java + Swing
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-coverflow-swing</artifactId>
</dependency>
Groovy + Swing
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-coverflow-swing-groovy</artifactId>
</dependency>

3. Modules

The following sections display all bindings per module. Use this information to successfully override a binding on your own modules or to troubleshoot a module binding if the wrong type has been applied by the Griffon runtime.

3.1. Swing

Module name: coverflow-swing-groovy

Depends on: swing-groovy

Unresolved directive in modules.adoc - include::../../../../subprojects/griffon-coverflow-swing-groovy/src/main/groovy/org/codehaus/griffon/runtime/swing/coverflow/CoverflowSwingGroovyModule.java[tags=bindings,indent=0]

3.1.1. Nodes

The following nodes will become available on a Groovy View

Table 1. stacklayout
Property Type Default Bindable Notes

exposes BOTTOM and TOP as constraints

Table 2. gradientPanel
Property Type Default Bindable Notes

gradientStart

Color

Color(110, 110, 110)

yes

gradientEnd

Color

Color(0, 0, 0)

yes

Table 3. imageFlow
Property Type Default Bindable Notes

items

ImageFlowItem[]

no

alternate values may be of type List<ImageFlowItem>, ListModel or ImageFlow

amount

int

5

yes

sigma

double

yes

itemFont

Font

Font("Dialog", Font.PLAIN, 24)

yes

itemTextColor

Color

Color.WHITE

yes

itemSpacing

double

0.4

yes

Table 4. imageFlowItem
Property Type Default Bindable Notes

file

File

no

value can be a String. Alternate to url:, image:, inputStream:, resource:

url

URL

no

value can be a String. Alternate to file:, image:, inputStream:, resource:

image

Image

no

value can be a String. Alternate to file:, url:, inputStream:, resource:

inputStream

InputStream

no

Alternate to file:, url:, image:, resource:

resource

String

no

Alternate to file:, url:, image:, inputStream: