RSS
 

Archive for the ‘RIA-RDA-RWA’ Category

Google Streets

12 sept

The new Google service extend the GoogleMaps features and provide 360 view of streets. To do that, they just take 360 photo each 100 meter and linked alls in a little Flash application. It’s really interesting, it’s like if you are in the town. But there is a little problem with the image rights, some people may don’t want to be seen in this tool. Google have to take photos by previously making the street empty :) , there’s a lot of work to do. Anyway i invite you to take a look a this : go to http://maps.google.com and clic Street View.

 
 

Interaction between web and desktop application

15 juil

Browser component in Eclipse RCP application offers the possibility to mix web and desktop applications. There’s a lot of advantages of this, in particular when it concern reuse of an existing web application. One of the interest is to never be dependant of the browser but to make your application become the browser.
To make this working it’s necessary to communicate between web and desktop, it’s relatively easy to send data to browser by using (setURL()) or by executing Javascript (execute()). But for sending data to the desktop it’s more difficult. I suggest 6 solutions to do that :
1. via the status bar : like it show on the SWT snippets site (Snippet160)
2. via the address bar: like Peter Nehrer say
3. directly request HTML DOM : by using Mozilla Browser (new in 3.3) with the XPCOM library. A little example using the Snippet267 and modify it to use XPath and catch a title of an input field. There’s a lot of possibility with this API like ATF do (maybe i have to take time to make an article about the possibility offers by XPCOM).

static Browser browser;
public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout(2, true));
    shell.setText("Use Mozilla's Design Mode");
    try {
        browser = new Browser(shell, SWT.MOZILLA);
    } catch (SWTError e) {
        System.out.println("Could not instantiate Browser: " + e.getMessage());
        return;
    }
    browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
    Button searchButton = new Button(shell, SWT.PUSH);
    searchButton.setText("Search");
    searchButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            search();
        }
    });
    browser.setUrl("http://www.google.com");
    shell.setSize(400, 400);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
             display.sleep();
    }
    display.dispose();
}

public static boolean search() {
    nsIWebBrowser webBrowser = (nsIWebBrowser) browser.getWebBrowser();
    if (webBrowser == null) {
        System.out.println("Could not get the nsIWebBrowser from the Browser widget");
        return false;
    }
    nsIDOMWindow window = webBrowser.getContentDOMWindow();
    nsIDOMDocument document = window.getDocument();
    nsIDOMXPathEvaluator xpath = (nsIDOMXPathEvaluator) document.queryInterface(nsIDOMXPathEvaluator.NS_IDOMXPATHEVALUATOR_IID);
    nsIDOMXPathNSResolver res = xpath.createNSResolver(document);
    nsISupports obj = xpath.evaluate("//input[@name='q']/@title",
                                                 document,
                                                 res,
                                                 nsIDOMXPathResult.STRING_TYPE,
                                                 null);
    nsIDOMXPathResult result = (nsIDOMXPathResult) obj.queryInterface(nsIDOMXPathResult.NS_IDOMXPATHRESULT_IID);
    System.out.println(result.getStringValue());
    return true;
}


4. via a socket : by executing an XMLHTTPRequest with execute() method which call a socket and get the content.

private String getDataFromBrowser() {
	String javascript = "try {";
	javascript += "xhr_object = new ActiveXObject(\"Microsoft.XMLHTTP\"); ";
	javascript += "xhr_object.open(\"POST\", \"http://localhost:9091\", false);";
	javascript += "xhr_object.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");";
	javascript += "xhr_param = generateXML();"; // appel d'une fonction retournant un contenu
	javascript += "xhr_object.send(xhr_param);";
	javascript += "} catch (ex) { alert(\"Failed to save document\"); }";

	String xml = null;
	XMLPicker e = new XMLPicker();
	Thread t = new Thread(e);
	t.start();

	// wait threa run
	try {
		Thread.sleep(10);
	} catch (InterruptedException eee) {
	}
	// ask browser
	boolean ok = browser.execute(javascript);

	int wait = 0;
	while (xml == null && wait < 10)
		try {
			Thread.sleep(10);
			wait++;
			xml = e.getXML();
		} catch (InterruptedException eeee) {
		}
	System.out.println(xml);
	return xml;
}

