Apache Wicket utilities for using iziToast. wicket-iziToast converts the feedback message to JavaScript to display the toast.
Version | Wicket | iziToast |
---|---|---|
3.0.0 | 10.x | 1.4.0 |
2.1.0 | 9.x | 1.4.0 |
1.1.0 | 8.x | 1.4.0 |
Deployed wicket-izitoast-samples module.
Add wicket-izitoast-core dependency.
Wicket 10.x
<dependency>
<groupId>jp.try0.wicket</groupId>
<artifactId>wicket-izitoast-core</artifactId>
<version>3.0.0</version>
</dependency>
Wicket 9.x
<dependency>
<groupId>jp.try0.wicket</groupId>
<artifactId>wicket-izitoast-core</artifactId>
<version>2.1.0</version>
</dependency>
Wicket 8.x
<dependency>
<groupId>jp.try0.wicket</groupId>
<artifactId>wicket-izitoast-core</artifactId>
<version>1.1.0</version>
</dependency>
You can set default values, in the application initialize process(Application#init).
IziToastSetting
.createInitializer(this)
.setAutoAppendBehavior(true)
.setGlobalOption(option) // default iziToast option. apply in client-side (execute iziToast.settings(option))
.setGlobalEachLevelOptions(perLevelOptions) // default option per levels. apply in server-side.
.setToastMessageCombiner(combiner) // combiner that combine same level feedback messages.
.initialize();
if true add IziToastBehavior to page automatically.
Default toast option. Execute iziToast.settings(option) on the client-side and apply the default option.
Default toast option per levels.
ToastOption defaultInfoOption = new ToastOption();
// TODO set option values
EachLevelToastOptions options = EachLevelToastOptions.builder()
.setInfoOption(defaultInfoOption)
.get();
// TODO setGlobalEachLevelOptions(options)
Option priority level Default option per levels (GlobalEachLevelOptions) > Default option (GlobalOption)
Combiner that combines messages for each toast level.
ToastMessageCombiner combiner = new ToastMessageCombiner();
combiner.setPrefix("・");
// TODO setToastMessageCombiner(combiner)
If execute this Java code.
error("message1");
error("message2");
Messages are combined and displayed in one toast.
add IziToastBehavior to page. (If you set setAutoAppendBehavior to true when initializing settings, no need this code.)
add(new IziToastBehavior());
IziToastBehavior converts feedback messages to JavaScript for displaying toast.
Success toast
- org.apache.wicket.Component#success(Serializable)
- org.apache.wicket.Session#success(Serializable)
Information toast
- org.apache.wicket.Component#info(Serializable)
- org.apache.wicket.Session#info(Serializable)
Warning toast
- org.apache.wicket.Component#warn(Serializable)
- org.apache.wicket.Session#warn(Serializable)
Error toast
- org.apache.wicket.Component#error(Serializable)
- org.apache.wicket.Session#error(Serializable)
- org.apache.wicket.Component#fatal(Serializable)
- org.apache.wicket.Session#fatal(Serializable)
In this case, need instance of class that implemented IHeaderResponse or AjaxRequestTarget.
Toast.create(toastLevel, message)
.show(target);