From eac4c6364fc9c98777cc526ed800bcc3acfdea8e Mon Sep 17 00:00:00 2001 From: isXander Date: Tue, 15 Aug 2023 17:34:07 +0100 Subject: Rename @ColorRGBA to @ColorField --- .../yacl3/config/v2/api/autogen/ColorField.java | 21 +++++++++++++++++++++ .../yacl3/config/v2/api/autogen/ColorRGBA.java | 21 --------------------- .../config/v2/impl/autogen/ColorFieldImpl.java | 19 +++++++++++++++++++ .../yacl3/config/v2/impl/autogen/ColorRGBAImpl.java | 19 ------------------- .../v2/impl/autogen/OptionFactoryRegistry.java | 2 +- 5 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorField.java delete mode 100644 common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorRGBA.java create mode 100644 common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorFieldImpl.java delete mode 100644 common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorRGBAImpl.java (limited to 'common/src/main/java/dev/isxander/yacl3/config') diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorField.java b/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorField.java new file mode 100644 index 0000000..74937b4 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorField.java @@ -0,0 +1,21 @@ +package dev.isxander.yacl3.config.v2.api.autogen; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * An option factory. + *

+ * This creates a regular option with a + * {@link dev.isxander.yacl3.api.controller.ColorControllerBuilder} controller. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ColorField { + /** + * Whether to show/allow the alpha channel in the color field. + */ + boolean allowAlpha() default false; +} diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorRGBA.java b/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorRGBA.java deleted file mode 100644 index 7e76e27..0000000 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/api/autogen/ColorRGBA.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.isxander.yacl3.config.v2.api.autogen; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * An option factory. - *

- * This creates a regular option with a - * {@link dev.isxander.yacl3.api.controller.ColorControllerBuilder} controller. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface ColorRGBA { - /** - * Whether to show/allow the alpha channel in the color field. - */ - boolean allowAlpha() default false; -} diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorFieldImpl.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorFieldImpl.java new file mode 100644 index 0000000..7910c59 --- /dev/null +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorFieldImpl.java @@ -0,0 +1,19 @@ +package dev.isxander.yacl3.config.v2.impl.autogen; + +import dev.isxander.yacl3.api.Option; +import dev.isxander.yacl3.api.controller.ColorControllerBuilder; +import dev.isxander.yacl3.api.controller.ControllerBuilder; +import dev.isxander.yacl3.config.v2.api.ConfigField; +import dev.isxander.yacl3.config.v2.api.autogen.SimpleOptionFactory; +import dev.isxander.yacl3.config.v2.api.autogen.ColorField; +import dev.isxander.yacl3.config.v2.api.autogen.OptionAccess; + +import java.awt.Color; + +public class ColorFieldImpl extends SimpleOptionFactory { + @Override + protected ControllerBuilder createController(ColorField annotation, ConfigField field, OptionAccess storage, Option option) { + return ColorControllerBuilder.create(option) + .allowAlpha(annotation.allowAlpha()); + } +} diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorRGBAImpl.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorRGBAImpl.java deleted file mode 100644 index 81d62bb..0000000 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/ColorRGBAImpl.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.isxander.yacl3.config.v2.impl.autogen; - -import dev.isxander.yacl3.api.Option; -import dev.isxander.yacl3.api.controller.ColorControllerBuilder; -import dev.isxander.yacl3.api.controller.ControllerBuilder; -import dev.isxander.yacl3.config.v2.api.ConfigField; -import dev.isxander.yacl3.config.v2.api.autogen.SimpleOptionFactory; -import dev.isxander.yacl3.config.v2.api.autogen.ColorRGBA; -import dev.isxander.yacl3.config.v2.api.autogen.OptionAccess; - -import java.awt.Color; - -public class ColorRGBAImpl extends SimpleOptionFactory { - @Override - protected ControllerBuilder createController(ColorRGBA annotation, ConfigField field, OptionAccess storage, Option option) { - return ColorControllerBuilder.create(option) - .allowAlpha(annotation.allowAlpha()); - } -} diff --git a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/OptionFactoryRegistry.java b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/OptionFactoryRegistry.java index fe63234..4bcf5d6 100644 --- a/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/OptionFactoryRegistry.java +++ b/common/src/main/java/dev/isxander/yacl3/config/v2/impl/autogen/OptionFactoryRegistry.java @@ -30,7 +30,7 @@ public class OptionFactoryRegistry { registerOptionFactory(DoubleField.class, new DoubleFieldImpl()); registerOptionFactory(EnumCycler.class, new EnumCyclerImpl()); registerOptionFactory(StringField.class, new StringFieldImpl()); - registerOptionFactory(ColorRGBA.class, new ColorRGBAImpl()); + registerOptionFactory(ColorField.class, new ColorFieldImpl()); registerOptionFactory(Label.class, new LabelImpl()); registerOptionFactory(ListGroup.class, new ListGroupImpl<>()); -- cgit