| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
| 6 | 6 | ||
| 7 | 7 | ## [Unreleased] | |
| 8 | 8 | ||
| 9 | + ### Changed | ||
| 10 | + | ||
| 11 | + - Refactor alert component factory methods | ||
| 12 | + | ||
| 9 | 13 | ## [0.0.3] - 2023-10-10 | |
| 10 | 14 | ||
| 11 | 15 | ### Added | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,5 @@ | |||
| 1 | 1 | [](https://github.com/patternfly-java/patternfly-java/actions/workflows/verify.yml) [](https://search.maven.org/search?q=g:org.patternfly%20AND%20a:patternfly-java)  [](https://app.gitter.im/#/room/#pf4-java_core:gitter.im) | |
| 2 | 2 | ||
| 3 | - # PatternFly Java | ||
| 4 | - | ||
| 5 | 3 | PatternFly Java is a Java implementation of [PatternFly 5](https://www.patternfly.org) based on GWT/J2CL and [Elemento](https://github.com/hal/elemento). Its goal is to provide an easy-to-use, elegant, and efficient API to build complex web applications with PatternFly in Java. The following code snippet gives a taste of what PatternFly Java looks like: | |
| 6 | 4 | ||
| 7 | 5 | ```java | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ | |||
| 22 | 22 | import org.patternfly.component.button.Button; | |
| 23 | 23 | import org.patternfly.core.Aria; | |
| 24 | 24 | import org.patternfly.core.Modifiers.Inline; | |
| 25 | + import org.patternfly.core.UnderDevelopment; | ||
| 25 | 26 | import org.patternfly.handler.Callback; | |
| 26 | 27 | import org.patternfly.layout.Classes; | |
| 27 | 28 | ||
@@ -48,33 +49,13 @@ | |||
| 48 | 49 | import static org.patternfly.layout.Classes.truncate; | |
| 49 | 50 | import static org.patternfly.layout.PredefinedIcon.times; | |
| 50 | 51 | ||
| 51 | - /** | ||
| 52 | - * An alert is a notification that provides brief information to the user without blocking their workflow. | ||
| 53 | - * | ||
| 54 | - * @see <a href= "https://www.patternfly.org/components/alert/html">https://www.patternfly.org/components/alert/html</a> | ||
| 55 | - */ | ||
| 52 | + @UnderDevelopment | ||
| 56 | 53 | public class Alert extends BaseComponent<HTMLDivElement, Alert> implements Inline<HTMLDivElement, Alert> { | |
| 57 | 54 | ||
| 58 | 55 | // ------------------------------------------------------ factory methods | |
| 59 | 56 | ||
| 60 | - public static Alert custom(String title) { | ||
| 61 | - return new Alert(AlertType.custom, title); | ||
| 62 | - } | ||
| 63 | - | ||
| 64 | - public static Alert info(String title) { | ||
| 65 | - return new Alert(AlertType.info, title); | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - public static Alert success(String title) { | ||
| 69 | - return new Alert(AlertType.success, title); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - public static Alert warning(String title) { | ||
| 73 | - return new Alert(AlertType.warning, title); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - public static Alert danger(String title) { | ||
| 77 | - return new Alert(AlertType.danger, title); | ||
| 57 | + public static Alert alert(AlertType type, String title) { | ||
| 58 | + return new Alert(type, title); | ||
| 78 | 59 | } | |
| 79 | 60 | ||
| 80 | 61 | // ------------------------------------------------------ instance | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | 27 | public enum AlertType { | |
| 28 | 28 | ||
| 29 | - @Deprecated | ||
| 30 | 29 | custom(bell, Status.custom, "custom alert"), | |
| 31 | 30 | ||
| 32 | 31 | info(infoCircle, Status.info, "info alert"), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,7 +30,8 @@ | |||
| 30 | 30 | * | |
| 31 | 31 | * @see <a href= "https://www.patternfly.org/components/brand/html">https://www.patternfly.org/components/brand/html</a> | |
| 32 | 32 | */ | |
| 33 | - public class Brand extends BaseComponent<HTMLImageElement, Brand> implements UnderDevelopment { | ||
| 33 | + @UnderDevelopment | ||
| 34 | + public class Brand extends BaseComponent<HTMLImageElement, Brand> { | ||
| 34 | 35 | ||
| 35 | 36 | // ------------------------------------------------------ factory methods | |
| 36 | 37 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,5 +15,16 @@ | |||
| 15 | 15 | */ | |
| 16 | 16 | package org.patternfly.core; | |
| 17 | 17 | ||
| 18 | - public interface UnderDevelopment { | ||
| 18 | + import java.lang.annotation.Retention; | ||
| 19 | + import java.lang.annotation.RetentionPolicy; | ||
| 20 | + import java.lang.annotation.Target; | ||
| 21 | + | ||
| 22 | + import static java.lang.annotation.ElementType.TYPE; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * Internal annotation to track Patternfly Java development | ||
| 26 | + */ | ||
| 27 | + @Retention(RetentionPolicy.SOURCE) | ||
| 28 | + @Target(value = TYPE) | ||
| 29 | + public @interface UnderDevelopment { | ||
| 19 | 30 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments