-
Notifications
You must be signed in to change notification settings - Fork 1
Slider, range and color arguments #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
krystian-panek-vmltech
merged 17 commits into
main
from
slider-range-and-color-arguments
May 15, 2025
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4c1b285
Slider, range and color arguments
kamil-orwat-vmltech 53b1d20
formatting
kamil-orwat-vmltech 802ee56
Improved documentation
kamil-orwat-vmltech acac1ff
removed useless code
kamil-orwat-vmltech d51ccb8
Merge remote-tracking branch 'origin/main' into slider-range-and-colo…
krystian-panek-vmltech 8b95ad2
Bundle up fix
krystian-panek-vmltech 03d92ce
Bug fixes, Jackson private
krystian-panek-vmltech 87413e2
extended color arg and renamed slider to number and range to numberrange
kamil-orwat-vmltech 006f142
Merge branch 'main' into slider-range-and-color-arguments
kamil-orwat-vmltech b887c02
changes from review
kamil-orwat-vmltech e70503f
refactored inputs
kamil-orwat-vmltech af304f4
formattings + cleanup
kamil-orwat-vmltech 23806cc
Implemented changes from CR
kamil-orwat-vmltech df8f74d
Merge branch 'main' into slider-range-and-color-arguments
kamil-orwat-vmltech f9d692f
formatting
kamil-orwat-vmltech dee0d24
Merge remote-tracking branch 'origin/main' into slider-range-and-colo…
krystian-panek-vmltech 8ad36a3
Minor imprs
krystian-panek-vmltech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,7 @@ public enum ArgumentType { | |
STRING, | ||
TEXT, | ||
SELECT, | ||
MULTISELECT | ||
MULTISELECT, | ||
COLOR, | ||
NUMBER_RANGE | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
core/src/main/java/com/vml/es/aem/acm/core/code/arg/ColorArgument.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.vml.es.aem.acm.core.code.arg; | ||
|
||
import com.vml.es.aem.acm.core.code.Argument; | ||
import com.vml.es.aem.acm.core.code.ArgumentType; | ||
import java.util.Arrays; | ||
|
||
public class ColorArgument extends Argument<String> { | ||
private ColorArgument.Format format = ColorArgument.Format.RGBA; | ||
|
||
public ColorArgument(String name) { | ||
super(name, ArgumentType.COLOR); | ||
} | ||
|
||
public Format getFormat() { | ||
return format; | ||
} | ||
|
||
public void setFormat(String format) { | ||
this.format = ColorArgument.Format.of(format); | ||
} | ||
|
||
public void setFormat(ColorArgument.Format format) { | ||
this.format = format; | ||
} | ||
|
||
public void hex() { | ||
this.format = ColorArgument.Format.HEX; | ||
} | ||
|
||
public void hsl() { | ||
this.format = ColorArgument.Format.HSL; | ||
} | ||
|
||
public void rgba() { | ||
this.format = ColorArgument.Format.RGBA; | ||
} | ||
|
||
public void hsb() { | ||
this.format = ColorArgument.Format.HSB; | ||
} | ||
|
||
public enum Format { | ||
HEX, | ||
HSL, | ||
RGBA, | ||
HSB; | ||
|
||
public static ColorArgument.Format of(String name) { | ||
return Arrays.stream(ColorArgument.Format.values()) | ||
.filter(r -> r.name().equalsIgnoreCase(name)) | ||
.findFirst() | ||
.orElseThrow(() -> | ||
new IllegalArgumentException(String.format("Color format '%s' is not supported!", name))); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
core/src/main/java/com/vml/es/aem/acm/core/code/arg/DecimalRangeArgument.java
10000
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.vml.es.aem.acm.core.code.arg; | ||
|
||
import com.vml.es.aem.acm.core.code.Argument; | ||
import com.vml.es.aem.acm.core.code.ArgumentType; | ||
import com.vml.es.aem.acm.core.util.Range; | ||
import java.math.BigDecimal; | ||
import java.util.List; | ||
|
||
public class DecimalRangeArgument extends Argument<Range<BigDecimal>> { | ||
private BigDecimal min; | ||
|
||
private BigDecimal max; | ||
|
||
private BigDecimal step; | ||
|
||
public DecimalRangeArgument(String name) { | ||
super(name, ArgumentType.NUMBER_RANGE); | ||
} | ||
|
||
public void setValue(List<BigDecimal> value) { | ||
if (value.size() != 2) { | ||
throw new IllegalArgumentException( | ||
String.format("Range value must be a list of two elements but specified '%s'!", value)); | ||
} | ||
super.setValue(new Range<>(value.get(0), value.get(1))); | ||
} | ||
|
||
public BigDecimal getMin() { | ||
return min; | ||
} | ||
|
||
public void setMin(BigDecimal min) { | ||
this.min = min; | ||
} | ||
|
||
public BigDecimal getStep() { | ||
return step; | ||
} | ||
|
||
public void setStep(BigDecimal step) { | ||
this.step = step; | ||
} | ||
|
||
public BigDecimal getMax() { | ||
return max; | ||
} | ||
|
||
public void setMax(BigDecimal max) { | ||
this.max = max; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it work with ints, doubles, strings when passed from groovy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, only decimals, but I think it's expected if we want type safety?