-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass at editing new text, only.
- Loading branch information
1 parent
4a28299
commit 369af89
Showing
1 changed file
with
6 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -300,7 +300,7 @@ Since [classname]`NumberSignal` is a [classname]`ValueSignal` with the additiona | |
[role="since:com.vaadin:[email protected]"] | ||
=== ListSignal | ||
|
||
The [classname]`ListSignal<T>` is a full-stack signal that holds a list of values of an arbitrary type. It has to be a JSON-serializable type that's supported by the Hilla framework. Every item in a [classname]`ListSignal` is a [classname]`ValueSignal`, meaning that any changes to the item's value is propagated to the server and other clients automatically. | ||
The [classname]`ListSignal<T>` is a full-stack signal that holds a list of values of an arbitrary type. It has to be a JSON-serializable type that's supported by the Hilla framework. Every item in a [classname]`ListSignal` is a [classname]`ValueSignal`, meaning that any changes to the item's value is propagated to the server and other clients. | ||
|
||
The following example demonstrates how to create and use a [classname]`ListSignal` in a server-side service: | ||
|
||
|
@@ -599,7 +599,7 @@ public interface OperationValidator<T> { | |
The [methodname]`validate` method takes a [classname]`SignalOperation` instance as a parameter and returns a [classname]`ValidationResult`. The [classname]`SignalOperation` is a common interface for all operations that can be applied to a signal. The [classname]`ValidationResult` is used to communicate the result of the validation, containing: | ||
|
||
- A `status` with two possible enumerated values, `ALLOWED` and `REJECTED`; and | ||
- A `message` that can be used to provide a reason for the rejection. Considering the nature of operation validators as a security point cut, this message is only logged on server side (at `WARN` level), and it is not propagated to the client to prevent any possible misuse. | ||
- A `message` that can be used to provide a reason for the rejection. Considering the nature of operation validators as a security point cut, this message is only logged on the server side (i.e., at `WARN` level), and it's not propagated to the client to prevent any possible misuse. | ||
|
||
The [classname]`ValidationResult` class provides two convenient static methods to create instances of the class: | ||
|
||
|
@@ -625,16 +625,16 @@ NumberSignal voteSignal = new NumberSignal() // <1> | |
<1> Creates an instance of a [classname]`NumberSignal` that defaults to zero. | ||
<2> Defines an operation validator on the signal instance, which results in a new signal instance with the operation validator attached. The original instance remains unchanged (i.e., no validators). | ||
<3> Checks the operation type to be only an `IncrementOperation`. | ||
<4> Allow the operation only if the value is incremented/decremented by `1.0`. | ||
<4> Allows the operation only if the value is incremented or decremented by `1.0`. | ||
<5> Rejects the operation if the value is not `1.0` or `-1.0`. | ||
<6> Rejects all other operations, in this case the could be `SetValueOperation` and `ReplaceValueOperation`. | ||
<6> Rejects all other operations, which could be `SetValueOperation` and `ReplaceValueOperation`. | ||
|
||
In the above example, the `operation` parameter is an instance of [classname]`SignalOperation`. At runtime, the operation can be one of the following types: | ||
|
||
`ValueOperation<T>`:: Represents an operation that contains a value of type `T`. | ||
`IncrementOpertaion`:: Specific to `NumberSignal`. Represents an operation that increments the value of the signal by a given value. Value is of Type `Double`. This operation is a special case of [classname]`ValueOperation<Double>`. | ||
`SetValueOperation<T>`:: Specific to `ValueSignal` and `NumberSignal`. Also, applies to the changes happening to the items of a `ListSignal`. Represents an operation that sets the value of the signal to a new value of type `T`. This operation is a special case of [classname]`ValueOperation<T>`. | ||
`ReplaceValueOperation<T>`:: Specific to `ValueSignal` and `NumberSignal`. Also, applies to the changes happening to the items of a `ListSignal`. Represents an operation that replaces the value of the signal with a new value of type `T`. This operation is a special case of [classname]`ValueOperation<T>`. | ||
`SetValueOperation<T>`:: Specific to `ValueSignal` and `NumberSignal`. Also, applies to changes happening to the items in a `ListSignal`. Represents an operation that sets the value of the signal to a new value of type `T`. This operation is a special case of [classname]`ValueOperation<T>`. | ||
`ReplaceValueOperation<T>`:: Specific to `ValueSignal` and `NumberSignal`. Also, applies to the changes happening to the items in a `ListSignal`. Represents an operation that replaces the value of the signal with a new value of type `T`. This operation is a special case of [classname]`ValueOperation<T>`. | ||
`ListInsertOperation<T>`:: Specific to `ListSignal`. Represents an operation that inserts a new value to the list signal at a given position. The value is of type `T`. This operation is a special case of [classname]`ValueOperation<T>`. | ||
`ListRemoveOperation<T>`:: Specific to `ListSignal`. Represents an operation that removes a value from the list signal at a given position. The value is of type `T`. | ||
|
||
|