Browse Source

Remove need for "NoEntry" widgetset definitions, fail if multiple widgetsets get initialized. For #2494

svn changeset:6639/svn branch:trunk
tags/6.7.0.beta1
Marc Englund 15 years ago
parent
commit
2dacdf7196

+ 2
- 2
src/com/itmill/toolkit/demo/colorpicker/gwt/ColorPickerWidgetSet.gwt.xml View File

@@ -1,6 +1,6 @@
<module>
<!-- Inherit the NoEntry version to avoid multiple entrypoints -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSetNoEntry" />
<!-- Inherit DefaultWidgetSet -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSet" />
<!-- WidgetSet default theme -->
<stylesheet src="colorpicker/styles.css"/>

+ 2
- 2
src/com/itmill/toolkit/demo/reservation/gwt/ReservationWidgetSet.gwt.xml View File

@@ -1,6 +1,6 @@
<module>
<!-- Inherit the NoEntry version to avoid multiple entrypoints -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSetNoEntry" />
<!-- Inherit DefaultWidgetSet -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSet" />
<!-- The googlemaps_gwt module -->
<inherits name="com.google.gwt.maps.GoogleMaps" />

+ 2
- 2
src/com/itmill/toolkit/demo/sampler/gwt/SamplerWidgetSet.gwt.xml View File

@@ -1,6 +1,6 @@
<module>
<!-- Inherit the NoEntry version to avoid multiple entrypoints -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSetNoEntry" />
<!-- Inherit the DefaultWidgetSet -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSet" />
<!-- WidgetSet default theme -->
<stylesheet src="sampler/styles.css"/>

+ 27
- 5
src/com/itmill/toolkit/terminal/gwt/DefaultWidgetSet.gwt.xml View File

@@ -1,7 +1,29 @@
<module>
<source path="client"/>
<!-- This module just defines a entrypoint for the DefaultWidgetSet -->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSetNoEntry"/>
<entry-point class="com.itmill.toolkit.terminal.gwt.client.DefaultWidgetSet"/>
<!--
This GWT module defines the IT Mill Toolkit DefaultWidgetSet. This is
the module you want to extend when creating an extended widget set, or
when creating a specialized widget set with a subset of the
components.
-->
<!--
NOTE that your WidgetSet entry-point (.java) should have the same
"logical" name (a.k.a SimpleName) as the specification (.gwt.xml).
-->
<!--
E.g: com/example/gwt/MyWidgetSet.gwt.xml should point to the
entry-point
com.example.gwt.client[.some.package].MyWidgetSet.java
-->

<inherits name="com.google.gwt.user.User" />

<inherits name="com.google.gwt.http.HTTP" />

<inherits name="com.google.gwt.xml.XML" />

<inherits name="com.google.gwt.json.JSON" />

<source path="client" />

<entry-point class="com.itmill.toolkit.terminal.gwt.client.DefaultWidgetSet" />
</module>

+ 5
- 45
src/com/itmill/toolkit/terminal/gwt/DefaultWidgetSetNoEntry.gwt.xml View File

@@ -1,46 +1,6 @@
<module>
<!--
This is the NoEntry version of DefaultWidgetSet.
This is the module you want to extend when creating an extended
widget set.
-->

<inherits name="com.google.gwt.user.User"/>

<inherits name="com.google.gwt.http.HTTP"/>

<inherits name="com.google.gwt.xml.XML"/>

<inherits name="com.google.gwt.json.JSON"/>

<source path="client"/>
<source path="gwtwidgets"/>
<!--
Default theme for this widget set.
Please name the sub directory differently when creating a extended widget set
(e.g. src="mywidgets/styles.css") to avoid naming conflicts.
<stylesheet src="default/common/common.css"/>
<stylesheet src="default/button/button.css"/>
<stylesheet src="default/textfield/textfield.css"/>
<stylesheet src="default/select/select.css"/>
<stylesheet src="default/panel/panel.css"/>
<stylesheet src="default/tabsheet/tabsheet.css"/>
<stylesheet src="default/datefield/datefield.css"/>
<stylesheet src="default/table/table.css"/>
<stylesheet src="default/slider/slider.css"/>
<stylesheet src="default/window/window.css"/>
<stylesheet src="default/window/notification.css"/>
<stylesheet src="default/caption/caption.css"/>
<stylesheet src="default/tree/tree.css"/>
<stylesheet src="default/splitpanel/splitpanel.css"/>
<stylesheet src="default/select/filterselect.css"/>
<stylesheet src="default/progressindicator/progressindicator.css"/>
<stylesheet src="default/expandlayout/expandlayout.css"/>
<stylesheet src="default/orderedlayout/orderedlayout.css"/>
<stylesheet src="default/accordion/accordion.css"/>
-->

</module>
<!--
"NoEntry" -concept deprecated, inherit DefaultWidgetSet instead.
-->
<inherits name="com.itmill.toolkit.terminal.gwt.DefaultWidgetSet" />
</module>

+ 26
- 0
src/com/itmill/toolkit/terminal/gwt/client/ApplicationConfiguration.java View File

@@ -4,10 +4,14 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;

public class ApplicationConfiguration {

// can only be inited once, to avoid multiple-entrypoint-problem
private static WidgetSet initedWidgetSet;

private String id;
private String themeUri;
private String pathInfo;
@@ -105,6 +109,28 @@ public class ApplicationConfiguration {
* the widgetset that is running the apps
*/
public static void initConfigurations(WidgetSet widgetset) {
String wsname = widgetset.getClass().getName();
String module = GWT.getModuleName();
int lastdot = module.lastIndexOf(".");
String base = module.substring(0, lastdot);
String simpleName = module.substring(lastdot + 1);
if (!wsname.startsWith(base) || !wsname.endsWith(simpleName)) {
// WidgetSet module name does not match implementation name;
// probably inherited WidgetSet with entry-point. Skip.
GWT.log("Ignored init for " + wsname + " when starting " + module,
null);
return;
}

if (initedWidgetSet != null) {
// Something went wrong: multiple widgetsets inited
String msg = "Tried to init " + widgetset.getClass().getName()
+ ", but " + initedWidgetSet.getClass().getName()
+ " is already inited.";
System.err.println(msg);
throw new IllegalStateException(msg);
}
initedWidgetSet = widgetset;
ArrayList appIds = new ArrayList();
loadAppIdListFromDOM(appIds);


Loading…
Cancel
Save