Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
iceraj committed Dec 12, 2013
1 parent 135cf7c commit 31c4d2b
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 35 deletions.
4 changes: 4 additions & 0 deletions diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo "========= DIFF ==========="
echo $1

diff ../stargenetics_java/$1 $1
7 changes: 7 additions & 0 deletions i18n.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

java -cp ../star_xls2i18_java/bin/:../star_xls2i18_java/lib/poi-3.2-FINAL-20081019.jar xls.MessagesBuilder ../stargenetics_java/src/StarGenetics_Properties_en.xls src/star/genetics/client/messages.properties
mkdir -p war/stargenetics_gwt_java/messages
cp src/star/genetics/client/messages*.json war/stargenetics_gwt_java/messages


18 changes: 18 additions & 0 deletions ignore/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-user.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/gwt-dev.jar">
<attributes>
<attribute name="javadoc_location" value="file:/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/doc/javadoc/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="lib" path="/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA.jar" sourcepath="/Applications/eclipse-4.3/plugins/com.google.gwt.eclipse.sdkbundle_2.5.1/gwt-2.5.1/validation-api-1.0.0.GA-sources.jar"/>
<classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>
74 changes: 43 additions & 31 deletions src/star/genetics/client/messages/UpdateExperimentImpl.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package star.genetics.client.messages;

import java.util.logging.Level;
import java.util.logging.Logger;

import star.genetics.client.StrainHelper;
import star.genetics.genetic.impl.MatingException;
import star.genetics.genetic.model.CrateModel;
Expand All @@ -16,50 +19,55 @@
public class UpdateExperimentImpl
{
private UpdateExperiment exp;


private static Logger logger = Logger.getLogger("UpdateExperiment");

public UpdateExperimentImpl(UpdateExperiment e)
{
this.exp = e ;
this.exp = e;
}

public final void execute(Model model)
{
{
Experiment experiment = exp.getExperiment();
String id = experiment.getId();
if (id == null)
{
CrateModel cratemodel = model.getCrateSet().newCrateModel();
if ("mate".equalsIgnoreCase(exp.getExperimentCommand()))
{
cratemodel.setName(experiment.getName());
if( experiment.getName() != null )
{
cratemodel.setName(experiment.getName());
}
for (JavaScriptObject so : experiment.getParents())
{
Strain s = so.cast();
System.out.println( new JSONObject(s));
System.out.println(new JSONObject(s));
Creature c = getCreature(s, model);
System.out.println( c );
System.out.println(c);
cratemodel.getParents().add(c);
}
try
{
CreatureSet children = model.getMatingEngine().getProgenies(cratemodel.getName(), cratemodel.getParents(), cratemodel.getProgenies().size()+1, 1, model.getRules());
for( Creature c : children )
{
cratemodel.getProgenies().add(c);
}
}
catch (MatingException e)
{
JSONObject err = new JSONObject();
err.put("error", new JSONString("Mating exception." + e.getMessage() ));
exp.onError(err.getJavaScriptObject());
e.printStackTrace();
}
{
CreatureSet children = model.getMatingEngine().getProgenies(cratemodel.getName(), cratemodel.getParents(), cratemodel.getProgenies().size() + 1, 1, model.getRules());
for (Creature c : children)
{
cratemodel.getProgenies().add(c);
}
}
catch (MatingException e)
{
JSONObject err = new JSONObject();
err.put("error", new JSONString("Mating exception." + e.getMessage()));
exp.onError(err.getJavaScriptObject());
e.printStackTrace();
}
JSONObject ret = new JSONObject();
ret.put("name", new JSONString(cratemodel.getName()));
ret.put("name", new JSONString(cratemodel.getName() != null ? cratemodel.getName() : "-- No Name --"));
ret.put("id", new JSONString(cratemodel.getUUID()));
ret.put("parents", getCrateSetToJSON(cratemodel.getParents(),model));
ret.put("children", getCrateSetToJSON(cratemodel.getProgenies(),model));
ret.put("parents", getCrateSetToJSON(cratemodel.getParents(), model));
ret.put("children", getCrateSetToJSON(cratemodel.getProgenies(), model));
exp.onSuccess(ret.getJavaScriptObject());
}
else if ("metadata".equalsIgnoreCase(exp.getExperimentCommand()))
Expand Down Expand Up @@ -100,17 +108,21 @@ else if ("metadata".equalsIgnoreCase(exp.getExperimentCommand()))
}
}



private final JSONValue getCrateSetToJSON(CreatureSet creatures, Model model)
{
{
logger.log(Level.INFO, " getCrateSetToJSON " + creatures + " " + model);
JSONArray ret = new JSONArray();
for( Creature c : creatures )
logger.log(Level.INFO, " getCrateSetToJSON 2");
for (Creature c : creatures)
{
ret.set(ret.size(),StrainHelper.getLong(c, model.getRules()));
logger.log(Level.INFO, " getCrateSetToJSON 3 ");
logger.log(Level.INFO, " getCrateSetToJSON 3 " + c);
logger.log(Level.INFO, " getCrateSetToJSON 3 " + model.getRules());
ret.set(ret.size(), StrainHelper.getLong(c, model.getRules()));
}
return ret;
}
logger.log(Level.INFO, " getCrateSetToJSON 4");
return ret;
}

private final Creature getCreature(Strain s, Model model)
{
Expand Down
1 change: 1 addition & 0 deletions src/star/genetics/client/messages_en.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/star/genetics/client/messages_en.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#en
#Thu Aug 22 15:14:45 EDT 2013
#Wed Dec 11 17:50:40 EST 2013
GroupBy.4={0} ({1}%)
GroupBy.3=<html><b>Male</b></html>
Cow.0=m\:
Expand Down Expand Up @@ -412,7 +412,7 @@ ChooseExperiment.0=Choose experimental setup
CrateModelImpl.0=Exp. {0}
Sex.10=Unknown sex type
Fly.wingsize=Wing size
MatingEngineImpl_Common.4=Parents can not mate\\\!
MatingEngineImpl_Common.4=These parents cannot perform any more matings.
MatingEngineImpl_Common.3=All progenies are dead\\\!
Fly.sex=Sex
MainPanel.9=Unsupported visualizer class, supported classes\: {0}
Expand Down
5 changes: 3 additions & 2 deletions src/star/genetics/genetic/impl/CrateSetImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ public Iterator<CrateModel> iterator()
public CrateModel newCrateModel()
{
clearInvisibleCrates();
add(new CrateModelImpl(id++));
return current();
CrateModel ret = new CrateModelImpl(id++);
add(ret);
return ret;
}

private void clearInvisibleCrates()
Expand Down
1 change: 1 addition & 0 deletions war/Stargenetics_gwt_java.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ h1 {
#closeButton {
margin: 15px 6px 6px;
}

1 change: 1 addition & 0 deletions war/Stargenetics_gwt_java.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ <h1>Web Application Starter Project</h1>
</table>
</body>
</html>

1 change: 1 addition & 0 deletions war/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
</welcome-file-list>

</web-app>

Binary file removed war/favicon.ico
Binary file not shown.

0 comments on commit 31c4d2b

Please sign in to comment.