Archive for the 'Seam' Category

Seam component events

A very powerful feature in Seam that usually doesn’t get enough attention in my opinion is component-driven events. Seam component can raise or throw arbitrary event and any number of other Seam components can observe or listen to these events. This truly creates a loose coupled architecture. Components raise events and anyone who cares listens to the event. The components are not connected to each other in any way.

Let’s start with CourseManager component:

@Name("courseManager")
public class CourseManager {
 
   private String name; // setter and getter
 
   @Out(required=false)
   private String studentName;
 
   @Logger Log log;
 
   @RaiseEvent("courseDropped")
   public void drop() {
     studentName = name;
     log.info("course dropped");
   }
}

In component above when drop() method is invoked, courseDropped event will be raised via @RaiseEvent annotation. Once invocation is done, the component will outject studentName variable.

Although data can passed with the event, a better way is to use bijection in Seam. The name variable would most likely be submitted from a JSF page. Its value is assigned to studentName component variable and studentName is outjected after the method invokation. Anyone who is interested in this event can listen to it and also get the data associated with the event (via injection).
Read more »

CITYTECH: enterprise application with JavaFX, Seam, and Exadel Flamingo

Great post by John Kraus from CITYTECH on how they used Exadel Flamingo to connect rich JavaFX UI to their existing Seam application. It’s good to see JavaFX slowly penetrating the enterprise. And with Flamingo, it becomes even simpler. Companies can leverage their existing services and easily connect them to JavaFX rich UI as CITYTECH did.

There are a number of interesting new features in Flamingo. There is now server-side push and off-line applications for JavaFX. There is also a connector for Google’s Android platform. I’m planning to blog about these technologies and more very soon. As for JavaFX tooling, we have been working on JavaFX plug-in for Eclipse. Try it out. The plug-in is going to be open source any day now.

Read blog post here

Hibernate Validator with JavaFX

One of the key features in Exadel Flamingo is that it allows you to use Hibernate Validator based validation on JavaFX UI side.

On the server you can have something like this:

@Entity
@Name ("message")
public class Message {
   @Id @GeneratedValue
   private Long id;
 
   @Length(min=3, max=40)
   private String text;
   ...
}

This is a simple entity and also a Seam component.

On the JavaFX side all you need to do is this:

var textBox : TextBox = TextBox {};
var errorText: String {};
...
errorText = FlamingoServiceFactory.getHessianEntityValidator().
                    validate("message.text", textBox.text);

message.text – message is Seam component name and text is component property. textBox.text is JavaFX node (widget) whose value we need to validate.

Simple… right?

Article: JSF 2 – Seam’s Other Avenue to Standardization

Great article by Dan Allan on how Seam and RichFaces (in particular Ajax4jsf) helped shape JSF 2.