Advanced Topics
Error Handling
Register custom ErrorHandler implementations through the Java Service Provider Interface to respond to specific exceptions in webforJ apps.
Lifecycle Listeners
Hook into webforJ app startup and shutdown phases with AppLifecycleListener to initialize services, modify config, or clean up resources.
Web Storage
Web storage 是 web 开发中的一个基本概念,它允许网站在客户端存储数据。这使得 web 应用能够在用户的浏览器中本地保存状态、偏好和其他信息。Web 存储提供了一种在页面重新加载和浏览器会话之间持久化数据的方法,减少了对服务器重复请求的需要,并支持离线功能。
Locale Management
webforJ 提供内置支持来管理应用程序的区域设置。区域设置决定了整个应用使用的语言和区域格式。组件可以通过 LocaleObserver 接口对区域设置的变化做出反应,从而在用户切换语言时立即更新 UI。
Translation
Resolve localized strings from resource bundles or custom sources with the t() method, MessageFormat placeholders, and browser locale detection.
Browser Console
Log messages from Java to the browser console with typed levels and styled output using the BrowserConsole utility.
MaskDecorator
MaskDecorator 是一个静态工具类,用于在输入字段外对字符串、数字、日期和时间应用掩码。它使用与 webforJ 的 masked field components 相同的掩码语法,使得在展示标签、Table 渲染器或应用程序的任何其他位置一致地格式化和解析值变得简单明了。
Interval
类 Interval 代表一个定时器,它以固定的时间延迟触发一个 事件。
Debouncing
防抖是一种技术,它延迟执行操作,直到自上一次调用以来经过了指定的时间。每个新调用都会重置计时器。这在像“搜索时输入”的场景中非常有用,在这种情况下,您希望等到用户停止输入后再执行搜索查询。
Browser History
BrowserHistory 类在 webforJ 中提供了一个高层次的 API,用于与浏览器的历史记录进行交互。浏览器历史记录允许 web 应用程序跟踪用户在应用程序中的导航。通过使用浏览器历史记录,开发者可以启用诸如前进和后退导航、状态保留以及动态 URL 管理等功能,而无需进行完整页面重载。
Page Visibility
Detect when the tab hosting your app moves between the foreground and the background, and react in Java.
Geolocation
Request and watch the device's geographic position using the Geolocation class, with high-accuracy, timeout, and maximum age controls.
App badges
Paint notification badges onto the operating system app icon and the browser tab favicon.
Namespaces
Share thread-safe key-value state across sessions, thread groups, or the entire JVM using Private, Group, and Global namespaces.
Terminate and Error Actions
在使用 webforJ 开发应用程序时,定义应用在终止或遇到错误时的行为至关重要。框架提供了通过 terminate 和 error 操作来定制这些行为的机制。
View Transitions
Animate DOM changes with the browser View Transition API, applying fade, slide, zoom, and shared morph effects between component states.
Object and String Tables
ObjectTable、SessionObjectTable 和 StringTable 提供在 webforJ 环境中对共享数据的静态访问。它们可以在应用中的任何位置访问,并具有不同的用途:
仓库
1 项
Asynchronous Updates
Run background work off the UI thread and push updates back to webforJ components safely with Environment.runLater and PendingResult.
Route Registry Provider
RouteRegistryProvider 是一个服务提供者接口 (SPI),允许集成框架提供自定义的路由发现机制。这使得框架能够将其自己的类路径扫描和依赖注入系统与 webforJ 的路由基础设施集成。