Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Using Spring with XWT"
(New page: == Introduction == == CLR Class == === CLR with x:Class === XWT file can be linked to a Java CLR (Common Language Runtime) class to manage for instance event handler of the UI with Jav...) |
(→CLR Class) |
||
Line 3: | Line 3: | ||
== CLR Class == | == CLR Class == | ||
+ | |||
+ | Before explaining Spring support for XWT, it's interesting to understand how CLR Java class are managed with '''x:Class''' and '''x:ClassFactory'''. | ||
=== CLR with x:Class === | === CLR with x:Class === | ||
− | XWT file can be linked to a Java CLR (Common Language Runtime) class to manage for instance event handler of the UI with Java code by using '''x:Class''' attribute | + | The [http://wiki.eclipse.org/E4/XWT#Event_Handling Event Handling sample] show you how XWT file can be linked to a Java CLR (Common Language Runtime) class to manage for instance event handler of the UI with Java code by using '''x:Class''' attribute : |
<source lang="xml"> | <source lang="xml"> | ||
Line 20: | Line 22: | ||
</source> | </source> | ||
− | + | The attribute '''x:Class="ui.EventHandler"''' is linked to teh Java class '''ui.EventHandler''' : | |
<source lang="java"> | <source lang="java"> | ||
Line 37: | Line 39: | ||
=== CLR with x:ClassFactory === | === CLR with x:ClassFactory === | ||
+ | |||
+ | === CLR with x:ClassFactory & Spring === | ||
+ | |||
+ | == Spring support for XWT == | ||
+ | |||
+ | === Spring === | ||
org.eclipse.e4.xwt.springframework.AbstractSpringCLRFactory | org.eclipse.e4.xwt.springframework.AbstractSpringCLRFactory | ||
− | === | + | === Spring Dynamic Module === |
org.eclipse.e4.xwt.springframework.SpringCLRFactory | org.eclipse.e4.xwt.springframework.SpringCLRFactory |
Revision as of 09:11, 4 August 2010
Contents
Introduction
CLR Class
Before explaining Spring support for XWT, it's interesting to understand how CLR Java class are managed with x:Class and x:ClassFactory.
CLR with x:Class
The Event Handling sample show you how XWT file can be linked to a Java CLR (Common Language Runtime) class to manage for instance event handler of the UI with Java code by using x:Class attribute :
<Shell xmlns="http://www.eclipse.org/xwt/presentation" xmlns:x="http://www.eclipse.org/xwt" x:Class="ui.EventHandler"> <Shell.layout> <GridLayout/> </Shell.layout> <Button text="Click Me!" SelectionEvent="clickButton"> </Button> </Shell>
The attribute x:Class="ui.EventHandler" is linked to teh Java class ui.EventHandler :
package ui; import org.eclipse.swt.Event; import org.eclipse.swt.Button; public class EventHandler { protected void clickButton(Event event) { Button button = (Button )event.widget; button.setText("Hello, world!"); } }
When the button gets selected, the method clickButton is invoked to change the Button text to "Hello, world!".
CLR with x:ClassFactory
CLR with x:ClassFactory & Spring
Spring support for XWT
Spring
org.eclipse.e4.xwt.springframework.AbstractSpringCLRFactory
Spring Dynamic Module
org.eclipse.e4.xwt.springframework.SpringCLRFactory