Skip to content

Commit

Permalink
IDE-Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Mar 21, 2024
1 parent e24cef2 commit 19b9e42
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,33 @@

/**
* @author Oliver Wolff
*
*/
@Getter
public enum ButtonSize implements StyleClassProvider {

/** The default. */
/**
* The default.
*/
DEFAULT(""),
/** Large. */
/**
* Large.
*/
LG("lg"),
/** SM. */
/**
* SM.
*/
SM("sm");

ButtonSize(final String suffix) {
if (MoreStrings.isEmpty(suffix)) {
styleClass = "";
} else {
styleClass = new StringBuilder().append(PREFIX).append(suffix).toString();
styleClass = PREFIX + suffix;
}
}

private static final String PREFIX = "btn-";

@Getter
private final String styleClass;

@Override
Expand All @@ -58,17 +63,17 @@ public StyleClassBuilder getStyleClassBuilder() {
* {@link ContextSize#LG}, {@link ContextSize#DEFAULT} or
* {@link ContextSize#SM}
* @return the corresponding {@link ButtonSize} derived by the given
* {@link ContextSize}. In case of <code>contextSize==null</code> it
* will return {@link ButtonSize#DEFAULT}. In case it is none of the
* supported sizes it will throw an {@link IllegalArgumentException}
* {@link ContextSize}. In case of <code>contextSize==null</code> it
* will return {@link ButtonSize#DEFAULT}. In case it is none of the
* supported sizes it will throw an {@link IllegalArgumentException}
*/
public static final ButtonSize getForContextSize(final ContextSize contextSize) {
public static ButtonSize getForContextSize(final ContextSize contextSize) {
if (null != contextSize) {
return switch (contextSize) {
case DEFAULT -> ButtonSize.DEFAULT;
case LG -> ButtonSize.LG;
case SM -> ButtonSize.SM;
default -> throw new IllegalArgumentException("No Button-Size defined for " + contextSize);
case DEFAULT -> ButtonSize.DEFAULT;
case LG -> ButtonSize.LG;
case SM -> ButtonSize.SM;
default -> throw new IllegalArgumentException("No Button-Size defined for " + contextSize);
};
}
return ButtonSize.DEFAULT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,39 @@

/**
* @author Oliver Wolff
*
*/
@Getter
public enum ButtonState implements StyleClassProvider {

/** The default-state. */
/**
* The default-state.
*/
DEFAULT("default"),
/** Primary. */
/**
* Primary.
*/
PRIMARY("primary"),
/** Success. */
/**
* Success.
*/
SUCCESS("success"),
/** Info. */
/**
* Info.
*/
INFO("info"),
/** Warning. */
/**
* Warning.
*/
WARNING("warning"),
/** error. */
/**
* error.
*/
DANGER("danger"),
/** Light. */
LINK("link"),;
/**
* Light.
*/
LINK("link"),
;

ButtonState(final String suffix) {
if (MoreStrings.isEmpty(suffix)) {
Expand All @@ -55,7 +70,6 @@ public enum ButtonState implements StyleClassProvider {

private static final String PREFIX = "btn-";

@Getter
private final String styleClass;

@Override
Expand All @@ -68,8 +82,8 @@ public StyleClassBuilder getStyleClassBuilder() {
* {"default","primary", "success", "info", "warning", "danger",
* "link"}
* @return the corresponding {@link ButtonState} derived by the given
* {@link ContextState}. In case of <code>contextSize==null</code> it
* will return {@link ButtonState#DEFAULT}.
* {@link ContextState}. In case of <code>contextSize==null</code> it
* will return {@link ButtonState#DEFAULT}.
*/
public static ButtonState getForContextState(final String state) {
if (isEmpty(state)) {
Expand Down

0 comments on commit 19b9e42

Please sign in to comment.