wicket and swing from one codebase

15
Wicket and Swing from one code base Johan Compagner

Upload: jcompagner

Post on 10-Jul-2015

3.686 views

Category:

Technology


0 download

DESCRIPTION

Wicket and Swing very alike

TRANSCRIPT

Page 1: Wicket And Swing From One Codebase

Wicket and Swing from one code base

Johan Compagner

Page 2: Wicket And Swing From One Codebase

Who is Johan Compagner

• Senior Java Developer at Servoy (and Topicus)• 10+ years of Java experience

– Swing and the Web (Struts/Tapestry)

• Core Wicket developer since September 2004

Page 3: Wicket And Swing From One Codebase

Agenda

• How does Servoy work.• Wicket/Web compared to Swing.• One codebase -> 2 Clients• Q&A

Page 4: Wicket And Swing From One Codebase

How does Servoy work

• Own Drag'N'Drop RAD IDE• Developers use Javascript to code.

– Those scripts are attached to events (onaction)– Those scripts can alter the form components.

• Repository based, no code generation.• First only a Swing rich client (via webstart)• Web client introduced in 2005• Full AJAX based webclient in 2006

Page 5: Wicket And Swing From One Codebase

The IDE

Page 6: Wicket And Swing From One Codebase

The Eclipse Servoy IDE

Page 7: Wicket And Swing From One Codebase

Wicket compared to Swing

• Both component based (MVC)• Wicket even “more” MVC then Swing.• Pull against Push.• Swing has setLocation/setBackground/Ect.• Swing is richer (even when using AJAX)• Web has browsers....

Page 8: Wicket And Swing From One Codebase

One codebase -> 2 clients

• We kept the Model part of the MVC.• Controller and View are generated based

on client type.

Page 9: Wicket And Swing From One Codebase

The Controller part

• IComponentFactory– IButton createButton(..);

• 2 Component Factories– SwingComponentFactory– WicketComponentFactory

• Swing Button uses ActionListener interface.• Wicket Button generates onclick attribute.

Page 10: Wicket And Swing From One Codebase

The View part

• Swing has this build in (the controller)• Template Generator

– HTML per form.– CSS per form.

• Custom IResourceStreamLocator

Page 11: Wicket And Swing From One Codebase

Use of AJAX

• All events are done by AJAX.• Basic AJAX support build in a few days..• But.. a Servoy developer can do anything in

a script.– button.setLocation/button.setBackground.

Page 12: Wicket And Swing From One Codebase

ChangeRecording

• AJAX event is coming in.• Calls the events method.• All components are recording the changes

when touched• An IVisitor walks over the page collecting

the changed components.• And are added to the AjaxRequestTarget.

Page 13: Wicket And Swing From One Codebase

The Result (Swing)

Page 14: Wicket And Swing From One Codebase

The Result (Web)

Page 15: Wicket And Swing From One Codebase

Q/A

?