21
I Use This!
Activity Not Available

News

Posted over 6 years ago by [email protected] (Max Barkley)
We've recently released Errai 4.1.0.Final, the first release on master since branching off the 4.0.x series. In this short post, I will highlight some of cool new things you can find in 4.1.0.Final, which include: Size and performance improvements ... [More] in code generated for Errai Marshalling and Errai Data Binding Custom content delegation in Errai Navigation ErraiApp.properties moved to META-INF Templating and Data Binding support for Elemental 2 The best part: two of these changes were delivered by our fantastic community. Read below for descriptions about these features. At the end I will talk briefly about forward-development currently happening in Errai. Marshalling and Data Binding ImprovmentsBoth Errai Marshalling and Data Binding use generated code to introspect and access members of annotated classes. In Errai 4.1.0.Final, this code has been refactored to decrease generated code size and better take advantage of optimisations for String literals in the GWT compiler.If you use Errai Marshalling or Data Binding heavily, Errai 4.1.0.Final should noticeably decrease the size of your JavaScript payload. A big shout out to slavap for this excellent contribution!Custom Content DelegationErrai Navigation provides lots of page-specific mechanisms for hooking into the navigation lifecycle, but until now there were no convenient ways to generically customize how all pages were shown or hidden.Errai 4.1.0.Final introduces a content delegation system. Users can override a ContentDelegation interface and replace the default implementation to insert their own custom logic for displaying and hiding all pages. The delegation is quite flexible, even allowing for asynchronous actions.A big thanks to BenDol for the concept and implementation of this feature!Configuration Moved to META-INFBy convention, configuration files that don't require name-spacing are supposed to be placed in the META-INF folder. Errai 4.1.0.Final supports scanning ErraiApp.properties files in the META-INF folder, allowing users to follow this convention. Moving forward, you should consider this a best practice.Errai 4.1.0.Final will still work properly with ErraiApp.properties files outside of a META-INF folder, but you may see an abundance of warnings in your logs, as we will likely phase out support for this in our next major release.Elemental 2 Support for Templating and Data Binding Elemental 2 is a project that exposes built-in web APIs in Java. Like the first Elemental, the project is automatically generated from external definitions of web APIs. Unlike its predecessor, Elemental 2 uses JS Interop.Back when we began work on Errai 4, Elemental 2 was not yet available. We didn't want that to slow down our work on HTMLElement-based user interfaces and JS Interop support, and so we created a collection of hand-written element wrappers in Errai.But now that Elemental 2 is available, it is in the best interests of the GWT community to standardise around these. As such, Errai's DOM wrappers have been deprecated and we have added full support to templating and data-binding for classes from Elemental 2.We will not be removing the Errai element wrappers, but we will also not be updating them, and you are highly encouraged to use Elemental 2 going forward.Looking to the FutureThe biggest priority for Errai in the coming months is preparing for migration to GWT 3. We've known for some time that GWT 3 will require big changes to the way we develop GWT applications. There probably won't be GWT Widgets. There definitely won't be GWT Generators.We've already made large strides towards GWT-Widget-less UI development. Although there is some more work to be done here, we are also beginning progress on the even larger and equally important task: migrating Errai's GWT generators to annotation processors.I'd like to take this opportunity to mention recent addition to our team, Tiago Bento, who has been the driving force behind our APT migration efforts. It's not quite ready for a test drive yet, but keep an eye out in the future for blog posts about how to try out Errai annotation processors on our snapshot releases.Until the next time, happy coding! [Less]
Posted almost 7 years ago by [email protected] (Max Barkley)
Today I'm thrilled to announce that Errai 4.0.0.Final has been released!At a glance, here are the big changes from Errai 3 to 4: Uses GWT 2.8.0 and WildFly 10 for Super Dev Mode Has a new Errai IoC container supporting incremental code regeneration ... [More] , and greater compliance with CDI Has advanced JS Interop support, including dependency injection of native JavaScript objects, and templating and data-binding with JS Interop wrappers of DOM elements and web components Has message bus enhancements (better clustering support and CSRF protection) All of these changes have been discussed in previous blog posts. Nonetheless, in this post I will summarise these changes with links to the more detailed descriptions. New Errai IoC ContainerErrai 4 has a new IoC container, that supports incremental regeneration of code. The main benefit of this is to improve the performance of refreshing during Super Dev Mode. But this rewrite also allows for the possibility of migrating to annotation processors for all code generation in a future release.The new IoC container also more closely aligns with CDI: @ApplicationScoped beans must be proxiable, and are lazily loaded like in Weld @Singleton is a "pseudo-scope": it need not be proxiable but cannot be part of a circular injection @Typed annotation is supported In some cases, beans may be resolved slightly differently than in Errai 3. Our upgrade guide highlights some important "gotchas" to look out for when upgrading to Errai 4. Advanced JS Interop Support The overarching theme of Errai 4 is working directly with JavaScript APIs and the DOM via JS Interop. If you don't already know about JS Interop, I encourage you to watch the first half of this talk by Daniel Kurka at GWTCon.Here are the ways in which you can use JS Interop with Errai 4: Use JS Interop interfaces for DOM elements or web components as @DataFields in @Templated components Use JS Interop interfaces for DOM elements or web components as @Bound UI components with Errai data-binding Inject JavaScript objects into your application like normal GWT/Java objects You can read more about Errai 4 JS Interop support here and here, or view examples in the Errai Tutorial. Message Bus EnhancementsThe Errai message bus has received some love in Errai 4, with fixes that improve fail-over behaviour in clustered setups, and optional built-in CSRF protection.Both of these are described briefly in this blog post.Thanks to the CommunityI'd like to end by thanking everyone in the Errai community who contributed to the quality of this release, through pull requests with new features and reports of important issues in our beta and candidate releases. In particular, the Errai JS Interop support was greatly improved by the important feedback from our community.Until the next time, happy coding! [Less]
Posted about 7 years ago by [email protected] (Max Barkley)
As of today Errai 4.0.0.CR2 is available. This release contains mostly bug fixes and enhancements to some of our demos.Below are some of the highlights.Fix Maven Parallel Build IssuesPreviously doing a parallel Maven build of an Errai project could ... [More] occasionally lead to compilation failures. This release provides a fix so that parallel builds can now reliably execute on Errai projects.Add Jetty Profiles Back to Errai DemosDuring the migration from GWT 2.7 to 2.8 many Errai demo Jetty configurations stopped working, and consequently they were simply removed. Thanks to Dmitrii Tikhomirov, many of the Errai demos now have Jetty profiles once more so you can see how to build an Errai application for deployment outside of a Java EE app server.Source Translation of Stack Traces in Google Chrome FixedA bug in Errai logging had broken source mapping of stack traces in errors logged through Errai. The result was that stack traces printed to the console in Google Chrome would only show obfuscated method names and line numbers. The problem has been fixed so that stack traces logged to the console once again use source maps to show line numbers from the Java source.Stay TunedStay tuned as we get closer to our first final release of Errai 4. Until then, happy coding! [Less]
Posted about 7 years ago by [email protected] (Max Barkley)
As of today Errai 4.0.0.CR2 is available. This release contains mostly bug fixes and enhancements to some of our demos.Below are some of the highlights.Fix Maven Parallel Build IssuesPreviously doing a parallel Maven build of an Errai project could ... [More] occasionally lead to compilation failures. This release provides a fix so that parallel builds can now reliably execute on Errai projects.Add Jetty Profiles Back to Errai DemosDuring the migration from GWT 2.7 to 2.8 many Errai demo Jetty configurations stopped working, and consequently they were simply removed. Thanks to Dmitrii Tikhomirov, many of the Errai demos now have Jetty profiles once more so you can see how to build an Errai application for deployment outside of a Java EE app server.Source Translation of Stack Traces in Google Chrome FixedA bug in Errai logging had broken source mapping of stack traces in errors logged through Errai. The result was that stack traces printed to the console in Google Chrome would only show obfuscated method names and line numbers. The problem has been fixed so that stack traces logged to the console once again use source maps to show line numbers from the Java source.Stay TunedStay tuned as we get closer to our first final release of Errai 4. Until then, happy coding! [Less]
Posted about 7 years ago by [email protected] (Max Barkley)
Since our last post we've done several beta releases, but today I'm happy to announce our first candidate release of Errai 4! Since we haven't blogged about our last few Beta releases, this post will contain highlights of all the changes introduced ... [More] since 4.0.0.Beta4. Client-side support for the CDI @Typed annotation Global translation keys for Errai i18n Removed ResponseCallback Message bus enhancments (better clustering and CSRF protection) Gneral purpose gatekeepers on @Pages Without further ado, let's dive right in.Client-side support @TypedThe @Typed annotation allows you to restrict the types of injection sites that a bean may satisfy. What does that mean? To explain, we'll use the example from the @Typed javadoc. Consider the following class:With normal CDI resolution, this bean will satisfy any unqualified injection site for any the following types, because the bean is assignable to any of these: Shop, BookShop, Business, and Object. Typically this is desirable, but we could reasonably want this bean to only satisfy injection sites of type ShopThe @Typed annotation allows us to specify a subset of this bean's assignable types as its bean types, like so:With this declaration, BookShop now only satisfies injection sites with types Shop or Object, preventing other developers from injecting this as a BookShop or a Business.Global Translation Keys in Errai i18nIf you use Errai i18n, then you know that translation bundles use templated class names as prefixes for the keys. For example, consider this templated bean.If we used Errai i18n to translate the "hello" data-field, we would define the translation of this element with the key "I18nTemplatedBean.hello-key". The disadvantage of this prefixing is that it made it impossible to share translations of common words between templates, leading to lots of duplication.Now Errai i18n supports unprefixed translation keys that can be used in any template. Global translation keys have a lower priority than prefixed translations, and so they will only be used to translate a data-field if there is no translation key for the field specific to that template. So we could use the value associated with the key "hello-key" to translate the data-field in the above example provided there is no value for the key "I18nTemplatedBean.hello-key".No more ResponseCallback for JAX-RS RPCsThe ResponseCallback was introduced to Errai to allow developers to access the underlying Response object returned from a JAX-RS RPC call. Unfortunately, this feature caused a serious problem for client-side RPC interceptors (including those used by Errai Security), where it became impossible to intercept the result of an RPC calls without a ClassCastException in some cases.To solve this problem, we've removed the ResponseCallback, so that every RPC method has a single expected callback type that directly corresponds to the return type of the RPC method. In cases where a Response object is needed, you can modify your JAX-RS method to return a javax.ws.rs.core.Response, allowing you to use a RemoteCallback from the client call site.Message Bus EnhancementsClustering FixesThis release fixes a bug where the message bus could enter a reconnect loop after failover in certain clustering setups. With this fix the message bus is now more resilient at handling failover when working behind a load balancer.CSRF ProtectionThe Errai Bus now provides basic CSRF protection. This protection is disabled by default. It can be enabled setting this property to true (as a System property or in ErraiApp.properties): errai.bus.enable_csrf_tokenWhen enabled, a CSRF token is generated on the server that must be included as a header in every bus request. This token can be embedded on a GWT host page with a provided filter, or else negotiated as part of the message bus connection.General purpose gatekeepers for @PagesSince the release of Errai Security it has been possible to control access to pages via required roles, but there was no general way to redirect before a page was displayed based on business logic.As a recent change, you can now intercept navigation by adding a NavigationControl parameter to a @PageShowing method like so:We on the Errai team would like to thank Ben Dol for both suggesting and implementing this feature.Still Time for FeedbackAs always, we encourage and welcome community feedback. If you are still on Errai 3, consider checking out our migration guide and trying out Errai 4 today!Until the next time, happy coding! [Less]
Posted about 7 years ago by [email protected] (Max Barkley)
Since our last post we've done several beta releases, but today I'm happy to announce our first candidate release of Errai 4! Since we haven't blogged about our last few Beta releases, this post will contain highlights of all the changes introduced ... [More] since 4.0.0.Beta4. Client-side support for the CDI @Typed annotation Global translation keys for Errai i18n Removed ResponseCallback Message bus enhancments (better clustering and CSRF protection) General purpose gatekeepers on @Pages Without further ado, let's dive right in.Client-side support @TypedThe @Typed annotation allows you to restrict the types of injection sites that a bean may satisfy. What does that mean? To explain, we'll use the example from the @Typed javadoc. Consider the following class:With normal CDI resolution, this bean will satisfy any unqualified injection site for any the following types, because the bean is assignable to any of these: Shop, BookShop, Business, and Object. Typically this is desirable, but we could reasonably want this bean to only satisfy injection sites of type ShopThe @Typed annotation allows us to specify a subset of this bean's assignable types as its bean types, like so:With this declaration, BookShop now only satisfies injection sites with types Shop or Object, preventing other developers from injecting this as a BookShop or a Business.Global Translation Keys in Errai i18nIf you use Errai i18n, then you know that translation bundles use templated class names as prefixes for the keys. For example, consider this templated bean.If we used Errai i18n to translate the "hello" data-field, we would define the translation of this element with the key "I18nTemplatedBean.hello-key". The disadvantage of this prefixing is that it made it impossible to share translations of common words between templates, leading to lots of duplication.Now Errai i18n supports unprefixed translation keys that can be used in any template. Global translation keys have a lower priority than prefixed translations, and so they will only be used to translate a data-field if there is no translation key for the field specific to that template. So we could use the value associated with the key "hello-key" to translate the data-field in the above example provided there is no value for the key "I18nTemplatedBean.hello-key".No more ResponseCallback for JAX-RS RPCsThe ResponseCallback was introduced to Errai to allow developers to access the underlying Response object returned from a JAX-RS RPC call. Unfortunately, this feature caused a serious problem for client-side RPC interceptors (including those used by Errai Security), where it became impossible to intercept the result of an RPC calls without a ClassCastException in some cases.To solve this problem, we've removed the ResponseCallback, so that every RPC method has a single expected callback type that directly corresponds to the return type of the RPC method. In cases where a Response object is needed, you can modify your JAX-RS method to return a javax.ws.rs.core.Response, allowing you to use a RemoteCallback from the client call site.Message Bus EnhancementsClustering FixesThis release fixes a bug where the message bus could enter a reconnect loop after failover in certain clustering setups. With this fix the message bus is now more resilient at handling failover when working behind a load balancer.CSRF ProtectionThe Errai Bus now provides basic CSRF protection. This protection is disabled by default. It can be enabled setting this property to true (as a System property or in ErraiApp.properties): errai.bus.enable_csrf_tokenWhen enabled, a CSRF token is generated on the server that must be included as a header in every bus request. This token can be embedded on a GWT host page with a provided filter, or else negotiated as part of the message bus connection.General purpose gatekeepers for @PagesSince the release of Errai Security it has been possible to control access to pages via required roles, but there was no general way to redirect before a page was displayed based on business logic.As a recent change, you can now intercept navigation by adding a NavigationControl parameter to a @PageShowing method like so:We on the Errai team would like to thank Ben Dol for both suggesting and implementing this feature.Still Time for FeedbackAs always, we encourage and welcome community feedback. If you are still on Errai 3, consider checking out our migration guide and trying out Errai 4 today!Until the next time, happy coding! [Less]
Posted over 7 years ago by [email protected] (Max Barkley)
Greetings!Errai 4.0.0.Beta4 is now available. This release contains mostly bug fixes, but here are some noteworthy changes: Upgrade GWT to 2.8.0 and Guava to 20.0 The Errai Tutorial now showcases Errai's JS interop integration Errai Tutorial ... [More] EnhancmentsA major vision of Errai 4 has been more support for working directly with the DOM and more support for using JS interop. With this latest round of enhancements, the Errai Tutorial now showcases this vision and below I'll highlight some of the major features in action. UI Components without GWT WidgetsThe Errai Tutorial now showcases UI components built without any GWT widgets [1] [2]. These components are built with Errai templating using JS interop wrappers for interacting with the DOM; Element wrappers are used in place of GWT widgets and DOM events in place of GWT widget events.One big advantage of this approach is that the markup of these UI components at runtime is exactly the same as the template HTML. Because GWT widgets are often implemented with multiple tags and custom CSS classes, using widgets as @DataFields can result in UI components rendering differently than their templates render when viewed outside the application. Custom JS Interop Wrappers for DOM Elements and Web ComponentsThe Errai Tutorial demonstrates how you can integrate web components with your Errai app, and how you can write your own custom element wrappers with specialized data-binding behaviour.The tutorial now uses the Polymer paper-input and paper-textarea web components as part of a @Templated form. These components can be injected and used as @DataFields (as they are here). By using Errai's new HasValue interface for native @JsTypes with the @JsProperty annotation, these wrappers declaratively instruct Errai to use the "value" property of the paper elements for data-binding.The tutorial also includes custom anchor element wrappers that showcase more complex data-binding behaviour. The BindableEmailAnchor is a wrapper for an anchor element that uses HasValue and @JsOverlay so that @Bound instances will display an email address as a mailto link as well as in the anchor text content.Since the @JsOverlay method implementation is the only code generated by the GWT-compiler for a native @JsType, this is a light-weight way to declare element interfaces with custom data-binding behaviour. Uses JQuery to Demonstrate Third-Party JavaScript IntegrationThe Errai Tutorial has a wrapper for a small subset of JQuery to showcase third-party JavaScript integration. With only a single @Produces annotation added to the JQuery wrapper, it is possible to inject the JQuery function for use in GWT code.In general, we on the Errai team believe that using dependency injection is a best practice, but this is especially important with native JavaScript objects. By injecting the JQuery function rather than accessing it through a static method, it is much easier to mock out that object and test the code using it in a Java SE environment. Try It Out and Give Us Your FeedbackWe encourage you all to check out Errai 4.0.0.Beta4 and our new tutorial and share with us your feedback, whether that feedback is bug reports to our JIRA page, or more general disucssion in our forum.Until the next time, happy coding! [Less]
Posted over 7 years ago by [email protected] (Max Barkley)
Greetings!Today we have the pleasure of announcing a new Errai release, 4.0.0.Beta3. Some important highlights in this release are: GWT version upgraded to 2.8.0-rc2. support for different merging strategies on @DataField attributes. support for JS ... [More] interop DOM event wrappers for @EventHandler methods. Without any delay, let's talk about what these changes mean for you.GWT Version Upgrade to 2.8.0-rc2If you tried using Errai 4.0.0.Beta2 with GWT 2.8 snapshots or 2.8.0-rc2 you may have experienced issues running Super Dev Mode because of transitive dependency conflicts between GWT and Errai. These issues are resolved in 4.0.0.Beta3.Data-Field Attribute Merging StrategiesWhen Errai initialises a templated bean, it merges attributes of data-fields in the HTML file with attributes on @DataFields in the @Templated Java file. In previous versions, attribute values of the data-fields in the HTML file always overrode @DataField attribute values. For example, for the Errai template below, the value of the title attribute at runtime would be "template". As of this release, you can select between two strategies: USE_BEAN and USE_TEMPLATE.Merging Single-Valued Attributes For most attributes, USE_TEMPLATE (the default) causes merging to happen as in previous Errai versions: attribute values on a data-fields in the HTML file will override values of the respective @DataFields.Conversely, the USE_BEAN strategy will preserve attribute values from the @DataField, only copying attribute values from a data-field in the HTML template if that attribute is not set in the respective @DataField.You can declare which strategies to use as part of the @DataField annotation, with the ability to specify strategies for specific attributes, or a default strategy for all other attributes. In the example below, the "title" attribute will keep whatever value is set on the @DataField and all other attributes will have the value from the template data-field. Merging List-Valued Attributes Both strategies behave a bit differently when merging the "style" and "class" attributes because these attributes have list values.When merging class values, all class names from the template and Java field are preserved. In other words, all CSS classes are combined between template data-fields and Java @DataFields regardless of which strategy is selected.For example, below the "container" div will have the following classes (even if a different merging strategy was specified on the @DataField): "template bean both" When merging style properties, individual CSS rules are kept from both the Java @DataField and the template data-fields as long as they do not conflict with each other. When there is a conflict, the selected strategy is used to resolve it, where USE_TEMPLATE causes the HTML data-field style value to win, and USE_BEAN causes the Java @DataField value to win.In the example below, the "container" div will have the following style after the merging strategy is applied: "color: red; font-weight: bold; background-color: black" JS Interop DOM Event WrappersIn this release we have introduced a @BrowserEvent annotation for defining a native @JsType as an interface for a DOM Event. Annotated types can be used with the @EventHandler annotation to define methods as event listeners similarly to how @EventHandler is used with GWT Widget events. Several @BrowserEvent interfaces can be found in errai-common, covering the more common DOM event interfaces.Below is an excerpt from the MouseEvent interface in errai-common.Unlike GWT Widget events, multiple kinds of DOM events can share the same interface. The @BrowserEvent value for MouseEvent specifies the names of DOM events for which MouseEvent is an interface.Because of this many-to-one mapping, declaring a handler method with a @BrowserEvent works similarly to declaring a native GWT event. There is a new @ForEvent annotation that is used to specify for which DOM event a handler should listen (which is analogous to @SinkNative for native GWT events). An @EventHandler with a @BrowserEvent type can be registered for any data-field in the template HTML file, whether or not it has a corresponding @DataField in the Java bean.Next Steps Keep an eye out for upcoming blog posts focusing on some of the more advanced new features in Errai 4 such as JS interop support.Until then, happy coding! [Less]
Posted almost 8 years ago by [email protected] (Max Barkley)
Salutations!Today we're happy to announce the release of Errai 4.0.0.Beta2. This release includes lots of little fixes and enhancements including:The EmbeddedWildflyLauncher for Super Dev Mode has been upgraded to use WildFly 10Errai Navigation has ... [More] new annotations for linking native anchors to Errai Navigation pagesImproved code-generation performanceBetter support for declarative data-binding to native DOM elementsAn injectable ManagedInstance for dynamically creating bean instances that manages the instances' life-cyclesBelow we'll explain what some of these changes mean before talking about next steps.WildFly 10 UpgradeThe EmbeddedWildflyLauncher now support WidFly 10+. Because of API changes in WildFly, it was not possible to maintain backwards compatibility with WildFly 8. That means that you have two options when upgrading Errai to 4.0.0.Beta2.Upgrading to WildFly 10 (Recommended)If you use the same WildFly configuration shown in the Errai Tutorial then you need only upgrade the as.version property to 10.0.0.Final. If you have any other configuration, just make sure that the errai.jboss.home system property in your Super Dev Mode configuration points to the root of a WildFly 10 installation.Don't Upgrade errai-cdi-jbossIf you can't migrate to WildFly 10 right away, you can use an older version of errai-cdi-jboss (which contains the launcher) while still using the newest beta release for all other Errai jars.Errai Navigation Links with Native AnchorsErrai Navigation has two new annotations that you can use on native Anchors for linking to Errai Navigation pages:org.jboss.errai.ui.nav.client.local.api.TransitionToorg.jboss.errai.ui.nav.client.local.api.TransitionToRoleThese annotations are meant to replace the widget-based TransitionAnchor. Below we show them used in an Errai UI templated bean. The first anchor links directly to the FAQPage while the second links to the page with the DefaultPage role. As with the previous transition anchors, Anchors with TransitionTo or TransitionToRole are validated at compile-time.Better Data-Binding Support for Native DOM ElementsThere were two issues with declarative data-binding of native elements in Errai 4.0.0.Beta1:@Bound on a native element would fail in some cases for beans that were not @Templated@Bound(onKeyUp=true) on an input element (TextInput, NumberInput, etc.) was not supported (and would cause compilation errors)Both of these issues are fixed in 4.0.0.Beta2, moving Errai two small steps closer to the goal of GWT widget-free UI development.Creating Beans Dynamically with Managed Life-CyclesErrai supports CDI's Instance<T> for dynamically creating bean instances, but this API has some practical issues:An instance created by an Instance<T> is managed by the caller. The caller is responsible for destroying the bean, which can lead to memory leaks.Calling destroy on an Instance<T> destroys a bean regardless of its scope. But usually it is only desirable to destroy @Dependent beans, since @ApplicationScoped beans tend to be used throughout the entire runtime of an application.Errai 4.0.0.Beta2 includes a new ManagedInstance<T> interface with similar methods but slightly different semantics that aim to simplify dynamic bean creation:The destroy method on ManagedInstance<T> destroys @Dependent instances and is a no-op for all other scopes.ManagedInstance<T> has a destroyAll method that destroys all @Dependent instances created by it.When a ManagedInstance<T> is destroyed, its destroyAll method is called. A ManagedInstance<T> is destroyed when the bean it is injected into is destroyed.In case the significance of that last point isn't immediately clear, this means that every dynamically created @Dependent instance from ManagedInstance<T> is cleaned-up when the type that injected that ManagedInstance<T> is destroyed. This avoids memory leaks and boiler-plate in short-lived components that create dynamic instances (like lists of UI elements).Next StepsIn the coming weeks here are some of the features and tasks we will be working on:Support for a new scope bound to Errai Navigation @Page life-cyclesThin DOM wrappers for browser events supported by Errai UI @EventHandlerConfigurable strategy for merging @DataField element attributesTesting with the newest GWT 2.8 snapshots and releasesIn the interim, please try out Errai 4.0.0.Beta2 and tell us what you think.Happy coding! [Less]
Posted almost 8 years ago by [email protected] (Max Barkley)
Salutations!Today we're happy to announce the release of Errai 4.0.0.Beta2. This release includes lots of little fixes and enhancements including: The EmbeddedWildflyLauncher for Super Dev Mode has been upgraded to use WildFly 10 Errai Navigation has ... [More] new annotations for linking native anchors to Errai Navigation pages Improved code-generation performance Better support for declarative data-binding to native DOM elements An injectable ManagedInstance Below we'll explain what some of these changes mean before talking about next steps.WildFly 10 UpgradeThe EmbeddedWildflyLauncher now support WidFly 10+. Because of API changes in WildFly, it was not possible to maintain backwards compatibility with WildFly 8. That means that you have two options when upgrading Errai to 4.0.0.Beta2.Upgrading to WildFly 10 (Recommended)If you use the same WildFly configuration shown in the Errai Tutorial then you need only upgrade the as.version property to 10.0.0.Final. If you have any other configuration, just make sure that the errai.jboss.home system property in your Super Dev Mode configuration points to the root of a WildFly 10 installation.Don't Upgrade errai-cdi-jboss If you can't migrate to WildFly 10 right away, you can use an older version of errai-cdi-jboss (which contains the launcher) while still using the newest beta release for all other Errai jars.Errai Navigation Links with Native AnchorsErrai Navigation has two new annotations that you can use on native Anchors for linking to Errai Navigation pages: org.jboss.errai.ui.nav.client.local.api.TransitionTo org.jboss.errai.ui.nav.client.local.api.TransitionToRole These annotations are meant to replace the widget-based TransitionAnchor. Below we show them used in an Errai UI templated bean. The first anchor links directly to the FAQPage while the second links to the page with the DefaultPage role. As with the previous transition anchors, Anchors with TransitionTo or TransitionToRole are validated at compile-time.Better Data-Binding Support for Native DOM Elements There were two issues with declarative data-binding of native elements in Errai 4.0.0.Beta1: @Bound on a native element would fail in some cases for beans that were not @Templated @Bound(onKeyUp=true) on an input element (TextInput, NumberInput, etc.) was not supported (and would cause compilation errors) Both of these issues are fixed in 4.0.0.Beta2, moving Errai two small steps closer to the goal of GWT widget-free UI development. Errai supports CDI's Instance for dynamically creating bean instances, but this API has some practical issues: An instance created by an Instance is managed by the caller. The caller is responsible for destroying the bean, which can lead to memory leaks. Calling destroy on an Instance destroys a bean regardless of its scope. But usually it is only desirable to destroy @Dependent beans, since @ApplicationScoped beans tend to be used throughout the entire runtime of an application. Errai 4.0.0.Beta2 includes a new ManagedInstance interface with similar methods but slightly different semantics that aim to simplify dynamic bean creation: The destroy method on ManagedInstance destroys @Dependent instances and is a no-op for all other scopes. ManagedInstance has a destroyAll method that destroys all @Dependent instances created by it. When a ManagedInstance is destroyed, its destroyAll method is called. A ManagedInstance is destroyed when the bean it is injected into is destroyed. In case the significance of that last point isn't immediately clear, this means that every dynamically created @Dependent instance from ManagedInstance is cleaned-up when the type that injected that ManagedInstance is destroyed. This avoids memory leaks and boiler-plate in short-lived components that create dynamic instances (like lists of UI elements).Next Steps In the coming weeks here are some of the features and tasks we will be working on: Support for a new scope bound to Errai Navigation @Page life-cycles Thin DOM wrappers for browser events supported by Errai UI @EventHandler Configurable strategy for merging @DataField element attributes Testing with the newest GWT 2.8 snapshots and releases In the interim, please try out Errai 4.0.0.Beta2 and tell us what you think. Happy coding! [Less]