Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "Using Spring with XWT"

(CLR with x:Class)
(Introduction)
Line 1: Line 1:
== Introduction ==
+
==Introduction==
  
 +
Work is underway to integrate XWT with [http://www.springsource.org/ Spring] and [http://www.springsource.org/osgi Spring Dynamic Module] to '''declare the CLR classes used into XWT file with XML Spring file.
 +
 +
See (for the moment) [https://bugs.eclipse.org/bugs/show_bug.cgi?id=320405 Bug 320405]. Attached to this bug are zips containing bundles
 +
 +
<ul>
 +
  <li>'''org.eclipse.e4.xwt.springframework''': bundle of XWT Spring support</li>
 +
</ul>
  
 
== CLR Class ==
 
== CLR Class ==

Revision as of 09:20, 4 August 2010

Introduction

Work is underway to integrate XWT with Spring and Spring Dynamic Module to declare the CLR classes used into XWT file with XML Spring file.

See (for the moment) Bug 320405. Attached to this bug are zips containing bundles

  • org.eclipse.e4.xwt.springframework: bundle of XWT Spring support

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 declaration x:Class="ui.EventHandler" means that the UI is linked to the 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 Dynamic Module

org.eclipse.e4.xwt.springframework.SpringCLRFactory

Using Spring with XWT

org.eclipse.e4.xwt.springframework.AbstractSpringCLRFactory

Using Spring Dynamic Module (OSGi) with XWT

Back to the top