Skip to content

Commit

Permalink
Update dependencies; handle icon size
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Mar 1, 2015
1 parent 8d9bc2e commit c3dbd21
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 33 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Expand Up @@ -4,7 +4,7 @@ install:
- TERM=dumb ./gradlew -q assemble

script:
- TERM=dumb ./gradlew build cobertura
- TERM=dumb ./gradlew build jacocoTestReport jacocoRootReport

jdk:
- oraclejdk8
Expand All @@ -14,5 +14,4 @@ before_install:
- sh -e /etc/init.d/xvfb start

after_success:
./gradlew aggregateCoberturaMerge aggregateCoberturaReport coveralls

./gradlew coveralls
53 changes: 44 additions & 9 deletions build.gradle
Expand Up @@ -3,18 +3,18 @@ import java.text.SimpleDateFormat
buildscript {
repositories {
jcenter()
mavenLocal()
}

dependencies {
classpath 'org.codehaus.griffon:gradle-griffon-plugin:2.0.0'
classpath 'org.codehaus.griffon:gradle-griffon-build-plugin:2.0.0'
classpath 'net.saliman:gradle-cobertura-plugin:2.2.5'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0'
classpath 'org.codehaus.griffon:gradle-griffon-plugin:2.2.0'
classpath 'org.codehaus.griffon:gradle-griffon-build-plugin:2.2.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
classpath 'org.ajoberstar:gradle-git:0.12.0'
classpath 'org.ajoberstar:gradle-git:1.0.0'
classpath 'org.kordamp.gradle:stats-gradle-plugin:0.1.3'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.7'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
}
}

