https://github.com/try0/wicket-toastr
Apache Wicket utilities for using toastr.
https://github.com/try0/wicket-toastr
display-toast feedback-message java toast-component toastr wicket
Last synced: 3 months ago
JSON representation
Apache Wicket utilities for using toastr.
- Host: GitHub
- URL: https://github.com/try0/wicket-toastr
- Owner: try0
- License: apache-2.0
- Created: 2018-09-04T12:35:19.000Z (over 7 years ago)
- Default Branch: wicket-10.x
- Last Pushed: 2024-07-18T15:21:03.000Z (almost 2 years ago)
- Last Synced: 2025-07-12T01:48:07.384Z (11 months ago)
- Topics: display-toast, feedback-message, java, toast-component, toastr, wicket
- Language: Java
- Homepage:
- Size: 278 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# wicket-toastr
[](https://travis-ci.org/try0/wicket-toastr)
[](https://codecov.io/gh/try0/wicket-toastr)
[](https://sonarcloud.io/dashboard?id=try0_wicket-toastr)
[](https://search.maven.org/search?q=g:%22jp.try0.wicket%22%20AND%20a:%22wicket-toastr-core%22)
[](https://www.javadoc.io/doc/jp.try0.wicket/wicket-toastr-core)
[Apache Wicket](https://wicket.apache.org/) utilities for using [toastr](https://codeseven.github.io/toastr/) which is a library of a simple javascript toast notification.
Just add behavior to the component, and you can display toast.
This behavior uses a wicket feedback message system.
Also, you can display toast manually without using a feedback message.
## Version
| |toastr |wicket |
|--:|--:|--:|
|3.0.0 |2.1.4 |10.x |
|2.0.0 |2.1.4 |9.x |
|1.0.2 |2.1.4 |8.x |
## Demo
Deployed wicket-toastr-samples module.
[demo](https://try0.jp/app/wicket-toastr-samples/)
## Usage
### Maven
Wicket10
```xml
jp.try0.wicket
wicket-toastr-core
3.0.0
```
Wicket9
```xml
jp.try0.wicket
wicket-toastr-core
2.0.0
```
Wicket8
```xml
jp.try0.wicket
wicket-toastr-core
1.0.2
```
### Initialize Settings
You can set default values, in the application initialize process(Application#init).
```java
ToastrSettings.createInitializer(this)
.setAutoAppendBehavior(true)
.setMessageFilter(filter)
.setToastrBehaviorFactory(factory)
.initialize();
```
### Display toast using ToastrBehavior
add ToastrBehavior to any of the components on the page
```java
add(new ToastrBehavior());
```
or set true to setAutoAppendBehavior on initialize settings
```java
ToastrSettings.createInitializer(this)
.setAutoAppendBehavior(true)
```
Component#success(Serializable), Session#success(Serializable)
⇒ success toast

Component#info(Serializable), Session#info(Serializable)
⇒ info toast

Component#warn(Serializable), Session#warn(Serializable)
⇒ warn toast

Component#error(Serializable), Session#error(SerializableSerializable)
Component#fatal(Serializable), Session#fatal(Serializable)
⇒ error toast

### Display toast manually
In this case, it needs an instance of the class that implemented IHeaderResponse or AjaxRequestTarget.
```java
Toast.create(toastLevel, message)
.show(target);
```
### Others
#### With title
```java
Toast.create(toastLevel, message)
.withTitle(title)
.show(target);
```
#### With options
Overrides global options.
```java
Toast.create(toastLevel, message)
.withToastOptions(options)
.show(target);
```