private class XMLPicker implements Runnable {
	private String xml;
	public String getXML() {
		return xml;
	}

	public void run() {
		ServerSocket server = null;
		try {
			server = new ServerSocket(9091);
			server.setSoTimeout(5000);
			System.out.println("Waiting for response");
			Socket socket = server.accept();
			// stream treatment, i can give the HTTPServer class if you want
			xml = HttpServer.getXMLString(socket, "UTF-8");
			socket.close();
		} catch (IOException ee) {
			System.err.println(ee);
		} finally {
			if (server != null) {
				try {
					server.close();
				} catch (Exception e) {
				// Ignore.
				}
			}
		}
	}
}

5. running an HTTP server inside the Eclipse JVM : with Tomcat embedded for example or with WebObjects (Application.primeApplication()). The objects in the same JVM can be shared but be carreful of classloaders.
6. via terracota : a JVM cluster offer an easy way to synchronize objects between JVM.

 

GWT-Plugin CYPAL

22 juin

Ok the news is not hot (Didier was talking about it in onGWT on April) but i just try Cypal Studio plugin for eclipse and i found it really interresting. The features are the one you can expect for that kind of tool (project creation wizzard, compilation, creating module and remote service…). To have if you start GWT project.

 

GWT- How to reference the body in your java code

10 juin

I was confronted with this problem. How to retrieve Element references the body. As GWT API doesn’t provide this service directly you need to use an other way.

You can add for example an id to the body in the HTML description of the page
<html> <head> <meta name='gwt:module' content='fr.improve.testGWT.gwt.Application'> </head> <body id='bodyId'> <script language="javascript" src="gwt.js"></script> </body> </html>

In your java application you just have to use the following code:

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;

Element body= DOM.getElementById(« bodyId »);

Another solution is to use the JSNI with the following method:

public static native Element getBody() /*-{ return $doc.body; }-*/;

The body element is retrieve with this call:

Element body = getBody();

And you don’t need to change the HTML page of your application.
It is a little bit strange that base element like the body can’t be directly accessible

 

JFXBuilder

24 mai

Based on the great report designer tool : ReportMill, JFXBuilder is the first Java rich interface designer. A « preview JFX » button transform the ReportMill shapes in the JavaFXPad with the corresponding JavaFX Script. It’s just a first version with bugs but the concept is interesting and the based tool have already prove his reliability.

 

Java on the RIA road

18 mai

The JavaFX news have burned feed readers, Sun take place on the RIA market against Microsoft and Adobe and it’s a good thing. F3 (i talkin’ about before) which is the base of JavaFX Script is a very great technology, and make easier the Swing productivity in terms of design. But don’t forget Java have always been a RIA plateform with Applet to create RWA applications. Apple understand this and migrated NeXT UI library since WebObjects 5.0. Java Web Start was arrive after making easier, like Web application, the deployment of RDA applications. Sun was in advance in this domain but Applet don’t find success and it’s the asset of Silverlight and Flex because they have GUI design tool (Expression Web, Flex Builder). Bob Brewin Sun CTO, tell us that this tool is a priority [Ed Burnette interview Q6] : JavaFX Designer.

I’m not agree with Simon Brocklehurst, I think that this tool and the designer/developer collaboration are essential, i’m not saying developers aren’t good designer, i think application conception with clean code is an art but design and development are different jobs.
The other difficulty is the JRE size, ~13 Mo where the others turns around 5 Mo, but it will be better.
Finally don’t forget mobile objectives (JavaFX Mobile), Java is really present in this domain and could make the difference.

Chris Oliver don’t choose XML for JavaFX Script unlike Microsoft with XAML. It’s true that JavaFX Script syntax is more intuitive and have advantages but we loose XML extension advantages (XInclude, XPath, XSLT). I was thinking Sun make more interest on JAXX, an XML UI language for Swing. But it’s a reality that JavaFX Script is an easier syntax for UI design.
What about SWT ? Bob Brewin say JavaFX Script could be extended for SWT [Ed Burnette interview Q5], and SWT is going to be compatible with WPF, could we have SWT UI generated with XAML ?
Don’t forget SWT is an UI library for RDA not RWA. The Silverlight, Flex and JavaFX Script objectives aren’t the same than Eclipse RCP, NetBeans RCP, Apollo and WPF. I notice that Silverlight use only 30% of WPF [5mn avec Kevin Gallo, Product Manager Silverlight par Didier Girard] where JavaFX Script can use all Java libraries.

