Merge branch 'charts' into gwt

This commit is contained in:
Benjamin Ebling committed 2011-11-14 13:54:34 +01:00
commit aa69dde5df
14 files changed
+363 -20

No files matched your search

+2 -6
View File
@@ -2,14 +2,10 @@
<classpath> <classpath>
<classpathentry kind="src" path="src/main/resources"/> <classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/gwt-servlet.jar" sourcepath="/com.google.gwt.osgi/lib/gwt-user.jar">
<attributes>
<attribute name="javadoc_location" value="http://google-web-toolkit.googlecode.com/svn/javadoc/2.3"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="lib/gwt-maps.jar"/> <classpathentry kind="lib" path="lib/gwt-maps.jar"/>
<classpathentry kind="lib" path="lib/gwt-visualization.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
+5
View File
@@ -30,6 +30,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<triggers>full,incremental,</triggers>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.m2e.core.maven2Builder.launch</value>
</dictionary>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.pde.PluginNature</nature>
@@ -1,4 +1,5 @@
#Thu Sep 29 09:30:43 CEST 2011 #Wed Nov 09 12:43:38 CET 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc2FpbGluZy5nd3QudWkuQWRtaW5Db25zb2xlPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\= gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48ZW50cnktcG9pbnQtbW9kdWxlPmNvbS5zYXAuc2FpbGluZy5nd3QudWkuQWRtaW5Db25zb2xlPC9lbnRyeS1wb2ludC1tb2R1bGU+PC9nd3QtY29tcGlsZS1zZXR0aW5ncz4\=
@@ -21,7 +21,7 @@
</listAttribute> </listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war &quot;${project_loc:com.sap.sailing.gwt.ui}/war&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9997 com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.UserManagement"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war C:\Users\d056866\git\git\java\com.sap.sailing.gwt.ui\war -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9997 com.sap.sailing.gwt.ui.UserManagement com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.Leaderboard"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/>
</launchConfiguration> </launchConfiguration>
+1 -3
View File
@@ -3,7 +3,5 @@ source.. = src/main/resources,\
output.. = bin output.. = bin
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
lib/gwt-visualization.jar,\
lib/gwt-maps.jar,\
lib/gwt-servlet.jar,\
war/ war/
jars.compile.order = .
@@ -38,10 +38,10 @@ public class AdminConsole extends AbstractEntryPoint implements EventRefresher {
eventDisplayers.add(windPanel); eventDisplayers.add(windPanel);
windPanel.setSize("90%", "90%"); windPanel.setSize("90%", "90%");
tabPanel.add(windPanel, stringConstants.wind(), /* asHTML */ false); tabPanel.add(windPanel, stringConstants.wind(), /* asHTML */ false);
final RaceMapPanel raceMapPanel = new RaceMapPanel(sailingService, this, this, stringConstants); //final RaceMapPanel raceMapPanel = new RaceMapPanel(sailingService, this, this, stringConstants);
eventDisplayers.add(raceMapPanel); //eventDisplayers.add(raceMapPanel);
raceMapPanel.setSize("90%", "90%"); //raceMapPanel.setSize("90%", "90%");
tabPanel.add(raceMapPanel, stringConstants.map(), /* asHTML */ false); //tabPanel.add(raceMapPanel, stringConstants.map(), /* asHTML */ false);
LeaderboardPanel defaultLeaderboardPanel = new LeaderboardPanel(sailingService, stringConstants.defaultLeaderboard(), this, stringConstants); LeaderboardPanel defaultLeaderboardPanel = new LeaderboardPanel(sailingService, stringConstants.defaultLeaderboard(), this, stringConstants);
defaultLeaderboardPanel.setSize("90%", "90%"); defaultLeaderboardPanel.setSize("90%", "90%");
tabPanel.add(defaultLeaderboardPanel, stringConstants.defaultLeaderboard(), /* asHTML */ false); tabPanel.add(defaultLeaderboardPanel, stringConstants.defaultLeaderboard(), /* asHTML */ false);
@@ -51,14 +51,14 @@ public class AdminConsole extends AbstractEntryPoint implements EventRefresher {
eventDisplayers.add(leaderboardConfigPanel); eventDisplayers.add(leaderboardConfigPanel);
tabPanel.selectTab(0); tabPanel.selectTab(0);
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() { /*tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
@Override @Override
public void onSelection(SelectionEvent<Integer> event) { public void onSelection(SelectionEvent<Integer> event) {
if(raceMapPanel.isVisible()) { if(raceMapPanel.isVisible()) {
raceMapPanel.onResize(); raceMapPanel.onResize();
} }
} }
}); });*/
fillEvents(); fillEvents();
} }
@@ -182,7 +182,7 @@ public abstract class ExpandableSortableColumn<C> extends SortableColumn<Leaderb
ensureExpansionDataIsLoaded(new Runnable() { ensureExpansionDataIsLoaded(new Runnable() {
public void run() { public void run() {
int insertIndex = table.getColumnIndex(ExpandableSortableColumn.this); int insertIndex = table.getColumnIndex(ExpandableSortableColumn.this);
// The check "insertIndex == -1" is necessary, because the child-columns might be deleted asynchronous // The check "insertIndex != -1" is necessary, because the child-columns might be deleted asynchronously
// while toggling the columns. // while toggling the columns.
if (insertIndex != -1) { if (insertIndex != -1) {
insertIndex++; insertIndex++;
@@ -880,7 +880,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
/** /**
* Also updates the min/max values on the columns * Also updates the min/max values on the columns
*/ */
private void updateLeaderboard(LeaderboardDAO leaderboard) { protected void updateLeaderboard(LeaderboardDAO leaderboard) {
setLeaderboard(leaderboard); setLeaderboard(leaderboard);
adjustColumnLayout(leaderboard); adjustColumnLayout(leaderboard);
getData().getList().clear(); getData().getList().clear();
@@ -981,6 +981,7 @@ public class LeaderboardPanel extends FormPanel implements TimeListener, PlaySta
createRaceColumn(race, leaderboard.raceIsMedalRace(race), createRaceColumn(race, leaderboard.raceIsMedalRace(race),
leaderboard.raceIsTracked(race))); leaderboard.raceIsTracked(race)));
} }
} }
} }
} }
@@ -0,0 +1,52 @@
package com.sap.sailing.gwt.ui.test;
import com.google.gwt.user.cellview.client.CellTable;
import com.sap.sailing.gwt.ui.client.ErrorReporter;
import com.sap.sailing.gwt.ui.client.LeaderboardPanel;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.SortableColumn;
import com.sap.sailing.gwt.ui.client.StringConstants;
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
public class LeaderboardPanelMock extends LeaderboardPanel {
public LeaderboardPanelMock(SailingServiceAsync sailingService,
String leaderboardName, ErrorReporter errorReporter,
StringConstants stringConstants) {
super(sailingService, leaderboardName, errorReporter, stringConstants);
// TODO Auto-generated constructor stub
}
@Override
public void addColumn(SortableColumn<LeaderboardRowDAO, ?> column) {
// TODO Auto-generated method stub
super.addColumn(column);
}
@Override
public RaceColumn<?> createRaceColumn(String raceName,
boolean isMedalRace, boolean isTracked) {
// TODO Auto-generated method stub
return super.createRaceColumn(raceName, isMedalRace, isTracked);
}
@Override
public void removeColumn(int columnIndex) {
// TODO Auto-generated method stub
super.removeColumn(columnIndex);
}
@Override
public void updateLeaderboard(LeaderboardDAO leaderboard) {
// TODO Auto-generated method stub
super.updateLeaderboard(leaderboard);
}
@Override
public CellTable<LeaderboardRowDAO> getLeaderboardTable() {
// TODO Auto-generated method stub
return super.getLeaderboardTable();
}
}
@@ -0,0 +1,218 @@
package com.sap.sailing.gwt.ui.test;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.ui.client.ExpandableSortableColumn;
import com.sap.sailing.gwt.ui.client.StringConstants;
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
import com.sap.sailing.gwt.ui.shared.LeaderboardRowDAO;
import com.sap.sailing.gwt.ui.shared.Pair;
import com.sap.sailing.gwt.ui.shared.RaceRecordDAO;
public class TestColumnToggling extends GWTTestCase {
//These objects should be created by calling GWT.create(Class c);
private LeaderboardPanelMock leaderboardPanel;
private TestSailingServiceAsync service;
private StringConstants sc;
//Test data.
private final String LEADERBOARD_NAME = "test";
private final String COLUMN1_NAME = "r1";
private final String EVENT_NAME = "Sailing Team Germany (STG)";
private final String JSON_URL= "http://germanmaster.traclive.dk/events/event_20110505_SailingTea/jsonservice.php";
private final String TRACKED_RACE = "schwerttest";
private LeaderboardDAO leaderboard;
private RaceRecordDAO rrDao;
private ExpandableSortableColumn<LeaderboardRowDAO> rc;
@Override
protected void gwtSetUp() throws Exception {
super.gwtSetUp();
service = GWT.create(TestSailingService.class);
sc = GWT.create(StringConstants.class);
}
public void testColumnDeleting() {
delayTestFinish(1000000);
listRacesInEvent();
}
private void listRacesInEvent(){
service.listTracTracRacesInEvent(JSON_URL, new AsyncCallback<Pair<String,List<RaceRecordDAO>>>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to list races." + caught.getLocalizedMessage());
}
@Override
public void onSuccess(Pair<String, List<RaceRecordDAO>> result) {
System.out.println("Listed races.");
for (RaceRecordDAO rr : result.getB()){
if (rr.name.equals(TRACKED_RACE)){
rrDao = rr;
}
}
assertNotNull("rrDao != null",rrDao);
trackRace();
}
});
}
private void trackRace(){
service.track(rrDao, "", "", false, false, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to track race: " + caught.getLocalizedMessage());
}
@Override
public void onSuccess(Void result) {
System.out.println("Tracked race.");
createLeaderboard();
}
});
}
private void createLeaderboard(){
service.createLeaderboard(LEADERBOARD_NAME, new int[] { 1, 2 },
new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
System.out.println("Created Leaderboard.");
addColumnToLeaderboard();
}
@Override
public void onFailure(Throwable caught) {
fail("Failed to create Leaderboard." + caught.getLocalizedMessage());
finishTest();
}
});
}
private void addColumnToLeaderboard() {
leaderboardPanel = new LeaderboardPanelMock(service, LEADERBOARD_NAME,
null, sc);
service.addColumnToLeaderboard(COLUMN1_NAME, LEADERBOARD_NAME, false,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to add column to leaderboard.");
finishTest();
}
@Override
public void onSuccess(Void result) {
System.out.println("Added column to leaderboard.");
leaderboardPanel.addColumn(leaderboardPanel.createRaceColumn(COLUMN1_NAME, false, false));
linkTrackedRace();
}
});
}
private void linkTrackedRace(){
service.connectTrackedRaceToLeaderboardColumn(LEADERBOARD_NAME, COLUMN1_NAME, EVENT_NAME, TRACKED_RACE, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to link race.");
}
@Override
public void onSuccess(Void result) {
System.out.println("Linked race to column.");
getLeaderboard();
}
});
}
private void getLeaderboard(){
ArrayList<String> al = new ArrayList<String>();
al.add(COLUMN1_NAME);
service.getLeaderboardByName(LEADERBOARD_NAME, new Date(), al,
new AsyncCallback<LeaderboardDAO>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to get leaderboard.");
finishTest();
}
@Override
public void onSuccess(LeaderboardDAO result) {
System.out.println("Got leaderboard.");
leaderboard = result;
leaderboardPanel.updateLeaderboard(leaderboard);
for (int i = 0; i < leaderboardPanel.getLeaderboardTable()
.getColumnCount(); i++) {
Column<LeaderboardRowDAO, ?> c = leaderboardPanel.getLeaderboardTable().getColumn(i);
if (c instanceof ExpandableSortableColumn<?>) {
rc = (ExpandableSortableColumn<LeaderboardRowDAO>) c;
rc.setEnableLegDrillDown(true);
}
}
removeColumnAndAssert();
}
});
}
private void removeColumnAndAssert(){
service.removeLeaderboardColumn(LEADERBOARD_NAME, COLUMN1_NAME,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
fail("Failed to remoce column.");
finishTest();
}
@Override
public void onSuccess(Void result) {
leaderboardPanel.updateLeaderboard(leaderboard);
assertNotNull(rc);
try {
rc.toggleExpansion();
leaderboardPanel.updateLeaderboard(leaderboard);
} catch (Exception e) {
fail("Toggle column failed." + e.getLocalizedMessage());
}
finishTest();
}
});
}
@Override
protected void gwtTearDown() throws Exception {
// TODO Auto-generated method stub
super.gwtTearDown();
}
@Override
public String getModuleName() {
// TODO Auto-generated method stub
return "com.sap.sailing.gwt.ui.AdminConsole";
}
}
@@ -0,0 +1,10 @@
package com.sap.sailing.gwt.ui.test;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.sap.sailing.gwt.ui.client.SailingService;
import com.sap.sailing.server.RacingEventService;
@RemoteServiceRelativePath("testsailing")
public interface TestSailingService extends SailingService {
}
@@ -0,0 +1,26 @@
package com.sap.sailing.gwt.ui.test;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.shared.CompetitorDAO;
import com.sap.sailing.gwt.ui.shared.EventDAO;
import com.sap.sailing.gwt.ui.shared.GPSFixDAO;
import com.sap.sailing.gwt.ui.shared.LeaderboardDAO;
import com.sap.sailing.gwt.ui.shared.LeaderboardEntryDAO;
import com.sap.sailing.gwt.ui.shared.MarkDAO;
import com.sap.sailing.gwt.ui.shared.Pair;
import com.sap.sailing.gwt.ui.shared.QuickRankDAO;
import com.sap.sailing.gwt.ui.shared.RaceRecordDAO;
import com.sap.sailing.gwt.ui.shared.TracTracConfigurationDAO;
import com.sap.sailing.gwt.ui.shared.WindDAO;
import com.sap.sailing.gwt.ui.shared.WindInfoForRaceDAO;
import com.sap.sailing.server.RacingEventService;
public interface TestSailingServiceAsync extends SailingServiceAsync {
}
@@ -0,0 +1,32 @@
package com.sap.sailing.gwt.ui.test;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
import com.sap.sailing.gwt.ui.server.SailingServiceImpl;
import com.sap.sailing.server.RacingEventService;
import com.sap.sailing.server.RacingEventServiceImpl;
public class TestSailingServiceImpl extends SailingServiceImpl implements TestSailingService {
private static final long serialVersionUID = 3647254510616623048L;
private RacingEventService service;
public TestSailingServiceImpl(){
super();
service = new RacingEventServiceImpl();
}
public RacingEventService getService(){
return service;
}
@Override
protected ServiceTracker<RacingEventService, RacingEventService> createAndOpenRacingEventServiceTracker(
BundleContext context) {
// TODO Auto-generated method stub
return null;
}
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Could not determine the version of your GWT SDK; using the module DTD from GWT 1.6.4. You may want to change this. --> <!-- Could not determine the version of your GWT SDK; using the module DTD from GWT 1.6.4. You may want to change this. -->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.4//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.4/distro-source/core/src/gwt-module.dtd"> <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module> <module>
<!-- Inherit the core Web Toolkit stuff. --> <!-- Inherit the core Web Toolkit stuff. -->
@@ -29,4 +29,8 @@
<extend-property name="locale" values="de"/> <extend-property name="locale" values="de"/>
<source path='client'/> <source path='client'/>
<source path='shared'/> <source path='shared'/>
<source path='test'/>
<servlet path='/testsailing' class='com.sap.sailing.gwt.ui.test.TestSailingServiceImpl'/>
</module> </module>