toastr is a Javascript library for Gnome / Growl type non-blocking notifications. The goal is to create a simple core library that can be customized and extended. This plugin provides JWebMP integration with type-safe Java APIs and Angular asset management.
Built on Toastr · JWebMP Core · JPMS module com.jwebmp.plugins.toastr · Java 25+
<dependency>
<groupId>com.jwebmp.plugins</groupId>
<artifactId>toastr</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>Gradle (Kotlin DSL)
implementation("com.jwebmp.plugins:toastr:2.0.0-SNAPSHOT")Automatically included via @TsDependency:
{
"dependencies": {
"toastr": "^2.1.4"
}
}- Java 25 LTS (required)
- Maven 3.8+
- Node.js 18+ (for frontend builds)
- Angular 21+ (auto-integrated via JWebMP)
import com.jwebmp.plugins.toastr.ToastrFeature;
import com.jwebmp.plugins.toastr.ToastrType;
// Show a simple info toast
addFeature(new ToastrFeature<>("Hello World"));
// Show a toast with title and type
addFeature(new ToastrFeature<>(ToastrType.Success, "Done!", "Your changes have been saved."));import com.jwebmp.plugins.toastr.ToastrFeature;
import com.jwebmp.plugins.toastr.ToastrType;
import com.jwebmp.plugins.toastr.ToastrPosition;
ToastrFeature<?> toast = new ToastrFeature<>(ToastrType.Warning, "Alert", "Something needs attention");
toast.getOptions()
.setPositionClass(ToastrPosition.Toast_Top_Center)
.setCloseButton(true)
.setProgressBar(true)
.setTimeOut(3000)
.setNewestOnTop(true)
.setPreventDuplicates(true);
addFeature(toast);ToastrType.Info // Information toast (default)
ToastrType.Success // Success toast
ToastrType.Warning // Warning toast
ToastrType.Error // Error toastToastrPosition.Toast_Top_Right // Top right (default)
ToastrPosition.Toast_Top_Left // Top left
ToastrPosition.Toast_Top_Center // Top center
ToastrPosition.Toast_Top_Full_Width // Top full width
ToastrPosition.Toast_Bottom_Right // Bottom right
ToastrPosition.Toast_Bottom_Left // Bottom left
ToastrPosition.Toast_Bottom_Center // Bottom center
ToastrPosition.Toast_Bottom_Full_Width // Bottom full width- Non-Blocking Notifications — Lightweight toast messages that don't interrupt user flow
- Multiple Toast Types — Info, Success, Warning, and Error styles
- Configurable Positioning — 8 screen positions to choose from
- Animation Effects — Easing effects for show/hide transitions via JQ Easing Effects
- Progress Bar — Optional countdown progress bar
- Close Button — Optional close button on toasts
- Duplicate Prevention — Prevent duplicate toast messages
- CRTP Fluent API — Method chaining for toast configuration
- Zero Configuration — Auto-registered via ServiceLoader SPI
- Angular Integration — Assets loaded via
@TsDependency,@NgScript, and@NgStyleSheet
The plugin is automatically configured when present on the classpath. No manual registration needed.
@TsDependency(value = "toastr", version = "^2.1.4")
@NgScript(name = "Toastr", value = "node_modules/toastr/toastr.js")
@NgStyleSheet(name = "Toastr", value = "node_modules/toastr/build/toastr.min.css")
public class ToastrPageConfigurator implements IPageConfigurator<ToastrPageConfigurator> {
// Auto-loaded via ServiceLoader SPI
}src/main/java/com/jwebmp/plugins/toastr/
├── ToastrFeature.java # Main toast feature component
├── ToastrOptions.java # Toast configuration options (CRTP)
├── ToastrType.java # Toast type enum (Info, Success, Warning, Error)
├── ToastrPosition.java # Toast position enum (8 positions)
├── ToastrPageConfigurator.java # Auto-configuration with npm/Angular
├── ToastrReferencePool.java # Legacy reference pool
└── implementations/
└── ToastrInclusionsModule.java # GuicedEE module inclusion
mvn clean test- GitHub Repository: https://github.com/JWebMP/Toastr
- Maven Central: https://mvnrepository.com/artifact/com.jwebmp.plugins/toastr
- Original Library: http://codeseven.github.io/toastr/
- Toastr GitHub: https://github.com/CodeSeven/toastr
- JWebMP Home: https://jwebmp.com/
Licensed under the Apache License 2.0.
Made with JWebMP