FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refactor alert component factory methods · patternfly-java/patternfly-java@99f2d4c · GitHub

Commit 99f2d4c

Browse files
committed
Refactor alert component factory methods
1 parent 35b5f55 commit 99f2d4c

6 files changed

Lines changed: 22 additions & 28 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
### Changed
10+
11+
- Refactor alert component factory methods
12+
913
## [0.0.3] - 2023-10-10
1014

1115
### Added

‎README.md‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[![Verify Codebase](https://github.com/patternfly-java/patternfly-java/actions/workflows/verify.yml/badge.svg)](https://github.com/patternfly-java/patternfly-java/actions/workflows/verify.yml) [![Maven Central](https://img.shields.io/maven-central/v/org.patternfly/patternfly-java)](https://search.maven.org/search?q=g:org.patternfly%20AND%20a:patternfly-java) ![GWT3/J2CL compatible](https://img.shields.io/badge/GWT3/J2CL-compatible-brightgreen.svg) [![Chat on Gitter](https://badges.gitter.im/patternfly-java/patternfly-java.svg)](https://app.gitter.im/#/room/#pf4-java_core:gitter.im)
22

3-
# PatternFly Java
4-
53
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:
64

75
```java

‎src/main/java/org/patternfly/component/alert/Alert.java‎

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.patternfly.component.button.Button;
2323
import org.patternfly.core.Aria;
2424
import org.patternfly.core.Modifiers.Inline;
25+
import org.patternfly.core.UnderDevelopment;
2526
import org.patternfly.handler.Callback;
2627
import org.patternfly.layout.Classes;
2728

@@ -48,33 +49,13 @@
4849
import static org.patternfly.layout.Classes.truncate;
4950
import static org.patternfly.layout.PredefinedIcon.times;
5051

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
5653
public class Alert extends BaseComponent<HTMLDivElement, Alert> implements Inline<HTMLDivElement, Alert> {
5754

5855
// ------------------------------------------------------ factory methods
5956

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);
7859
}
7960

8061
// ------------------------------------------------------ instance

‎src/main/java/org/patternfly/component/alert/AlertType.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
public enum AlertType {
2828

29-
@Deprecated
3029
custom(bell, Status.custom, "custom alert"),
3130

3231
info(infoCircle, Status.info, "info alert"),

‎src/main/java/org/patternfly/component/brand/Brand.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
*
3131
* @see <a href= "https://www.patternfly.org/components/brand/html">https://www.patternfly.org/components/brand/html</a>
3232
*/
33-
public class Brand extends BaseComponent<HTMLImageElement, Brand> implements UnderDevelopment {
33+
@UnderDevelopment
34+
public class Brand extends BaseComponent<HTMLImageElement, Brand> {
3435

3536
// ------------------------------------------------------ factory methods
3637

‎src/main/java/org/patternfly/core/UnderDevelopment.java‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,16 @@
1515
*/
1616
package org.patternfly.core;
1717

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 {
1930
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL