From 6ac2e2232cb11f297a89287a7ebc9c36bdaf98c8 Mon Sep 17 00:00:00 2001 From: tnj Date: Sat, 2 Feb 2019 20:58:38 +0900 Subject: [PATCH 1/2] make RibbonizerExtension public To support type-safe access from Kotlin DSL --- .../com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java b/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java index b112d17..a69841a 100644 --- a/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java +++ b/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java @@ -18,7 +18,7 @@ import java.util.Set; import java.util.function.Consumer; -class RibbonizerExtension { +public class RibbonizerExtension { public static String NAME = "ribbonizer"; From d6a00d4a20a989d2c0e8a8a28aa2b3283a91a937 Mon Sep 17 00:00:00 2001 From: tnj Date: Sat, 2 Feb 2019 21:37:47 +0900 Subject: [PATCH 2/2] expose ribbon options and implementation class --- .../ribbonizer/filter/ColorRibbonFilter.java | 8 +++---- .../plugin/RibbonizerExtension.java | 22 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/plugin/src/main/groovy/com/github/gfx/ribbonizer/filter/ColorRibbonFilter.java b/plugin/src/main/groovy/com/github/gfx/ribbonizer/filter/ColorRibbonFilter.java index 77efe53..ce49fbf 100644 --- a/plugin/src/main/groovy/com/github/gfx/ribbonizer/filter/ColorRibbonFilter.java +++ b/plugin/src/main/groovy/com/github/gfx/ribbonizer/filter/ColorRibbonFilter.java @@ -15,13 +15,13 @@ public class ColorRibbonFilter implements Consumer { final Color labelColor; - String label; + public String label; - String fontName = "Default"; + public String fontName = "Default"; - int fontStyle = Font.PLAIN; + public int fontStyle = Font.PLAIN; - boolean largeRibbon = false; + public boolean largeRibbon = false; public ColorRibbonFilter(String label, Color ribbonColor, Color labelColor) { this.label = label; diff --git a/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java b/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java index a69841a..bb78607 100644 --- a/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java +++ b/plugin/src/main/groovy/com/github/gfx/ribbonizer/plugin/RibbonizerExtension.java @@ -7,6 +7,8 @@ import com.github.gfx.ribbonizer.GrayRibbonBuilder; import com.github.gfx.ribbonizer.GreenRibbonBuilder; import com.github.gfx.ribbonizer.YellowRibbonBuilder; +import com.github.gfx.ribbonizer.filter.ColorRibbonFilter; +import com.github.gfx.ribbonizer.filter.GrayScaleFilter; import java.awt.image.BufferedImage; import java.io.File; @@ -87,23 +89,23 @@ public void builder(FilterBuilder filterBuilder) // utilities - public Consumer grayScaleFilter(ApplicationVariant variant, File iconFile) { - return new GrayScaleBuilder().apply(variant, iconFile); + public GrayScaleFilter grayScaleFilter(ApplicationVariant variant, File iconFile) { + return (GrayScaleFilter) new GrayScaleBuilder().apply(variant, iconFile); } - public Consumer grayRibbonFilter(ApplicationVariant variant, File iconFile) { - return new GrayRibbonBuilder().apply(variant, iconFile); + public ColorRibbonFilter grayRibbonFilter(ApplicationVariant variant, File iconFile) { + return (ColorRibbonFilter) new GrayRibbonBuilder().apply(variant, iconFile); } - public Consumer yellowRibbonFilter(ApplicationVariant variant, File iconFile) { - return new YellowRibbonBuilder().apply(variant, iconFile); + public ColorRibbonFilter yellowRibbonFilter(ApplicationVariant variant, File iconFile) { + return (ColorRibbonFilter) new YellowRibbonBuilder().apply(variant, iconFile); } - public Consumer greenRibbonFilter(ApplicationVariant variant, File iconFile) { - return new GreenRibbonBuilder().apply(variant, iconFile); + public ColorRibbonFilter greenRibbonFilter(ApplicationVariant variant, File iconFile) { + return (ColorRibbonFilter) new GreenRibbonBuilder().apply(variant, iconFile); } - public Consumer customColorRibbonFilter(ApplicationVariant variant, File iconFile, String nm) { - return new CustomColorRibbonBuilder(nm).apply(variant, iconFile); + public ColorRibbonFilter customColorRibbonFilter(ApplicationVariant variant, File iconFile, String nm) { + return (ColorRibbonFilter) new CustomColorRibbonBuilder(nm).apply(variant, iconFile); } }