<module rename-to='theknowledgetowers'>
<inherits name='playn.PlayN'/>
<inherits name='TheKnowledgeTowersAssets'/>
<inherits name='tripleplay.TriplePlay'/>
<source path='core'/>
<source path='html'/>
<public path="resources" />
<entry-point class='saga.progetto.tesi.html.TheKnowledgeTowersHtml'/>
</module>
the weird thing is that all those classes (except gson) are made by myself. What could it be and how can I fix it?
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>saga.progetto.tesi</groupId>
<artifactId>theknowledgetowers</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>theknowledgetowers-html</artifactId>
<packaging>war</packaging>
<name>TheKnowledgeTowers HTML</name>
<properties>
<gwt.module>saga.progetto.tesi.TheKnowledgeTowers</gwt.module>
<gwt.name>theknowledgetowers</gwt.name>
<!-- Desired Google App Engine SDK version -->
<gae.version>1.6.1</gae.version>
</properties>
<dependencies>
<dependency>
<groupId>com.threerings</groupId>
<artifactId>tripleplay</artifactId>
<version>${playn.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>saga.progetto.tesi</groupId>
<artifactId>theknowledgetowers-core</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>saga.progetto.tesi</groupId>
<artifactId>theknowledgetowers-assets</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-html</artifactId>
<version>${playn.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.playn</groupId>
<artifactId>playn-html</artifactId>
<version>${playn.version}</version>
<classifier>sources</classifier>
</dependency>
<!-- Start Google App Engine dependencies -->
<!-- These can be removed if you don't wish to deploy to Google App Engine -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>${gae.version}</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<!-- End Google App Engine dependencies -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- allows testing of HTML backend via: mvn integration-test -Phtml -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.0.0.v20110901</version>
<configuration>
<webApp>
${project.basedir}/target/${project.artifactId}-${project.version}
</webApp>
</configuration>
<executions>
<execution>
<id>test-html</id>
<phase>integration-test</phase>
<goals>
<goal>run-exploded</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
<additionalBuildcommands>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
</buildCommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>com.google.gwt.eclipse.core.gwtNature</projectnature>
<!-- This nature can be removed if you don't wish to deploy to Google App Engine -->
<projectnature>com.google.appengine.eclipse.core.gaeNature</projectnature>
</additionalProjectnatures>
</configuration>
</plugin>
<!-- Start Google App Engine plugin configuration -->
<!-- This can be removed if you don't wish to deploy to Google App Engine -->
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.9.2</version>
<dependencies>
<!-- Use explicit dependency on gae-runtime here, so we can specify GAE SDK version -->
<dependency>
<groupId>net.kindleit</groupId>
<artifactId>gae-runtime</artifactId>
<version>${gae.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<executions>
<execution>
<id />
<phase>validate</phase>
<goals>
<goal>unpack</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- End Google App Engine plugin configuration -->
</plugins>
<!-- Start Google App Engine Eclipse plugin configuration -->
<!-- This can be removed if you don't wish to deploy to Google App Engine -->
<pluginManagement>
<plugins>
<!-- This plugin's configuration is used to store Eclipse m2e settings only. -->
<!-- It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<versionRange>[0.9.2,)</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[2.1.1,)</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<!-- End Google App Engine plugin configuration -->
</build>
</project>
Gson uses Java features that are not supported in GWT such as reflection. Thus it is not possible to use Gson in GWT client side code.
thanks Daniel.But what about this guy that said he made gson for gwt? (Last post in the stackoverflow topic you linked me). anything reliable ? :P
update: I guess the problem has to do with the compiler not reading the packages outside of the main class (the one with init() method I mean)I tryed making an empty class Test(without nothing, not even a field or a constructor). If I keep it in the same package as my main class I don't get any error, if I move it out of the main package I get:[INFO] [ERROR] Line 73: No source code is available for type progetto.saga.map.Test ; did you forget to inherit a required module?at line 73 I just do Test test = new Test()this is driving me crazy, any idea?
<source path='core'/>
Is there another json class which allows me to do the same as Gson and to understand the file I made and which is supported by gwt or do I need to parse a big string on the client to generate the map? This last approach would make the code look very chaotic unfortunally
ye I just wanted to get sure it was ok to use it :)thanks!
Another possibility for GWT and json is to use the PlayN built in JSON parser. I ran into the same issues parsing JSON myself, though I tried using Jackson without realizing that it would not work with GWT.
for (ButtonType buttonType : ButtonType.values())
any idea why I can't iterate on enum values?
public void initButtons(ButtonType menuButton)
{
for (ButtonType buttonType : ButtonType.values())
{
Text charText = null;
if (menuButton == buttonType)
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, true);
else
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, false);
charText.setTranslation(BUTTON_POINT.x(), BUTTON_POINT.y() + 45 * buttonType.ordinal());
charText.setDepth(8.0f);
charText.init();
buttons.put(charText, gameLoop.getMenu().get(buttonType.ordinal()));
}
Text resumeText = new Text("Resume", "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, false);
resumeText.setTranslation(BUTTON_POINT.x(), BUTTON_POINT.y() + 45 * buttons.size());
resumeText.setDepth(8.0f);
resumeText.init();
buttons.put(resumeText, this);
}
if (menuButton == buttonType)
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, true);
else
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, false);
the html compiler was acting like if there was a break; in the for()
This is the Text constructor (which uses tripleplay)
public Text(String text, String font, Style style, float size, int color, boolean underlined)
{
this.text = text;
this.color = color;
textFont = graphics().createFont(font, style, size);
config = new TextConfig(new TextFormat().withFont(textFont), color).withUnderline(underlined);
textLayer = config.toLayer(text);
textLayer.setVisible(false);
}
if (menuButton == buttonType)
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, true);
else
charText = new Text(buttonType.getText(), "Gabriola", Style.BOLD, 30, 0xFFFFFFFF, false);
well actually that's it. if I just remove the underline it works. If I keep it then I get the bug, maybe it's not supported by HTML?