oωo (owo-lib)

oωo (owo-lib)

23M Downloads

@PredicateConstraint doesn't give visual feedback, whether an input is valid or not

Zappic3 opened this issue · 0 comments

commented

owo_version=0.12.14+1.21

When using the @PredicateConstraint in my config model, the value inside the input box appears green, even though the value does not satisfy the @PredicateConstraint. This gives the impression that the input is valid, which can be misleading for users. The only sign that the config value didn't get saved is a log message, that is probably overlooked by most users.

grafik
How it looks to the user

[Render thread/WARN] (owo) Option Key{path=[maxMediaSize]} in config 'mod' could not be updated, as the given value '-123' does not match its constraint: Predicate method maxMediaSizePredicate
The only sign that the config didn't get saved. Probably overlooked by most users

Expected Behavior:
The input box should visually indicate when a @PredicateConstraint is not satisfied by turning the text red, similar to how other invalid inputs are indicated.

(I have only tested this with int values)

My Code:

@PredicateConstraint("maxMediaSizePredicate")
public int maxMediaSize = 30;
public static boolean maxMediaSizePredicate(int maxMediaSize) {
        return maxMediaSize > 0;
}