Skip to content

Commit

Permalink
Initial commit with GWT code
Browse files Browse the repository at this point in the history
  • Loading branch information
iceraj committed Aug 29, 2013
1 parent faa115d commit 7813833
Show file tree
Hide file tree
Showing 121 changed files with 13,541 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" output="test-classes" path="test"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
*.class

# Package Files #
*.jar
*.war

# gwt caches and compiled units #
war/gwt_bree/
gwt-unitCache/

# boilerplate generated classes #
.apt_generated/

# more caches and things from deploy #
war/WEB-INF/deploy/
war/WEB-INF/classes/

34 changes: 34 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>stargenetics_gwt_java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
3 changes: 3 additions & 0 deletions .settings/com.google.gdt.eclipse.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
warSrcDir=war
warSrcDirIsOutput=true
3 changes: 3 additions & 0 deletions .settings/com.google.gwt.eclipse.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eclipse.preferences.version=1
filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+VFJBQ0U8L2xvZy1sZXZlbD48b3V0cHV0LXN0eWxlPk9CRlVTQ0FURUQ8L291dHB1dC1zdHlsZT48ZXh0cmEtYXJncz48IVtDREFUQVtdXT48L2V4dHJhLWFyZ3M+PHZtLWFyZ3M+PCFbQ0RBVEFbLVhteDUxMm1dXT48L3ZtLWFyZ3M+PGVudHJ5LXBvaW50LW1vZHVsZT5zdGFyLmdlbmV0aWNzLlN0YXJnZW5ldGljc19nd3RfamF2YTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+
7 changes: 7 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
4 changes: 4 additions & 0 deletions .settings/org.eclipse.wst.common.project.facet.core.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.6"/>
</faceted-project>
6 changes: 6 additions & 0 deletions src/java/beans/JavaBeans.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
<inherits name="com.google.gwt.user.User" />
<source path=""/>
</module>
33 changes: 33 additions & 0 deletions src/java/beans/PropertyChangeEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package java.beans;

public class PropertyChangeEvent
{

private Object source;
private String name;
private Object oldValue;
private Object newValue;

public PropertyChangeEvent(Object source, String name, Object oldValue, Object newValue)
{
this.source = source;
this.name = name;
this.oldValue = oldValue;
this.newValue = newValue;
}

public String getPropertyName()
{
return name;
}

public Object getOldValue()
{
return oldValue;
}

public Object getNewValue()
{
return newValue;
}
}
7 changes: 7 additions & 0 deletions src/java/beans/PropertyChangeListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package java.beans;

public interface PropertyChangeListener
{
public void propertyChange(PropertyChangeEvent e);

}
35 changes: 35 additions & 0 deletions src/java/beans/PropertyChangeSupport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package java.beans;

import java.util.ArrayList;

public class PropertyChangeSupport
{

private Object source;
private ArrayList<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();

public PropertyChangeSupport(Object source)
{
this.source = source;
}

public void firePropertyChange(PropertyChangeEvent propertyChangeEvent)
{
for( PropertyChangeListener l : listeners)
{
l.propertyChange(propertyChangeEvent);
}

}

public void addPropertyChangeListener(PropertyChangeListener listener)
{
listeners.add(listener);
}

public void removePropertyChangeListener(PropertyChangeListener listener)
{
listeners.remove(listener);
}

}
30 changes: 30 additions & 0 deletions src/java/beans/StringTokenizer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package java.beans;

public class StringTokenizer
{
//TODO: make better or correct
private String str;
private String split;
private int index;

public StringTokenizer(String str, String split)
{
this.str = str;
this.split = split;
this.index = 0;
}

public boolean hasMoreTokens()
{
return str.indexOf(split,index) > 0;
}

public String nextToken()
{
int next_index = str.indexOf(split,index);
String ret = str.substring(index, next_index);
index = next_index;
return ret;
}

}
33 changes: 33 additions & 0 deletions src/star/genetics/Stargenetics_gwt_java.gwt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
When updating your version of GWT, you should also update this DTD reference,
so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN"
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module rename-to='stargenetics_gwt_java'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

<!-- Other module inherits -->
<inherits name="java.beans.JavaBeans"/>
<!-- Specify the app entry point class. -->
<entry-point class='star.genetics.client.Stargenetics_gwt_java'/>

<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='genetic'/>
<source path='shared'/>
<source path='utils'/>
<source path='visualizers'/>
<source path='xls'/>

</module>
76 changes: 76 additions & 0 deletions src/star/genetics/client/Helper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package star.genetics.client;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;

import star.genetics.genetic.model.Creature;
import star.genetics.genetic.model.ModelModifiedProvider;
import star.genetics.visualizers.Visualizer;
import star.genetics.visualizers.VisualizerFactory;

public class Helper
{
public static void setVisualizerFromCreature(Visualizer v, Creature c)
{
v.setName(c.getName());
v.setNote(c.getNote());
v.setProperties(c.getProperties(), c.getSex());
}

public static void setVisualizerFromCreature(Visualizer v, Creature c, HashMap<String, String> additional)
{
v.setName(c.getName());
v.setNote(c.getNote());
// additional.putAll(c.getProperties());
HashMap<String, String> prop = new HashMap<String, String>();
prop.putAll(c.getProperties());
prop.putAll(additional);
v.setProperties(prop, c.getSex());
}

public static Map<String, String> parse(String value)
{
Map<String, String> ret = new TreeMap<String, String>();
if (value != null)
{
if (value.contains("=")) //$NON-NLS-1$
{
String elements[] = value.split(","); //$NON-NLS-1$
for (String element : elements)
{
if (element.indexOf('=') != -1)
{
String[] pair = element.split("=", 2); //$NON-NLS-1$
ret.put(pair[0], pair[1]);
}
else
{
throw new RuntimeException();
//throw new RuntimeException(MessageFormat.format(Messages.getString("Helper.0"), element, value)); //$NON-NLS-1$
}
}
}
else if (!value.equalsIgnoreCase("wildtype")) //$NON-NLS-1$
{
throw new RuntimeException(Messages.getString("Helper.5")); //$NON-NLS-1$
}
}
return ret;
}

public static String export(Map<String, String> source)
{
StringBuffer sb = new StringBuffer();
for (Entry<String, String> entry : source.entrySet())
{
sb.append(entry.getKey() + "=" + entry.getValue() + ","); //$NON-NLS-1$ //$NON-NLS-2$
}
sb.setLength(sb.length() - 1);
return sb.toString();
}

private static String MODEL_PROVIDER_EXCEPTION = "Model Modified Provider not found"; //$NON-NLS-1$

}
15 changes: 15 additions & 0 deletions src/star/genetics/client/Messages.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package star.genetics.client;

//import java.util.Locale;
//import java.util.MissingResourceException;
//import java.util.ResourceBundle;

public class Messages
{

public static String getString(String key)
{
return '!' + key + '!';
}

}
Loading

0 comments on commit 7813833

Please sign in to comment.