Archive for the 'RIA' Category
Published by max on July 12, 2010
under Flamingo, JavaFX
In addition to calling methods and Hibernate Validator, it’s also very simple to bind to a context variable and update it from JavaFX. A context variable is any variable inside a scope on the server.
Server
Seam component:
@Name ("shop")
@Scope (ScopeType.SESSION)
public class Store {
IceCream iceCream; // getter and setter
@Create
public void init (){
iceCream = new IceCream();
iceCream.setName("Best ice cream");
iceCream.setFlavors(2);
}
}
Model:
@Entity
@Name ("icecream")
public class IceCream implements java.io.Serializable{
@Max(value=5, message="Sorry, you can't have more than {value} flavors")
private Integer flavors;
private String name;
// getters and setters
}
Client
Model:
public class IceCream implements java.io.Serializable{
private String name;
private Integer flavors;
// setters and getters
}
BindingManager interface:
public interface BindingManager {
public String commit(String componentName, Object value);
public Object getObject(String name);
}
public class IceCreamServiceFactory {
public static BindingManager getBindingManager() {
return (BindingManager) FXServiceFactory.getService(BindingManager.class,
"com.exadel.flamingo.service.binding.bindingManager");
}
public static String commit (String componentName, Object value){
return getBindingManager().commit(componentName, value);
}
public static IceCream getIceCream (String componentName){
return (IceCream)getBindingManager().getObject(componentName);
}
}
JavaFX script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| CookieHandler.setDefault(new CookieManager(null,CookiePolicy.ACCEPT_ALL));
FXServiceFactory.URL = "http://localhost:8080/server-javafx/seam/resource/hessian/";
FX.println("Getting ice cream from server");
var iceCream = IceCreamServiceFactory.getIceCream('shop.iceCream');
FX.println (" {iceCream}");
iceCream.setName ("Gelato");
iceCream.setFlavors(4);
FX.println("Starting commit");
IceCreamServiceFactory.commit("shop.iceCream", iceCream);
FX.println("Getting ice cream from the server after update");
FX.println (" {IceCreamServiceFactory.getIceCream('shop.iceCream')}"); |
Line 5: Getting ice cream from the server (binding to context variable)
Line 8-9: Making changes to ice cream
Line 12: Committing changes to the server
Line 14: Getting the updated object from the server
Output:
Getting ice cream from server
Name: Best ice cream, flavors: 2
Starting commit
Getting ice cream from the server after update
Name: Gelato, flavors: 4
That’s it.
Published by max on July 7, 2010
under Flamingo, JavaFX
I showed how to call a Seam component with Flamingo from JavaFX. In this post I show how to invoke Hibernate Validator from JavaFX with Flamingo:
Entity (and Seam component):
@Entity
@Name ("icecream")
public class IceCream {
@Id @GeneratedValue
private Long id;
@Max(value=5, message="Sorry, you can't have more than {value} flavors")
private Integer flavors;
// getters and setters
}
JavaFX script (most interesting stuff is happening lines 17-21):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| FXServiceFactory.URL = "http://localhost:8080/server-javafx/seam/resource/hessian/";
var message:String;
var textBox:TextBox = TextBox {
columns: 15
}
var label:Label = Label {
text : "How many flavors:"
style:"-fx-font-weight:bold"
}
var errorMessage:Label = Label {
text: bind message
style : "-fx-text-fill:red; -fx-font-weight:bold"
}
var button:Button = Button {
text: "Click"
action : function () {
var ev = FXServiceFactory.getService(EntityValidator.class,
"com.exadel.flamingo.service.validator.entityValidator")
as (EntityValidator);
message = ev.validate ("icecream.flavors", textBox.text)
}
}
Stage {
title: "Application"
width: 250 height: 100
scene: Scene {
content: [
VBox {
spacing: 5
content:[
label,
HBox {
spacing: 5
content: [
textBox,
errorMessage
]
}
button
]
}
]
}
}; |
Result:

That’s it.
Published by max on July 6, 2010
under Flamingo, JavaFX, Seam
We very close to moving Flamingo and Fiji to exadel.org. It will probably (finally) happen next week. I just wanted to show how simple it is to call a Seam component from JavaFX using Flamingo:
Seam component (server):
@Name ("currentTime")
public class CurrentTime {
public Date currentTime () {
return (new java.util.Date());
}
}
Service interface (client):
public interface CurrentTime {
public Date currentTime ();
}
JavaFX script (client):
FXServiceFactory.URL = "http://localhost:8080/server-javafx/seam/resource/hessian/";
var ct = (FXServiceFactory.getService(CurrentTime.class,"currentTime") as CurrentTime);
var now = ct.currentTime();
FX.println(now);
That’s it!
Published by max on July 6, 2010
under Events, Flamingo, JavaFX
I will be presenting Enterprise JavaFX at the Silicon Valley JavaFX User Group on Wednesday, July 14, 2010.
The event starts at 7pm (PT) and is broadcast live here. To sign for the event (even if attending remotely), please click here.
Published by max on July 1, 2010
under Eclipse, JavaFX, JavaFX plug-in
Exadel JavaFX Plug-in for Eclipse version 1.3.3 introduced a handy feature which lets you quickly navigate to any part of JavaFX script. It works like an Outline view in a popup. The feature is invoked when in JavaFX editor by pressing Ctrl-O.
Pressing Ctrl-O and navigating through the outline using up and down arrows:

Pressing Ctrl-O and typing the name of a variable:

Published by max on June 29, 2010
under Events, Flamingo, JavaFX, RichFaces, Seam
I knew these existed but somehow forgot to post them. These are videos of my presentations at JBoss booth at JavaOne 2009 in San Francisco. I think it would be more useful if the videos would switch more often to the slides I’m showing, but in case, enjoy!
RichFaces presentation
Part 1
Part 2
Part 3
Part 4
JavaFX with Seam presentation
Part 1
Part 2
Part 3
Published by max on June 28, 2010
under JavaFX, JavaFX plug-in
Another small update to Exadel JavaFX Plug-in for Eclipse.
As always, let us know what features you would like to see added. You can post them on the forum or add directly to Jira.
Published by max on June 28, 2010
under RichFaces
Learn how to use RichFaces a4j:queue tag to control traffic to the server from my article published on JSFCentral.
Published by max on June 25, 2010
under Flamingo, JavaFX
I will be talking about Enterprise JavaFX with Exadel Flamingo at Silicon Valley JavaFX User Group on Wednesday, July 14th, 2010. More info and registration.
Published by max on June 25, 2010
under Flamingo, Mobile, RichFaces, weekend
Two greats posts by Felipe Wasserman (Exadel marketing intern):
RichFaces 4
Exadel Flamingo:
« Previous Page — Next Page »