--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ style="width:100%;height:100%;border:0;margin:0;">
+<head>
+<title>Multiple embedded applications</title>
+<script type="text/javascript">
+ var vaadin = {
+ debug: true,
+ vaadinConfigurations : {
+ 'fb' : {
+ appUri : '/sampler',
+ // sampler only works with sampler widgetset
+ widgetset : 'com.vaadin.demo.sampler.gwt.SamplerWidgetSet',
+ themeUri : '/VAADIN/themes/sampler-reindeer',
+ versionInfo : {
+ vaadinVersion : "6.0.0-INTERNAL-NONVERSIONED-DEBUG-BUILD",
+ applicationVersion : "NONVERSIONED"
+ }
+ },
+ 'calc' : {
+ appUri : '/Calc',
+ // no widgetset defined means don't care. Most widgetset have button and gridlayout.
+ // First injected widgetset will start this app.
+ themeUri : '/VAADIN/themes/sampler-reindeer',
+ versionInfo : {
+ vaadinVersion : "6-INTERNAL-NONVERSIONED-DEBUG-BUILD",
+ applicationVersion : "NONVERSIONED"
+ }
+ },
+ 'colorpicker' : {
+ appUri : '/colorpicker',
+ widgetset : 'com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet',
+ themeUri : '/VAADIN/themes/sampler-reindeer',
+ versionInfo : {
+ vaadinVersion : "6.0.0-INTERNAL-NONVERSIONED-DEBUG-BUILD",
+ applicationVersion : "NONVERSIONED"
+ }
+ }
+ }
+ };
+</script>
+
+<script language='javascript'
+ src='/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/com.vaadin.terminal.gwt.DefaultWidgetSet.nocache.js'></script>
+<script language='javascript'
+ src='/VAADIN/widgetsets/com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet/com.vaadin.demo.colorpicker.gwt.ColorPickerWidgetSet.nocache.js'></script>
+<script language='javascript'
+ src='/VAADIN/widgetsets/com.vaadin.demo.sampler.gwt.SamplerWidgetSet/com.vaadin.demo.sampler.gwt.SamplerWidgetSet.nocache.js'></script>
+<link rel="stylesheet" type="text/css"
+ href="/VAADIN/themes/sampler-reindeer/styles.css" />
+</head>
+<body>
+ <iframe id="__gwt_historyFrame"
+ style="width: 0; height: 0; border: 0; overflow: hidden"
+ src="javascript:false"></iframe>
+
+ <p>Experimental test page for multiple apps and multiple widgetsets
+ on the same page. Try with ?debug to see three VConsoles! Test well
+ before using this kind of setup in production. E.g. theme conflicts
+ and other unknown issues may arise. E.g. Glass can get broken in your
+ screen, even in LCD:s. Seriously, to save bandwidth and client side load,
+ it is highly recommended to use the classic shared widgetset approach.</p>
+
+ <div id="fb" style="height: 400px; border: 2px solid red; margin: 0"></div>
+ <div id="calc" style="border: 2px solid green; margin: 0"></div>
+ <div id="colorpicker" style="border: 2px solid blue; margin: 0"></div>
+</body>
+</html>
private String authorizationErrorCaption;
private String authorizationErrorMessage;
private String authorizationErrorUrl;
+ private String requiredWidgetset;
private boolean useDebugIdInDom = true;
private boolean usePortletURLs = false;
private String portletUidlURLBase;
return authorizationErrorUrl;
}
+ public String getRequiredWidgetset() {
+ return requiredWidgetset;
+ }
+
private native void loadFromDOM()
/*-{
if (jsobj.standalone) {
this.@com.vaadin.terminal.gwt.client.ApplicationConfiguration::standalone = true;
}
+ if (jsobj.widgetset) {
+ this.@com.vaadin.terminal.gwt.client.ApplicationConfiguration::requiredWidgetset = jsobj.widgetset;
+ }
} else {
$wnd.alert("Vaadin app failed to initialize: " + this.id);
}
for (Iterator<String> it = appIds.iterator(); it.hasNext();) {
String appId = it.next();
ApplicationConfiguration appConf = getConfigFromDOM(appId);
- ApplicationConnection a = GWT.create(ApplicationConnection.class);
- a.init(widgetSet, appConf);
- unstartedApplications.add(a);
+ if (canStartApplication(appConf)) {
+ ApplicationConnection a = GWT
+ .create(ApplicationConnection.class);
+ a.init(widgetSet, appConf);
+ unstartedApplications.add(a);
+ consumeApplication(appId);
+ } else {
+ VConsole.log("Application "
+ + appId
+ + " was not started. Provided widgetset did not match with this module.");
+ }
}
deferredWidgetLoadLoop.scheduleRepeating(100);
}
+ /**
+ * Marks an applicatin with given id to be initialized. Suggesting other
+ * modules should not try to start this application anymore.
+ *
+ * @param appId
+ */
+ private native static void consumeApplication(String appId)
+ /*-{
+ $wnd.vaadin.vaadinConfigurations[appId].initialized = true;
+ }-*/;
+
+ private static boolean canStartApplication(ApplicationConfiguration appConf) {
+ return appConf.getRequiredWidgetset() == null
+ || appConf.getRequiredWidgetset().equals(GWT.getModuleName());
+ }
+
/**
* Starts the next unstarted application. The WidgetSet should call this
* once to start the first application; after that, each application should
/*-{
var j;
for(j in $wnd.vaadin.vaadinConfigurations) {
- list.@java.util.Collection::add(Ljava/lang/Object;)(j);
+ if(!$wnd.vaadin.vaadinConfigurations[j].initialized) {
+ list.@java.util.Collection::add(Ljava/lang/Object;)(j);
+ }
}
}-*/;