What’s interesting thing is Eclipse is everywhere :

When you choose Eclipse you’re sure make the good choice ;) .

To compare JavaFX Script and XAML the pad tool are interesting :

 

XML/Javascript UI development

06 avr

In following my previous news on GUI conception, the Jonathan Allen’s news ask the question a new time, talking about Javascript approach and presenting the new Firefox 3.0 approach with Gran Paradiso.

 

RIA : desktop or web ?

28 mar

To resume quickly, after the old client/server model where the software was duplicated on each client we passed to the thin client where the software was concentrated on the applications server and make easier deployment and support. But thin client have been criticized by users for the lack of interaction with desktop tools (particulary with the Office suite) and the dependence with the network because of HTML and HTTP. Then the rich client appear : it gives to users better ergonomy and less dependency to the network. The software intelligence is now fairly shared between server and client. The underneath diagram presents this evolution :

Then a new acronym is dedicated for the rich client : RIA. This concept is used a lot and i think have to be more clearly defined. The underneath diagram suggest a decomposition of RIA in 2 subgroup : the RDA (Rich Desktop Applications for oriented desktop applications, executed on the client without a browser) and the RWA (Rich Web Applications for web oriented applications executed in a browser).

This 2 subgroup could be extended to platform concept which suggest to help developers create applications with a pre initialized application and a lot of basics and utils components pluggable like help, preferences, splashscreen, view, …

The question is now which branch i have to choose between desktop or web to develop my application. The still problem is the deployment for desktop application, it have been the success of thin client where no deployment is needed (if you have a browser installed ;) ). It’s not a problem now for Java because of the Java Web Start, for Microsoft and Micromedia the question is different and they suggest to use the browser with the dedicated plugin for WPF/e and Flex but is it really RDA ?
So the frontier between RDA and RWA is not always obvious. In one hand with Firefox/XUL we have a browser where desktop components can be added, in other hand a Flex application is linked to the browser only by the plugin, the interaction is possible but the Flex components are detached of the browser.
It bring us to the RSP (Rich Server Platform) concept which suggest to combine browser and desktop in the same application.

In thie RIA concept the 5 layers software architecture is always aware but have to evolve to take care of rich client features in particularly for RDA.

Application and enterprise layer have to be separate in 2 part : one for the server another for the client. Between this separation a new layer appear for the communication. It’s in this layer web services is used but not only them. Among of frameworks implementing this layer there are WebObjects EODistribution, Cayenne, Spring remoting. They don’t use web services so there is others alternatives. It’s Microsoft choice with WCF which integrate more exchange possibility (WCF represent 70% of the .NET 3.0).
This new approach of architecture not really concern RWA because there is no Javascript framework could integrate this, but it can change …

Well, all of this don’t help me to answer to my question, which branch between desktop or web i have to choose ? The rich client is a real evolution for the client side but there is a lot of technology to implement it and not always concurrent. Maybe we have to define which technology or branch is appropriate for a set of needs.

 
 

Desktop Matters Conference

10 mar

Les 8 et 9 Mars s’est tenu la conférence Desktop Matters qui relate des applications orientées desktop en Java. A première vue Eclipse n’y est pas trés présent (normal l’EclipseCon se tenait au même moment) et c’est plutôt Swing qui a été évoqué. Le résumé des sessions est à suivre sur le blog de Ben Galbraith. A noter :

  • 1/3 du code de JIDE devrait passer en open-source
  • Nimbus : le futur Java Desktop System de Sun
  • Présentation de SwingLabs
 
 

Desktop Matters Conference

10 mar

8/9 March was Desktop Matters conference, talked about Java Desktop Applications. Eclipse was not very promote (of course it was the EclipseCon at the same time) and Swing was more mentionned. The sessions summary are on the Ben Galbraith‘s blog. Be noted :

  • JIDE is open-sourcing about a 1/3 of their code
  • Nimbus : the future Sun’s Java Desktop System
  • SwingLabs presentation