Skip to content

Commit

Permalink
feat: added visibility documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aldanchenko committed Aug 2, 2022
1 parent d61e804 commit eecc378
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## [11.8.0](https://github.com/dlsc-software-consulting-gmbh/PreferencesFX/tree/11.8.0) (2022-08-02)
[Full Changelog](https://github.com/dlsc-software-consulting-gmbh/PreferencesFX/compare/11.6.0...11.8.0)

**Implemented enhancements:**

- Added support setting an optional visibility condition for Categories, Groups and Settings

## [11.7.0](https://github.com/dlsc-software-consulting-gmbh/PreferencesFX/tree/11.7.0) (2020-12-15)
[Full Changelog](https://github.com/dlsc-software-consulting-gmbh/PreferencesFX/compare/11.6.0...11.7.0)

Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- [Setting types](#setting-types)
- [Localisation](#localisation)
- [Validation](#validation)
- [Visibility](#visibility)
- [Team](#team)

## Maven
Expand Down Expand Up @@ -363,6 +364,36 @@ It is possible to optionally add a [Validator](http://dlsc.com/wp-content/html/f
| `SelectionLengthValidator` | Defines a length interval which is considered valid. This range can be limited in either one direction or in both directions. |
| `StringLengthValidator` | Defines a length interval which is considered valid. This range can be limited in either one direction or in both directions. |

## Visibility

PreferencesFX support setting an optional visibility condition for Categories, Groups and Settings
* condition could be defined as a lambda-expression
* condition will be re-evaluated whenever any Setting changes

```java
Category.of("General",
Group.of("Display",
Setting.of("Brightness", brightness),
Setting.of("Night mode", nightMode, VisibilityProperty.of(brightness, (newValue) -> newValue.intValue() > 50)),
Setting.of("Scale", scale, VisibilityProperty.of(nightMode, (newValue) -> newValue)),
Setting.of("Is production category visible", productionVisibility)
)
),
Category.of("Production", VisibilityProperty.of(productionVisibility, (newValue) -> newValue),
Group.of("Display",
Setting.of("Port", salary, VisibilityProperty.of(nightMode, (newValue) -> newValue))
)
),
Category.of("View",
Group.of("Display",
Setting.of("Salary", salary, VisibilityProperty.of(nightMode, (newValue) -> newValue))
),
Group.of("Bonuses", VisibilityProperty.of(salary, (newValue) -> newValue.intValue() > 10),
Setting.of("Bonus", bonus)
)
)
```

## Team
- Marco Sanfratello
- marco.sanfratello@students.fhnw.ch
Expand Down

0 comments on commit eecc378

Please sign in to comment.