From 794f0d8726fe586ef178e72154c5f811bf18083c Mon Sep 17 00:00:00 2001 From: Joacim Breiler Date: Sat, 8 Jun 2024 09:28:38 +0200 Subject: [PATCH] Scale the clipart when resizing the dialog (#2538) --- .../resources/MessagesBundle_en_US.properties | 1 + .../nbp/designer/gui/clipart/Category.java | 1 + .../designer/gui/clipart/ClipartButton.java | 10 ++++++- .../designer/gui/clipart/ClipartLabel.java | 29 +++++++++++++++++++ .../designer/gui/clipart/ClipartSource.java | 2 +- .../nbp/designer/gui/clipart/FontClipart.java | 10 +++++-- .../gui/clipart/PreviewListPanel.java | 2 +- .../sources/AbstractClipartSource.java | 19 ++++++++++++ .../gui/clipart/sources/BuDingbatsSource.java | 8 ++--- .../gui/clipart/sources/ChristmasSource.java | 13 ++++----- .../gui/clipart/sources/Corners2Source.java | 10 +++---- .../clipart/sources/CreepyCrawliesSource.java | 8 ++--- .../sources/DarriansFrames1Source.java | 8 ++--- .../sources/DarriansFrames2Source.java | 8 ++--- .../sources/DestinysBordersSource.java | 11 ++++--- .../gui/clipart/sources/EasterArtSource.java | 11 ++++--- .../gui/clipart/sources/EfonSource.java | 8 ++--- .../gui/clipart/sources/EvilzSource.java | 11 ++++--- .../gui/clipart/sources/FredokaSource.java | 11 ++++--- .../gui/clipart/sources/GardenSource.java | 9 +++--- .../gui/clipart/sources/HouseIconsSource.java | 8 ++--- .../clipart/sources/KomikaBubblesSource.java | 12 ++++---- .../gui/clipart/sources/LogoSkate1Source.java | 11 ++++--- .../gui/clipart/sources/LogoSkate2Source.java | 11 ++++--- .../gui/clipart/sources/MythicalSource.java | 11 ++++--- .../gui/clipart/sources/SealifeSource.java | 11 ++++--- .../gui/clipart/sources/SugarComaSource.java | 8 ++--- .../gui/clipart/sources/ToolSource.java | 8 ++--- .../gui/clipart/sources/TransdingsSource.java | 11 ++++--- .../gui/clipart/sources/TravelconsSource.java | 8 ++--- .../gui/clipart/sources/TropicanaSource.java | 8 ++--- .../sources/VintageCorners23Source.java | 8 ++--- .../VintageDecorativeSigns2Source.java | 8 ++--- .../clipart/sources/WorldOfScifiSource.java | 8 ++--- .../gui/clipart/sources/WwfreebieSource.java | 12 ++++---- .../gui/clipart/sources/XmasSource.java | 11 ++++--- .../gui/clipart/sources/YourSignSource.java | 13 ++++----- 37 files changed, 187 insertions(+), 170 deletions(-) create mode 100644 ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartLabel.java create mode 100644 ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/AbstractClipartSource.java diff --git a/ugs-core/src/resources/MessagesBundle_en_US.properties b/ugs-core/src/resources/MessagesBundle_en_US.properties index 69eb8ba46b..569f454915 100644 --- a/ugs-core/src/resources/MessagesBundle_en_US.properties +++ b/ugs-core/src/resources/MessagesBundle_en_US.properties @@ -726,6 +726,7 @@ platform.plugin.toolbox.title=Toolbox platform.plugin.toolbox.tooltip=Toolbox platform.plugin.toolbox.settings.title=Edit toolbox buttons... platform.plugin.editor.showOnOpen=Show editor when opening g-code files +platform.plugin.designer.clipart.all=All platform.plugin.designer.clipart.animals=Animals platform.plugin.designer.clipart.buildings=Buildings platform.plugin.designer.clipart.computer=Computer diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/Category.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/Category.java index a970ef6dd9..5897e25174 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/Category.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/Category.java @@ -24,6 +24,7 @@ This file is part of Universal Gcode Sender (UGS). * @author Joacim Breiler */ public enum Category { + ALL("platform.plugin.designer.clipart.all"), ANIMALS("platform.plugin.designer.clipart.animals"), BUILDINGS("platform.plugin.designer.clipart.buildings"), DECORATIONS("platform.plugin.designer.clipart.decorations"), diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartButton.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartButton.java index 0c3eee12ce..3fd8a03ab9 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartButton.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartButton.java @@ -31,13 +31,14 @@ This file is part of Universal Gcode Sender (UGS). * @author Joacim Breiler */ public class ClipartButton extends RoundedPanel { - private final Clipart clipart; + private final transient Clipart clipart; public ClipartButton(Clipart clipart, ClipartTooltip tooltip) { super(12); this.clipart = clipart; setLayout(new MigLayout("fill, inset 0")); setMinimumSize(new Dimension(128, 128)); + setMaximumSize(new Dimension(512, 512)); setForeground(ThemeColors.LIGHT_GREY); setBackground(Color.WHITE); setHoverBackground(ThemeColors.LIGHT_GREY); @@ -49,4 +50,11 @@ public ClipartButton(Clipart clipart, ClipartTooltip tooltip) { public Clipart getClipart() { return clipart; } + + @Override + public Dimension getPreferredSize() { + Dimension d = super.getSize(); + int width = (int) Math.round(d.getWidth()); + return new Dimension(width, width); // Make the buttion square + } } diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartLabel.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartLabel.java new file mode 100644 index 0000000000..d5c408da52 --- /dev/null +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartLabel.java @@ -0,0 +1,29 @@ +package com.willwinder.ugs.nbp.designer.gui.clipart; + +import javax.swing.JLabel; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.font.FontRenderContext; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; + +public class ClipartLabel extends JLabel { + public ClipartLabel(String text) { + super(text); + AffineTransform affinetransform = new AffineTransform(); + FontRenderContext frc = new FontRenderContext(affinetransform, true, true); + + addComponentListener(new ComponentAdapter() { + @Override + public void componentResized(ComponentEvent e) { + Rectangle2D stringBounds = getFont().getStringBounds(getText(), frc); + int currentSize = (int) Math.round(Math.max(stringBounds.getWidth(), stringBounds.getHeight())); + float sizeChange = (float) Math.min(getWidth(), getHeight()) / (float) currentSize; + if (sizeChange < 1f || sizeChange > 1.1f) { + int newFontSize = Math.min(Math.round((getFont().getSize() * sizeChange)), getHeight()); + setFont(getFont().deriveFont((float) newFontSize)); + } + } + }); + } +} diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartSource.java index 9631fef281..1d411861ca 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/ClipartSource.java @@ -34,7 +34,7 @@ public interface ClipartSource { String getUrl(); - List getCliparts(Category category); + List getCliparts(Category category); String getLicense(); } diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/FontClipart.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/FontClipart.java index f04d60a8db..0990b2ea66 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/FontClipart.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/FontClipart.java @@ -22,8 +22,12 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.entities.cuttable.Path; import com.willwinder.universalgcodesender.uielements.helpers.ThemeColors; -import javax.swing.*; -import java.awt.*; +import javax.swing.JLabel; +import javax.swing.SwingConstants; +import java.awt.Component; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.Shape; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; @@ -48,7 +52,7 @@ public FontClipart(String name, Category category, Font font, String text, Clipa this.font = font; this.source = source; - label = new JLabel(text); + label = new ClipartLabel(text); label.setFont(font); label.setHorizontalAlignment(SwingConstants.CENTER); label.setForeground(ThemeColors.VERY_DARK_GREY); diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/PreviewListPanel.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/PreviewListPanel.java index 3c1cf20f76..9c2035ca5f 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/PreviewListPanel.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/PreviewListPanel.java @@ -124,7 +124,7 @@ public void setCategory(Category category) { selectedClipart = clipart; selectAction.actionPerformed(new ActionEvent(roundedPanel, 0, "selected_clipart")); }); - buttonsPanel.add(roundedPanel); + buttonsPanel.add(roundedPanel, "grow, w 100:100:400"); }); buttonsPanel.revalidate(); buttonsPanel.repaint(); diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/AbstractClipartSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/AbstractClipartSource.java new file mode 100644 index 0000000000..3179a6f450 --- /dev/null +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/AbstractClipartSource.java @@ -0,0 +1,19 @@ +package com.willwinder.ugs.nbp.designer.gui.clipart.sources; + +import com.willwinder.ugs.nbp.designer.gui.clipart.Category; +import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; +import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; + +import java.util.List; + +public abstract class AbstractClipartSource implements ClipartSource { + public abstract List getCliparts(); + + @Override + public List getCliparts(Category category) { + return getCliparts() + .stream() + .filter(clipart -> clipart.getCategory() == category || category == Category.ALL) + .toList(); + } +} diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/BuDingbatsSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/BuDingbatsSource.java index d67844581c..ae3ed63b98 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/BuDingbatsSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/BuDingbatsSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class BuDingbatsSource implements ClipartSource { +public class BuDingbatsSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public BuDingbatsSource() { @@ -117,8 +115,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ChristmasSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ChristmasSource.java index 91a9acc1d1..0e5ef008e5 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ChristmasSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ChristmasSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class ChristmasSource implements ClipartSource { +public class ChristmasSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public ChristmasSource() { @@ -153,11 +152,9 @@ public String getUrl() { return "https://www.fontspace.com/christmas-font-f4808"; } - - @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/Corners2Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/Corners2Source.java index f357e9df6c..55b2a57c9a 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/Corners2Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/Corners2Source.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class Corners2Source implements ClipartSource { +public class Corners2Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -55,7 +53,7 @@ public Corners2Source() { cliparts.add(new FontClipart("Corner with star and leaves", Category.DECORATIONS, font, "E", this)); cliparts.add(new FontClipart("Corner with eagle", Category.DECORATIONS, font, "F", this)); cliparts.add(new FontClipart("Corner with bells", Category.DECORATIONS, font, "G", this)); - cliparts.add(new FontClipart("Banner with heart and petals", Category.DECORATIONS, font.deriveFont(font.getSize() * 0.8f), "H", this)); + cliparts.add(new FontClipart("Banner with heart and petals", Category.DECORATIONS, font, "H", this)); cliparts.add(new FontClipart("Banner", Category.DECORATIONS, font, "I", this)); cliparts.add(new FontClipart("Corner with flowers 2", Category.DECORATIONS, font, "J", this)); cliparts.add(new FontClipart("Corner with fairy", Category.DECORATIONS, font, "K", this)); @@ -78,8 +76,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/CreepyCrawliesSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/CreepyCrawliesSource.java index 65c1eeb722..717d605e1f 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/CreepyCrawliesSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/CreepyCrawliesSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class CreepyCrawliesSource implements ClipartSource { +public class CreepyCrawliesSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public CreepyCrawliesSource() { @@ -103,8 +101,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames1Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames1Source.java index 5db105f511..0e491f5229 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames1Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames1Source.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class DarriansFrames1Source implements ClipartSource { +public class DarriansFrames1Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public DarriansFrames1Source() { @@ -91,8 +89,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames2Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames2Source.java index 3b6e41dd8e..8e3ebac2e7 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames2Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DarriansFrames2Source.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class DarriansFrames2Source implements ClipartSource { +public class DarriansFrames2Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public DarriansFrames2Source() { @@ -91,8 +89,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DestinysBordersSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DestinysBordersSource.java index a11634f87b..25429e7986 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DestinysBordersSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/DestinysBordersSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class DestinysBordersSource implements ClipartSource { +public class DestinysBordersSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -75,8 +74,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EasterArtSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EasterArtSource.java index 7b308d39c8..aa3a0c870d 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EasterArtSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EasterArtSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class EasterArtSource implements ClipartSource { +public class EasterArtSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -113,8 +112,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EfonSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EfonSource.java index 146ba726eb..2ab7634738 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EfonSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EfonSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class EfonSource implements ClipartSource { +public class EfonSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -109,8 +107,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EvilzSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EvilzSource.java index 796da380f2..660437b1aa 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EvilzSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/EvilzSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class EvilzSource implements ClipartSource { +public class EvilzSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -129,8 +128,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/FredokaSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/FredokaSource.java index 7ff3b72bad..fd0665bc71 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/FredokaSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/FredokaSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class FredokaSource implements ClipartSource { +public class FredokaSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -97,8 +96,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/GardenSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/GardenSource.java index 904f3023b2..9fe24b1fbe 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/GardenSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/GardenSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class GardenSource implements ClipartSource { +public class GardenSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public GardenSource() { @@ -109,10 +107,11 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } + @Override public String getLicense() { return "Free for commercial use"; diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/HouseIconsSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/HouseIconsSource.java index 4146d671f0..7d11b6bc79 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/HouseIconsSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/HouseIconsSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class HouseIconsSource implements ClipartSource { +public class HouseIconsSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public HouseIconsSource() { @@ -128,8 +126,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/KomikaBubblesSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/KomikaBubblesSource.java index 5a59adda77..c9d24f47df 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/KomikaBubblesSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/KomikaBubblesSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class KomikaBubblesSource implements ClipartSource { +public class KomikaBubblesSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -85,10 +84,11 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } + @Override public String getLicense() { return "Free for commercial use"; diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate1Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate1Source.java index 120133e4b0..5d62470536 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate1Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate1Source.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class LogoSkate1Source implements ClipartSource { +public class LogoSkate1Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -123,8 +122,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate2Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate2Source.java index f971b77975..d2838185dc 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate2Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/LogoSkate2Source.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class LogoSkate2Source implements ClipartSource { +public class LogoSkate2Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -114,8 +113,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/MythicalSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/MythicalSource.java index 85a59f2399..b50b3a3cc6 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/MythicalSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/MythicalSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class MythicalSource implements ClipartSource { +public class MythicalSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -116,8 +115,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SealifeSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SealifeSource.java index b5aaa2f540..0a916921cc 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SealifeSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SealifeSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class SealifeSource implements ClipartSource { +public class SealifeSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -89,8 +88,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SugarComaSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SugarComaSource.java index a8a4537d7d..97a200418d 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SugarComaSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/SugarComaSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class SugarComaSource implements ClipartSource { +public class SugarComaSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public SugarComaSource() { @@ -91,8 +89,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ToolSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ToolSource.java index 212343622a..f41eeda788 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ToolSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/ToolSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class ToolSource implements ClipartSource { +public class ToolSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public ToolSource() { @@ -110,8 +108,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TransdingsSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TransdingsSource.java index f281424167..5f4aca98b7 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TransdingsSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TransdingsSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class TransdingsSource implements ClipartSource { +public class TransdingsSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -133,8 +132,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TravelconsSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TravelconsSource.java index 2101baf0ae..fdc5e9eaa4 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TravelconsSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TravelconsSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class TravelconsSource implements ClipartSource { +public class TravelconsSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public TravelconsSource() { @@ -124,8 +122,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TropicanaSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TropicanaSource.java index 6451156d9b..80cf8ec624 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TropicanaSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/TropicanaSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class TropicanaSource implements ClipartSource { +public class TropicanaSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -92,8 +90,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageCorners23Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageCorners23Source.java index 9fb2ff93d1..427b762010 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageCorners23Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageCorners23Source.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class VintageCorners23Source implements ClipartSource { +public class VintageCorners23Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public VintageCorners23Source() { @@ -73,8 +71,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageDecorativeSigns2Source.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageDecorativeSigns2Source.java index f2077581c6..d98eddb2f7 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageDecorativeSigns2Source.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/VintageDecorativeSigns2Source.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class VintageDecorativeSigns2Source implements ClipartSource { +public class VintageDecorativeSigns2Source extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public VintageDecorativeSigns2Source() { @@ -128,8 +126,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WorldOfScifiSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WorldOfScifiSource.java index bfcec4a0b7..d35e66d8fc 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WorldOfScifiSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WorldOfScifiSource.java @@ -20,7 +20,6 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; @@ -29,12 +28,11 @@ This file is part of Universal Gcode Sender (UGS). import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class WorldOfScifiSource implements ClipartSource { +public class WorldOfScifiSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); public WorldOfScifiSource() { @@ -116,8 +114,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WwfreebieSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WwfreebieSource.java index 096bd2e62f..3adbb40fbb 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WwfreebieSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/WwfreebieSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class WwfreebieSource implements ClipartSource { +public class WwfreebieSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -128,10 +127,9 @@ public String getCredits() { public String getUrl() { return "https://www.fontspace.com/wwfreebie-font-f3394"; } - @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/XmasSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/XmasSource.java index 318bd18edf..dd45b9b6c9 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/XmasSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/XmasSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class XmasSource implements ClipartSource { +public class XmasSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -102,8 +101,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override diff --git a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/YourSignSource.java b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/YourSignSource.java index 1a09c9ad0b..6433abd46a 100644 --- a/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/YourSignSource.java +++ b/ugs-platform/ugs-platform-plugin-designer/src/main/java/com/willwinder/ugs/nbp/designer/gui/clipart/sources/YourSignSource.java @@ -20,20 +20,19 @@ This file is part of Universal Gcode Sender (UGS). import com.willwinder.ugs.nbp.designer.gui.clipart.Category; import com.willwinder.ugs.nbp.designer.gui.clipart.Clipart; -import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSource; import com.willwinder.ugs.nbp.designer.gui.clipart.ClipartSourceException; import com.willwinder.ugs.nbp.designer.gui.clipart.FontClipart; -import java.awt.*; +import java.awt.Font; +import java.awt.FontFormatException; import java.io.IOException; +import java.util.ArrayList; import java.util.List; -import java.util.*; -import java.util.stream.Collectors; /** * @author Joacim Breiler */ -public class YourSignSource implements ClipartSource { +public class YourSignSource extends AbstractClipartSource { private final List cliparts = new ArrayList<>(); @@ -89,8 +88,8 @@ public String getUrl() { } @Override - public List getCliparts(Category category) { - return cliparts.stream().filter(clipart -> clipart.getCategory() == category).collect(Collectors.toList()); + public List getCliparts() { + return cliparts; } @Override