Expand All @@ -40,6 +40,7 @@ allprojects {

repositories {
jcenter()
mavenLocal()
}

if (JavaVersion.current().isJava8Compatible()) {
Expand All @@ -49,6 +50,14 @@ allprojects {
}
}

apply plugin: 'jacoco'

jacoco {
toolVersion = jacocoVersion
}

ext.jacocoProjects = []

subprojects { subproj ->
plugins.withType(JavaPlugin) {
configurations {
Expand All @@ -57,8 +66,13 @@ subprojects { subproj ->
}

subproj.tasks.withType(JavaCompile) {
sourceCompatibility = rootProject.sourceCompatibility
targetCompatibility = rootProject.targetCompatibility
sourceCompatibility = subproj.sourceCompatibility
targetCompatibility = subproj.targetCompatibility
}

subproj.tasks.withType(GroovyCompile) {
sourceCompatibility = subproj.sourceCompatibility
targetCompatibility = subproj.targetCompatibility
}

sourceSets {
Expand All @@ -84,7 +98,7 @@ subprojects { subproj ->
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'org.slf4j:slf4j-simple:1.7.7'
testCompile 'org.slf4j:slf4j-simple:1.7.10'
}

task sourceJar(type: Jar) {
Expand All @@ -108,6 +122,8 @@ subprojects { subproj ->
if (subproj.publishJars.toBoolean()) {
subproj.apply from: rootProject.file('gradle/docs.gradle')
}

subproj.test.testLogging { exceptionFormat 'full' }
}
}

Expand All @@ -129,3 +145,22 @@ githubPages {
}

publishGhPages.dependsOn(project(":${pluginBaseName}-guide").guide)

coveralls {
sourceDirs = files(jacocoProjects.sourceSets.main.allSource.srcDirs).files.absolutePath
}

task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = jacocoProjects.test
additionalSourceDirs = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(jacocoProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(jacocoProjects.sourceSets.main.output)
executionData = files(jacocoProjects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
html.destination = "${buildDir}/reports/jacoco/test/html"
xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
5 changes: 3 additions & 2 deletions gradle.properties
@@ -1,7 +1,7 @@
group=org.codehaus.griffon.plugins
version=1.0.0
version=1.1.0
pluginBaseName=griffon-silkicons
griffonVersion=2.0.0
griffonVersion=2.2.0
griffonPlugin=true
publishJars=false
sourceCompatibility=1.7
Expand All @@ -13,3 +13,4 @@ projectIssueTrackerUrl=https://github.com/griffon-plugins/griffon-silkicons-plug
projectVcsUrl=https://github.com/griffon-plugins/griffon-silkicons-plugin
javadocFooter=Copyright © 2014 Andres Almiray. All rights reserved.
projectLabels=griffon,plugin,icons,silk
jacocoVersion=0.7.3.201502191951
16 changes: 4 additions & 12 deletions gradle/code-coverage.gradle
@@ -1,17 +1,7 @@
apply plugin: 'net.saliman.cobertura'
apply plugin: 'jacoco'

cobertura {
coverageFormats = ['html', 'xml']
if (project.plugins.hasPlugin('groovy')) {
coverageSourceDirs = sourceSets.main.java.srcDirs + sourceSets.main.groovy.srcDirs
} else {
coverageSourceDirs = sourceSets.main.java.srcDirs
}
}

jacoco {
toolVersion = '0.7.2.201409121644'
toolVersion = jacocoVersion
}

jacocoTestReport {
Expand All @@ -25,4 +15,6 @@ jacocoTestReport {
csv.enabled = false
html.enabled = true
}
}
}

jacocoProjects << project
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Sep 08 14:12:16 CEST 2014
#Mon Feb 16 21:42:59 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
Expand Up @@ -7,6 +7,7 @@ include::_links.adoc[]

:leveloffset: 1
include::introduction.adoc[]
include::usage.adoc[]
include::configuration.adoc[]
include::modules.adoc[]

Expand Down
39 changes: 39 additions & 0 deletions subprojects/griffon-silkicons-guide/src/asciidoc/usage.adoc
@@ -0,0 +1,39 @@

[[_usage]]
= Usage

== Swing

The `griffon-silk-swing:{project-version}` JAR provides a new Icon class: `{api_link_silkicon_swing}`.
You may use this class with any Swing component that supports an Icon property.

== JavaFX

The `griffon-silk-javafx:{project-version}` JAR provides a new Node class: `{api_link_silkicon_javafx}`.
You may use this class with any JavaFX control that accepts a graphic property. You may also use the icon directly as
it is a subclass of `javafx.scene.control.Label`.

== Action Resources

Action icons can be set using resources files if the following format is used:

[source]
----
iconClassName|description
----

Here's an example using the Swing icon

[source,java,options="nowrap"]
.griffon-app/i18n/messages.properties
----
org.example.AppController.action.Preferences.icon=griffon.swing.support.silk.SilkIcon|star
----

The JavaFX version for the same icon value is

[source,java,options="nowrap"]
.griffon-app/i18n/messages.properties
----
org.example.AppController.action.Preferences.icon=griffon.javafx.support.silk.SilkIcon|star
----
@@ -1,6 +1,6 @@
<html>
<head>
<title>griffon-silkicons-plugin 1.0.0</title>
<title>griffon-silkicons-plugin 1.1.0</title>
</head>
<body>

Expand Down
Expand Up @@ -13,5 +13,5 @@ dependencies {
testCompile project.files(project.jfxrtLocation)

testRuntime "org.codehaus.griffon:griffon-guice:$griffonVersion"
testRuntime 'org.slf4j:slf4j-simple:1.7.7'
testRuntime 'org.slf4j:slf4j-simple:1.7.10'
}
Expand Up @@ -9,7 +9,7 @@ dependencies {

testCompile "org.codehaus.griffon:griffon-core-test:$griffonVersion"
testRuntime "org.codehaus.griffon:griffon-guice:$griffonVersion"
testRuntime 'org.slf4j:slf4j-simple:1.7.7'
testRuntime 'org.slf4j:slf4j-simple:1.7.10'
}

compileGroovy.enabled = false
Expand Up @@ -19,15 +19,22 @@

import javax.annotation.Nonnull;
import javax.swing.ImageIcon;
import java.awt.Toolkit;
import java.net.URL;

import static griffon.util.GriffonNameUtils.requireNonBlank;
import static java.util.Objects.requireNonNull;

/**
* @author Andres Almiray
*/
public class SilkIcon extends ImageIcon {
private final Silk silk;
private static final String ERROR_SILK_NULL = "Argument 'silk' must not be null";
private Silk silk;

public SilkIcon() {
this(Silk.STAR);
}

public SilkIcon(@Nonnull Silk silk) {
super(toURL(silk));
Expand All @@ -40,7 +47,7 @@ public SilkIcon(@Nonnull String description) {

@Nonnull
private static URL toURL(@Nonnull Silk silk) {
requireNonNull(silk, "Argument 'silk' must not be null.");
requireNonNull(silk, ERROR_SILK_NULL);
String resource = silk.asResource();
return Thread.currentThread().getContextClassLoader().getResource(resource);
}
Expand All @@ -49,4 +56,14 @@ private static URL toURL(@Nonnull Silk silk) {
public Silk getSilk() {
return silk;
}

public void setSilk(@Nonnull Silk silk) {
this.silk = requireNonNull(silk, ERROR_SILK_NULL);
setImage(Toolkit.getDefaultToolkit().getImage(toURL(silk)));
}

public void setSilk(@Nonnull String description) {
requireNonBlank(description, "Argument 'description' must not be blank");
setSilk(Silk.findByDescription(description));
}
}

0 comments on commit c3dbd21

Please sign in to comment.