mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 09:41:00 +00:00
Merge branch 'master' into bug1744
This commit is contained in:
commit
3b20e50ec0
200 files changed
+8961
-1832
No files matched your search
@@ -0,0 +1,10 @@
|
||||
Hi Riccardo,
|
||||
|
||||
wir haben vielfach versucht, Dich zu erreichen, aber Du antwortest nicht mehr auf e-Mails. Ruf bitte an,
|
||||
Axel: +491735341892
|
||||
Stefan: +4916090819687
|
||||
|
||||
Es geht um Deinen Vertrag.
|
||||
|
||||
Gruss,
|
||||
-- Axel
|
||||
@@ -27,11 +27,11 @@
|
||||
<!-- Leave empty, if no proxy is needed in your environment! -->
|
||||
<parameters.proxy>
|
||||
-Dhttp.proxyHost=proxy.wdf.sap.corp -Dhttp.proxyPort=8080
|
||||
</parameters.proxy>
|
||||
<!-- Change the configuration file to the one you like to use for the tests. -->
|
||||
</parameters.proxy>
|
||||
<!-- Change the configuration file to the one you like to use for the tests. -->
|
||||
<parameters.integration-tests>
|
||||
-Dselenium.test.environment.configuration=ci-test-environment.xml
|
||||
</parameters.integration-tests>
|
||||
-Dselenium.test.environment.configuration=ci-test-environment.xml -Dmongo.dbName=winddbTest
|
||||
</parameters.integration-tests>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
<properties>
|
||||
<!-- Leave empty, if no proxy is needed in your environment! -->
|
||||
<parameters.proxy>
|
||||
</parameters.proxy>
|
||||
<!-- Change the configuration file to the one you like to use for the tests. -->
|
||||
</parameters.proxy>
|
||||
<!-- Change the configuration file to the one you like to use for the tests. -->
|
||||
<parameters.integration-tests>
|
||||
-Dselenium.test.environment.configuration=ci-test-environment.xml
|
||||
</parameters.integration-tests>
|
||||
-Dselenium.test.environment.configuration=ci-test-environment.xml -Dmongo.dbName=winddbTest
|
||||
</parameters.integration-tests>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
BIN
Binary file not shown.
+2602
File diff suppressed because it is too large.
Load diff
Executable
+32
@@ -0,0 +1,32 @@
|
||||
package com.sap.sailing.domain.test.markpassing;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.junit.Ignore;
|
||||
|
||||
public class Kiel2013505Test extends AbstractMarkPassingTest {
|
||||
|
||||
public Kiel2013505Test() throws MalformedURLException, URISyntaxException {
|
||||
super();
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testRace5() throws IOException, InterruptedException, URISyntaxException {
|
||||
testRace("5");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String getFileName() {
|
||||
return "event_20130626_KielerWoch-505_race_";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getExpectedEventName() {
|
||||
return "Kieler Woche 2013 - International";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -937,7 +937,7 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Position, Position> getLeftAndRightMarkPositions(TimePoint t, Waypoint w) {
|
||||
public Pair<Mark, Mark> getPortAndStarboardMarks(TimePoint t, Waypoint w) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
+26
-59
@@ -43,14 +43,15 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
private Candidate end;
|
||||
private final DynamicTrackedRace race;
|
||||
private final double penaltyForSkipping = 1 - Edge.getPenaltyForSkipping();
|
||||
private static double strictness = 900; // Lower = stricter
|
||||
private static double strictness = 900; // Lower = stricter; 900
|
||||
|
||||
public CandidateChooser(DynamicTrackedRace race) {
|
||||
logger.setLevel(Level.INFO);
|
||||
this.race = race;
|
||||
raceStartTime = race.getStartOfRace().minus(2000);
|
||||
start = new Candidate(0, raceStartTime, 1, null, true, true, "Proxy");
|
||||
end = new Candidate(race.getRace().getCourse().getIndexOfWaypoint(race.getRace().getCourse().getLastWaypoint()) + 2, null, 1, null, true, true, "Proxy");
|
||||
raceStartTime = race.getStartOfRace()!=null?race.getStartOfRace().minus(2000):null;
|
||||
start = new Candidate(/*Index*/0, raceStartTime, /*Probability*/1, /*Waypoint*/null, /*right Side*/true, /*right Direction*/true, "Proxy");
|
||||
end = new Candidate(race.getRace().getCourse().getIndexOfWaypoint(race.getRace().getCourse().getLastWaypoint()) + 2, /*TimePoint*/null,
|
||||
/*Probability*/1, /*Waypoint*/null, /*right Side*/true, /*right Direction*/true, "Proxy");
|
||||
candidates = new LinkedHashMap<>();
|
||||
for (Competitor c : race.getRace().getCompetitors()) {
|
||||
candidates.put(c, new TreeSet<Candidate>());
|
||||
@@ -67,12 +68,12 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
|
||||
@Override
|
||||
public void calculateMarkPassDeltas(Competitor c, Pair<Iterable<Candidate>, Iterable<Candidate>> candidateDeltas) {
|
||||
if (race.getStartOfRace().minus(2000) != raceStartTime) {
|
||||
if (race.getStartOfRace()!=null&&!race.getStartOfRace().minus(2000).equals(raceStartTime)) {
|
||||
raceStartTime = race.getStartOfRace().minus(2000);
|
||||
for (Competitor com : allEdges.keySet()) {
|
||||
removeCandidates(Arrays.asList(start), com);
|
||||
}
|
||||
start = new Candidate(0, raceStartTime, 1, null, true, true, "Proxy");
|
||||
start = new Candidate(0, raceStartTime, /*Probability*/1, /*Waypoint*/null, /*right Side*/true, /*right Direction*/true, "Proxy");
|
||||
for (Competitor com : allEdges.keySet()) {
|
||||
addCandidates(Arrays.asList(start), com);
|
||||
}
|
||||
@@ -99,11 +100,7 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
allEdges.get(co).add(e);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* if (early == start && late.getID() == 1 && numberOfCloseStarts(late.getTimePoint()) >
|
||||
* penaltyForSkipping) { allEdges.get(co).add(new Edge(early, late,
|
||||
* numberOfCloseStarts(late.getTimePoint()))); } else
|
||||
*/if ((late == end || early == start) && early != late) {
|
||||
if ((late == end || early == start) && early != late) {
|
||||
allEdges.get(co).add(new Edge(early, late, 1));
|
||||
} else if (!(early.getID() == late.getID()) && late.getTimePoint().after(early.getTimePoint()) && estimatedDistance(co, early, late) > penaltyForSkipping) {
|
||||
allEdges.get(co).add(new Edge(early, late, estimatedDistance(co, early, late)));
|
||||
@@ -134,15 +131,14 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!candidateWithParent.containsKey(currentMostLikelyEdge.getA().getEnd())
|
||||
|| candidateWithParent.get(currentMostLikelyEdge.getA().getEnd()).getB() > currentMostLikelyEdge.getB()) {
|
||||
if (!candidateWithParent.containsKey(currentMostLikelyEdge.getA().getEnd())) {
|
||||
candidateWithParent.put(currentMostLikelyEdge.getA().getEnd(), new Pair<Candidate, Double>(currentMostLikelyEdge.getA().getStart(), currentMostLikelyEdge.getB()));
|
||||
}
|
||||
all.remove(currentMostLikelyEdge.getA());
|
||||
}
|
||||
Candidate marker = candidateWithParent.get(end).getA();
|
||||
while (!(marker == start)) {
|
||||
if (currentMarkPasses.get(co).get(marker.getWaypoint()) == null || currentMarkPasses.get(co).get(marker.getWaypoint()).getTimePoint() != marker.getTimePoint()) {
|
||||
if (currentMarkPasses.get(co).get(marker.getWaypoint()) == null || !currentMarkPasses.get(co).get(marker.getWaypoint()).getTimePoint().equals(marker.getTimePoint())) {
|
||||
currentMarkPasses.get(co).put(marker.getWaypoint(), new MarkPassingImpl(marker.getTimePoint(), marker.getWaypoint(), co));
|
||||
changed = true;
|
||||
}
|
||||
@@ -158,48 +154,6 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void reEvaluateStartingEdges() {
|
||||
for (Competitor c : candidates.keySet()) {
|
||||
ArrayList<Edge> newEdges = new ArrayList<>();
|
||||
ArrayList<Edge> edgesToRemove = new ArrayList<>();
|
||||
for (Edge e : allEdges.get(c)) {
|
||||
if (e.getStart().getID() == 0 && e.getEnd().getID() == 1) {
|
||||
newEdges.add(new Edge(e.getStart(), e.getEnd(), numberOfCloseStarts(e.getEnd().getTimePoint())));
|
||||
edgesToRemove.add(e);
|
||||
}
|
||||
}
|
||||
for (Edge e : edgesToRemove) {
|
||||
allEdges.get(c).remove(e);
|
||||
}
|
||||
for (Edge e : newEdges) {
|
||||
allEdges.get(c).add(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double numberOfCloseStarts(TimePoint t) {
|
||||
double numberOfCompetitors = 0;
|
||||
double totalTimeDifference = 0;
|
||||
for (Competitor c : candidates.keySet()) {
|
||||
double closestCandidate = -1;
|
||||
for (Candidate ca : candidates.get(c)) {
|
||||
if (ca.getID() == 1) {
|
||||
if (closestCandidate == -1) {
|
||||
closestCandidate = Math.abs(ca.getTimePoint().asMillis() - t.asMillis());
|
||||
} else if (closestCandidate > Math.abs(ca.getTimePoint().asMillis() - t.asMillis())) {
|
||||
closestCandidate = Math.abs(ca.getTimePoint().asMillis() - t.asMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (closestCandidate != -1) {
|
||||
numberOfCompetitors++;
|
||||
totalTimeDifference = totalTimeDifference + closestCandidate;
|
||||
}
|
||||
}
|
||||
return 1 / (0.00001 * (totalTimeDifference / numberOfCompetitors) + 1);
|
||||
}
|
||||
|
||||
private double estimatedDistance(Competitor c, Candidate c1, Candidate c2) {
|
||||
Distance totalEstimatedDistance = new MeterDistance(0);
|
||||
Waypoint current;
|
||||
@@ -243,9 +197,6 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
if (!candidates.get(co).contains(c)) {
|
||||
candidates.get(co).add(c);
|
||||
}
|
||||
/*
|
||||
* if (c.getID() == 1 && race.getStartOfRace() == null) { reEvaluateStartingEdges(); }
|
||||
*/
|
||||
}
|
||||
createNewEdges(co, newCandidates);
|
||||
}
|
||||
@@ -265,3 +216,19 @@ public class CandidateChooser implements AbstractCandidateChooser {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @SuppressWarnings("unused") private void reEvaluateStartingEdges() { for (Competitor c : candidates.keySet()) {
|
||||
* ArrayList<Edge> newEdges = new ArrayList<>(); ArrayList<Edge> edgesToRemove = new ArrayList<>(); for (Edge e :
|
||||
* allEdges.get(c)) { if (e.getStart().getID() == 0 && e.getEnd().getID() == 1) { newEdges.add(new Edge(e.getStart(),
|
||||
* e.getEnd(), numberOfCloseStarts(e.getEnd().getTimePoint()))); edgesToRemove.add(e); } } for (Edge e : edgesToRemove)
|
||||
* { allEdges.get(c).remove(e); } for (Edge e : newEdges) { allEdges.get(c).add(e); } } }
|
||||
*
|
||||
* private double numberOfCloseStarts(TimePoint t) { double numberOfCompetitors = 0; double totalTimeDifference = 0; for
|
||||
* (Competitor c : candidates.keySet()) { double closestCandidate = -1; for (Candidate ca : candidates.get(c)) { if
|
||||
* (ca.getID() == 1) { if (closestCandidate == -1) { closestCandidate = Math.abs(ca.getTimePoint().asMillis() -
|
||||
* t.asMillis()); } else if (closestCandidate > Math.abs(ca.getTimePoint().asMillis() - t.asMillis())) {
|
||||
* closestCandidate = Math.abs(ca.getTimePoint().asMillis() - t.asMillis()); } } } if (closestCandidate != -1) {
|
||||
* numberOfCompetitors++; totalTimeDifference = totalTimeDifference + closestCandidate; } } return 1 / (0.00001 *
|
||||
* (totalTimeDifference / numberOfCompetitors) + 1); }
|
||||
*/
|
||||
+4
-8
@@ -53,10 +53,7 @@ public class CandidateFinder implements AbstractCandidateFinder {
|
||||
}
|
||||
};
|
||||
|
||||
private double strictness = 9; // Higher = stricter
|
||||
|
||||
// TODO Identical Waypoints (ControlPoint and PassingInstruction) are calculated twice.
|
||||
// => Distance to Mark instead of Waypoint?
|
||||
private double strictness = 9; // Higher = stricter; 9
|
||||
|
||||
public CandidateFinder(DynamicTrackedRace race) {
|
||||
this.race = race;
|
||||
@@ -352,7 +349,6 @@ public class CandidateFinder implements AbstractCandidateFinder {
|
||||
}
|
||||
|
||||
private Candidate createCandidate(Competitor c, GPSFix fix1, GPSFix fix2, Waypoint w) {
|
||||
|
||||
double cte1 = crossTrackErrors.get(c).get(fix1).get(w).getA();
|
||||
double cte2 = crossTrackErrors.get(c).get(fix2).get(w).getA();
|
||||
if ((cte1 < 0 && cte2 < 0) || (cte1 > 0 && cte2 > 0)) {
|
||||
@@ -436,9 +432,9 @@ public class CandidateFinder implements AbstractCandidateFinder {
|
||||
Position p2 = null;
|
||||
|
||||
if (instruction == PassingInstruction.Line) {
|
||||
Pair<Position, Position> pos = race.getLeftAndRightMarkPositions(t, w);
|
||||
p1 = pos.getA();
|
||||
p2 = pos.getB();
|
||||
Pair<Mark, Mark> pos = race.getPortAndStarboardMarks(t, w);
|
||||
p1 = race.getOrCreateTrack(pos.getA()).getEstimatedPosition(t, false);
|
||||
p2 = race.getOrCreateTrack(pos.getB()).getEstimatedPosition(t, false);
|
||||
} else {
|
||||
int i = 1;
|
||||
for (Mark m : w.getMarks()) {
|
||||
|
||||
+7
-5
@@ -13,6 +13,7 @@ import com.sap.sailing.domain.base.Event;
|
||||
import com.sap.sailing.domain.base.Fleet;
|
||||
import com.sap.sailing.domain.base.RaceColumn;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.media.MediaTrack;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
@@ -30,7 +31,7 @@ import com.sap.sailing.domain.tracking.WindTrack;
|
||||
public class TopLevelMasterData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4820893865792553281L;
|
||||
private final Map<Regatta, Set<String>> raceIdStringsForRegatta;
|
||||
private final Map<RegattaIdentifier, Set<String>> raceIdStringsForRegatta;
|
||||
private final Set<MediaTrack> allMediaTracks;
|
||||
private final Set<LeaderboardGroup> leaderboardGroups;
|
||||
private final Set<WindTrackMasterData> windTrackMasterData;
|
||||
@@ -83,14 +84,15 @@ public class TopLevelMasterData implements Serializable {
|
||||
return eventsForLeaderboardGroup;
|
||||
}
|
||||
|
||||
private Map<Regatta, Set<String>> convertToRaceIdStringsForRegattaMap(Map<String, Regatta> regattaForRaceIdString) {
|
||||
Map<Regatta, Set<String>> raceIdStringsForRegatta = new HashMap<Regatta, Set<String>>();
|
||||
private Map<RegattaIdentifier, Set<String>> convertToRaceIdStringsForRegattaMap(
|
||||
Map<String, Regatta> regattaForRaceIdString) {
|
||||
Map<RegattaIdentifier, Set<String>> raceIdStringsForRegatta = new HashMap<RegattaIdentifier, Set<String>>();
|
||||
for (Entry<String, Regatta> entry : regattaForRaceIdString.entrySet()) {
|
||||
Regatta regatta = entry.getValue();
|
||||
Set<String> raceIds = raceIdStringsForRegatta.get(regatta);
|
||||
if (raceIds == null) {
|
||||
raceIds = new HashSet<String>();
|
||||
raceIdStringsForRegatta.put(regatta, raceIds);
|
||||
raceIdStringsForRegatta.put(regatta.getRegattaIdentifier(), raceIds);
|
||||
}
|
||||
raceIds.add(entry.getKey());
|
||||
}
|
||||
@@ -158,7 +160,7 @@ public class TopLevelMasterData implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<Regatta, Set<String>> getRaceIdStringsForRegatta() {
|
||||
public Map<RegattaIdentifier, Set<String>> getRaceIdStringsForRegatta() {
|
||||
return raceIdStringsForRegatta;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -5,7 +5,6 @@ import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.Bearing;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
@@ -104,5 +103,5 @@ public interface DynamicTrackedRace extends TrackedRace {
|
||||
|
||||
Bearing getCrossingBearing(Waypoint w, TimePoint t);
|
||||
|
||||
Pair<Position, Position> getLeftAndRightMarkPositions(TimePoint t, Waypoint w);
|
||||
Pair<Mark, Mark> getPortAndStarboardMarks(TimePoint t, Waypoint w);
|
||||
}
|
||||
+11
-11
@@ -814,10 +814,14 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
result = before.middle(after.reverse());
|
||||
}
|
||||
} else if (instruction == PassingInstruction.Line) {
|
||||
Pair<Position, Position> pos = getLeftAndRightMarkPositions(t, w);
|
||||
Pair<Mark, Mark> pos = getPortAndStarboardMarks(t, w);
|
||||
if (pos.getA() != null && pos.getB() != null) {
|
||||
result = pos.getA().getBearingGreatCircle(pos.getB());
|
||||
}
|
||||
Position portPosition = getOrCreateTrack(pos.getA()).getEstimatedPosition(t, false);
|
||||
Position starboardPosition = getOrCreateTrack(pos.getB()).getEstimatedPosition(t, false);
|
||||
if (portPosition != null && starboardPosition != null) {
|
||||
result = portPosition.getBearingGreatCircle(starboardPosition);
|
||||
}
|
||||
}
|
||||
} else if (instruction == PassingInstruction.Offset) {
|
||||
// TODO Bug 1712
|
||||
}
|
||||
@@ -825,13 +829,13 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Position, Position> getLeftAndRightMarkPositions(TimePoint t, Waypoint w) {
|
||||
public Pair<Mark, Mark> getPortAndStarboardMarks(TimePoint t, Waypoint w) {
|
||||
List<Position> markPositions = new ArrayList<Position>();
|
||||
for (Mark lineMark : w.getMarks()) {
|
||||
final Position estimatedMarkPosition = getOrCreateTrack(lineMark).getEstimatedPosition(t, /* extrapolate */
|
||||
false);
|
||||
if (estimatedMarkPosition == null) {
|
||||
return new Pair<Position, Position>(null,null);
|
||||
return new Pair<Mark, Mark>(null,null);
|
||||
}
|
||||
markPositions.add(estimatedMarkPosition);
|
||||
}
|
||||
@@ -840,13 +844,11 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
final boolean isStartLine = indexOfWaypoint == 0;
|
||||
final Bearing legDeterminingDirectionBearing = getTrackedLeg(legs.get(isStartLine ? 0 : indexOfWaypoint - 1)).getLegBearing(t);
|
||||
if (legDeterminingDirectionBearing == null) {
|
||||
return new Pair<Position, Position>(null, null);
|
||||
return new Pair<Mark, Mark>(null, null);
|
||||
}
|
||||
Distance crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint = markPositions.get(0).crossTrackError(markPositions.get(1), legDeterminingDirectionBearing);
|
||||
final Mark starboardMarkWhileApproachingLine;
|
||||
final Mark portMarkWhileApproachingLine;
|
||||
final Position starboardMarkPositionWhileApproachingLine;
|
||||
final Position portMarkPositionWhileApproachingLine;
|
||||
if (crossTrackErrorOfMark0OnLineFromMark1ToNextWaypoint.getMeters() < 0) {
|
||||
portMarkWhileApproachingLine = Util.get(w.getMarks(), 0);
|
||||
starboardMarkWhileApproachingLine = Util.get(w.getMarks(), 1);
|
||||
@@ -854,8 +856,6 @@ DynamicTrackedRace, GPSTrackListener<Competitor, GPSFixMoving> {
|
||||
portMarkWhileApproachingLine = Util.get(w.getMarks(), 1);
|
||||
starboardMarkWhileApproachingLine = Util.get(w.getMarks(), 0);
|
||||
}
|
||||
portMarkPositionWhileApproachingLine = getOrCreateTrack(portMarkWhileApproachingLine).getEstimatedPosition(t, /* extrapolate */false);
|
||||
starboardMarkPositionWhileApproachingLine = getOrCreateTrack(starboardMarkWhileApproachingLine).getEstimatedPosition(t, /* extrapolate */false);
|
||||
return new Pair<Position, Position>(portMarkPositionWhileApproachingLine, starboardMarkPositionWhileApproachingLine);
|
||||
return new Pair<Mark, Mark>(portMarkWhileApproachingLine, starboardMarkWhileApproachingLine);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -938,7 +938,7 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<Position, Position> getLeftAndRightMarkPositions(TimePoint t, Waypoint w) {
|
||||
public Pair<Mark, Mark> getPortAndStarboardMarks(TimePoint t, Waypoint w) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,53 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
|
||||
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
|
||||
<listEntry value="com.sap.sailing.gwt.ui.RegattaOverview"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.gwt.ui"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/sapjvm_7" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/sapjvm_7"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=7999,server=y"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
|
||||
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
|
||||
<listEntry value="com.sap.sailing.gwt.ui.RegattaOverview"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.gwt.ui"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/sapjvm_7" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/sapjvm_7"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=7999,server=y"/>
|
||||
</launchConfiguration>
|
||||
@@ -1,54 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
|
||||
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
|
||||
<listEntry value="com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.gwt.ui"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" javaProject="com.sap.sailing.gwt.ui" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/TvView.html com.sap.sailing.gwt.ui.TvView -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview -startupUrl /gwt/Simulator.html com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m -XX:MaxPermSize=512m"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
|
||||
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
|
||||
<listEntry value="com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.gwt.ui"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" javaProject="com.sap.sailing.gwt.ui" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/TvView.html com.sap.sailing.gwt.ui.TvView -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview -startupUrl /gwt/Simulator.html com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m -XX:MaxPermSize=512m"/>
|
||||
</launchConfiguration>
|
||||
@@ -63,7 +63,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<version>2.3.2.0-SNAPSHOT</version>
|
||||
<version>2.3.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+4
-2
@@ -23,12 +23,14 @@ public abstract class AbstractEventManagementPanel extends AbstractRegattaPanel
|
||||
ErrorReporter errorReporter, RaceSelectionProvider raceSelectionProvider, StringMessages stringMessages) {
|
||||
super(sailingService, regattaRefresher, errorReporter, stringMessages);
|
||||
this.availableRegattas = new ArrayList<RegattaDTO>();
|
||||
|
||||
this.availableRegattasListBox = new ListBox();
|
||||
this.availableRegattasListBox.ensureDebugId("AvailableRegattas");
|
||||
this.availableRegattasListBox.ensureDebugId("AvailableRegattasListBox");
|
||||
|
||||
// TrackedEventsComposite should exist in every *ManagementPanel.
|
||||
trackedRacesListComposite = new TrackedRacesListComposite(sailingService, errorReporter, regattaRefresher,
|
||||
raceSelectionProvider, stringMessages, /* multiselection */ true);
|
||||
trackedRacesListComposite.ensureDebugId("TrackedRaces");
|
||||
trackedRacesListComposite.ensureDebugId("TrackedRacesListComposite");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-7
@@ -16,7 +16,6 @@ import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
@@ -36,6 +35,7 @@ import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
import com.sap.sailing.domain.common.impl.NaturalComparator;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionChangeListener;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaDisplayer;
|
||||
@@ -118,7 +118,7 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
raceTable = new CellTable<RaceDTO>(/* pageSize */10000, tableRes);
|
||||
raceTable.ensureDebugId("TrackedRacesTable");
|
||||
raceTable.ensureDebugId("TrackedRacesCellTable");
|
||||
ListHandler<RaceDTO> columnSortHandler = setupTableColumns(stringMessages);
|
||||
raceTable.setWidth("300px");
|
||||
raceTable.setSelectionModel(selectionModel);
|
||||
@@ -154,14 +154,14 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl
|
||||
return strings;
|
||||
}
|
||||
};
|
||||
filterablePanelRaces.getTextBox().ensureDebugId("TrackedRacesFilter");
|
||||
filterablePanelRaces.getTextBox().ensureDebugId("TrackedRacesFilterTextBox");
|
||||
filterPanel.add(filterablePanelRaces);
|
||||
HorizontalPanel trackedRacesButtonPanel = new HorizontalPanel();
|
||||
trackedRacesButtonPanel.setSpacing(10);
|
||||
panel.add(trackedRacesButtonPanel);
|
||||
|
||||
btnRefresh = new Button(stringMessages.refresh());
|
||||
btnRefresh.ensureDebugId("Refresh");
|
||||
btnRefresh.ensureDebugId("RefreshButton");
|
||||
btnRefresh.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -382,16 +382,16 @@ public abstract class AbstractTrackedRacesListComposite extends SimplePanel impl
|
||||
|
||||
if (raceIdentifiersToUpdate != null && !raceIdentifiersToUpdate.isEmpty()) {
|
||||
sailingService.updateRacesDelayToLive(raceIdentifiersToUpdate, settings.getDelayToLiveInSeconds() * 1000l,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter
|
||||
.reportError("Exception trying to set the delay to live for the selected tracked races: "
|
||||
+ caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
|
||||
+3
-3
@@ -66,7 +66,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt
|
||||
|
||||
RegattaStructureManagementPanel eventStructureManagementPanel = new RegattaStructureManagementPanel(
|
||||
sailingService, this, stringMessages, this);
|
||||
// eventStructureManagementPanel.ensureDebugId("RegattaStructureManagement");
|
||||
eventStructureManagementPanel.ensureDebugId("RegattaStructureManagement");
|
||||
eventStructureManagementPanel.setSize("90%", "90%");
|
||||
addScrollableTab(tabPanel, eventStructureManagementPanel, stringMessages.regattas());
|
||||
regattaDisplayers.add(eventStructureManagementPanel);
|
||||
@@ -104,7 +104,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt
|
||||
|
||||
TrackedRacesManagementPanel trackedRacesManagementPanel = new TrackedRacesManagementPanel(sailingService, this,
|
||||
this, stringMessages);
|
||||
// trackedRacesManagementPanel.ensureDebugId("TrackedRacesManagement");
|
||||
trackedRacesManagementPanel.ensureDebugId("TrackedRacesManagement");
|
||||
trackedRacesManagementPanel.setSize("90%", "90%");
|
||||
addScrollableTab(tabPanel, trackedRacesManagementPanel, stringMessages.trackedRaces());
|
||||
regattaDisplayers.add(trackedRacesManagementPanel);
|
||||
@@ -131,7 +131,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt
|
||||
|
||||
final LeaderboardGroupConfigPanel leaderboardGroupConfigPanel = new LeaderboardGroupConfigPanel(sailingService,
|
||||
this, this, stringMessages);
|
||||
// leaderboardGroupConfigPanel.ensureDebugId("LeaderboardGroupConfiguration");
|
||||
leaderboardGroupConfigPanel.ensureDebugId("LeaderboardGroupConfiguration");
|
||||
leaderboardGroupConfigPanel.setSize("90%", "90%");
|
||||
addScrollableTab(tabPanel, leaderboardGroupConfigPanel, stringMessages.leaderboardGroupConfiguration());
|
||||
regattaDisplayers.add(leaderboardGroupConfigPanel);
|
||||
|
||||
+7
@@ -40,9 +40,16 @@ public class FleetListEditorComposite extends ListEditorComposite<FleetDTO> {
|
||||
hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
|
||||
|
||||
final TextBox nameBox = createNameBox();
|
||||
nameBox.ensureDebugId("NameTextBox");
|
||||
|
||||
final IntegerBox orderNoBox = createOrderNoBox();
|
||||
orderNoBox.ensureDebugId("OrderNoIntegerBox");
|
||||
|
||||
final ListBox colorListBox = createColorListBox(nameBox, orderNoBox);
|
||||
colorListBox.ensureDebugId("ColorListBox");
|
||||
|
||||
final Button addButton = new Button(stringMessages.add());
|
||||
addButton.ensureDebugId("AddButton");
|
||||
addButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
+4
-3
@@ -14,10 +14,11 @@ public class FlexibleLeaderboardCreateDialog extends FlexibleLeaderboardDialog {
|
||||
super(stringMessages.createFlexibleLeaderboard(), new LeaderboardDescriptor(), stringMessages, existingEvents,
|
||||
errorReporter, new FlexibleLeaderboardDialog.LeaderboardParameterValidator(stringMessages, existingLeaderboards), callback);
|
||||
nameTextBox = createTextBox(null);
|
||||
nameTextBox.ensureDebugId("LeaderboardNameField");
|
||||
displayNameTextBox = createTextBox(null);
|
||||
displayNameTextBox.ensureDebugId("LeaderboardDisplayNameField");
|
||||
nameTextBox.ensureDebugId("NameTextBox");
|
||||
nameTextBox.setVisibleLength(50);
|
||||
|
||||
displayNameTextBox = createTextBox(null);
|
||||
displayNameTextBox.ensureDebugId("DisplayNameTextBox");
|
||||
displayNameTextBox.setVisibleLength(50);
|
||||
|
||||
scoringSchemeListBox = createScoringSchemeListBox(this, stringMessages);
|
||||
|
||||
+60
-50
@@ -198,6 +198,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
|
||||
AdminConsoleTableResources tableRes = GWT.create(AdminConsoleTableResources.class);
|
||||
leaderboardTable = new CellTable<StrippedLeaderboardDTO>(/* pageSize */10000, tableRes);
|
||||
leaderboardTable.ensureDebugId("LeaderboardsCellTable");
|
||||
filterLeaderboardPanel = new LabeledAbstractFilterablePanel<StrippedLeaderboardDTO>(lblFilterEvents, availableLeaderboardList, leaderboardTable, leaderboardList) {
|
||||
@Override
|
||||
public List<String> getSearchableStrings(StrippedLeaderboardDTO t) {
|
||||
@@ -207,7 +208,10 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
return strings;
|
||||
}
|
||||
};
|
||||
filterLeaderboardPanel.getTextBox().ensureDebugId("LeaderboardsFilterTextBox");
|
||||
|
||||
leaderboardRemoveButton = new Button(stringMessages.remove());
|
||||
leaderboardRemoveButton.ensureDebugId("LeaderboardsRemoveButton");
|
||||
leaderboardRemoveButton.setEnabled(false);
|
||||
leaderboardRemoveButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
@@ -220,7 +224,6 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
leaderboardConfigControlsPanel.add(filterLeaderboardPanel);
|
||||
leaderboardConfigControlsPanel.add(leaderboardRemoveButton);
|
||||
leaderboardsPanel.add(leaderboardConfigControlsPanel);
|
||||
leaderboardTable.ensureDebugId("AvailableLeaderboardsTable");
|
||||
ListHandler<StrippedLeaderboardDTO> leaderboardColumnListHandler = new ListHandler<StrippedLeaderboardDTO>(
|
||||
leaderboardList.getList());
|
||||
|
||||
@@ -387,6 +390,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
});
|
||||
leaderboardList.addDataDisplay(leaderboardTable);
|
||||
leaderboardsPanel.add(leaderboardTable);
|
||||
|
||||
HorizontalPanel leaderboardButtonPanel = new HorizontalPanel();
|
||||
leaderboardButtonPanel.setSpacing(5);
|
||||
leaderboardsPanel.add(leaderboardButtonPanel);
|
||||
@@ -414,6 +418,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
|
||||
// caption panels for the selected leaderboard and tracked races
|
||||
HorizontalPanel splitPanel = new HorizontalPanel();
|
||||
splitPanel.ensureDebugId("LeaderboardDetailsPanel");
|
||||
mainPanel.add(splitPanel);
|
||||
|
||||
selectedLeaderBoardPanel = new CaptionPanel(stringMessages.leaderboard());
|
||||
@@ -436,12 +441,13 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
raceSelectionProvider = new RaceSelectionModel();
|
||||
trackedRacesListComposite = new TrackedRacesListComposite(sailingService, errorReporter, adminConsole,
|
||||
raceSelectionProvider, stringMessages, /* multiselection */false);
|
||||
trackedRacesListComposite.ensureDebugId("TrackedRaces");
|
||||
trackedRacesListComposite.ensureDebugId("TrackedRacesListComposite");
|
||||
trackedRacesPanel.add(trackedRacesListComposite);
|
||||
trackedRacesListComposite.addTrackedRaceChangeListener(this);
|
||||
raceSelectionProvider.addRaceSelectionChangeListener(this);
|
||||
|
||||
Button reloadAllRaceLogs = new Button(stringMessages.reloadAllRaceLogs());
|
||||
reloadAllRaceLogs.ensureDebugId("ReloadAllRaceLogsButton");
|
||||
reloadAllRaceLogs.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -543,7 +549,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
Label lblRaceNamesIn = new Label(stringMessages.races());
|
||||
vPanel.add(lblRaceNamesIn);
|
||||
raceColumnTable = new CellTable<RaceColumnDTOAndFleetDTOWithNameBasedEquality>(/* pageSize */200, tableRes);
|
||||
raceColumnTable.ensureDebugId("RaceColumnTable");
|
||||
raceColumnTable.ensureDebugId("RacesCellTable");
|
||||
raceColumnTable.addColumn(raceLinkColumn, stringMessages.name());
|
||||
raceColumnTable.addColumn(fleetNameColumn, stringMessages.fleet());
|
||||
raceColumnTable.addColumn(isMedalRaceCheckboxColumn, stringMessages.medalRace());
|
||||
@@ -566,8 +572,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
vPanel.add(selectedLeaderboardRaceButtonPanel);
|
||||
|
||||
addRaceColumnsButton = new Button(stringMessages.actionAddRaces() + "...");
|
||||
addRaceColumnsButton.ensureDebugId("AddRaceColumnsButton");
|
||||
selectedLeaderboardRaceButtonPanel.add(addRaceColumnsButton);
|
||||
addRaceColumnsButton.ensureDebugId("AddRacesButton");
|
||||
addRaceColumnsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -578,23 +583,27 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
}
|
||||
});
|
||||
selectedLeaderboardRaceButtonPanel.add(addRaceColumnsButton);
|
||||
|
||||
columnMoveUpButton = new Button(stringMessages.columnMoveUp());
|
||||
selectedLeaderboardRaceButtonPanel.add(columnMoveUpButton);
|
||||
columnMoveUpButton.ensureDebugId("MoveRaceUpButton");
|
||||
columnMoveUpButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
moveSelectedRaceColumnUp();
|
||||
}
|
||||
});
|
||||
selectedLeaderboardRaceButtonPanel.add(columnMoveUpButton);
|
||||
|
||||
columnMoveDownButton = new Button(stringMessages.columnMoveDown());
|
||||
selectedLeaderboardRaceButtonPanel.add(columnMoveDownButton);
|
||||
columnMoveDownButton.ensureDebugId("MoveRaceDownButton");
|
||||
columnMoveDownButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
moveSelectedRaceColumnDown();
|
||||
}
|
||||
});
|
||||
selectedLeaderboardRaceButtonPanel.add(columnMoveDownButton);
|
||||
|
||||
loadLeaderboards();
|
||||
}
|
||||
@@ -645,9 +654,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
|
||||
public void loadLeaderboards() {
|
||||
sailingService.getLeaderboards(new AsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
sailingService.getLeaderboards(new MarkedAsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
public void handleSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
leaderboardList.getList().clear();
|
||||
availableLeaderboardList.clear();
|
||||
leaderboardList.getList().addAll(leaderboards);
|
||||
@@ -658,7 +667,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
LeaderboardConfigPanel.this.errorReporter.reportError("Error trying to obtain list of leaderboards: "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@@ -671,9 +680,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
* after the refresh has successfully completed. See {@link #selectRaceColumn(String)}.
|
||||
*/
|
||||
public void loadAndRefreshLeaderboard(final String leaderboardName, final String nameOfRaceColumnToSelect) {
|
||||
sailingService.getLeaderboard(leaderboardName, new AsyncCallback<StrippedLeaderboardDTO>() {
|
||||
sailingService.getLeaderboard(leaderboardName, new MarkedAsyncCallback<StrippedLeaderboardDTO>() {
|
||||
@Override
|
||||
public void onSuccess(StrippedLeaderboardDTO leaderboard) {
|
||||
public void handleSuccess(StrippedLeaderboardDTO leaderboard) {
|
||||
for (StrippedLeaderboardDTO leaderboardDTO : leaderboardSelectionModel.getSelectedSet()) {
|
||||
if (leaderboardDTO.name.equals(leaderboardName)) {
|
||||
leaderboardSelectionModel.setSelected(leaderboardDTO, false);
|
||||
@@ -691,7 +700,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
LeaderboardConfigPanel.this.errorReporter.reportError("Error trying to update leaderboard with name " + leaderboardName + " : "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@@ -714,15 +723,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
private void unlinkRaceColumnFromTrackedRace(final String raceColumnName, final FleetDTO fleet) {
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
sailingService.disconnectLeaderboardColumnFromTrackedRace(selectedLeaderboardName, raceColumnName, fleet.getName(),
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to unlink tracked race from column " + raceColumnName
|
||||
+ " from leaderboard " + selectedLeaderboardName + ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void arg0) {
|
||||
public void handleSuccess(Void arg0) {
|
||||
trackedRacesListComposite.clearSelection();
|
||||
getSelectedRaceColumnWithFleet().getA().setRaceIdentifier(fleet, null);
|
||||
raceColumnAndFleetList.refresh();
|
||||
@@ -784,15 +793,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
|
||||
private void refreshRaceLog(final RaceColumnDTO raceColumnDTO, final FleetDTO fleet, final boolean showAlerts) {
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
sailingService.reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet, new AsyncCallback<Void>() {
|
||||
sailingService.reloadRaceLog(selectedLeaderboardName, raceColumnDTO, fleet, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
if (showAlerts) {
|
||||
errorReporter.reportError(caught.getMessage());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
if (showAlerts) {
|
||||
Window.alert(stringMessages.raceLogReloaded());
|
||||
}
|
||||
@@ -804,15 +813,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
final String raceColumnString = raceColumnDTO.getRaceColumnName();
|
||||
sailingService.removeLeaderboardColumn(getSelectedLeaderboardName(), raceColumnString,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to remove leaderboard race column " + raceColumnDTO
|
||||
+ " in leaderboard " + getSelectedLeaderboardName() + ": " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void arg0) {
|
||||
public void handleSuccess(Void arg0) {
|
||||
loadAndRefreshLeaderboard(selectedLeaderboardName, /* raceColumnNameToSelect */ null);
|
||||
}
|
||||
});
|
||||
@@ -826,16 +835,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
final String selectedRaceColumnName = raceColumnTableSelectionModel.getSelectedObject().getA().getRaceColumnName();
|
||||
sailingService.moveLeaderboardColumnDown(getSelectedLeaderboardName(), selectedRaceColumnName,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to move leaderboard race column "
|
||||
+ selectedRaceColumnName + " in leaderboard " + getSelectedLeaderboardName()
|
||||
+ " down: " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
loadAndRefreshLeaderboard(selectedLeaderboardName, selectedRaceColumnName);
|
||||
}
|
||||
});
|
||||
@@ -849,16 +858,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
final String selectedLeaderboardName = getSelectedLeaderboardName();
|
||||
final String selectedRaceColumnName = raceColumnTableSelectionModel.getSelectedObject().getA().getRaceColumnName();
|
||||
sailingService.moveLeaderboardColumnUp(getSelectedLeaderboardName(), selectedRaceColumnName,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to move leaderboard race column "
|
||||
+ selectedRaceColumnName + " in leaderboard " + getSelectedLeaderboardName() + " up: "
|
||||
+ caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
loadAndRefreshLeaderboard(selectedLeaderboardName, selectedRaceColumnName);
|
||||
}
|
||||
});
|
||||
@@ -894,16 +903,16 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
final String selectedRaceColumnName = selectedRaceColumnAndFleetNameInLeaderboard.getA().getRaceColumnName();
|
||||
final String selectedFleetName = selectedRaceColumnAndFleetNameInLeaderboard.getB().getName();
|
||||
sailingService.getRegattaAndRaceNameOfTrackedRaceConnectedToLeaderboardColumn(selectedLeaderboardName,
|
||||
selectedRaceColumnName, new AsyncCallback<Map<String, RegattaAndRaceIdentifier>>() {
|
||||
selectedRaceColumnName, new MarkedAsyncCallback<Map<String, RegattaAndRaceIdentifier>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to determine tracked race linked to race column "
|
||||
+ selectedRaceColumnName + " in leaderboard " + selectedLeaderboardName + ": "
|
||||
+ t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, RegattaAndRaceIdentifier> regattaAndRaceNamesPerFleet) {
|
||||
public void handleSuccess(Map<String, RegattaAndRaceIdentifier> regattaAndRaceNamesPerFleet) {
|
||||
if (regattaAndRaceNamesPerFleet != null && !regattaAndRaceNamesPerFleet.isEmpty()) {
|
||||
RegattaAndRaceIdentifier raceIdentifier = regattaAndRaceNamesPerFleet
|
||||
.get(selectedFleetName);
|
||||
@@ -997,14 +1006,14 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
private void setIsMedalRace(String leaderboardName, final RaceColumnDTO raceInLeaderboard,
|
||||
final boolean isMedalRace) {
|
||||
sailingService.updateIsMedalRace(leaderboardName, raceInLeaderboard.getRaceColumnName(), isMedalRace,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError(stringMessages.errorUpdatingIsMedalRace(caught.getMessage()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
getSelectedLeaderboard().setIsMedalRace(raceInLeaderboard.getRaceColumnName(), isMedalRace);
|
||||
}
|
||||
});
|
||||
@@ -1040,15 +1049,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
}
|
||||
|
||||
sailingService.addColumnsToLeaderboard(leaderboardName, raceColumnsToAdd, new AsyncCallback<Void>() {
|
||||
sailingService.addColumnsToLeaderboard(leaderboardName, raceColumnsToAdd, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to add race columns to leaderboard " + leaderboardName
|
||||
+ ": " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
public void handleSuccess(Void v) {
|
||||
loadAndRefreshLeaderboard(leaderboardName, /* nameOfRaceColumnToSelect */ null);
|
||||
}
|
||||
});
|
||||
@@ -1156,7 +1165,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
});
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("CreateFlexibleLeaderboardDialog");
|
||||
dialog.ensureDebugId("FlexibleLeaderboardCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -1185,6 +1194,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
});
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("RegattaLeaderboardCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@@ -1197,15 +1207,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
|
||||
private void updateLeaderboard(final String oldLeaderboardName, final LeaderboardDescriptor leaderboardToUpdate) {
|
||||
sailingService.updateLeaderboard(oldLeaderboardName, leaderboardToUpdate.getName(), leaderboardToUpdate.getDisplayName(),
|
||||
leaderboardToUpdate.getDiscardThresholds(), leaderboardToUpdate.getCourseAreaId(), new AsyncCallback<StrippedLeaderboardDTO>() {
|
||||
leaderboardToUpdate.getDiscardThresholds(), leaderboardToUpdate.getCourseAreaId(), new MarkedAsyncCallback<StrippedLeaderboardDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to update leaderboard " + oldLeaderboardName + ": "
|
||||
+ t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(StrippedLeaderboardDTO updatedLeaderboard) {
|
||||
public void handleSuccess(StrippedLeaderboardDTO updatedLeaderboard) {
|
||||
int indexOfLeaderboard = 0;
|
||||
for (int i = 0; i < leaderboardList.getList().size(); i++) {
|
||||
StrippedLeaderboardDTO dao = leaderboardList.getList().get(i);
|
||||
@@ -1226,17 +1236,17 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
for (StrippedLeaderboardDTO leaderboard : leaderboards) {
|
||||
leaderboardNames.add(leaderboard.name);
|
||||
}
|
||||
sailingService.removeLeaderboards(leaderboardNames, new AsyncCallback<Void>() {
|
||||
sailingService.removeLeaderboards(leaderboardNames, new MarkedAsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to remove the leaderboards:" + caught.getMessage());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
for (StrippedLeaderboardDTO leaderboard : leaderboards) {
|
||||
removeLeaderboardFromTable(leaderboard);
|
||||
}
|
||||
@@ -1246,15 +1256,15 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
|
||||
private void removeLeaderboard(final StrippedLeaderboardDTO leaderBoard) {
|
||||
sailingService.removeLeaderboard(leaderBoard.name, new AsyncCallback<Void>() {
|
||||
sailingService.removeLeaderboard(leaderBoard.name, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to remove leaderboard " + leaderBoard.name + ": "
|
||||
+ caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
removeLeaderboardFromTable(leaderBoard);
|
||||
}
|
||||
});
|
||||
@@ -1286,9 +1296,9 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
final FleetDTO fleet, final RegattaAndRaceIdentifier selectedRace) {
|
||||
sailingService.connectTrackedRaceToLeaderboardColumn(getSelectedLeaderboardName(), selectedRaceInLeaderboard
|
||||
.getRaceColumnName(), fleet.getName(), selectedRace,
|
||||
new AsyncCallback<Boolean>() {
|
||||
new MarkedAsyncCallback<Boolean>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to link tracked race " + selectedRace + " to race column named "
|
||||
+ selectedRaceInLeaderboard.getRaceColumnName() + " of leaderboard "
|
||||
+ getSelectedLeaderboardName() + ": " + t.getMessage());
|
||||
@@ -1296,7 +1306,7 @@ public class LeaderboardConfigPanel extends FormPanel implements SelectedLeaderb
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean success) {
|
||||
public void handleSuccess(Boolean success) {
|
||||
if (success) {
|
||||
// TODO consider enabling the Unlink button
|
||||
selectedRaceInLeaderboard.setRaceIdentifier(fleet, selectedRace);
|
||||
|
||||
+47
-25
@@ -20,7 +20,6 @@ import com.google.gwt.user.cellview.client.Column;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||
import com.google.gwt.user.cellview.client.TextColumn;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CaptionPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
@@ -39,6 +38,7 @@ import com.sap.sailing.gwt.ui.adminconsole.LeaderboardGroupDialog.LeaderboardGro
|
||||
import com.sap.sailing.gwt.ui.client.AbstractRegattaPanel;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.LeaderboardGroupRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -111,6 +111,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
mainPanel.add(createLeaderboardGroupsGUI(tableRes));
|
||||
|
||||
splitPanel = new HorizontalPanel();
|
||||
splitPanel.ensureDebugId("LeaderboardGroupDetailsPanel");
|
||||
splitPanel.setSpacing(5);
|
||||
splitPanel.setWidth("100%");
|
||||
splitPanel.setVisible(false);
|
||||
@@ -132,6 +133,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
switchLeaderboardsPanel.setWidth("5%");
|
||||
|
||||
moveToGroupButton = new Button("<-");
|
||||
moveToGroupButton.ensureDebugId("AddLeaderboardButton");
|
||||
moveToGroupButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -142,6 +144,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
switchLeaderboardsPanel.add(moveToGroupButton);
|
||||
|
||||
moveToLeaderboardsButton = new Button("->");
|
||||
moveToLeaderboardsButton.ensureDebugId("RemoveLeaderboardButton");
|
||||
moveToLeaderboardsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -167,10 +170,12 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
leaderboardsPanel.add(leaderboardsFunctionPanel);
|
||||
Label filterLeaderboardsLabel = new Label(stringMessages.filterLeaderboardsByName() + ":");
|
||||
leaderboardsFunctionPanel.add(filterLeaderboardsLabel);
|
||||
|
||||
// Create leaderboards table
|
||||
leaderboardsProvider = new ListDataProvider<StrippedLeaderboardDTO>();
|
||||
ListHandler<StrippedLeaderboardDTO> leaderboardsListHandler = new ListHandler<StrippedLeaderboardDTO>(leaderboardsProvider.getList());
|
||||
leaderboardsTable = new CellTable<StrippedLeaderboardDTO>(10000, tableRes);
|
||||
leaderboardsTable.ensureDebugId("LeaderboardsCellTable");
|
||||
leaderboardsFilterablePanel = new LabeledAbstractFilterablePanel<StrippedLeaderboardDTO>(filterLeaderboardsLabel, availableLeaderboards, leaderboardsTable, leaderboardsProvider) {
|
||||
@Override
|
||||
public Iterable<String> getSearchableStrings(StrippedLeaderboardDTO t) {
|
||||
@@ -180,8 +185,11 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
return strings;
|
||||
}
|
||||
};
|
||||
leaderboardsFilterablePanel.getTextBox().ensureDebugId("LeaderboardsFilterTextBox");
|
||||
leaderboardsFunctionPanel.add(leaderboardsFilterablePanel);
|
||||
|
||||
Button refreshLeaderboardsButton = new Button(stringMessages.refresh());
|
||||
refreshLeaderboardsButton.ensureDebugId("RefreshLeaderboardsButton");
|
||||
refreshLeaderboardsButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -189,6 +197,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
}
|
||||
});
|
||||
leaderboardsFunctionPanel.add(refreshLeaderboardsButton);
|
||||
|
||||
TextColumn<StrippedLeaderboardDTO> leaderboardsNameColumn = new TextColumn<StrippedLeaderboardDTO>() {
|
||||
@Override
|
||||
public String getValue(StrippedLeaderboardDTO leaderboard) {
|
||||
@@ -256,6 +265,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
descriptionCaptionPanel.add(descriptionPanel);
|
||||
|
||||
descriptionTextArea = new TextArea();
|
||||
descriptionTextArea.ensureDebugId("DescriptionTextArea");
|
||||
descriptionTextArea.setCharacterWidth(60);
|
||||
descriptionTextArea.setVisibleLines(8);
|
||||
descriptionTextArea.getElement().getStyle().setProperty("resize", "none");
|
||||
@@ -267,6 +277,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
descriptionPanel.add(descriptionFunctionsPanel);
|
||||
|
||||
editDescriptionButton = new Button(stringMessages.edit());
|
||||
editDescriptionButton.ensureDebugId("EditDescriptionButton");
|
||||
editDescriptionButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -276,6 +287,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
descriptionFunctionsPanel.add(editDescriptionButton);
|
||||
|
||||
abortDescriptionButton = new Button(stringMessages.abort());
|
||||
abortDescriptionButton.ensureDebugId("AbortButton");
|
||||
abortDescriptionButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -291,6 +303,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
descriptionFunctionsPanel.add(abortDescriptionButton);
|
||||
|
||||
saveDescriptionButton = new Button(stringMessages.save());
|
||||
saveDescriptionButton.ensureDebugId("SaveButton");
|
||||
saveDescriptionButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -326,6 +339,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
};
|
||||
|
||||
groupDetailsTable = new CellTable<StrippedLeaderboardDTO>(10000, tableRes);
|
||||
groupDetailsTable.ensureDebugId("LeaderboardGroupsCellTable");
|
||||
groupDetailsTable.setWidth("100%");
|
||||
groupDetailsTable.addColumn(groupDetailsNameColumn, stringMessages.leaderboardName());
|
||||
groupDetailsTable.addColumn(groupDetailsRacesColumn, stringMessages.races());
|
||||
@@ -352,6 +366,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
groupDetailsPanel.add(groupDetailsFunctionPanel);
|
||||
|
||||
leaderboardUpButton = new Button(stringMessages.columnMoveUp());
|
||||
leaderboardUpButton.ensureDebugId("MoveLeaderboardGroupUpButton");
|
||||
leaderboardUpButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -362,6 +377,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
groupDetailsFunctionPanel.add(leaderboardUpButton);
|
||||
|
||||
leaderboardDownButton = new Button(stringMessages.columnMoveDown());
|
||||
leaderboardDownButton.ensureDebugId("MoveLeaderboardGroupDownButton");
|
||||
leaderboardDownButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -392,6 +408,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
groupsProvider = new ListDataProvider<LeaderboardGroupDTO>();
|
||||
ListHandler<LeaderboardGroupDTO> leaderboardGroupsListHandler = new ListHandler<LeaderboardGroupDTO>(groupsProvider.getList());
|
||||
groupsTable = new CellTable<LeaderboardGroupDTO>(10000, tableRes);
|
||||
groupsTable.ensureDebugId("LeaderboardGroupsCellTable");
|
||||
groupsFilterablePanel = new LabeledAbstractFilterablePanel<LeaderboardGroupDTO>(filterLeaderboardGroupsLbl, availableLeaderboardGroups, groupsTable, groupsProvider) {
|
||||
@Override
|
||||
public Iterable<String> getSearchableStrings(LeaderboardGroupDTO t) {
|
||||
@@ -400,8 +417,11 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
return string;
|
||||
}
|
||||
};
|
||||
groupsFilterablePanel.getTextBox().ensureDebugId("LeaderboardGroupsFilterTextBox");
|
||||
leaderboardGroupsFunctionPanel.add(groupsFilterablePanel);
|
||||
|
||||
Button createGroupButton = new Button(stringMessages.createNewLeaderboardGroup());
|
||||
createGroupButton.ensureDebugId("CreateLeaderboardGroupButton");
|
||||
createGroupButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -411,6 +431,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
leaderboardGroupsFunctionPanel.add(createGroupButton);
|
||||
|
||||
removeButton = new Button(stringMessages.remove());
|
||||
removeButton.ensureDebugId("RemoveLeaderboardButton");
|
||||
removeButton.setEnabled(false);
|
||||
removeButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
@@ -519,9 +540,9 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
}
|
||||
|
||||
public void fillLeaderboardGroups() {
|
||||
sailingService.getLeaderboardGroups(false /*withGeoLocationData*/, new AsyncCallback<List<LeaderboardGroupDTO>>() {
|
||||
sailingService.getLeaderboardGroups(false /*withGeoLocationData*/, new MarkedAsyncCallback<List<LeaderboardGroupDTO>>() {
|
||||
@Override
|
||||
public void onSuccess(List<LeaderboardGroupDTO> groups) {
|
||||
public void handleSuccess(List<LeaderboardGroupDTO> groups) {
|
||||
availableLeaderboardGroups.clear();
|
||||
if (groups != null) {
|
||||
availableLeaderboardGroups.addAll(groups);
|
||||
@@ -530,20 +551,20 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
groupsProvider.getList().addAll(availableLeaderboardGroups);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to obtain list of leaderboard groups: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadLeaderboards() {
|
||||
sailingService.getLeaderboards(new AsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
sailingService.getLeaderboards(new MarkedAsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to obtain list of leaderboards: " + t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
public void handleSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
availableLeaderboards.clear();
|
||||
if (leaderboards != null) {
|
||||
availableLeaderboards.addAll(leaderboards);
|
||||
@@ -564,14 +585,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
final LeaderboardGroupDTO selectedGroup = getSelectedGroup();
|
||||
final Set<StrippedLeaderboardDTO> selectedLeaderboards = leaderboardsSelectionModel.getSelectedSet();
|
||||
if (isSingleGroupSelected && selectedGroup != null) {
|
||||
sailingService.getLeaderboards(new AsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
sailingService.getLeaderboards(new MarkedAsyncCallback<List<StrippedLeaderboardDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to obtain list of leaderboards: " + t.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
public void handleSuccess(List<StrippedLeaderboardDTO> leaderboards) {
|
||||
availableLeaderboards.clear();
|
||||
if (leaderboards != null) {
|
||||
availableLeaderboards.addAll(leaderboards);
|
||||
@@ -600,20 +621,21 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
createNewGroup(newGroup);
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("LeaderboardGroupCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void createNewGroup(final LeaderboardGroupDescriptor newGroup) {
|
||||
sailingService.createLeaderboardGroup(newGroup.getName(), newGroup.getDescription(), newGroup.isDisplayLeaderboardsInReverseOrder(),
|
||||
newGroup.getOverallLeaderboardDiscardThresholds(),
|
||||
newGroup.getOverallLeaderboardScoringSchemeType(), new AsyncCallback<LeaderboardGroupDTO>() {
|
||||
newGroup.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback<LeaderboardGroupDTO>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to create new leaderboard group" + newGroup.getName()
|
||||
+ ": " + t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(LeaderboardGroupDTO newGroup) {
|
||||
public void handleSuccess(LeaderboardGroupDTO newGroup) {
|
||||
availableLeaderboardGroups.add(newGroup);
|
||||
groupsProvider.getList().add(newGroup);
|
||||
groupsSelectionModel.clear();
|
||||
@@ -629,14 +651,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
}
|
||||
sailingService.updateLeaderboardGroup(oldGroupName, updateDescriptor.getName(), updateDescriptor.getDescription(),
|
||||
leaderboardNames, updateDescriptor.getOverallLeaderboardDiscardThresholds(),
|
||||
updateDescriptor.getOverallLeaderboardScoringSchemeType(), new AsyncCallback<Void>() {
|
||||
updateDescriptor.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to update leaderboard group " + oldGroupName + ": "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
public void handleSuccess(Void v) {
|
||||
// Update the availableLeaderboardGroups and the list of displayed groups
|
||||
for (int i = 0; i < availableLeaderboardGroups.size(); i++) {
|
||||
LeaderboardGroupDTO group = availableLeaderboardGroups.get(i);
|
||||
@@ -668,14 +690,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
}
|
||||
sailingService.updateLeaderboardGroup(group.getName(), group.getName(), group.description,
|
||||
leaderboardNames, group.getOverallLeaderboardDiscardThresholds(),
|
||||
group.getOverallLeaderboardScoringSchemeType(), new AsyncCallback<Void>() {
|
||||
group.getOverallLeaderboardScoringSchemeType(), new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to update leaderboard group " + group.getName() + ": "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
public void handleSuccess(Void v) {
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -686,14 +708,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
for (LeaderboardGroupDTO group : groups) {
|
||||
groupNames.add(group.getName());
|
||||
}
|
||||
sailingService.removeLeaderboardGroups(groupNames, new AsyncCallback<Void>() {
|
||||
sailingService.removeLeaderboardGroups(groupNames, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to remove the leaderboard groups: "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
for (LeaderboardGroupDTO group : groups) {
|
||||
removeGroupFromTable(group);
|
||||
}
|
||||
@@ -705,14 +727,14 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
|
||||
private void removeLeaderboardGroup(final LeaderboardGroupDTO group) {
|
||||
Set<String> groups = new HashSet<String>();
|
||||
groups.add(group.getName());
|
||||
sailingService.removeLeaderboardGroups(groups, new AsyncCallback<Void>() {
|
||||
sailingService.removeLeaderboardGroups(groups, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
errorReporter.reportError("Error trying to remove leaderboard group " + group.getName() + ": "
|
||||
+ t.getMessage());
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
public void handleSuccess(Void v) {
|
||||
removeGroupFromTable(group);
|
||||
}
|
||||
});
|
||||
|
||||
+6
-2
@@ -12,8 +12,12 @@ public class LeaderboardGroupCreateDialog extends LeaderboardGroupDialog {
|
||||
super(new LeaderboardGroupDTO(), stringMessages,
|
||||
callback, existingGroups);
|
||||
nameEntryField = createTextBox(null, 50);
|
||||
descriptionEntryField = createTextArea(null);
|
||||
nameEntryField.ensureDebugId("NameTextBox");
|
||||
|
||||
descriptionEntryField = createTextArea(null);
|
||||
descriptionEntryField.ensureDebugId("DescriptionTextArea");
|
||||
|
||||
displayLeaderboardsInReverseOrderCheckBox.setValue(false);
|
||||
useOverallLeaderboardCheckBox.setValue(false);
|
||||
useOverallLeaderboardCheckBox.setValue(false);
|
||||
}
|
||||
}
|
||||
+6
@@ -123,8 +123,14 @@ public class LeaderboardGroupDialog extends DataEntryDialog<LeaderboardGroupDial
|
||||
super(stringMessages.leaderboardGroup(), null, stringMessages.ok(), stringMessages.cancel(),
|
||||
new LeaderboardGroupParameterValidator(stringMessages, existingLeaderboardGroups), callback);
|
||||
this.stringMessages = stringMessages;
|
||||
|
||||
displayLeaderboardsInReverseOrderCheckBox = createCheckbox(stringMessages.displayGroupsInReverseOrder());
|
||||
// QUESTION [Riccardo]: Are this groups or leaderboards?
|
||||
displayLeaderboardsInReverseOrderCheckBox.ensureDebugId("DisplayGroupsInReverseOrderCheckBox");
|
||||
|
||||
useOverallLeaderboardCheckBox = createCheckbox(stringMessages.useOverallLeaderboard());
|
||||
useOverallLeaderboardCheckBox.ensureDebugId("UseOverallLeaderboardCheckBox");
|
||||
|
||||
Grid formGrid = new Grid(3,2);
|
||||
formGrid.setCellSpacing(3);
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.scoringSystem() + ":"));
|
||||
|
||||
+2
-1
@@ -81,8 +81,9 @@ public class RaceColumnsInLeaderboardDialog extends DataEntryDialog<List<RaceCol
|
||||
this.existingRaces = existingRaces;
|
||||
this.stringMessages = stringMessages;
|
||||
addRacesListBox = createListBox(false);
|
||||
addRacesListBox.ensureDebugId("AddRacesListBox");
|
||||
addRacesListBox.ensureDebugId("NumberOfRacesListBox");
|
||||
raceNamePrefixTextBox = createTextBox(null);
|
||||
raceNamePrefixTextBox.ensureDebugId("RaceNamePrefixTextBox");
|
||||
raceNameEntryFields = new ArrayList<TextBox>();
|
||||
isMedalRaceCheckboxes = new ArrayList<CheckBox>();
|
||||
raceColumnsGrid = new Grid(0, 0);
|
||||
|
||||
+15
-1
@@ -69,22 +69,34 @@ public class RegattaDetailsComposite extends Composite {
|
||||
mainPanel.add(vPanel);
|
||||
Grid grid = new Grid(5, 2);
|
||||
vPanel.add(grid);
|
||||
|
||||
regattaName = new Label();
|
||||
regattaName.ensureDebugId("NameLabel");
|
||||
grid.setWidget(0 , 0, new Label(stringMessages.regattaName() + ":"));
|
||||
grid.setWidget(0 , 1, regattaName);
|
||||
|
||||
boatClassName = new Label();
|
||||
boatClassName.ensureDebugId("BoatClassLabel");
|
||||
grid.setWidget(1 , 0, new Label(stringMessages.boatClass() + ":"));
|
||||
grid.setWidget(1 , 1, boatClassName);
|
||||
|
||||
defaultCourseArea = new Label();
|
||||
defaultCourseArea.ensureDebugId("CourseAreaLabel");
|
||||
grid.setWidget(2 , 0, new Label(stringMessages.courseArea() + ":"));
|
||||
grid.setWidget(2 , 1, defaultCourseArea);
|
||||
|
||||
configuration = new Label();
|
||||
configuration.ensureDebugId("RacingProcedureLabel");
|
||||
grid.setWidget(3, 0, new Label(stringMessages.racingProcedureConfiguration() + ":"));
|
||||
grid.setWidget(3, 1, configuration);;
|
||||
grid.setWidget(3, 1, configuration);
|
||||
|
||||
scoringSystem = new Label();
|
||||
scoringSystem.ensureDebugId("ScoringSystemLabel");
|
||||
grid.setWidget(4 , 0, new Label(stringMessages.scoringSystem() + ":"));
|
||||
grid.setWidget(4 , 1, scoringSystem);
|
||||
|
||||
seriesTable = createRegattaSeriesTable();
|
||||
seriesTable.ensureDebugId("SeriesCellTable");
|
||||
seriesSelectionModel = new SingleSelectionModel<SeriesDTO>();
|
||||
seriesSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
@@ -95,6 +107,7 @@ public class RegattaDetailsComposite extends Composite {
|
||||
seriesListDataProvider = new ListDataProvider<SeriesDTO>();
|
||||
seriesListDataProvider.addDataDisplay(seriesTable);
|
||||
vPanel.add(seriesTable);
|
||||
|
||||
initWidget(mainPanel);
|
||||
}
|
||||
|
||||
@@ -247,6 +260,7 @@ public class RegattaDetailsComposite extends Composite {
|
||||
updateRacesOfRegattaSeries(regatta, result);
|
||||
}
|
||||
});
|
||||
raceDialog.ensureDebugId("SeriesEditDialog");
|
||||
raceDialog.show();
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -16,14 +16,17 @@ public class RegattaLeaderboardCreateDialog extends RegattaLeaderboardDialog {
|
||||
super(stringMessages.createRegattaLeaderboard(), new LeaderboardDescriptor(), existingRegattas, stringMessages, errorReporter, new RegattaLeaderboardDialog.LeaderboardParameterValidator(stringMessages, existingLeaderboards), callback);
|
||||
|
||||
nameTextBox = createTextBox(null);
|
||||
displayNameTextBox = createTextBox(null);
|
||||
|
||||
nameTextBox.ensureDebugId("NameTextBox");
|
||||
nameTextBox.setVisibleLength(50);
|
||||
// the name of the regatta leaderboard will be derived from the selected regatta
|
||||
nameTextBox.setEnabled(false);
|
||||
nameTextBox.setVisibleLength(50);
|
||||
|
||||
displayNameTextBox = createTextBox(null);
|
||||
displayNameTextBox.ensureDebugId("DisplayNameTextBox");
|
||||
displayNameTextBox.setVisibleLength(50);
|
||||
|
||||
regattaListBox = createSortedRegattaListBox(existingRegattas, null);
|
||||
regattaListBox.ensureDebugId("RegattaListBox");
|
||||
regattaListBox.addChangeHandler(new ChangeHandler() {
|
||||
public void onChange(ChangeEvent event) {
|
||||
int selectedIndex = regattaListBox.getSelectedIndex();
|
||||
|
||||
+12
-7
@@ -28,6 +28,7 @@ import com.sap.sailing.domain.common.RegattaIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaName;
|
||||
import com.sap.sailing.domain.common.impl.NaturalComparator;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaSelectionProvider;
|
||||
@@ -81,10 +82,13 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer
|
||||
Label filterRegattasLabel = new Label(stringMessages.filterRegattasByName() + ":");
|
||||
filterRegattasLabel.setWordWrap(false);
|
||||
noRegattasLabel = new Label(stringMessages.noRegattasYet());
|
||||
noRegattasLabel.ensureDebugId("NoRegattasLabel");
|
||||
noRegattasLabel.setWordWrap(false);
|
||||
panel.add(noRegattasLabel);
|
||||
|
||||
regattaListDataProvider = new ListDataProvider<RegattaDTO>();
|
||||
regattaTable = createRegattaTable();
|
||||
regattaTable.ensureDebugId("RegattasCellTable");
|
||||
regattaTable.setVisible(false);
|
||||
filterablePanelRegattas = new LabeledAbstractFilterablePanel<RegattaDTO>(filterRegattasLabel, allRegattas,
|
||||
regattaTable, regattaListDataProvider) {
|
||||
@@ -96,7 +100,9 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer
|
||||
return string;
|
||||
}
|
||||
};
|
||||
filterablePanelRegattas.getTextBox().ensureDebugId("ReggatasFilterTextBox");
|
||||
panel.add(filterablePanelRegattas);
|
||||
|
||||
regattaSelectionModel = new MultiSelectionModel<RegattaDTO>();
|
||||
regattaSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
|
||||
@Override
|
||||
@@ -191,14 +197,14 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer
|
||||
|
||||
private void editRegatta(final RegattaDTO toBeEdited) {
|
||||
final Collection<RegattaDTO> existingRegattas = getAllRegattas();
|
||||
sailingService.getEvents(new AsyncCallback<List<EventDTO>>() {
|
||||
sailingService.getEvents(new MarkedAsyncCallback<List<EventDTO>>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
openEditRegattaDialog(toBeEdited, existingRegattas, Collections.<EventDTO> emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<EventDTO> events) {
|
||||
public void handleSuccess(List<EventDTO> events) {
|
||||
openEditRegattaDialog(toBeEdited, existingRegattas, Collections.unmodifiableList(events));
|
||||
}
|
||||
});
|
||||
@@ -223,15 +229,14 @@ public class RegattaListComposite extends Composite implements RegattaDisplayer
|
||||
final RegattaIdentifier regattaName = new RegattaName(editedRegatta.getName());
|
||||
|
||||
sailingService.updateRegatta(regattaName, editedRegatta.defaultCourseAreaUuid,
|
||||
editedRegatta.configuration,
|
||||
new AsyncCallback<Void>() {
|
||||
editedRegatta.configuration, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Error trying to update regatta " + editedRegatta.getName() + ": " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
}
|
||||
});
|
||||
|
||||
+6
@@ -65,7 +65,9 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
|
||||
|
||||
HorizontalPanel regattaManagementControlsPanel = new HorizontalPanel();
|
||||
regattaManagementControlsPanel.setSpacing(5);
|
||||
|
||||
Button addRegattaBtn = new Button(stringMessages.addRegatta());
|
||||
addRegattaBtn.ensureDebugId("AddRegattaButton");
|
||||
addRegattaBtn.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -75,6 +77,7 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
|
||||
regattaManagementControlsPanel.add(addRegattaBtn);
|
||||
|
||||
removeRegattaButton = new Button(stringMessages.remove());
|
||||
removeRegattaButton.ensureDebugId("RemoveRegattaButton");
|
||||
removeRegattaButton.setEnabled(false);
|
||||
removeRegattaButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
@@ -100,10 +103,12 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
|
||||
regattaSelectionProvider.addRegattaSelectionChangeListener(this);
|
||||
|
||||
regattaListComposite = new RegattaListComposite(sailingService, regattaSelectionProvider, regattaRefresher, errorReporter, stringMessages);
|
||||
regattaListComposite.ensureDebugId("RegattaListComposite");
|
||||
grid.setWidget(0, 0, regattaListComposite);
|
||||
grid.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
|
||||
grid.getColumnFormatter().getElement(1).getStyle().setPaddingTop(2.0, Unit.EM);
|
||||
regattaDetailsComposite = new RegattaDetailsComposite(sailingService, regattaRefresher, errorReporter, stringMessages);
|
||||
regattaDetailsComposite.ensureDebugId("RegattaDetailsComposite");
|
||||
regattaDetailsComposite.setVisible(false);
|
||||
grid.setWidget(0, 1, regattaDetailsComposite);
|
||||
}
|
||||
@@ -152,6 +157,7 @@ public class RegattaStructureManagementPanel extends SimplePanel implements Rega
|
||||
createNewRegatta(newRegatta);
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("RegattaCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -46,16 +46,19 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends DataEntryDialog<R
|
||||
this.existingEvents = existingEvents;
|
||||
|
||||
nameEntryField = createTextBox(null);
|
||||
nameEntryField.ensureDebugId("NameTextBox");
|
||||
nameEntryField.setVisibleLength(40);
|
||||
nameEntryField.setText(regatta.getName());
|
||||
|
||||
boatClassEntryField = createTextBox(null);
|
||||
boatClassEntryField.ensureDebugId("BoatClassTextBox");
|
||||
boatClassEntryField.setVisibleLength(20);
|
||||
if (regatta.boatClass != null) {
|
||||
boatClassEntryField.setText(regatta.boatClass.getName());
|
||||
}
|
||||
|
||||
scoringSchemeListBox = createListBox(false);
|
||||
scoringSchemeListBox.ensureDebugId("ScoringSchemeListBox");
|
||||
for (ScoringSchemeType scoringSchemeType : ScoringSchemeType.values()) {
|
||||
scoringSchemeListBox.addItem(ScoringSchemeTypeFormatter.format(scoringSchemeType, stringMessages),
|
||||
String.valueOf(scoringSchemeType.ordinal()));
|
||||
@@ -65,10 +68,13 @@ public abstract class RegattaWithSeriesAndFleetsDialog extends DataEntryDialog<R
|
||||
}
|
||||
|
||||
sailingEventsListBox = createListBox(false);
|
||||
courseAreaListBox = createListBox(false);
|
||||
setupEventAndCourseAreaListBoxes(stringMessages);
|
||||
sailingEventsListBox.ensureDebugId("EventListBox");
|
||||
|
||||
courseAreaListBox = createListBox(false);
|
||||
courseAreaListBox.ensureDebugId("CourseAreaListBox");
|
||||
courseAreaListBox.setEnabled(false);
|
||||
|
||||
setupEventAndCourseAreaListBoxes(stringMessages);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-1
@@ -44,6 +44,7 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl
|
||||
courseAreaListBox.setEnabled(true);
|
||||
|
||||
regattaConfigurationCheckbox = createCheckbox(stringMessages.setRacingProcedureConfiguration());
|
||||
regattaConfigurationCheckbox.ensureDebugId("RacingProcedureConfigurationCheckBox");
|
||||
regattaConfigurationCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
@@ -51,6 +52,7 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl
|
||||
}
|
||||
});
|
||||
regattaConfigurationButton = new Button(stringMessages.edit());
|
||||
regattaConfigurationButton.ensureDebugId("RacingProcedureConfigurationEditButton");
|
||||
regattaConfigurationButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -64,7 +66,7 @@ public class RegattaWithSeriesAndFleetsEditDialog extends RegattaWithSeriesAndFl
|
||||
@Override
|
||||
public void cancel() {
|
||||
}
|
||||
}).show();;
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
regattaConfigurationCheckbox.setValue(regatta.configuration != null);
|
||||
|
||||
+35
-12
@@ -163,21 +163,31 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
String seriesName = getSelectedSeries().getName();
|
||||
seriesPanel.add(new Label(stringMessages.series() + ": " + seriesName));
|
||||
additionalWidgetPanel.add(seriesPanel);
|
||||
|
||||
seriesNameTextBox = createTextBox(seriesName);
|
||||
isMedalCheckbox = createCheckbox(stringMessages.medalSeries());
|
||||
additionalWidgetPanel.add(seriesNameTextBox);
|
||||
|
||||
isMedalCheckbox = createCheckbox(stringMessages.medalSeries());
|
||||
isMedalCheckbox.ensureDebugId("MedalSeriesCheckbox");
|
||||
isMedalCheckbox.setValue(selectedSeries.isMedal());
|
||||
additionalWidgetPanel.add(isMedalCheckbox);
|
||||
|
||||
startWithZeroScoreCheckbox = createCheckbox(stringMessages.startsWithZeroScore());
|
||||
startWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox");
|
||||
startWithZeroScoreCheckbox.setValue(selectedSeries.isStartsWithZeroScore());
|
||||
additionalWidgetPanel.add(startWithZeroScoreCheckbox);
|
||||
|
||||
hasSplitFleetContiguousScoringCheckbox = createCheckbox(stringMessages.hasSplitFleetContiguousScoring());
|
||||
hasSplitFleetContiguousScoringCheckbox.setValue(selectedSeries.hasSplitFleetContiguousScoring());
|
||||
additionalWidgetPanel.add(hasSplitFleetContiguousScoringCheckbox);
|
||||
|
||||
firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward());
|
||||
firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox");
|
||||
firstColumnIsNonDiscardableCarryForwardCheckbox.setValue(selectedSeries.isFirstColumnIsNonDiscardableCarryForward());
|
||||
additionalWidgetPanel.add(firstColumnIsNonDiscardableCarryForwardCheckbox);
|
||||
|
||||
useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule());
|
||||
useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox");
|
||||
useSeriesResultDiscardingThresholdsCheckbox.setValue(selectedSeries.getDiscardThresholds() != null);
|
||||
useSeriesResultDiscardingThresholdsCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
@Override
|
||||
@@ -186,10 +196,14 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
}
|
||||
});
|
||||
additionalWidgetPanel.add(useSeriesResultDiscardingThresholdsCheckbox);
|
||||
additionalWidgetPanel.add(discardThresholdBoxes.getWidget());
|
||||
discardThresholdBoxes.getWidget().setVisible(useSeriesResultDiscardingThresholdsCheckbox.getValue());
|
||||
|
||||
Widget discardThresholdBoxesWidget = discardThresholdBoxes.getWidget();
|
||||
discardThresholdBoxesWidget.ensureDebugId("");
|
||||
discardThresholdBoxesWidget.setVisible(useSeriesResultDiscardingThresholdsCheckbox.getValue());
|
||||
additionalWidgetPanel.add(discardThresholdBoxesWidget);
|
||||
|
||||
raceNamesEditor = new StringListInlineEditorComposite(getExistingRacesOfSeries(), new RaceNamesEditorUi(regatta, stringMessages, resources.removeIcon(), seriesName));
|
||||
raceNamesEditor.ensureDebugId("RaceNamesStringListEditorComposite");
|
||||
raceNamesEditor.addValueChangeHandler(new ValueChangeHandler<List<String>>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<List<String>> event) {
|
||||
@@ -234,13 +248,23 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
|
||||
public RaceNamesEditorUi(RegattaDTO regatta, StringMessages stringMessages, ImageResource removeImage, String seriesName) {
|
||||
super(stringMessages, removeImage, Collections.<String>emptyList());
|
||||
this.regatta = regatta;
|
||||
this.addRacesFromListBox = createListBox(false);
|
||||
this.addRacesToListBox = createListBox(false);
|
||||
this.raceNamePrefixTextBox = createTextBox(null);
|
||||
this.addRacesBtn = new Button(stringMessages.add());
|
||||
this.addRacesHintLabel = new Label("");
|
||||
|
||||
this.seriesName = seriesName;
|
||||
this.regatta = regatta;
|
||||
|
||||
this.addRacesFromListBox = createListBox(false);
|
||||
this.addRacesFromListBox.ensureDebugId("AddRacesFromListBox");
|
||||
|
||||
this.addRacesToListBox = createListBox(false);
|
||||
this.addRacesToListBox.ensureDebugId("AddRacesToListBox");
|
||||
|
||||
this.raceNamePrefixTextBox = createTextBox(null);
|
||||
this.raceNamePrefixTextBox.ensureDebugId("RaceNamePrefixTextBox");
|
||||
|
||||
this.addRacesBtn = new Button(stringMessages.add());
|
||||
this.addRacesBtn.ensureDebugId("AddRacesButton");
|
||||
|
||||
this.addRacesHintLabel = new Label("");
|
||||
}
|
||||
|
||||
private List<String> resolveRaceNamesToAdd() {
|
||||
@@ -338,7 +362,7 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
updateHintLabel();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
addRacesPanel.add(addRacesFromListBox);
|
||||
@@ -362,7 +386,6 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
|
||||
addRacesPanel.add(raceNamePrefixTextBox);
|
||||
addRacesBtn.addStyleName("inlineButton");
|
||||
|
||||
addRacesBtn.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -371,7 +394,7 @@ public class SeriesEditDialog extends DataEntryDialog<SeriesDescriptor> {
|
||||
List<String> raceNamesToAdd = resolveRaceNamesToAdd();
|
||||
for(String raceToAdd: raceNamesToAdd) {
|
||||
addValue(raceToAdd);
|
||||
}
|
||||
}
|
||||
validate();
|
||||
// updateFromToListboxesSelection();
|
||||
// updateHintLabel();
|
||||
|
||||
+19
-1
@@ -102,23 +102,41 @@ public class SeriesWithFleetsCreateDialog extends DataEntryDialog<SeriesDTO> {
|
||||
new SeriesParameterValidator(stringMessages, existingSeries), callback);
|
||||
this.stringMessages = stringMessages;
|
||||
this.series = new SeriesDTO();
|
||||
|
||||
nameEntryField = createTextBox(null);
|
||||
nameEntryField.ensureDebugId("NameTextBox");
|
||||
nameEntryField.setVisibleLength(40);
|
||||
|
||||
isMedalSeriesCheckbox = createCheckbox(stringMessages.medalSeries());
|
||||
isMedalSeriesCheckbox.ensureDebugId("MedalSeriesCheckbox");
|
||||
|
||||
startsWithZeroScoreCheckbox = createCheckbox(stringMessages.startsWithZeroScore());
|
||||
startsWithZeroScoreCheckbox.ensureDebugId("StartsWithZeroScoreCheckbox");
|
||||
|
||||
hasSplitFleetContiguousScoringCheckbox = createCheckbox(stringMessages.hasSplitFleetContiguousScoring());
|
||||
hasSplitFleetContiguousScoringCheckbox.ensureDebugId("HasSplitFleetContiguousScoringCheckbox");
|
||||
|
||||
firstColumnIsNonDiscardableCarryForwardCheckbox = createCheckbox(stringMessages.firstRaceIsNonDiscardableCarryForward());
|
||||
firstColumnIsNonDiscardableCarryForwardCheckbox.ensureDebugId("StartsWithNonDiscardableCarryForwardCheckbox");
|
||||
|
||||
useSeriesResultDiscardingThresholdsCheckbox = createCheckbox(stringMessages.seriesDefinesResultDiscardingRule());
|
||||
useSeriesResultDiscardingThresholdsCheckbox.ensureDebugId("DefinesResultDiscardingRulesCheckbox");
|
||||
useSeriesResultDiscardingThresholdsCheckbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
discardThresholdBoxes.getWidget().setVisible(event.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
discardThresholdBoxes = new DiscardThresholdBoxes(this, stringMessages);
|
||||
discardThresholdBoxes.getWidget().setVisible(false);
|
||||
Widget widget = discardThresholdBoxes.getWidget();
|
||||
widget.ensureDebugId("DiscardThresholdBoxes");
|
||||
widget.setVisible(false);
|
||||
|
||||
fleetListComposite = new FleetListEditorComposite(Arrays.asList(new FleetDTO("Default", 0, null)), stringMessages, resources.removeIcon());
|
||||
fleetListComposite.ensureDebugId("FleetListEditorComposite");
|
||||
fleetListComposite.addValueChangeHandler(new ValueChangeHandler<List<FleetDTO>>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<List<FleetDTO>> event) {
|
||||
validate();
|
||||
|
||||
+2
@@ -31,6 +31,7 @@ public class SeriesWithFleetsListEditor extends ListEditorComposite<SeriesDTO> {
|
||||
@Override
|
||||
protected Widget createAddWidget() {
|
||||
Button addSeriesButton = new Button(stringMessages.addSeries());
|
||||
addSeriesButton.ensureDebugId("AddSeriesButton");
|
||||
addSeriesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -45,6 +46,7 @@ public class SeriesWithFleetsListEditor extends ListEditorComposite<SeriesDTO> {
|
||||
addValue(newSeries);
|
||||
}
|
||||
});
|
||||
dialog.ensureDebugId("SeriesCreateDialog");
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
+14
-14
@@ -149,7 +149,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
liveURILabel.setTitle(stringMessages.leaveEmptyForDefault());
|
||||
|
||||
liveURITextBox = new TextBox();
|
||||
liveURITextBox.ensureDebugId("LiveURI");
|
||||
liveURITextBox.ensureDebugId("LiveURITextBox");
|
||||
liveURITextBox.setVisibleLength(40);
|
||||
liveURITextBox.setTitle(stringMessages.leaveEmptyForDefault());
|
||||
|
||||
@@ -160,7 +160,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
storedURILabel.setTitle(stringMessages.leaveEmptyForDefault());
|
||||
|
||||
storedURITextBox = new TextBox();
|
||||
storedURITextBox.ensureDebugId("StoredURI");
|
||||
storedURITextBox.ensureDebugId("StoredURITextBox");
|
||||
storedURITextBox.setVisibleLength(40);
|
||||
storedURITextBox.setTitle(stringMessages.leaveEmptyForDefault());
|
||||
|
||||
@@ -171,7 +171,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
Label jsonURLLabel = new Label(stringMessages.jsonUrl() + ":");
|
||||
|
||||
jsonURLTextBox = new TextBox();
|
||||
jsonURLTextBox.ensureDebugId("JSONURL");
|
||||
jsonURLTextBox.ensureDebugId("JsonURLTextBox");
|
||||
jsonURLTextBox.setVisibleLength(100);
|
||||
|
||||
grid.setWidget(4, 0, jsonURLLabel);
|
||||
@@ -181,7 +181,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
Label tracTracUpdateURLLabel = new Label(stringMessages.tracTracUpdateUrl() + ":");
|
||||
|
||||
tracTracUpdateURITextBox = new TextBox();
|
||||
tracTracUpdateURITextBox.ensureDebugId("TRACTRACUPDATEURI");
|
||||
tracTracUpdateURITextBox.ensureDebugId("TracTracUpdateURITextBox");
|
||||
tracTracUpdateURITextBox.setVisibleLength(100);
|
||||
|
||||
grid.setWidget(5, 0, tracTracUpdateURLLabel);
|
||||
@@ -189,7 +189,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
|
||||
// TracTrac Username
|
||||
tractracUsernameTextBox = new TextBox();
|
||||
tractracUsernameTextBox.ensureDebugId("tractracUsername");
|
||||
tractracUsernameTextBox.ensureDebugId("TracTracUsernameTextBox");
|
||||
tractracUsernameTextBox.setVisibleLength(40);
|
||||
|
||||
grid.setWidget(6, 0, new Label(stringMessages.tractracUsername() + ":"));
|
||||
@@ -197,7 +197,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
|
||||
// TracTrac Password
|
||||
tractracPasswordTextBox = new TextBox();
|
||||
tractracPasswordTextBox.ensureDebugId("tractracPassword");
|
||||
tractracPasswordTextBox.ensureDebugId("TracTracPasswordTextBox");
|
||||
tractracPasswordTextBox.setVisibleLength(40);
|
||||
|
||||
grid.setWidget(7, 0, new Label(stringMessages.tractracPassword() + ":"));
|
||||
@@ -205,11 +205,12 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
|
||||
grid.setWidget(8, 0, new Label(stringMessages.racesWithHiddenState() + ":"));
|
||||
final CheckBox showHiddenRacesCheckbox = new CheckBox(stringMessages.show());
|
||||
showHiddenRacesCheckbox.ensureDebugId("ShowHiddenRacesCheckBox");
|
||||
grid.setWidget(8, 1, showHiddenRacesCheckbox);
|
||||
|
||||
// List Races
|
||||
Button listRacesButton = new Button(stringMessages.listRaces());
|
||||
listRacesButton.ensureDebugId("ListRaces");
|
||||
listRacesButton.ensureDebugId("ListRacesButton");
|
||||
listRacesButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -265,17 +266,17 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
Label trackSettingsLabel = new Label(stringMessages.trackSettings() + ":");
|
||||
|
||||
final CheckBox trackWindCheckBox = new CheckBox(stringMessages.trackWind());
|
||||
trackWindCheckBox.ensureDebugId("TrackWind");
|
||||
trackWindCheckBox.ensureDebugId("TrackWindCheckBox");
|
||||
trackWindCheckBox.setWordWrap(false);
|
||||
trackWindCheckBox.setValue(Boolean.TRUE);
|
||||
|
||||
final CheckBox correctWindCheckBox = new CheckBox(stringMessages.declinationCheckbox());
|
||||
correctWindCheckBox.ensureDebugId("CorrectWind");
|
||||
correctWindCheckBox.ensureDebugId("CorrectWindCheckBox");
|
||||
correctWindCheckBox.setWordWrap(false);
|
||||
correctWindCheckBox.setValue(Boolean.TRUE);
|
||||
|
||||
final CheckBox simulateWithStartTimeNowCheckBox = new CheckBox(stringMessages.simulateWithStartTimeNow());
|
||||
simulateWithStartTimeNowCheckBox.ensureDebugId("SimulateWithStartTimeNow");
|
||||
simulateWithStartTimeNowCheckBox.ensureDebugId("SimulateWithStartTimeNowCheckBox");
|
||||
simulateWithStartTimeNowCheckBox.setWordWrap(false);
|
||||
simulateWithStartTimeNowCheckBox.setValue(Boolean.FALSE);
|
||||
|
||||
@@ -288,7 +289,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
Label racesFilterLabel = new Label(stringMessages.filterRacesByName() + ":");
|
||||
AdminConsoleTableResources tableResources = GWT.create(AdminConsoleTableResources.class);
|
||||
racesTable = new CellTable<TracTracRaceRecordDTO>(10000, tableResources);
|
||||
racesTable.ensureDebugId("RacesTable");
|
||||
racesTable.ensureDebugId("TrackableRacesCellTable");
|
||||
this.racesFilterablePanel = new LabeledAbstractFilterablePanel<TracTracRaceRecordDTO>(racesFilterLabel, availableTracTracRaces, racesTable, raceList) {
|
||||
@Override
|
||||
public List<String> getSearchableStrings(TracTracRaceRecordDTO t) {
|
||||
@@ -298,7 +299,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
return strings;
|
||||
}
|
||||
};
|
||||
racesFilterablePanel.getTextBox().ensureDebugId("FilterRaces");
|
||||
racesFilterablePanel.getTextBox().ensureDebugId("TrackableRacesFilterTextBox");
|
||||
layoutTable.setWidget(4, 0, racesFilterLabel);
|
||||
layoutTable.setWidget(4, 1, racesFilterablePanel);
|
||||
|
||||
@@ -340,7 +341,6 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
};
|
||||
raceStatusColumn.setSortable(true);
|
||||
|
||||
racesTable.ensureDebugId("RacesTable");
|
||||
racesTable.addColumn(regattaNameColumn, stringMessages.event());
|
||||
racesTable.addColumn(raceNameColumn, stringMessages.race());
|
||||
racesTable.addColumn(boatClassColumn, stringMessages.boatClass());
|
||||
@@ -357,7 +357,7 @@ public class TracTracEventManagementPanel extends AbstractEventManagementPanel {
|
||||
cellFormatter.setColSpan(5, 0, 2);
|
||||
|
||||
Button startTrackingButton = new Button(stringMessages.startTracking());
|
||||
startTrackingButton.ensureDebugId("StartTracking");
|
||||
startTrackingButton.ensureDebugId("StartTrackingButton");
|
||||
startTrackingButton.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
+12
-11
@@ -7,13 +7,13 @@ import java.util.Set;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.dto.RaceDTO;
|
||||
import com.sap.sailing.gwt.ui.client.ErrorReporter;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
import com.sap.sailing.gwt.ui.client.RaceSelectionProvider;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaDisplayer;
|
||||
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
|
||||
@@ -60,14 +60,14 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
racesToStopTracking.add(race.getRaceIdentifier());
|
||||
}
|
||||
}
|
||||
sailingService.stopTrackingRaces(racesToStopTracking, new AsyncCallback<Void>() {
|
||||
sailingService.stopTrackingRaces(racesToStopTracking, new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Exception trying to stop tracking races " + races + ": " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
|
||||
listener.changeTrackingRace(racesToStopTracking, false);
|
||||
@@ -82,15 +82,15 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
regattaNamesAndRaceNames.add((RegattaNameAndRaceName) race.getRaceIdentifier());
|
||||
}
|
||||
sailingService.removeAndUntrackRaces(regattaNamesAndRaceNames,
|
||||
new AsyncCallback<Void>() {
|
||||
new MarkedAsyncCallback<Void>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
public void handleFailure(Throwable caught) {
|
||||
errorReporter.reportError("Exception trying to remove races " + regattaNamesAndRaceNames +
|
||||
": " + caught.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
public void handleSuccess(Void result) {
|
||||
regattaRefresher.fillRegattas();
|
||||
for (TrackedRaceChangedListener listener : raceIsTrackedRaceChangeListener) {
|
||||
listener.changeTrackingRace(regattaNamesAndRaceNames, false);
|
||||
@@ -102,7 +102,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
@Override
|
||||
protected void addControlButtons(HorizontalPanel trackedRacesButtonPanel) {
|
||||
btnRemoveRace = new Button(stringMessages.remove());
|
||||
btnRemoveRace.ensureDebugId("RemoveRace");
|
||||
btnRemoveRace.ensureDebugId("RemoveRaceButton");
|
||||
btnRemoveRace.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -111,8 +111,9 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
});
|
||||
btnRemoveRace.setEnabled(false);
|
||||
trackedRacesButtonPanel.add(btnRemoveRace);
|
||||
|
||||
btnUntrack = new Button(stringMessages.stopTracking());
|
||||
btnUntrack.ensureDebugId("UntrackRace");
|
||||
btnUntrack.ensureDebugId("StopTrackingButton");
|
||||
btnUntrack.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent click) {
|
||||
@@ -121,10 +122,9 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
});
|
||||
btnUntrack.setEnabled(false);
|
||||
trackedRacesButtonPanel.add(btnUntrack);
|
||||
|
||||
|
||||
btnSetDelayToLive = new Button(stringMessages.setDelayToLive() + "...");
|
||||
btnSetDelayToLive.ensureDebugId("SetDelayToLive");
|
||||
btnSetDelayToLive.ensureDebugId("SetDelayToLiveButton");
|
||||
btnSetDelayToLive.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
@@ -135,6 +135,7 @@ public class TrackedRacesListComposite extends AbstractTrackedRacesListComposite
|
||||
|
||||
exportPopup = new ExportPopup(stringMessages);
|
||||
btnExport = new Button(stringMessages.export());
|
||||
btnExport.ensureDebugId("ExportButton");
|
||||
btnExport.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
+2
@@ -341,6 +341,8 @@ public interface SailingService extends RemoteService {
|
||||
|
||||
RaceLogDTO getRaceLog(String leaderboardName, RaceColumnDTO raceColumnDTO, FleetDTO fleet);
|
||||
|
||||
List<String> getLeaderboardGroupNamesFromRemoteServer(String host);
|
||||
|
||||
MasterDataImportObjectCreationCount importMasterData(String host, String[] groupNames, boolean override, boolean compress);
|
||||
|
||||
<ResultType extends Number> QueryResult<ResultType> runQuery(QueryDefinition queryDefinition) throws Exception;
|
||||
|
||||
+2
@@ -464,6 +464,8 @@ public interface SailingServiceAsync {
|
||||
void importMasterData(String host, String[] names, boolean override, boolean compress,
|
||||
AsyncCallback<MasterDataImportObjectCreationCount> asyncCallback);
|
||||
|
||||
void getLeaderboardGroupNamesFromRemoteServer(String host, AsyncCallback<List<String>> leaderboardGroupNames);
|
||||
|
||||
<ResultType extends Number> void runQuery(QueryDefinition queryDefinition, AsyncCallback<QueryResult<ResultType>> asyncCallback);
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -766,7 +766,7 @@ public interface StringMessages extends Messages {
|
||||
String importRemoteHost();
|
||||
String importFetchRemoteLgs();
|
||||
String importUrlInvalid(String url);
|
||||
String importGetLeaderboardsFailed(int statusCode, String url);
|
||||
String importGetLeaderboardsFailed(String host, String errorMessage);
|
||||
String importNoDataReturned();
|
||||
String importServerError();
|
||||
String importLeaderboardGroups();
|
||||
|
||||
+1
-1
@@ -766,7 +766,7 @@ rawFixes=All fixes (including outliers)
|
||||
importRemoteHost=Remote host:
|
||||
importFetchRemoteLgs=Fetch Leaderboard Group List
|
||||
importUrlInvalid=Not a valid URL for fetching leaderboardgroups: {0}
|
||||
importGetLeaderboardsFailed=GET leaderboardgroups request failed with error code: {0}; For url: {1}
|
||||
importGetLeaderboardsFailed=GET leaderboardgroups request failed for host {0} with error {1}
|
||||
importNoDataReturned=No data was returned by the server
|
||||
importServerError=GET leaderboardgroups request failed with Server error. Please see server logs for more information.
|
||||
importLeaderboardGroups=Leaderboard Groups:
|
||||
|
||||
+1
-1
@@ -762,7 +762,7 @@ rawFixes=Alle Fixes (inklusive Ausreißer)
|
||||
importRemoteHost=Entfernter Host:
|
||||
importFetchRemoteLgs=Liste der Leaderboard Groups abrufen
|
||||
importUrlInvalid=Keine gültige URL um Leaderboard Groups abzurufen: {0}
|
||||
importGetLeaderboardsFailed=GET leaderboardgroups Request scheiterte mit Error Code: {0}; Für die Url: {1}
|
||||
importGetLeaderboardsFailed=GET leaderboardgroups Request scheiterte für den Host {0} mit dem Fehler: {1}
|
||||
importNoDataReturned=Es kamen keine Daten vom Server zurück
|
||||
importServerError=Der GET leaderboardgroups Request scheiterte an einem Server Error. Bitte schauen Sie in die Server logs für mehr Informationen.
|
||||
importLeaderboardGroups=Leaderboard Groups:
|
||||
|
||||
+3
@@ -76,7 +76,10 @@ public class StringListEditorComposite extends ListEditorComposite<String> {
|
||||
@Override
|
||||
protected Widget createAddWidget() {
|
||||
final SuggestBox inputBox = new SuggestBox(inputOracle);
|
||||
inputBox.ensureDebugId("InputSuggestBox");
|
||||
|
||||
final Button addButton = new Button(stringMessages.add());
|
||||
addButton.ensureDebugId("AddButton");
|
||||
addButton.setEnabled(false);
|
||||
addButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
Regular → Executable
+81
-79
@@ -1,88 +1,90 @@
|
||||
package com.sap.sailing.gwt.ui.client.shared.panels;
|
||||
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
package com.sap.sailing.gwt.ui.client.shared.panels;
|
||||
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.user.cellview.client.AbstractCellTable;
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.gwt.ui.client.shared.filter.AbstractListFilter;
|
||||
|
||||
/**
|
||||
import com.google.gwt.user.cellview.client.CellTable;
|
||||
import com.google.gwt.user.cellview.client.ColumnSortEvent;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.view.client.ListDataProvider;
|
||||
import com.sap.sailing.gwt.ui.client.shared.filter.AbstractListFilter;
|
||||
|
||||
/**
|
||||
* This Panel contains a text box. Text entered into the text box filters the {@link CellTable} passed to
|
||||
* the constructor by adjusting the cell table's {@link ListDataProvider}'s contents using the {@link
|
||||
* applyFilter(String, List)} of the {@link AbstractListFilter} and then sorting the table again according the the
|
||||
* sorting criteria currently active (the sorting is the only reason why the {@link CellTable} actually needs to be
|
||||
* known to an instance of this class). To be initiated the method {@link #getSearchableStrings(Object)} has to be
|
||||
* defined, which gets those Strings from a <code>T</code> that should be considered when filtering, e.g. name or
|
||||
* boatClass. The cell table can be sorted independently from the text box (e.g. after adding new objects) by calling
|
||||
* the method {@link #updateAll(Iterable)} which then runs the filter over the new selection.
|
||||
*
|
||||
* @param <T>
|
||||
* @author Nicolas Klose, Axel Uhl
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFilterablePanel<T> extends HorizontalPanel {
|
||||
* the constructor by adjusting the cell table's {@link ListDataProvider}'s contents using the {@link
|
||||
* applyFilter(String, List)} of the {@link AbstractListFilter} and then sorting the table again according the the
|
||||
* sorting criteria currently active (the sorting is the only reason why the {@link CellTable} actually needs to be
|
||||
* known to an instance of this class). To be initiated the method {@link #getSearchableStrings(Object)} has to be
|
||||
* defined, which gets those Strings from a <code>T</code> that should be considered when filtering, e.g. name or
|
||||
* boatClass. The cell table can be sorted independently from the text box (e.g. after adding new objects) by calling
|
||||
* the method {@link #updateAll(Iterable)} which then runs the filter over the new selection.
|
||||
*
|
||||
* @param <T>
|
||||
* @author Nicolas Klose, Axel Uhl
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFilterablePanel<T> extends HorizontalPanel {
|
||||
|
||||
protected Iterable<T> all;
|
||||
protected final AbstractCellTable<T> display;
|
||||
protected final ListDataProvider<T> filtered;
|
||||
protected final TextBox textBox;
|
||||
private final AbstractListFilter<T> filterer = new AbstractListFilter<T>(){
|
||||
@Override
|
||||
public Iterable<String> getStrings(T t) {
|
||||
return getSearchableStrings(t);
|
||||
}
|
||||
};
|
||||
|
||||
private final AbstractListFilter<T> filterer = new AbstractListFilter<T>(){
|
||||
|
||||
@Override
|
||||
public Iterable<String> getStrings(T t) {
|
||||
return getSearchableStrings(t);
|
||||
}
|
||||
};
|
||||
|
||||
public AbstractFilterablePanel(Iterable<T> all, AbstractCellTable<T> display, final ListDataProvider<T> filtered) {
|
||||
setSpacing(5);
|
||||
this.display = display;
|
||||
this.filtered = filtered;
|
||||
this.textBox = new TextBox();
|
||||
this.all = all;
|
||||
add(getTextBox());
|
||||
getTextBox().addKeyUpHandler(new KeyUpHandler() {
|
||||
@Override
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
filter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses must implement this to extract the strings from an object of type <code>T</code> based on which the
|
||||
* filter performs its filtering
|
||||
*
|
||||
* @param t
|
||||
* the object from which to extract the searchable strings
|
||||
* @return the searchable strings
|
||||
*/
|
||||
public abstract Iterable<String> getSearchableStrings(T t);
|
||||
|
||||
/**
|
||||
* Updates the set of all objects to be shown in the table and applies the search filter to update the
|
||||
* table view.
|
||||
*/
|
||||
public void updateAll(Iterable<T> all) {
|
||||
this.all = all;
|
||||
filter();
|
||||
}
|
||||
|
||||
public void filter() {
|
||||
filtered.getList().clear();
|
||||
filtered.getList().addAll(filterer.applyFilter(getTextBox().getText(), all));
|
||||
sort();
|
||||
}
|
||||
|
||||
private void sort() {
|
||||
ColumnSortEvent.fire(display, display.getColumnSortList());
|
||||
}
|
||||
|
||||
public TextBox getTextBox() {
|
||||
return textBox;
|
||||
}
|
||||
|
||||
setSpacing(5);
|
||||
this.display = display;
|
||||
this.filtered = filtered;
|
||||
this.textBox = new TextBox();
|
||||
this.textBox.ensureDebugId("FilterTextBox");
|
||||
this.all = all;
|
||||
add(getTextBox());
|
||||
getTextBox().addKeyUpHandler(new KeyUpHandler() {
|
||||
@Override
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
filter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclasses must implement this to extract the strings from an object of type <code>T</code> based on which the
|
||||
* filter performs its filtering
|
||||
*
|
||||
* @param t
|
||||
* the object from which to extract the searchable strings
|
||||
* @return the searchable strings
|
||||
*/
|
||||
public abstract Iterable<String> getSearchableStrings(T t);
|
||||
|
||||
/**
|
||||
* Updates the set of all objects to be shown in the table and applies the search filter to update the
|
||||
* table view.
|
||||
*/
|
||||
|
||||
public void updateAll(Iterable<T> all){
|
||||
this.all = all;
|
||||
filter();
|
||||
}
|
||||
|
||||
public void filter(){
|
||||
filtered.getList().clear();
|
||||
filtered.getList().addAll(filterer.applyFilter(getTextBox().getText(), all));
|
||||
sort();
|
||||
}
|
||||
|
||||
private void sort(){
|
||||
ColumnSortEvent.fire(display, display.getColumnSortList());
|
||||
}
|
||||
|
||||
public TextBox getTextBox() {
|
||||
return textBox;
|
||||
}
|
||||
}
|
||||
+5
-4
@@ -3,24 +3,25 @@ package com.sap.sailing.gwt.ui.leaderboardedit;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.sap.sailing.gwt.ui.actions.AsyncActionsExecutor;
|
||||
import com.sap.sailing.gwt.ui.client.AbstractEntryPoint;
|
||||
import com.sap.sailing.gwt.ui.client.LogoAndTitlePanel;
|
||||
import com.sap.sailing.gwt.ui.client.MarkedAsyncCallback;
|
||||
|
||||
public class LeaderboardEditPage extends AbstractEntryPoint {
|
||||
@Override
|
||||
protected void doOnModuleLoad() {
|
||||
super.doOnModuleLoad();
|
||||
sailingService.getLeaderboardNames(new AsyncCallback<List<String>>() {
|
||||
sailingService.getLeaderboardNames(new MarkedAsyncCallback<List<String>>() {
|
||||
@Override
|
||||
public void onSuccess(List<String> leaderboardNames) {
|
||||
public void handleSuccess(List<String> leaderboardNames) {
|
||||
String leaderboardName = Window.Location.getParameter("name");
|
||||
if (leaderboardNames.contains(leaderboardName)) {
|
||||
LogoAndTitlePanel logoAndTitlePanel = new LogoAndTitlePanel(stringMessages.editScores(), stringMessages, LeaderboardEditPage.this);
|
||||
logoAndTitlePanel.addStyleName("LogoAndTitlePanel");
|
||||
// TODO: Here happens something async. We have to use the semaphore for ui tests.
|
||||
EditableLeaderboardPanel leaderboardPanel = new EditableLeaderboardPanel(sailingService, new AsyncActionsExecutor(), leaderboardName, null,
|
||||
LeaderboardEditPage.this, stringMessages, userAgent);
|
||||
leaderboardPanel.ensureDebugId("EditableLeaderboardPanel");
|
||||
@@ -31,7 +32,7 @@ public class LeaderboardEditPage extends AbstractEntryPoint {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
public void handleFailure(Throwable t) {
|
||||
reportError("Error trying to obtain list of leaderboard names: "+t.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
+13
-75
@@ -13,14 +13,6 @@ import com.google.gwt.event.dom.client.KeyDownEvent;
|
||||
import com.google.gwt.event.dom.client.KeyDownHandler;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.http.client.Request;
|
||||
import com.google.gwt.http.client.RequestBuilder;
|
||||
import com.google.gwt.http.client.RequestCallback;
|
||||
import com.google.gwt.http.client.RequestException;
|
||||
import com.google.gwt.http.client.Response;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONParser;
|
||||
import com.google.gwt.regexp.shared.RegExp;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
@@ -47,9 +39,6 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
|
||||
private List<String> allLeaderboardGroupNames;
|
||||
|
||||
private RegExp urlValidator;
|
||||
private RegExp urlPlusTldValidator;
|
||||
|
||||
private final StringMessages stringMessages;
|
||||
private String currentHost;
|
||||
private SailingServiceAsync sailingService;
|
||||
@@ -219,38 +208,24 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
}
|
||||
}
|
||||
|
||||
private void fireLgIdRequestAndFillList(String host) {
|
||||
private void fireLgIdRequestAndFillList(final String host) {
|
||||
currentHost = host;
|
||||
final String getLgsUrl = createGetLgsUrl(host);
|
||||
if (!isValidUrl(getLgsUrl, false)) {
|
||||
showErrorAlert(stringMessages.importUrlInvalid(getLgsUrl));
|
||||
return;
|
||||
}
|
||||
disableAllButtons();
|
||||
RequestBuilder getLgsRequestBuilder = new RequestBuilder(RequestBuilder.GET, getLgsUrl);
|
||||
getLgsRequestBuilder.setCallback(new RequestCallback() {
|
||||
sailingService.getLeaderboardGroupNamesFromRemoteServer(host, new AsyncCallback<List<String>>() {
|
||||
|
||||
@Override
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
if (response.getStatusCode() != 200) {
|
||||
showErrorAlert(stringMessages.importGetLeaderboardsFailed(response.getStatusCode(), getLgsUrl));
|
||||
}
|
||||
public void onFailure(Throwable caught) {
|
||||
showErrorAlert(stringMessages.importGetLeaderboardsFailed(host, caught.getMessage()));
|
||||
changeButtonStateAccordingToApplicationState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<String> result) {
|
||||
clearListBox();
|
||||
String body = response.getText();
|
||||
if (body == null || body.isEmpty()) {
|
||||
showErrorAlert(stringMessages.importNoDataReturned());
|
||||
changeButtonStateAccordingToApplicationState();
|
||||
return;
|
||||
}
|
||||
JSONArray leaderboardGroups = JSONParser.parseStrict(body).isArray();
|
||||
List<String> toSort = new ArrayList<String>();
|
||||
for (int i = 0; i < leaderboardGroups.size(); i++) {
|
||||
toSort.add(leaderboardGroups.get(i).isString().stringValue());
|
||||
}
|
||||
Collections.sort(toSort);
|
||||
allLeaderboardGroupNames = toSort;
|
||||
leaderboardgroupListBox.setVisibleItemCount(leaderboardGroups.size());
|
||||
for (String lgName : toSort) {
|
||||
Collections.sort(result);
|
||||
allLeaderboardGroupNames = result;
|
||||
leaderboardgroupListBox.setVisibleItemCount(result.size());
|
||||
for (String lgName : result) {
|
||||
leaderboardgroupListBox.addItem(lgName);
|
||||
}
|
||||
changeButtonStateAccordingToApplicationState();
|
||||
@@ -259,50 +234,13 @@ public class MasterDataImportPanel extends VerticalPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Request request, Throwable exception) {
|
||||
showErrorAlert(stringMessages.importServerError());
|
||||
changeButtonStateAccordingToApplicationState();
|
||||
}
|
||||
});
|
||||
try {
|
||||
getLgsRequestBuilder.send();
|
||||
} catch (RequestException e) {
|
||||
showErrorAlert(stringMessages.importServerError());
|
||||
changeButtonStateAccordingToApplicationState();
|
||||
}
|
||||
}
|
||||
|
||||
private String createGetLgsUrl(String host) {
|
||||
StringBuffer urlBuffer = new StringBuffer(host);
|
||||
appendHttpAndSlashIfNeeded(host, urlBuffer);
|
||||
urlBuffer.append("sailingserver/api/v1/leaderboardgroups");
|
||||
return urlBuffer.toString();
|
||||
}
|
||||
|
||||
private void appendHttpAndSlashIfNeeded(String host, StringBuffer urlBuffer) {
|
||||
if (!host.endsWith("/")) {
|
||||
urlBuffer.append("/");
|
||||
}
|
||||
if (!host.startsWith("http://")) {
|
||||
urlBuffer.insert(0, "http://");
|
||||
}
|
||||
}
|
||||
|
||||
private void showErrorAlert(String string) {
|
||||
Window.alert(string);
|
||||
}
|
||||
|
||||
public boolean isValidUrl(String url, boolean topLevelDomainRequired) {
|
||||
if (urlValidator == null || urlPlusTldValidator == null) {
|
||||
urlValidator = RegExp
|
||||
.compile("^((ftp|http|https)://[\\w@.\\-\\_]+(:\\d{1,5})?(/[\\w#!:.?+=&%@!\\_\\-/]+)*){1}$");
|
||||
urlPlusTldValidator = RegExp
|
||||
.compile("^((ftp|http|https)://[\\w@.\\-\\_]+\\.[a-zA-Z]{2,}(:\\d{1,5})?(/[\\w#!:.?+=&%@!\\_\\-/]+)*){1}$");
|
||||
}
|
||||
return (topLevelDomainRequired ? urlPlusTldValidator : urlValidator).exec(url) != null;
|
||||
}
|
||||
|
||||
private void addContentToLeftPanel(VerticalPanel contentPanel) {
|
||||
contentPanel.add(new Label(stringMessages.importLeaderboardGroups()));
|
||||
|
||||
|
||||
+80
-7
@@ -3,6 +3,7 @@ package com.sap.sailing.gwt.ui.server;
|
||||
import java.io.FilterInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
@@ -3356,14 +3357,67 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public MasterDataImportObjectCreationCount importMasterData(String urlAsString, String[] groupNames, boolean override, boolean compress) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
public List<String> getLeaderboardGroupNamesFromRemoteServer(String url) {
|
||||
Pair<String, Integer> hostnameAndPort = parseHostAndPort(url);
|
||||
String hostname = hostnameAndPort.getA();
|
||||
int port = hostnameAndPort.getB();
|
||||
final String path = "/sailingserver/api/v1/leaderboardgroups";
|
||||
final String query = null;
|
||||
|
||||
HttpURLConnection connection = null;
|
||||
|
||||
URL serverAddress = null;
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
serverAddress = createUrl(hostname, port, path, query);
|
||||
// set up out communications stuff
|
||||
connection = null;
|
||||
// Set up the initial connection
|
||||
connection = (HttpURLConnection) serverAddress.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.setDoOutput(true);
|
||||
// Initial timeout needs to be big enough to allow the first parts of the response to reach this server
|
||||
connection.setReadTimeout(10000);
|
||||
connection.connect();
|
||||
|
||||
inputStream = connection.getInputStream();
|
||||
|
||||
InputStreamReader in = new InputStreamReader(inputStream, "UTF-8");
|
||||
|
||||
org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser();
|
||||
org.json.simple.JSONArray array = (org.json.simple.JSONArray) parser.parse(in);
|
||||
List<String> names = new ArrayList<String>();
|
||||
for (Object obj : array) {
|
||||
names.add((String) obj);
|
||||
}
|
||||
return names;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
// close the connection
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Pair<String, Integer> parseHostAndPort(String urlAsString) {
|
||||
String hostname;
|
||||
Integer port = 80;
|
||||
try {
|
||||
URL url = new URL(urlAsString);
|
||||
hostname = url.getHost();
|
||||
port = url.getPort();
|
||||
int portFromUrl = url.getPort();
|
||||
if (portFromUrl > 0) {
|
||||
port = portFromUrl;
|
||||
}
|
||||
} catch (MalformedURLException e1) {
|
||||
hostname = urlAsString;
|
||||
if (urlAsString.contains("://")) {
|
||||
@@ -3375,9 +3429,21 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
if (hostname.contains(":")) {
|
||||
String[] split = hostname.split(":");
|
||||
hostname = split[0];
|
||||
port = Integer.parseInt(split[1]);
|
||||
if (port > 0) {
|
||||
port = Integer.parseInt(split[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Pair<String, Integer>(hostname, port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MasterDataImportObjectCreationCount importMasterData(String urlAsString, String[] groupNames,
|
||||
boolean override, boolean compress) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
Pair<String, Integer> hostnameAndPort = parseHostAndPort(urlAsString);
|
||||
String hostname = hostnameAndPort.getA();
|
||||
int port = hostnameAndPort.getB();
|
||||
String query;
|
||||
try {
|
||||
query = createLeaderboardQuery(groupNames, compress);
|
||||
@@ -3390,7 +3456,8 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
InputStream inputStream = null;
|
||||
ObjectInputStream objectInputStream = null;
|
||||
try {
|
||||
serverAddress = createUrl(hostname, port, query);
|
||||
String path = "/sailingserver/spi/v1/masterdata/leaderboardgroups";
|
||||
serverAddress = createUrl(hostname, port, path, query);
|
||||
//set up out communications stuff
|
||||
connection = null;
|
||||
//Set up the initial connection
|
||||
@@ -3434,8 +3501,14 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
}
|
||||
|
||||
private URL createUrl(String host, Integer port, String query) throws Exception {
|
||||
return new URL("http://" + host + ":" + port + "/sailingserver/spi/v1/masterdata/leaderboardgroups?" + query);
|
||||
private URL createUrl(String host, Integer port, String path, String query) throws Exception {
|
||||
URL url;
|
||||
if (query != null) {
|
||||
url = new URL("http://" + host + ":" + port + path + "?" + query);
|
||||
} else {
|
||||
url = new URL("http://" + host + ":" + port + path);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
protected MasterDataImportObjectCreationCount importFromHttpResponse(TopLevelMasterData topLevelMasterData,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="resources"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/cglib-nodep-2.2.3.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -10,3 +10,5 @@ Require-Bundle: org.junit4;bundle-version="4.8.2",
|
||||
com.sap.sailing.mongodb;bundle-version="1.0.0",
|
||||
com.mongodb.driver;bundle-version="2.6.2",
|
||||
com.sap.sailing.domain.common
|
||||
Bundle-ClassPath: lib/cglib-nodep-2.2.3.jar,
|
||||
.
|
||||
@@ -3,4 +3,5 @@ source.. = src/,\
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
test-environment-configuration.xsd
|
||||
test-environment-configuration.xsd,\
|
||||
lib/cglib-nodep-2.2.3.jar
|
||||
@@ -18,7 +18,12 @@
|
||||
<!--
|
||||
The folder where screenshots (attachments) are stored.
|
||||
-->
|
||||
<screenshots-folder></screenshots-folder>
|
||||
<screenshots-folder>
|
||||
file:///home/hudson/repo/jobs/SAPSailingAnalytics-selenium/workspace/java/com.sap.sailing.selenium.test/bin/surefire-reports/
|
||||
</screenshots-folder>
|
||||
<!--
|
||||
<screenshots-folder>file://{user.dir}/bin/surefire-reports/</screenshots-folder>
|
||||
-->
|
||||
|
||||
<!--
|
||||
In this section necessary system properties for the different web drivers can be provided if needed. For more
|
||||
@@ -34,18 +39,18 @@
|
||||
NOTE: For the Chrome and the InternetExplorer driver an additional "server", which acts as a bridge between the
|
||||
browser and the driver, is needed.
|
||||
-->
|
||||
<!--
|
||||
<system-properties>
|
||||
<system-property>
|
||||
<name>webdriver.chrome.driver</name>
|
||||
<value>[path to]\chromedriver.exe</value>
|
||||
<name>webdriver.enable.native.events </name>
|
||||
<value>true</value>
|
||||
</system-property>
|
||||
<!--
|
||||
<system-property>
|
||||
<name>webdriver.firefox.bin</name>
|
||||
<value>[path to]\firefox.exe</value>
|
||||
</system-property>
|
||||
</system-properties>
|
||||
-->
|
||||
</system-properties>
|
||||
|
||||
<!--
|
||||
The driver definitions define all web drivers (browsers) which should be used for the execution of the tests. This
|
||||
|
||||
+20
-20
@@ -1,20 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.selenium.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||
<mapEntry key="[debug]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
</mapAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.sap.sailing.selenium.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.selenium.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dselenium.test.environment.configuration=local-test-environment.xml -Dgwt.codesvr=gwt.codesvr=127.0.0.1:9997 -Dwebdriver.firefox.profile=Selenium"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.selenium.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
|
||||
<mapEntry key="[debug]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
<mapEntry key="[run]" value="org.eclipse.jdt.junit.launchconfig"/>
|
||||
</mapAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.sap.sailing.selenium.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.selenium.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dselenium.test.environment.configuration=local-test-environment.xml -Dgwt.codesvr=127.0.0.1:9997 -Dwebdriver.firefox.profile=Selenium"/>
|
||||
</launchConfiguration>
|
||||
+16
-16
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.selenium.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.sap.sailing.selenium.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.selenium.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dselenium.test.environment.configuration=local-test-environment.xml -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 -Dgwt.codesvr=gwt.codesvr=127.0.0.1:9997 -Dwebdriver.firefox.profile=Selenium"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.selenium.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.sap.sailing.selenium.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.selenium.test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Dselenium.test.environment.configuration=local-test-environment.xml -Dhttp.proxyHost=proxy -Dhttp.proxyPort=8080 -Dgwt.codesvr=127.0.0.1:9997 -Dwebdriver.firefox.profile=Selenium"/>
|
||||
</launchConfiguration>
|
||||
Binary file not shown.
@@ -70,9 +70,22 @@
|
||||
<artifactId>com.sap.sailing.feature.runtime</artifactId>
|
||||
<version>0.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- This bundle should only be deployed in a test environment! -->
|
||||
<dependency>
|
||||
<type>eclipse-plugin</type>
|
||||
<artifactId>com.sap.sailing.server.gateway.test.support</artifactId>
|
||||
<version>0.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<bundleStartLevel>
|
||||
<bundle>
|
||||
<id>com.sap.sailing.server.gateway.test.support</id>
|
||||
<level>4</level>
|
||||
<autoStart>true</autoStart>
|
||||
</bundle>
|
||||
|
||||
<bundle>
|
||||
<id>com.sap.sailing.ess40.resultimport</id>
|
||||
<level>3</level>
|
||||
|
||||
+7
-1
@@ -25,7 +25,7 @@ public class BySeleniumId extends By {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* <p>Creates a new location mechanism which search for an element or a list of elements with the given
|
||||
* <p>Creates a new location mechanism which searches for an element or a list of elements with the given
|
||||
* identifier.</p>
|
||||
*
|
||||
* @param id
|
||||
@@ -49,4 +49,10 @@ public class BySeleniumId extends By {
|
||||
public List<WebElement> findElements(SearchContext context) {
|
||||
return context.findElements(By.xpath(BY_SELENIUM_ID.format(new Object[] {this.id})));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BySeleniumId: " + this.id;
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -6,10 +6,10 @@ import com.google.common.base.Function;
|
||||
|
||||
/**
|
||||
* <p>Models a condition that might reasonably be expected to eventually evaluate to something that is neither
|
||||
* {@code null} nor {@code false} using a search context.</p>
|
||||
* {@code null} nor {@code false} using a search context. An example would be that an element is visible.</p>
|
||||
*
|
||||
* <p>Note that it is expected that conditions are idempotent. They will be called in a loop by the and any modification
|
||||
* of the state of the application under test may have unexpected side-effects.</p>
|
||||
* <p>Note that it is expected that conditions are idempotent. They will be called in a loop by the WebDriverWait
|
||||
* and any modification of the state of the application under test may have unexpected side-effects.</p>
|
||||
*
|
||||
* @param <T>
|
||||
* The return type
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* <p>Used to mark a field in test cases that should be injected with the {@link TestEnvironment} by the
|
||||
* {@link Selenium} runner. The environment provides the web driver to use for the tests as well as other information
|
||||
* {@link SeleniumRunner} runner. The environment provides the web driver to use for the tests as well as other information
|
||||
* as configured.</p>
|
||||
*
|
||||
* @author
|
||||
|
||||
+1
-8
@@ -1,7 +1,5 @@
|
||||
package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
|
||||
/**
|
||||
@@ -11,11 +9,6 @@ import org.junit.runner.Description;
|
||||
* D049941
|
||||
*/
|
||||
public interface ScreenShotFilenameGenerator {
|
||||
/**
|
||||
* <p>File extension for screenshots captured with a Selenium web driver.</p>
|
||||
*/
|
||||
public static final String SCREENSHOT_FILE_EXTENSION = ".png"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* <p>Generates and returns a unique file name for the test case described by the given description.</p>
|
||||
*
|
||||
@@ -24,5 +17,5 @@ public interface ScreenShotFilenameGenerator {
|
||||
* @return
|
||||
* The generated unique file name.
|
||||
*/
|
||||
File getTargetFilename(Description description);
|
||||
public String getTargetFilename(Description description);
|
||||
}
|
||||
+12
-6
@@ -1,18 +1,15 @@
|
||||
package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.SearchContext;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import org.openqa.selenium.support.pagefactory.ElementLocator;
|
||||
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
@@ -38,7 +35,9 @@ public class SeleniumElementLocator implements ElementLocator {
|
||||
|
||||
private WebElement element;
|
||||
private List<WebElement> elements;
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SeleniumElementLocator.class.getName());
|
||||
|
||||
/**
|
||||
* <p>Creates a new element locator for the given field using the specified context and timeout for the search.</p>
|
||||
*
|
||||
@@ -96,8 +95,10 @@ public class SeleniumElementLocator implements ElementLocator {
|
||||
this.element = this.wait.until(new Function<SearchContext, WebElement>() {
|
||||
@Override
|
||||
public WebElement apply(SearchContext context) {
|
||||
//return context.findElement(SeleniumElementLocator.this.getBy());
|
||||
WebElement element = context.findElement(SeleniumElementLocator.this.getBy());
|
||||
|
||||
logger.info("findElement(" + getBy() + ") returned " + element + " which is " +
|
||||
(isElementUsable(element) ? "useable" : " not useable"));
|
||||
return (isElementUsable(element) ? element : null);
|
||||
}
|
||||
});
|
||||
@@ -139,6 +140,11 @@ public class SeleniumElementLocator implements ElementLocator {
|
||||
return this.by;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SeleniumElementLocator->" + this.by;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>By default, elements are considered as "found" if they are in the DOM and displayed. You can override this
|
||||
* method in order to change whether or not an element is considered as loaded.</p>
|
||||
|
||||
+2
-2
@@ -60,8 +60,8 @@ public class SeleniumElementLocatorFactory implements ElementLocatorFactory {
|
||||
public ElementLocator createLocator(Field field) {
|
||||
if (!Annotations.isAnnotationPresent(field)) {
|
||||
return null;
|
||||
} else {
|
||||
return new SeleniumElementLocator(this.context, field, this.timeOut, this.interval);
|
||||
}
|
||||
|
||||
return new SeleniumElementLocator(this.context, field, this.timeOut, this.interval);
|
||||
}
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import org.openqa.selenium.internal.Locatable;
|
||||
import org.openqa.selenium.internal.WrapsElement;
|
||||
|
||||
import org.openqa.selenium.support.pagefactory.ElementLocator;
|
||||
import org.openqa.selenium.support.pagefactory.ElementLocatorFactory;
|
||||
import org.openqa.selenium.support.pagefactory.FieldDecorator;
|
||||
|
||||
import org.openqa.selenium.support.pagefactory.internal.LocatingElementHandler;
|
||||
import org.openqa.selenium.support.pagefactory.internal.LocatingElementListHandler;
|
||||
|
||||
public class SeleniumFieldDecorator implements FieldDecorator {
|
||||
private ElementLocatorFactory factory;
|
||||
|
||||
public SeleniumFieldDecorator(ElementLocatorFactory factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object decorate(ClassLoader loader, Field field) {
|
||||
ElementLocator locator = this.factory.createLocator(field);
|
||||
|
||||
if (locator == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isDecoratableField(field)) {
|
||||
return proxyForElementLocator(loader, locator);
|
||||
}
|
||||
|
||||
if (isDecoratableList(field)) {
|
||||
return proxyForElementsLocator(loader, locator);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isDecoratableField(Field field) {
|
||||
return WebElement.class.isAssignableFrom(field.getType());
|
||||
}
|
||||
|
||||
private boolean isDecoratableList(Field field) {
|
||||
if (!List.class.isAssignableFrom(field.getType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Type erasure in Java isn't complete. Attempt to discover the generic type of the list.
|
||||
Type genericType = field.getGenericType();
|
||||
if (!(genericType instanceof ParameterizedType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Type listType = ((ParameterizedType) genericType).getActualTypeArguments()[0];
|
||||
|
||||
if (!WebElement.class.equals(listType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Object proxyForElementLocator(ClassLoader loader, ElementLocator locator) {
|
||||
InvocationHandler handler = new LocatingElementHandler(locator);
|
||||
Object proxy = Proxy.newProxyInstance( loader, new Class[] {WebElement.class, WrapsElement.class, Locatable.class}, handler);
|
||||
|
||||
return proxy;
|
||||
}
|
||||
|
||||
private Object proxyForElementsLocator(ClassLoader loader, ElementLocator locator) {
|
||||
InvocationHandler handler = new LocatingElementListHandler(locator);
|
||||
Object proxy = Proxy.newProxyInstance(loader, new Class[] {List.class}, handler);
|
||||
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
+21
-4
@@ -7,6 +7,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runner.notification.Failure;
|
||||
@@ -21,7 +23,7 @@ import org.openqa.selenium.Capabilities;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||
|
||||
import com.sap.sailing.selenium.core.Selenium.SeleniumJUnit4ClassRunner;
|
||||
import com.sap.sailing.selenium.core.SeleniumRunner.SeleniumJUnit4ClassRunner;
|
||||
import com.sap.sailing.selenium.core.TestEnvironmentConfiguration.DriverDefinition;
|
||||
import com.sap.sailing.selenium.core.impl.TestEnvironmentImpl;
|
||||
|
||||
@@ -32,7 +34,7 @@ import com.sap.sailing.selenium.core.impl.TestEnvironmentImpl;
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class Selenium extends ParentRunner<SeleniumJUnit4ClassRunner> {
|
||||
public class SeleniumRunner extends ParentRunner<SeleniumJUnit4ClassRunner> {
|
||||
/**
|
||||
* <p>A test runner that will run the tests for a specific browser instance using a Selenium web driver. The web
|
||||
* driver is provided to the tests by injecting it to annotated fields.</p>
|
||||
@@ -207,7 +209,7 @@ public class Selenium extends ParentRunner<SeleniumJUnit4ClassRunner> {
|
||||
* @throws InitializationError
|
||||
* If there was an error during the initialization of the test runner.
|
||||
*/
|
||||
public Selenium(Class<?> klass) throws InitializationError {
|
||||
public SeleniumRunner(Class<?> klass) throws InitializationError {
|
||||
super(klass);
|
||||
|
||||
this.children = new LinkedList<>();
|
||||
@@ -253,7 +255,7 @@ public class Selenium extends ParentRunner<SeleniumJUnit4ClassRunner> {
|
||||
}
|
||||
|
||||
TestClass test = getTestClass();
|
||||
URL screenshotsStorage = (configuration.screenshotsEnabled() ? new URL(screenshotsFolder) : null);
|
||||
URL screenshotsStorage = (configuration.screenshotsEnabled() ? new URL(resolveScreenshotFolder(screenshotsFolder)) : null);
|
||||
|
||||
for (DriverDefinition defenition : configuration.getDriverDefinitions()) {
|
||||
SeleniumJUnit4ClassRunner child = new SeleniumJUnit4ClassRunner(test.getJavaClass(), contextRoot,
|
||||
@@ -265,4 +267,19 @@ public class Selenium extends ParentRunner<SeleniumJUnit4ClassRunner> {
|
||||
throw new InitializationError(exception);
|
||||
}
|
||||
}
|
||||
|
||||
private String resolveScreenshotFolder(String screenshotsFolder) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
Pattern pattern = Pattern.compile("\\{(\\w+((\\.\\w+)+))\\}");
|
||||
Matcher matcher = pattern.matcher(screenshotsFolder);
|
||||
|
||||
while (matcher.find()) {
|
||||
String replacement = System.getProperty(matcher.group(1), "");
|
||||
matcher.appendReplacement(buffer, Matcher.quoteReplacement(replacement));
|
||||
}
|
||||
|
||||
matcher.appendTail(buffer);
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -5,7 +5,7 @@ import java.net.URL;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
/**
|
||||
* <p>Description of the test environment in which a test is executed by the {@link Selenium} runner. The environment is
|
||||
* <p>Description of the test environment in which a test is executed by the {@link SeleniumRunner} runner. The environment is
|
||||
* injected by the runner to fields annotated with {@link Managed} and consists of the web driver which is used, a
|
||||
* folder where screenshots should be stored and a context root (base URL) against the tests is executed.</p>
|
||||
*
|
||||
@@ -21,6 +21,15 @@ public interface TestEnvironment {
|
||||
*/
|
||||
public WebDriver getWebDriver();
|
||||
|
||||
/**
|
||||
* <p>Returns the window manager for the used web driver, which can be used to open new windows and switching
|
||||
* between multiple windows.</p>
|
||||
*
|
||||
* @return
|
||||
* The window manager for the used web driver.
|
||||
*/
|
||||
public WindowManager getWindowManager();
|
||||
|
||||
/**
|
||||
* <p>Returns the context root (base URL) against the tests should be executed. The context root identifies the
|
||||
* web application and usually consists of a protocol definition, the host and a path.</p>
|
||||
|
||||
+3
@@ -185,10 +185,13 @@ public class TestEnvironmentConfiguration {
|
||||
|
||||
private static List<DriverDefinition> createDriverDefinitions(Element testEnvironmentNode) {
|
||||
List<DriverDefinition> definitions = new LinkedList<>();
|
||||
|
||||
List<Element> driverDefinitionNodes = XMLHelper.getElementsNS(testEnvironmentNode, DRIVER_DEFINITION, NAMESPACE_URI);
|
||||
|
||||
for (Element driverDefinitionNode : driverDefinitionNodes) {
|
||||
definitions.add(createDriverDefinition(driverDefinitionNode));
|
||||
}
|
||||
|
||||
return definitions;
|
||||
}
|
||||
|
||||
|
||||
+12
-78
@@ -2,36 +2,16 @@ package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriver.TargetLocator;
|
||||
import org.openqa.selenium.WebDriverException;
|
||||
|
||||
public class WebDriverWindow {
|
||||
|
||||
private static int instanceCount = 0;
|
||||
|
||||
private static final String JAVA_SCRIPT = "var anchorTag = document.createElement('a');" +
|
||||
"anchorTag.setAttribute('id', '%s');" +
|
||||
"anchorTag.setAttribute('href', '%s');" +
|
||||
"anchorTag.setAttribute('target', '_blank');" +
|
||||
"anchorTag.setAttribute('style', 'display:block;');" +
|
||||
"anchorTag.appendChild(document.createTextNode('nwh'));" +
|
||||
"document.getElementsByTagName('body')[0].appendChild(anchorTag);";
|
||||
|
||||
private static String createUniqueName() {
|
||||
return "WebDriverWindow_" + instanceCount++;
|
||||
}
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
private String name;
|
||||
|
||||
private String handle;
|
||||
|
||||
private String parent;
|
||||
|
||||
/**
|
||||
* Creates a new window for given web driver
|
||||
*
|
||||
@@ -40,80 +20,34 @@ public class WebDriverWindow {
|
||||
* @param url
|
||||
* Initial URL to load
|
||||
*/
|
||||
public WebDriverWindow(WebDriver driver, String url) {
|
||||
protected WebDriverWindow(WebDriver driver, String handle) {
|
||||
this.driver = driver;
|
||||
this.name = createUniqueName();
|
||||
|
||||
createWindow(url);
|
||||
// Switch to that window and load the url to wait
|
||||
switchToWindow();//.get(url);
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
|
||||
public String getWindowHandle() {
|
||||
return this.handle;
|
||||
}
|
||||
|
||||
public String getParentHandle() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
switchToWindow().close();
|
||||
this.handle = "";
|
||||
// Switch back to the parent window
|
||||
this.driver.switchTo().window(this.parent);
|
||||
WebDriver driver = switchToWindow();
|
||||
driver.close();
|
||||
|
||||
this.handle = null;
|
||||
}
|
||||
|
||||
public WebDriver switchToWindow() {
|
||||
checkForClosed();
|
||||
|
||||
return switchTo(this.handle);
|
||||
}
|
||||
|
||||
public WebDriver switchToParent() {
|
||||
checkForClosed();
|
||||
TargetLocator locator = this.driver.switchTo();
|
||||
|
||||
return switchTo(this.parent);
|
||||
}
|
||||
|
||||
private void createWindow(String url) {
|
||||
// Record old handles
|
||||
Set<String> oldHandles = this.driver.getWindowHandles();
|
||||
this.parent = this.driver.getWindowHandle();
|
||||
|
||||
// Inject an anchor element
|
||||
injectAnchorTag(this.name, url);
|
||||
|
||||
// Click on the anchor element
|
||||
this.driver.findElement(By.id(this.name)).click();
|
||||
|
||||
this.handle = getNewHandle(oldHandles);
|
||||
}
|
||||
|
||||
private String getNewHandle(Set<String> oldHandles) {
|
||||
Set<String> newHandles = this.driver.getWindowHandles();
|
||||
newHandles.removeAll(oldHandles);
|
||||
|
||||
// Find the new window
|
||||
for(String handle : newHandles)
|
||||
return handle;
|
||||
|
||||
return null;
|
||||
return locator.window(this.handle);
|
||||
}
|
||||
|
||||
private void checkForClosed() {
|
||||
if(this.handle == null || this.handle.equals(""))
|
||||
throw new WebDriverException("Web Window closed or not initialized");
|
||||
}
|
||||
|
||||
private void injectAnchorTag(String id, String url) {
|
||||
JavascriptExecutor executor = (JavascriptExecutor) this.driver;
|
||||
executor.executeScript(String.format(JAVA_SCRIPT, id, url));
|
||||
}
|
||||
|
||||
private WebDriver switchTo(String handle) {
|
||||
TargetLocator locator = this.driver.switchTo();
|
||||
Set<String> handles = this.driver.getWindowHandles();
|
||||
|
||||
return locator.window(handle);
|
||||
if(!handles.contains(this.handle))
|
||||
throw new WebDriverException("Window closed or not initialized"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package com.sap.sailing.selenium.core;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.openqa.selenium.JavascriptExecutor;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriver.TargetLocator;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @author
|
||||
* Riccardo Nimser (D049941)
|
||||
*/
|
||||
public class WindowManager {
|
||||
private static final String JAVA_SCRIPT = "window.open('%s', '_blank')";
|
||||
|
||||
private WebDriver driver;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param driver
|
||||
*
|
||||
*/
|
||||
public WindowManager(WebDriver driver) {
|
||||
this.driver = driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
public void switchTo(String url) {
|
||||
WebDriverWindow window = findWindow(url);
|
||||
|
||||
if(window == null)
|
||||
throw new RuntimeException("Window not found");
|
||||
|
||||
window.switchToWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns a handle to the window witch is currently active.</p>
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public WebDriverWindow getCurrentWindow() {
|
||||
return new WebDriverWindow(this.driver, this.driver.getWindowHandle());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* <p>Note: If no window is found with the specified URL, </p>
|
||||
*
|
||||
* @param url
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public WebDriverWindow findWindow(String url) {
|
||||
if(url == null)
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
TargetLocator locator = this.driver.switchTo();
|
||||
|
||||
for(String handle : this.driver.getWindowHandles()) {
|
||||
locator.window(handle);
|
||||
|
||||
if(url.equals(this.driver.getCurrentUrl()))
|
||||
return new WebDriverWindow(this.driver, handle);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public WebDriverWindow openNewWindow() {
|
||||
return openNewWindow("");
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public WebDriverWindow openNewWindow(String url) {
|
||||
return new WebDriverWindow(this.driver, createWindow(url));
|
||||
}
|
||||
|
||||
private String createWindow(String url) {
|
||||
// Record old handles
|
||||
Set<String> oldHandles = this.driver.getWindowHandles();
|
||||
|
||||
executeScript(url != null ? url : "");
|
||||
|
||||
return getNewHandle(oldHandles);
|
||||
}
|
||||
|
||||
private void executeScript(String url) {
|
||||
JavascriptExecutor executor = (JavascriptExecutor) this.driver;
|
||||
executor.executeScript(String.format(JAVA_SCRIPT, url));
|
||||
}
|
||||
|
||||
private String getNewHandle(Set<String> oldHandles) {
|
||||
Set<String> newHandles = this.driver.getWindowHandles();
|
||||
newHandles.removeAll(oldHandles);
|
||||
|
||||
// Find the new window
|
||||
for(String handle : newHandles)
|
||||
return handle;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.sap.sailing.selenium.core.impl;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
|
||||
import com.sap.sailing.selenium.core.ScreenShotFilenameGenerator;
|
||||
|
||||
public class DefaultFilenameGenerator implements ScreenShotFilenameGenerator {
|
||||
@Override
|
||||
public String getTargetFilename(Description description) {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.sap.sailing.selenium.core.impl;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
|
||||
public class JUnitAttachmentsPluginFilenameGenerator extends DefaultFilenameGenerator {
|
||||
@Override
|
||||
public String getTargetFilename(Description description) {
|
||||
return description.getClassName() + "/" + super.getTargetFilename(description);
|
||||
}
|
||||
}
|
||||
-57
@@ -1,57 +0,0 @@
|
||||
package com.sap.sailing.selenium.core.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.runner.Description;
|
||||
|
||||
import com.sap.sailing.selenium.core.ScreenShotFilenameGenerator;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class ScreenShotFilenameGeneratorImpl implements ScreenShotFilenameGenerator {
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmssSSS"); //$NON-NLS-1$
|
||||
|
||||
private final File directory;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param directory
|
||||
*
|
||||
*/
|
||||
public ScreenShotFilenameGeneratorImpl(File directory) {
|
||||
this.directory = directory;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Generates unique file names for the test case described by the given description.</p>
|
||||
*
|
||||
* TODO: Describe the resulting filename
|
||||
*
|
||||
* @param description
|
||||
* The test case description.
|
||||
* @return
|
||||
* The generated unique file name.
|
||||
*/
|
||||
@Override
|
||||
public File getTargetFilename(final Description description) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append(description.getMethodName());
|
||||
builder.append('-');
|
||||
builder.append(DATE_FORMAT.format(new Date()));
|
||||
builder.append('-');
|
||||
builder.append(UUID.randomUUID().toString());
|
||||
builder.append(SCREENSHOT_FILE_EXTENSION);
|
||||
|
||||
return new File(new File(this.directory, description.getTestClass().getCanonicalName().replace('.', File.separatorChar)),
|
||||
builder.toString());
|
||||
}
|
||||
}
|
||||
+9
@@ -5,6 +5,7 @@ import java.net.URL;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import com.sap.sailing.selenium.core.TestEnvironment;
|
||||
import com.sap.sailing.selenium.core.WindowManager;
|
||||
|
||||
/**
|
||||
* <p>Default implementation of the test environment.</p>
|
||||
@@ -14,6 +15,7 @@ import com.sap.sailing.selenium.core.TestEnvironment;
|
||||
*/
|
||||
public class TestEnvironmentImpl implements TestEnvironment {
|
||||
private WebDriver driver;
|
||||
private WindowManager manager;
|
||||
private String root;
|
||||
private URL screenshots;
|
||||
|
||||
@@ -31,6 +33,8 @@ public class TestEnvironmentImpl implements TestEnvironment {
|
||||
this.driver = driver;
|
||||
this.root = root;
|
||||
this.screenshots = screenshots;
|
||||
|
||||
this.manager = new WindowManager(driver);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,6 +42,11 @@ public class TestEnvironmentImpl implements TestEnvironment {
|
||||
return this.driver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WindowManager getWindowManager() {
|
||||
return this.manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContextRoot() {
|
||||
return this.root;
|
||||
|
||||
+24
-2
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.selenium.test;
|
||||
package com.sap.sailing.selenium.pages;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
@@ -10,6 +10,24 @@ import org.openqa.selenium.WebDriver;
|
||||
* D049941
|
||||
*/
|
||||
public class HostPage extends PageObject {
|
||||
protected static final String GWT_CODE_SERVER_PARAMETER_NAME = "gwt.codesvr"; //$NON-NLS-1$
|
||||
|
||||
protected static final String NO_CODE_SERVER_PARAMTER_VALUE = ""; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* </p>The default timeout of 60 seconds for the initialization of the page object.</p>
|
||||
*/
|
||||
protected static final int DEFAULT_PAGE_LOAD_TIMEOUT = 60;
|
||||
|
||||
protected static final String getGWTCodeServer() {
|
||||
String codeServer = System.getProperty(GWT_CODE_SERVER_PARAMETER_NAME);
|
||||
|
||||
if(codeServer == null)
|
||||
return NO_CODE_SERVER_PARAMTER_VALUE;
|
||||
|
||||
return GWT_CODE_SERVER_PARAMETER_NAME + "=" + codeServer;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Creates a new page object with the given web driver. In GWT an entry point is connected to a HTML page in
|
||||
* which the code for the application is executed, whereby the page is represented by the web driver.</p>
|
||||
@@ -28,8 +46,12 @@ public class HostPage extends PageObject {
|
||||
*/
|
||||
@Override
|
||||
protected void initElements() {
|
||||
waitForAjaxRequests(super.getTimeOut(), 5);
|
||||
waitForAjaxRequests(getPageLoadTimeOut(), 5);
|
||||
|
||||
super.initElements();
|
||||
}
|
||||
|
||||
protected int getPageLoadTimeOut() {
|
||||
return DEFAULT_PAGE_LOAD_TIMEOUT;
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.selenium.test;
|
||||
package com.sap.sailing.selenium.pages;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
@@ -22,4 +22,14 @@ public class PageArea extends PageObject {
|
||||
public PageArea(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the underlying WebElement which is represented by the page object.</p>
|
||||
*
|
||||
* @return
|
||||
* The underlying WebElement.
|
||||
*/
|
||||
public WebElement getWebElement() {
|
||||
return (WebElement) this.context;
|
||||
}
|
||||
}
|
||||
+125
-15
@@ -1,5 +1,8 @@
|
||||
package com.sap.sailing.selenium.test;
|
||||
package com.sap.sailing.selenium.pages;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -17,6 +20,7 @@ import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.core.FindBys;
|
||||
import com.sap.sailing.selenium.core.SeleniumElementLocatorFactory;
|
||||
import com.sap.sailing.selenium.core.SeleniumFieldDecorator;
|
||||
|
||||
/**
|
||||
* <p>Within a web app's UI there are areas that tests interact with. A page object simply models these as objects
|
||||
@@ -42,10 +46,14 @@ import com.sap.sailing.selenium.core.SeleniumElementLocatorFactory;
|
||||
* D049941
|
||||
*/
|
||||
public class PageObject {
|
||||
public static final int DEFAULT_WAIT_TIMEOUT = 30;
|
||||
|
||||
public static final int DEFAULT_POLLING_INTERVAL = 5;
|
||||
|
||||
/**
|
||||
* </p>The default timeout of 60 seconds for the initialization of the page object.</p>
|
||||
* </p>The default timeout of 5 seconds for the lookup of other elements.</p>
|
||||
*/
|
||||
protected static final int DEFAULT_TIMEOUT = 60;
|
||||
protected static final int DEFAULT_LOOKUP_TIMEOUT = 5;
|
||||
|
||||
/**
|
||||
* <p>The web driver to use.</p>
|
||||
@@ -57,6 +65,107 @@ public class PageObject {
|
||||
*/
|
||||
protected final SearchContext context;
|
||||
|
||||
/**
|
||||
* <p>Creates a FluentWait with the given input and the default timeout and polling interval.</p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public static <T> FluentWait<T> createFluentWait(T input) {
|
||||
return createFluentWait(input, Collections.<Class<? extends Throwable>>emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @param exceptions
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
@SafeVarargs
|
||||
public static <T> FluentWait<T> createFluentWait(T input, Class<? extends Throwable>... exceptions) {
|
||||
return createFluentWait(input, Arrays.asList(exceptions));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @param exceptions
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public static <T> FluentWait<T> createFluentWait(T input, Collection<Class<? extends Throwable>> exceptions) {
|
||||
return createFluentWait(input, DEFAULT_WAIT_TIMEOUT, DEFAULT_POLLING_INTERVAL, exceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Creates a FluentWait with the given input and the specified timeout and polling interval.</p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @param timeout
|
||||
*
|
||||
* @param polling
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public static <T> FluentWait<T> createFluentWait(T input, int timeout, int polling) {
|
||||
return createFluentWait(input, timeout, polling, Collections.<Class<? extends Throwable>>emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @param timeout
|
||||
*
|
||||
* @param polling
|
||||
*
|
||||
* @param exceptions
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
@SafeVarargs
|
||||
public static <T> FluentWait<T> createFluentWait(T input, int timeout, int polling,
|
||||
Class<? extends Throwable>... exceptions) {
|
||||
return createFluentWait(input, timeout, polling, Arrays.asList(exceptions));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param input
|
||||
*
|
||||
* @param timeout
|
||||
*
|
||||
* @param polling
|
||||
*
|
||||
* @param exceptions
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*/
|
||||
public static <T> FluentWait<T> createFluentWait(T input, int timeout, int polling,
|
||||
Collection<Class<? extends Throwable>> exceptions) {
|
||||
FluentWait<T> wait = new FluentWait<>(input);
|
||||
wait.withTimeout(timeout, TimeUnit.SECONDS);
|
||||
wait.pollingEvery(polling, TimeUnit.SECONDS);
|
||||
wait.ignoreAll(exceptions);
|
||||
|
||||
return wait;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Creates a new page object with the given web driver. This constructor is equivalent to the two argument
|
||||
* constructor whereby the web driver is also used as the context for the page object.</p>
|
||||
@@ -93,10 +202,10 @@ public class PageObject {
|
||||
|
||||
/**
|
||||
* <p>Initialize the page object. The default implementation use a factory to lazily initialize the elements
|
||||
* (annotated fields) of the page object using the timeout duration returned by {@link #getTimeOut()}. To get a
|
||||
* field lazily initialized you have to annotate the field either with {@link FindBy} or with {@link FindBys}.
|
||||
* If the element never changes (that is, that the same instance in the DOM can always be used) it is also
|
||||
* possible to use a cache for the lookup by using the annotation {@code CacheLookup} in addition.</p>
|
||||
* (annotated fields) of the page object using the timeout duration returned by {@link #getPageLoadTimeOut()}.
|
||||
* To get a field lazily initialized you have to annotate the field either with {@link FindBy} or with
|
||||
* {@link FindBys}. If the element never changes (that is, that the same instance in the DOM can always be used)
|
||||
* it is also possible to use a cache for the lookup by using the annotation {@code CacheLookup} in addition.</p>
|
||||
*
|
||||
* <p>A simple example for the implementation of a page object can look as follows:</p>
|
||||
*
|
||||
@@ -132,7 +241,10 @@ public class PageObject {
|
||||
* the default implementation.</p>
|
||||
*/
|
||||
protected void initElements() {
|
||||
PageFactory.initElements(new SeleniumElementLocatorFactory(this.context, getTimeOut()), this);
|
||||
SeleniumElementLocatorFactory factory = new SeleniumElementLocatorFactory(this.context, getLookupTimeOut());
|
||||
SeleniumFieldDecorator decorator = new SeleniumFieldDecorator(factory);
|
||||
|
||||
PageFactory.initElements(decorator, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,8 +253,8 @@ public class PageObject {
|
||||
* @return
|
||||
* The timeout duration for the initialization of the page object.
|
||||
*/
|
||||
protected int getTimeOut() {
|
||||
return DEFAULT_TIMEOUT;
|
||||
protected int getLookupTimeOut() {
|
||||
return DEFAULT_LOOKUP_TIMEOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +323,7 @@ public class PageObject {
|
||||
* @see #waitForAjaxRequests(int timeout, int polling)
|
||||
*/
|
||||
protected void waitForAjaxRequests() {
|
||||
waitForAjaxRequests(30, 5);
|
||||
waitForAjaxRequests(DEFAULT_WAIT_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,7 +338,7 @@ public class PageObject {
|
||||
* @see #waitForAjaxRequests(int timeout, int polling)
|
||||
*/
|
||||
protected void waitForAjaxRequests(String category) {
|
||||
waitForAjaxRequests(category, 30, 5);
|
||||
waitForAjaxRequests(category, DEFAULT_WAIT_TIMEOUT, DEFAULT_POLLING_INTERVAL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -260,9 +372,7 @@ public class PageObject {
|
||||
* if the timeout expires.
|
||||
*/
|
||||
protected void waitForAjaxRequests(String category, int timeout, int polling) {
|
||||
FluentWait<WebDriver> wait = new FluentWait<>(this.driver);
|
||||
wait.withTimeout(timeout, TimeUnit.SECONDS);
|
||||
wait.pollingEvery(polling, TimeUnit.SECONDS);
|
||||
FluentWait<WebDriver> wait = createFluentWait(this.driver, timeout, polling);
|
||||
|
||||
wait.until(new AjaxCallsComplete(category));
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole;
|
||||
|
||||
import org.openqa.selenium.Alert;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoAlertPresentException;
|
||||
import org.openqa.selenium.SearchContext;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebDriver.TargetLocator;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.sap.sailing.selenium.pages.PageObject;
|
||||
|
||||
public class ActionsHelper {
|
||||
private static final String ACTION_XPATH = ".//descendant::div[@name='%s']/img";
|
||||
|
||||
public static final String EDIT_ACTION = "ACTION_EDIT";
|
||||
|
||||
public static final String REMOVE_ACTION = "ACTION_REMOVE";
|
||||
|
||||
public static final String EDIT_SCORES_ACTION = "ACTION_EDIT_SCORES";
|
||||
|
||||
public static final String CONFIGURE_URL_ACTION = "ACTION_CONFIGURE_URL";
|
||||
|
||||
public static final String UNLINK_RACE_ACTION = "ACTION_UNLINK";
|
||||
|
||||
public static final String REFRESH_RACE_ACTION = "ACTION_REFRESH_RACE";
|
||||
|
||||
public static WebElement findEditAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, EDIT_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findRemoveAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, REMOVE_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findEditScoresAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, EDIT_SCORES_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findConfigureUrlAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, CONFIGURE_URL_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findUnlinkRaceAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, UNLINK_RACE_ACTION)));
|
||||
}
|
||||
|
||||
public static WebElement findRefreshAction(SearchContext context) {
|
||||
return context.findElement(By.xpath(String.format(ACTION_XPATH, REFRESH_RACE_ACTION)));
|
||||
}
|
||||
|
||||
public static void acceptAlert(WebDriver driver) {
|
||||
Alert alert = getAlert(driver);
|
||||
alert.accept();
|
||||
}
|
||||
|
||||
public static void dismissAlert(WebDriver driver) {
|
||||
Alert alert = getAlert(driver);
|
||||
alert.dismiss();
|
||||
}
|
||||
|
||||
public static Alert getAlert(WebDriver driver) {
|
||||
FluentWait<WebDriver> wait = PageObject.createFluentWait(driver, NoAlertPresentException.class);
|
||||
|
||||
Alert alert = wait.until(new Function<WebDriver, Alert>() {
|
||||
@Override
|
||||
public Alert apply(WebDriver driver) {
|
||||
TargetLocator locator = driver.switchTo();
|
||||
|
||||
return locator.alert();
|
||||
}
|
||||
});
|
||||
|
||||
return alert;
|
||||
}
|
||||
}
|
||||
+261
@@ -0,0 +1,261 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.By.ByXPath;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.CacheLookup;
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.ElementSearchConditions;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.HostPage;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardConfigurationPanelPO;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.leaderboard.LeaderboardGroupConfigurationPanelPO;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaStructureManagementPanelPO;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesManagementPanelPO;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.tractrac.TracTracEventManagementPanelPO;
|
||||
|
||||
/**
|
||||
* <p>The page object representing the administration console. The console consists of multiple tabs with its content
|
||||
* between you can switch.</p>
|
||||
*
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class AdminConsolePage extends HostPage {
|
||||
private enum ScrollDirection {
|
||||
Left {
|
||||
@Override
|
||||
public By getBy() {
|
||||
return By.className("gwt-ScrolledTabLayoutPanel-scrollLeft");
|
||||
}
|
||||
},
|
||||
Rigth {
|
||||
@Override
|
||||
public By getBy() {
|
||||
return By.className("gwt-ScrolledTabLayoutPanel-scrollRight");
|
||||
}
|
||||
};
|
||||
|
||||
public abstract By getBy();
|
||||
}
|
||||
|
||||
private static final String PAGE_TITLE = "SAP Sailing Analytics Administration Console"; //$NON-NLS-1$
|
||||
|
||||
private static final MessageFormat TAB_EXPRESSION = new MessageFormat(
|
||||
".//div[contains(@class, \"gwt-TabLayoutPanelTabInner\")]/div[text()=\"{0}\"]/../..");
|
||||
|
||||
private static final String REGATTA_STRUCTURE_TAB_LABEL = "Regattas"; //$NON-NLS-1$
|
||||
private static final String REGATTA_STRUCTURE_TAB_IDENTIFIER = "RegattaStructureManagement"; //$NON-NLS-1$
|
||||
|
||||
private static final String TRACTRAC_EVENTS_TAB_LABEL = "TracTrac Events"; //$NON-NLS-1$
|
||||
private static final String TRACTRAC_EVENTS_TAB_IDENTIFIER = "TracTracEventManagement"; //$NON-NLS-1$
|
||||
|
||||
private static final String TRACKED_RACES_TAB_LABEL = "Tracked races"; //$NON-NLS-1$
|
||||
private static final String TRACKED_RACES_TAB_IDENTIFIER = "TrackedRacesManagement"; //$NON-NLS-1$
|
||||
|
||||
private static final String LEADERBOARD_CONFIGURATION_TAB_LABEL = "Leaderboard Configuration"; //$NON-NLS-1$
|
||||
private static final String LEADERBOARD_CONFIGURATION_TAB_IDENTIFIER = "LeaderboardConfiguration"; //$NON-NLS-1$
|
||||
|
||||
private static final String LEADERBOARD_GROUP_CONFIGURATION_TAB_LABEL = "Leaderboard Group Configuration"; //$NON-NLS-1$
|
||||
private static final String LEADERBOARD_GROUP_CONFIGURATION_TAB_IDENTIFIER = "LeaderboardGroupConfiguration"; //$NON-NLS-1$
|
||||
|
||||
private static final Logger logger = Logger.getLogger(AdminConsolePage.class.getName());
|
||||
|
||||
/**
|
||||
* <p>Goes to the administration console and returns the representing page object.</p>
|
||||
*
|
||||
* @param driver
|
||||
* The web driver to use.
|
||||
* @param root
|
||||
* The context root of the application.
|
||||
* @return
|
||||
* The page object for the administration console.
|
||||
*/
|
||||
public static AdminConsolePage goToPage(WebDriver driver, String root) {
|
||||
logger.info("Window is " + driver.manage().window().getSize().width + ", " + driver.manage().window().getSize().height);
|
||||
//driver.manage().window().setSize(new Dimension(994, 730));
|
||||
driver.get(root + "gwt/AdminConsole.html?" + getGWTCodeServer()); //$NON-NLS-1$
|
||||
|
||||
// TODO: As soon as the security API is available in Selenium we should use it to login into the admin console.
|
||||
// FluentWait<WebDriver> wait = createFluentWait(driver);
|
||||
// wait.withTimeout(5, TimeUnit.SECONDS);
|
||||
// wait.pollingEvery(100, TimeUnit.MILLISECONDS);
|
||||
//
|
||||
// Alert alert = wait.until(new Function<WebDriver, Alert>() {
|
||||
// @Override
|
||||
// public Alert apply(WebDriver context) {
|
||||
// TargetLocator locator = context.switchTo();
|
||||
//
|
||||
// return locator.alert();
|
||||
// }
|
||||
// });
|
||||
// alert.authenticateUsing(new UserAndPassword("user", "password"));
|
||||
|
||||
return new AdminConsolePage(driver);
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AdministrationTabs")
|
||||
private WebElement tabPanel;
|
||||
|
||||
@CacheLookup
|
||||
@FindBy(how = ByXPath.class, using = ".//div[contains(@class, \"gwt-TabLayoutPanelTabInner\")]/..")
|
||||
private List<WebElement> tabs;
|
||||
|
||||
private AdminConsolePage(WebDriver driver) {
|
||||
super(driver);
|
||||
}
|
||||
|
||||
public RegattaStructureManagementPanelPO goToRegattaStructure() {
|
||||
return new RegattaStructureManagementPanelPO(this.driver, goToTab(REGATTA_STRUCTURE_TAB_LABEL,
|
||||
REGATTA_STRUCTURE_TAB_IDENTIFIER));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Switch to the TracTrac Events tab and waits until the animation is finished. The returned page object,
|
||||
* representing the tab, becomes invalid if you switch to another tab in the administration console.</p>
|
||||
*
|
||||
* @return
|
||||
* The page object for the TracTracEvents tab.
|
||||
*/
|
||||
public TracTracEventManagementPanelPO goToTracTracEvents() {
|
||||
return new TracTracEventManagementPanelPO(this.driver, goToTab(TRACTRAC_EVENTS_TAB_LABEL,
|
||||
TRACTRAC_EVENTS_TAB_IDENTIFIER));
|
||||
}
|
||||
|
||||
public TrackedRacesManagementPanelPO goToTrackedRaces() {
|
||||
return new TrackedRacesManagementPanelPO(this.driver, goToTab(TRACKED_RACES_TAB_LABEL,
|
||||
TRACKED_RACES_TAB_IDENTIFIER));
|
||||
}
|
||||
|
||||
public LeaderboardConfigurationPanelPO goToLeaderboardConfiguration() {
|
||||
return new LeaderboardConfigurationPanelPO(this.driver, goToTab(LEADERBOARD_CONFIGURATION_TAB_LABEL,
|
||||
LEADERBOARD_CONFIGURATION_TAB_IDENTIFIER));
|
||||
}
|
||||
|
||||
public LeaderboardGroupConfigurationPanelPO goToLeaderboardGroupConfiguration() {
|
||||
return new LeaderboardGroupConfigurationPanelPO(this.driver, goToTab(LEADERBOARD_GROUP_CONFIGURATION_TAB_LABEL,
|
||||
LEADERBOARD_GROUP_CONFIGURATION_TAB_IDENTIFIER));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Verifies that the current page is the administration console by checking the title of the page.</p>
|
||||
*/
|
||||
@Override
|
||||
protected void verify() {
|
||||
if(!PAGE_TITLE.equals(this.driver.getTitle())) {
|
||||
throw new IllegalStateException("This is not the administration console: " + this.driver.getTitle()); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private WebElement goToTab(String label, final String id) {
|
||||
logger.info("Try to got to tab " + label);
|
||||
String expression = TAB_EXPRESSION.format(new Object[] {label});
|
||||
WebElement tab = this.tabPanel.findElement(By.xpath(expression));
|
||||
|
||||
ScrollDirection direction = getScrollDirection(tab);
|
||||
|
||||
if(direction != null) {
|
||||
WebElement scroller = this.tabPanel.findElement(direction.getBy());
|
||||
|
||||
while(!tab.isDisplayed() && scroller.isDisplayed()) {
|
||||
WebElement arrow = scroller.findElement(By.tagName("img"));
|
||||
arrow.click();
|
||||
|
||||
// QUESTION: Do we need some kind of delay because of the scrolling?
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Workaround for "Offset within element cannot be scrolled into view: (-1, 5)".
|
||||
// We try to scroll one more time to make the tab completely visible
|
||||
//
|
||||
// TODO: Create a bug report for this!
|
||||
int tabIndex = (direction == ScrollDirection.Left ? getFirstVisibleTabIndex() : getLastVisibleTabIndex());
|
||||
|
||||
if(scroller.isDisplayed() && getTabIndex(tab) == tabIndex) {
|
||||
WebElement arrow = scroller.findElement(By.tagName("img"));
|
||||
arrow.click();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// We have to determine the location where we have to click at the tab for the case its not completely visible.
|
||||
// NOTE: We assume that the browser window is big enough to display at least 2 tabs!
|
||||
Actions actions = new Actions(this.driver);
|
||||
int offset = determineOffsetForClick(tab);
|
||||
logger.info("Try to click on tab " + label + " at posstion " + offset + ", 5");
|
||||
actions.moveToElement(tab, offset, 5);
|
||||
actions.click();
|
||||
actions.perform();
|
||||
|
||||
// Wait for the tab to become visible due to the used animations.
|
||||
FluentWait<WebElement> wait = createFluentWait(this.tabPanel);
|
||||
WebElement content = wait.until(ElementSearchConditions.visibilityOfElementLocated(new BySeleniumId(id)));
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
private ScrollDirection getScrollDirection(WebElement tab) {
|
||||
int tabIndex = getTabIndex(tab);
|
||||
|
||||
logger.info("Try to determine scroll direction");
|
||||
logger.info("Index for tab " + tab.getText() + " is " + tabIndex);
|
||||
logger.info("First visible tab is " + getFirstVisibleTabIndex());
|
||||
logger.info("Last visible tab is " + getLastVisibleTabIndex());
|
||||
|
||||
if(tabIndex < getFirstVisibleTabIndex())
|
||||
return ScrollDirection.Left;
|
||||
|
||||
if(tabIndex > getLastVisibleTabIndex())
|
||||
return ScrollDirection.Rigth;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getTabIndex(WebElement tab) {
|
||||
return tab.findElements(By.xpath("./preceding-sibling::div")).size();
|
||||
}
|
||||
|
||||
private int getFirstVisibleTabIndex() {
|
||||
for(int i = 0; i <= this.tabs.size() - 1; i++) {
|
||||
if(this.tabs.get(i).isDisplayed()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int getLastVisibleTabIndex() {
|
||||
for(int i = this.tabs.size() - 1; i >= 0; i--) {
|
||||
if(this.tabs.get(i).isDisplayed()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int determineOffsetForClick(WebElement tab) {
|
||||
int tabIndex = getTabIndex(tab);
|
||||
logger.info("Try to determine offset for click");
|
||||
logger.info("Index for tab " + tab.getText() + " is " + tabIndex);
|
||||
logger.info("First visible tab is " + getFirstVisibleTabIndex());
|
||||
logger.info("Last visible tab is " + getLastVisibleTabIndex());
|
||||
if(tabIndex == getFirstVisibleTabIndex())
|
||||
return -1;
|
||||
|
||||
if(tabIndex == getLastVisibleTabIndex())
|
||||
return +1;
|
||||
|
||||
return tab.getSize().width / 2;
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class FlexibleLeaderboardCreateDialogPO extends DataEntryDialogPO {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DisplayNameTextBox")
|
||||
private WebElement displayNameTextBox;
|
||||
|
||||
public FlexibleLeaderboardCreateDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.nameTextBox.clear();
|
||||
this.nameTextBox.sendKeys(name);
|
||||
}
|
||||
|
||||
public void setDisplayName(String name) {
|
||||
this.displayNameTextBox.clear();
|
||||
this.displayNameTextBox.sendKeys(name);
|
||||
}
|
||||
}
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.ActionsHelper;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListCompositePO.RegattaDescriptor;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
public class LeaderboardConfigurationPanelPO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateFlexibleLeaderboardButton")
|
||||
private WebElement createFlexibleLeaderboardButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateRegattaLeaderboardButton")
|
||||
private WebElement createRegattaLeaderboardButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveLeaderboardsButton")
|
||||
private WebElement removeLeaderboardsButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsFilterTextBox")
|
||||
private WebElement leaderboardsFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsCellTable")
|
||||
private WebElement leaderboardsCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardDetailsPanel")
|
||||
private WebElement leaderboardDetailsPanel;
|
||||
|
||||
public LeaderboardConfigurationPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public FlexibleLeaderboardCreateDialogPO startCreatingFlexibleLeaderboard() {
|
||||
this.createFlexibleLeaderboardButton.click();
|
||||
// Wait, since we trigger an AJAX-request to get the available events
|
||||
waitForAjaxRequests();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "FlexibleLeaderboardCreateDialog");
|
||||
|
||||
return new FlexibleLeaderboardCreateDialogPO(this.driver, dialog);
|
||||
}
|
||||
|
||||
// TODO: Extend with display name, scoring system, event, course area and discars
|
||||
public void createFlexibleLeaderboard(String name) {
|
||||
FlexibleLeaderboardCreateDialogPO dialog = startCreatingFlexibleLeaderboard();
|
||||
dialog.setName(name);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
public RegattaLeaderboardCreateDialogPO startCreatingRegattaLeaderboard() {
|
||||
this.createRegattaLeaderboardButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "RegattaLeaderboardCreateDialog");
|
||||
|
||||
return new RegattaLeaderboardCreateDialogPO(this.driver, dialog);
|
||||
}
|
||||
|
||||
public void createRegattaLeaderboard(RegattaDescriptor regatta) {
|
||||
RegattaLeaderboardCreateDialogPO dialog = startCreatingRegattaLeaderboard();
|
||||
dialog.selectRegatta(regatta);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
public void deleteLeaderboard(String leaderboard) {
|
||||
DataEntryPO entry = findLeaderboard(leaderboard);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement removeAction = ActionsHelper.findRemoveAction(entry.getWebElement());
|
||||
removeAction.click();
|
||||
|
||||
ActionsHelper.acceptAlert(this.driver);
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLeaderboardURL(String leaderboard) {
|
||||
DataEntryPO entry = findLeaderboard(leaderboard);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement link = entry.getWebElement().findElement(By.xpath(".//td/div/a"));
|
||||
|
||||
return link.getAttribute("href");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getAvailableLeaderboards() {
|
||||
List<String> leaderboards = new ArrayList<>();
|
||||
|
||||
CellTablePO<DataEntryPO> table = getLeaderboardTable();
|
||||
List<DataEntryPO> entries = table.getEntries();
|
||||
|
||||
for(DataEntryPO entry : entries) {
|
||||
leaderboards.add(entry.getColumnContent(0));
|
||||
}
|
||||
|
||||
return leaderboards;
|
||||
}
|
||||
|
||||
public LeaderboardDetailsPanelPO getLeaderboardDetails(String leaderboard) {
|
||||
CellTablePO<DataEntryPO> table = getLeaderboardTable();
|
||||
List<DataEntryPO> entries = table.getEntries();
|
||||
|
||||
for(DataEntryPO entry : entries) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(leaderboard.equals(name)) {
|
||||
entry.select();
|
||||
|
||||
return new LeaderboardDetailsPanelPO(this.driver, this.leaderboardDetailsPanel);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getLeaderboardTable() {
|
||||
return new GenericCellTablePO<>(this.driver, this.leaderboardsCellTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
private DataEntryPO findLeaderboard(String leaderboard) {
|
||||
CellTablePO<DataEntryPO> table = getLeaderboardTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(leaderboard.equals(name)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.ActionsHelper;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesListPO.TrackedRaceDescriptor;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
public class LeaderboardDetailsPanelPO extends PageArea {
|
||||
public static class RaceDescriptor {
|
||||
private final String name;
|
||||
private final String fleet;
|
||||
private final boolean medalRace;
|
||||
private final boolean linked;
|
||||
private final double factor;
|
||||
|
||||
public RaceDescriptor(String name, String fleet, boolean medalRace, boolean linked, double factor) {
|
||||
this.name = name;
|
||||
this.fleet = fleet;
|
||||
this.medalRace = medalRace;
|
||||
this.linked = linked;
|
||||
this.factor = factor;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getFleet() {
|
||||
return this.fleet;
|
||||
}
|
||||
|
||||
public boolean isMedalRace() {
|
||||
return this.medalRace;
|
||||
}
|
||||
|
||||
public boolean isLinked() {
|
||||
return this.linked;
|
||||
}
|
||||
|
||||
public double getFactor() {
|
||||
return this.factor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.name, this.fleet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
RaceDescriptor other = (RaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.name, other.name))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.fleet, other.fleet))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RacesCellTable")
|
||||
private WebElement racesCellTable;
|
||||
|
||||
// TODO: Only available for flexible leader boards
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRacesButton")
|
||||
private WebElement addRacesButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesListComposite")
|
||||
private WebElement trackedRacesListComposite;
|
||||
|
||||
public LeaderboardDetailsPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Assuming that the leaderboard is already selected, clicks the "Add Races..." button
|
||||
// * @param i
|
||||
// */
|
||||
// // TODO: Must be a flexible leaderboard
|
||||
public void addRacesToFlexibleLeaderboard(int i) {
|
||||
this.addRacesButton.click();
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "RaceColumnsInLeaderboardDialog");
|
||||
RaceColumnsInLeaderboardDialog raceColumnsInLeaderboardDialog = new RaceColumnsInLeaderboardDialog(this.driver, dialog);
|
||||
raceColumnsInLeaderboardDialog.addRaces(2);
|
||||
//selectRaceColumn("R1", "Default");
|
||||
}
|
||||
//
|
||||
// public void selectRaceColumn(String raceColumnName, String fleetName) {
|
||||
// CellTable table = getRaceColumnsTable();
|
||||
// for (WebElement row : table.getRows()) {
|
||||
// List<WebElement> fields = row.findElements(By.tagName("td"));
|
||||
// if (raceColumnName.equals(fields.get(0).getText()) && fleetName.equals(fields.get(1).getText())) {
|
||||
// fields.get(1).click();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public List<RaceDescriptor> getRaces() {
|
||||
List<RaceDescriptor> result = new ArrayList<>();
|
||||
|
||||
CellTablePO<DataEntryPO> racesTable = getRacesTable();
|
||||
|
||||
for(DataEntryPO entry : racesTable.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String fleet = entry.getColumnContent(1);
|
||||
//String medalRace = entry.getColumnContent(2);
|
||||
//String linked = entry.getColumnContent(3);
|
||||
//String factor = entry.getColumnContent(4);
|
||||
|
||||
result.add(new RaceDescriptor(name, fleet, false, false, 0.0));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public RaceEditDialog editRace(RaceDescriptor race) {
|
||||
//
|
||||
// WebElement action = Actions.findEditAction(findRace(race));
|
||||
//
|
||||
// action.click();
|
||||
// }
|
||||
|
||||
public void unlinkRace(RaceDescriptor race) {
|
||||
DataEntryPO entry = findRace(race);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = ActionsHelper.findUnlinkRaceAction(entry.getWebElement());
|
||||
|
||||
action.click();
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshRaceLog(RaceDescriptor race) {
|
||||
DataEntryPO entry = findRace(race);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = ActionsHelper.findRefreshAction(entry.getWebElement());
|
||||
|
||||
action.click();
|
||||
|
||||
// QUESTION [D049941]: What else can happen?
|
||||
ActionsHelper.acceptAlert(this.driver);
|
||||
}
|
||||
}
|
||||
|
||||
public void linkRace(RaceDescriptor race, TrackedRaceDescriptor tracking) {
|
||||
DataEntryPO raceRow = findRace(race);
|
||||
DataEntryPO trackingRow = findTracking(tracking);
|
||||
|
||||
if(raceRow == null || trackingRow == null) {
|
||||
}
|
||||
|
||||
raceRow.select();
|
||||
trackingRow.select();
|
||||
}
|
||||
|
||||
private DataEntryPO findRace(RaceDescriptor race) {
|
||||
CellTablePO<DataEntryPO> racesTable = getRacesTable();
|
||||
|
||||
for(DataEntryPO entry : racesTable.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String fleet = entry.getColumnContent(1);
|
||||
//String medalRace = entry.getColumnContent(2);
|
||||
//String linked = entry.getColumnContent(3);
|
||||
//String factor = entry.getColumnContent(4);
|
||||
|
||||
RaceDescriptor descriptor = new RaceDescriptor(name, fleet, false, false, 0.0);
|
||||
|
||||
if(descriptor.equals(race))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private DataEntryPO findTracking(TrackedRaceDescriptor tracking) {
|
||||
CellTablePO<DataEntryPO> trackingTable = getTrackedRacesTable();
|
||||
|
||||
for(DataEntryPO entry : trackingTable.getEntries()) {
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String raceName = entry.getColumnContent(2);
|
||||
|
||||
TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, raceName);
|
||||
|
||||
if(descriptor.equals(tracking))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getRacesTable() {
|
||||
return new GenericCellTablePO<>(this.driver, this.racesCellTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getTrackedRacesTable() {
|
||||
WebElement table = findElementBySeleniumId(this.trackedRacesListComposite, "TrackedRacesCellTable");
|
||||
|
||||
return new GenericCellTablePO<>(this.driver, table, DataEntryPO.class);
|
||||
}
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import static com.sap.sailing.selenium.pages.gwt.query.Alias.$;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.ActionsHelper;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.Alias;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.TableQuery;
|
||||
|
||||
public class LeaderboardGroupConfigurationPanelPO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "CreateLeaderboardGroupButton")
|
||||
private WebElement createLeaderboardGroupButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveLeaderboardsButton")
|
||||
private WebElement removeButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardGroupsCellTable")
|
||||
private WebElement leaderboardGroupsTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardGroupDetailsPanel")
|
||||
private WebElement leaderboardGroupDetailsPanel;
|
||||
|
||||
public LeaderboardGroupConfigurationPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public LeaderboardGroupCreateDialogPO startCreatingLeaderboardGroup() {
|
||||
this.createLeaderboardGroupButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "LeaderboardGroupCreateDialog");
|
||||
|
||||
return new LeaderboardGroupCreateDialogPO(this.driver, dialog);
|
||||
}
|
||||
|
||||
public void createLeaderboardGroup(String name, String description) {
|
||||
LeaderboardGroupCreateDialogPO dialog = startCreatingLeaderboardGroup();
|
||||
dialog.setName(name);
|
||||
dialog.setDescription(description);
|
||||
dialog.pressOk();
|
||||
}
|
||||
|
||||
public CellTablePO<DataEntryPO> getLeaderboardGroupsTable() {
|
||||
return new GenericCellTablePO<DataEntryPO>(this.driver, this.leaderboardGroupsTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
public void deleteLeaderboardGroup(String name) {
|
||||
DataEntryPO result = findLeaderboardGroup(name);
|
||||
|
||||
if (result != null) {
|
||||
ActionsHelper.findRemoveAction(result.getWebElement()).click();
|
||||
ActionsHelper.acceptAlert(this.driver);
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
public LeaderboardGroupDetailsPanelPO getLeaderboardGroupDetails(String name) {
|
||||
DataEntryPO result = findLeaderboardGroup(name);
|
||||
|
||||
if (result != null) {
|
||||
result.select();
|
||||
}
|
||||
|
||||
return getLeaderboardGroupDetails();
|
||||
}
|
||||
|
||||
public LeaderboardGroupDetailsPanelPO getLeaderboardGroupDetails() {
|
||||
if(!this.leaderboardGroupDetailsPanel.isDisplayed()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new LeaderboardGroupDetailsPanelPO(this.driver, this.leaderboardGroupDetailsPanel);
|
||||
}
|
||||
|
||||
private DataEntryPO findLeaderboardGroup(String name) {
|
||||
CellTablePO<DataEntryPO> table = getLeaderboardGroupsTable();
|
||||
final DataEntryPO alias = Alias.alias(DataEntryPO.class);
|
||||
TableQuery<DataEntryPO> query = new TableQuery<>();
|
||||
query.from(table)
|
||||
.where(
|
||||
$(alias.getColumnContent("Name")).eq(name)
|
||||
);
|
||||
|
||||
return query.firstResult();
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class LeaderboardGroupCreateDialogPO extends DataEntryDialogPO {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DescriptionTextArea")
|
||||
private WebElement descriptionField;
|
||||
|
||||
public LeaderboardGroupCreateDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.nameField.clear();
|
||||
this.nameField.sendKeys(name);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.descriptionField.clear();
|
||||
this.descriptionField.sendKeys(description);
|
||||
}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import static com.sap.sailing.selenium.pages.gwt.query.Alias.$;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.query.Alias;
|
||||
import com.sap.sailing.selenium.pages.gwt.query.TableQuery;
|
||||
|
||||
public class LeaderboardGroupDetailsPanelPO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsFilterTextBox")
|
||||
private WebElement leaderboardsFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "LeaderboardsCellTable")
|
||||
private WebElement leaderboardsCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RefreshLeaderboardsButton")
|
||||
private WebElement refreshLeaderboardsButton;
|
||||
|
||||
public LeaderboardGroupDetailsPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void refreshLeaderboards() {
|
||||
this.refreshLeaderboardsButton.click();
|
||||
}
|
||||
|
||||
public CellTablePO<DataEntryPO> getLeaderboardsTable() {
|
||||
return new GenericCellTablePO<DataEntryPO>(this.driver, this.leaderboardsCellTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
public DataEntryPO findLeaderboardEntry(String name) {
|
||||
CellTablePO<DataEntryPO> table = getLeaderboardsTable();
|
||||
DataEntryPO alias = Alias.alias(DataEntryPO.class);
|
||||
|
||||
TableQuery<DataEntryPO> query = new TableQuery<>();
|
||||
query.from(table).
|
||||
where($(alias.getColumnContent("Leaderboard Name")).eq(name));
|
||||
|
||||
return query.firstResult();
|
||||
}
|
||||
|
||||
public void filterLeaderboards(String filterText) {
|
||||
this.leaderboardsFilterTextBox.clear();
|
||||
this.leaderboardsFilterTextBox.sendKeys(filterText);
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class RaceColumnsInLeaderboardDialog extends DataEntryDialogPO {
|
||||
@FindBy(how = BySeleniumId.class, using = "NumberOfRacesListBox")
|
||||
private WebElement numberOfRacesListBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RaceNamePrefixTextBox")
|
||||
private WebElement raceNamePrefixTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRacesButton")
|
||||
private WebElement addRacesButton;
|
||||
|
||||
public RaceColumnsInLeaderboardDialog(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public int getSetNumberOfRacesToAdd() {
|
||||
Select select = new Select(this.numberOfRacesListBox);
|
||||
WebElement option = select.getFirstSelectedOption();
|
||||
|
||||
return Integer.parseInt(option.getAttribute("value"));
|
||||
}
|
||||
|
||||
public void setSetNumberOfRacesToAdd(int races) {
|
||||
Select select = new Select(this.numberOfRacesListBox);
|
||||
select.selectByValue(Integer.toString(races));
|
||||
}
|
||||
|
||||
public String getRaceNamePrefix() {
|
||||
return this.raceNamePrefixTextField.getText();
|
||||
}
|
||||
|
||||
public void setRaceNamePrefix(String prefix) {
|
||||
this.raceNamePrefixTextField.clear();
|
||||
this.raceNamePrefixTextField.sendKeys(prefix);
|
||||
}
|
||||
|
||||
public void pressAddRaces() {
|
||||
this.addRacesButton.click();
|
||||
}
|
||||
|
||||
public void addRaces(int races) {
|
||||
addRaces(races, getRaceNamePrefix());
|
||||
}
|
||||
|
||||
public void addRaces(int races, String prefix) {
|
||||
Select select = new Select(this.numberOfRacesListBox);
|
||||
select.selectByValue(Integer.toString(races));
|
||||
this.addRacesButton.click();
|
||||
pressOk();
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.leaderboard;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListCompositePO.RegattaDescriptor;
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class RegattaLeaderboardCreateDialogPO extends DataEntryDialogPO {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextBox")
|
||||
private WebElement nameTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaListBox")
|
||||
private WebElement regattaDropDown;
|
||||
|
||||
public RegattaLeaderboardCreateDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
Select dropDown = new Select(this.regattaDropDown);
|
||||
dropDown.selectByValue(regatta.toString());
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class RegattaCreateDialogPO extends DataEntryDialogPO {
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaNameTextField")
|
||||
private WebElement regattaNameTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "BoatClassTextField")
|
||||
private WebElement boatClassTextField;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "ScoringSchemeListBox")
|
||||
// private WebElement scoringSystemDropDown;
|
||||
// @FindBy(how = BySeleniumId.class, using = "EventListBox")
|
||||
// private WebElement eventDropDown;
|
||||
// @FindBy(how = BySeleniumId.class, using = "CourseAreaListBox")
|
||||
// private WebElement courseAreaDropDown;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddSeriesButton")
|
||||
private WebElement addSeriesButton;
|
||||
|
||||
public RegattaCreateDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setRegattaName(String name) {
|
||||
this.regattaNameTextField.clear();
|
||||
this.regattaNameTextField.sendKeys(name);
|
||||
}
|
||||
|
||||
public void setBoatClass(String boatClass) {
|
||||
this.boatClassTextField.clear();
|
||||
this.boatClassTextField.sendKeys(boatClass);
|
||||
}
|
||||
|
||||
// TODO: Scoring System, Event and Course Area
|
||||
|
||||
public SeriesCreateDialogPO addSeries() {
|
||||
this.addSeriesButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "SeriesCreateDialog");
|
||||
|
||||
return new SeriesCreateDialogPO(this.driver, dialog);
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.ActionsHelper;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
// TODO: Implement if needed
|
||||
public class RegattaDetailsCompositePO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameLabel")
|
||||
private WebElement regattaNameLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "BoatClassLabel")
|
||||
private WebElement boatClassLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CourseAreaLabel")
|
||||
private WebElement courseAreaLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ScoringSystemLabel")
|
||||
private WebElement scoringSystemLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SeriesCellTable")
|
||||
private WebElement seriesTable;
|
||||
|
||||
public RegattaDetailsCompositePO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public String getRegattaName() {
|
||||
return this.regattaNameLabel.getText();
|
||||
}
|
||||
|
||||
public String getBoatClass() {
|
||||
return this.boatClassLabel.getText();
|
||||
}
|
||||
|
||||
public String getCouresArea() {
|
||||
return this.courseAreaLabel.getText();
|
||||
}
|
||||
|
||||
public String getScoringSystem() {
|
||||
return this.scoringSystemLabel.getText();
|
||||
}
|
||||
|
||||
// public void getSeries() {
|
||||
//
|
||||
// }
|
||||
|
||||
public SeriesEditDialogPO editSeries(String series) {
|
||||
DataEntryPO entry = findSeries(series);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = ActionsHelper.findEditAction(entry.getWebElement());
|
||||
action.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "SeriesEditDialog");
|
||||
|
||||
return new SeriesEditDialogPO(this.driver, dialog);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deleteSeries(String series) {
|
||||
DataEntryPO entry = findSeries(series);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement removeAction = ActionsHelper.findRemoveAction(entry.getWebElement());
|
||||
removeAction.click();
|
||||
|
||||
ActionsHelper.acceptAlert(this.driver);
|
||||
|
||||
//waitForAjaxRequests();
|
||||
}
|
||||
}
|
||||
|
||||
private DataEntryPO findSeries(String series) {
|
||||
CellTablePO<DataEntryPO> table = getSeriesTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
|
||||
if(series.equals(name))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getSeriesTable() {
|
||||
return new GenericCellTablePO<>(this.driver, this.seriesTable, DataEntryPO.class);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class RegattaEditDialogPO extends PageArea {
|
||||
|
||||
public RegattaEditDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
}
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.ActionsHelper;
|
||||
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO.SortingOrder;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
public class RegattaListCompositePO extends PageArea {
|
||||
public static class RegattaDescriptor {
|
||||
private final String name;
|
||||
private final String boatClass;
|
||||
|
||||
// TODO [D049941]: Mark as a bug and remove this method as soon as possible
|
||||
public static RegattaDescriptor fromString(String name) {
|
||||
if(name == null || name.isEmpty())
|
||||
return null;
|
||||
|
||||
int openingBrace = name.lastIndexOf('(');
|
||||
int closingBrace = name.lastIndexOf(')');
|
||||
|
||||
return new RegattaDescriptor(name.substring(0, openingBrace - 1),
|
||||
name.substring(openingBrace + 1, closingBrace));
|
||||
}
|
||||
|
||||
public RegattaDescriptor(String name, String boatClass) {
|
||||
this.name = name;
|
||||
this.boatClass = boatClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getBoatClass() {
|
||||
return this.boatClass;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name + " (" + this.boatClass + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.name, this.boatClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
RegattaDescriptor other = (RegattaDescriptor) object;
|
||||
|
||||
if (!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if (!Objects.equals(this.name, other.name))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "FilterRegattasTextField")
|
||||
private WebElement RegattasFilterTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NoRegattasLabel")
|
||||
private WebElement noRegattasLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattasCellTable")
|
||||
private WebElement regattasTable;
|
||||
|
||||
public RegattaListCompositePO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void sortByRegattaName(SortingOrder order) {
|
||||
sortRegattaList(0, order);
|
||||
}
|
||||
|
||||
public void sortByBoatClass(SortingOrder order) {
|
||||
sortRegattaList(1, order);
|
||||
}
|
||||
|
||||
public List<RegattaDescriptor> getRegattas() {
|
||||
List<RegattaDescriptor> descriptors = new LinkedList<>();
|
||||
CellTablePO<DataEntryPO> table = getRegattasTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
|
||||
descriptors.add(new RegattaDescriptor(name, boatClass));
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
DataEntryPO entry = findRegatta(regatta);
|
||||
|
||||
if(entry != null) {
|
||||
entry.select();
|
||||
}
|
||||
}
|
||||
|
||||
// public EditRegattaDialog editRegatta(RegattaDescriptor regatta) {
|
||||
//
|
||||
// }
|
||||
|
||||
public void removeRegatta(RegattaDescriptor regatta) {
|
||||
DataEntryPO entry = findRegatta(regatta);
|
||||
|
||||
if(entry != null) {
|
||||
WebElement action = ActionsHelper.findRemoveAction(entry.getWebElement());
|
||||
action.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
|
||||
ActionsHelper.acceptAlert(this.driver);
|
||||
}
|
||||
}
|
||||
|
||||
private DataEntryPO findRegatta(RegattaDescriptor regatta) {
|
||||
CellTablePO<DataEntryPO> table = getRegattasTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String name = entry.getColumnContent(0);
|
||||
// String boatClass = columns.getColumnContent(1);
|
||||
//
|
||||
// if(regatta.equals(new RegattaDescriptor(name, boatClass)))
|
||||
// return row;
|
||||
if(regatta.equals(RegattaDescriptor.fromString(name)))
|
||||
return entry;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void sortRegattaList(int column, SortingOrder order) {
|
||||
CellTablePO<DataEntryPO> table = getRegattasTable();
|
||||
table.sortByColumn(column, order);
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getRegattasTable() {
|
||||
return new GenericCellTablePO<>(this.driver, this.regattasTable, DataEntryPO.class);
|
||||
}
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListCompositePO.RegattaDescriptor;
|
||||
|
||||
public class RegattaStructureManagementPanelPO extends PageArea {
|
||||
public static final String DEFAULT_SERIES_NAME = "Default"; //$NON-NLS-1$
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRegattaButton")
|
||||
WebElement addRegattaButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveRegattaButton")
|
||||
WebElement removeRegattaButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaListComposite")
|
||||
WebElement regattaList;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RegattaDetailsComposite")
|
||||
WebElement regattaDetails;
|
||||
|
||||
public RegattaStructureManagementPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public RegattaCreateDialogPO startRegattaCreation() {
|
||||
this.addRegattaButton.click();
|
||||
|
||||
WebElement dialog = findElementBySeleniumId(this.driver, "RegattaCreateDialog"); //$NON-NLS-1$
|
||||
|
||||
return new RegattaCreateDialogPO(this.driver, dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Creates a regatta with 1 series (named "Default").</p>
|
||||
*
|
||||
* @param regatta
|
||||
*/
|
||||
public void createRegatta(RegattaDescriptor regatta) {
|
||||
RegattaCreateDialogPO createRegattaDialog = startRegattaCreation();
|
||||
createRegattaDialog.setRegattaName(regatta.getName());
|
||||
createRegattaDialog.setBoatClass(regatta.getBoatClass());
|
||||
|
||||
SeriesCreateDialogPO addSeriesDialog = createRegattaDialog.addSeries();
|
||||
addSeriesDialog.setSeriesName(DEFAULT_SERIES_NAME);
|
||||
|
||||
addSeriesDialog.pressOk();
|
||||
|
||||
// QUESTION: How do we handle an error (here or in the dialog)?
|
||||
createRegattaDialog.pressOk();
|
||||
}
|
||||
|
||||
public void removeRegatta(RegattaDescriptor regatta) {
|
||||
// Select the regatta and click the remove button
|
||||
}
|
||||
|
||||
public void removeRegattas(List<RegattaDescriptor> regattas) {
|
||||
// Select all regattas and click the remove button
|
||||
}
|
||||
|
||||
public RegattaListCompositePO getRegattaList() {
|
||||
return new RegattaListCompositePO(this.driver, this.regattaList);
|
||||
}
|
||||
|
||||
public void selectRegatta(RegattaDescriptor regatta) {
|
||||
|
||||
}
|
||||
|
||||
public RegattaDetailsCompositePO getRegattaDetails(RegattaDescriptor regatta) {
|
||||
RegattaListCompositePO regattaList = getRegattaList();
|
||||
regattaList.selectRegatta(regatta);
|
||||
|
||||
return getRegattaDetails();
|
||||
}
|
||||
|
||||
public RegattaDetailsCompositePO getRegattaDetails() {
|
||||
if(this.regattaDetails.isDisplayed())
|
||||
return new RegattaDetailsCompositePO(this.driver, this.regattaDetails);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class SeriesCreateDialogPO extends DataEntryDialogPO {
|
||||
@FindBy(how = BySeleniumId.class, using = "NameTextField")
|
||||
private WebElement seriesNameTextField;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox")
|
||||
// private WebElement medalSeriesCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox")
|
||||
// private WebElement startsWithZeroScoreCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox")
|
||||
// private WebElement startsWithNonDiscardableCarryForwardCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox")
|
||||
// private WebElement definesResultDiscardingRulesCheckbox;
|
||||
|
||||
// @FindBy(how = BySeleniumId.class, using = "FleetListEditorComposite")
|
||||
// private WebElement fleetsPanel;
|
||||
|
||||
public SeriesCreateDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setSeriesName(String name) {
|
||||
this.seriesNameTextField.clear();
|
||||
this.seriesNameTextField.sendKeys(name);
|
||||
}
|
||||
|
||||
// TODO: Checkboxes and Fleets
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.regatta;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
|
||||
import com.sap.sailing.selenium.pages.common.DataEntryDialogPO;
|
||||
|
||||
public class SeriesEditDialogPO extends DataEntryDialogPO {
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "MedalSeriesCheckbox")
|
||||
private WebElement medalSeriesCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartsWithZeroScoreCheckbox")
|
||||
private WebElement startsWithZeroScoreCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartsWithNonDiscardableCarryForwardCheckbox")
|
||||
private WebElement startsWithNonDiscardableCarryForwardCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "DefinesResultDiscardingRulesCheckbox")
|
||||
private WebElement definesResultDiscardingRulesCheckbox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "NumberOfRacesListBox")
|
||||
private WebElement numberOfRacesDropDown;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RaceNamePrefixTextBox")
|
||||
private WebElement raceNamePrefixTextField;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AddRacesButton")
|
||||
private WebElement addRacesButton;
|
||||
|
||||
public SeriesEditDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public int getSetNumberOfRacesToAdd() {
|
||||
Select select = new Select(this.numberOfRacesDropDown);
|
||||
WebElement option = select.getFirstSelectedOption();
|
||||
|
||||
return Integer.parseInt(option.getAttribute("value"));
|
||||
}
|
||||
|
||||
public void setSetNumberOfRacesToAdd(int races) {
|
||||
Select select = new Select(this.numberOfRacesDropDown);
|
||||
select.selectByValue(Integer.toString(races));
|
||||
}
|
||||
|
||||
public String getRaceNamePrefix() {
|
||||
return this.raceNamePrefixTextField.getText();
|
||||
}
|
||||
|
||||
public void setRaceNamePrefix(String prefix) {
|
||||
this.raceNamePrefixTextField.clear();
|
||||
this.raceNamePrefixTextField.sendKeys(prefix);
|
||||
}
|
||||
|
||||
public void pressAddRaces() {
|
||||
this.addRacesButton.click();
|
||||
}
|
||||
|
||||
public void addRaces(int races) {
|
||||
setSetNumberOfRacesToAdd(races);
|
||||
pressAddRaces();
|
||||
}
|
||||
|
||||
public void addRaces(int races, String prefix) {
|
||||
setSetNumberOfRacesToAdd(races);
|
||||
setRaceNamePrefix(prefix);
|
||||
pressAddRaces();
|
||||
}
|
||||
}
|
||||
+299
@@ -0,0 +1,299 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tracking;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.openqa.selenium.TimeoutException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.FluentWait;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
public class TrackedRacesListPO extends PageArea {
|
||||
public enum Status {
|
||||
LOADING,
|
||||
TRACKING,
|
||||
FINISHED,
|
||||
UNKOWN;
|
||||
|
||||
public static Status fromString(String string) {
|
||||
if (string != null && !string.isEmpty()) {
|
||||
for (Status status : Status.values()) {
|
||||
if (string.startsWith(status.name())) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return UNKOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TrackedRaceDescriptor {
|
||||
public String regatta;
|
||||
public String boatClass;
|
||||
public String race;
|
||||
|
||||
public TrackedRaceDescriptor(String regatta, String boatClass, String race) {
|
||||
this.regatta = regatta;
|
||||
this.boatClass = boatClass;
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.regatta, this.boatClass, this.race);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
TrackedRaceDescriptor other = (TrackedRaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.regatta, other.regatta))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.race, other.race))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesFilterTextBox")
|
||||
private WebElement trackedRacesFilterTextBox;
|
||||
|
||||
//@FindBy(how = BySeleniumId.class, using = "NoTrackedRacesLabel")
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesCellTable")
|
||||
private WebElement trackedRacesTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RefreshButton")
|
||||
private WebElement refreshButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "RemoveRaceButton")
|
||||
private WebElement removeButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StopTrackingButton")
|
||||
private WebElement stopTrackingButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SetDelayToLiveButton")
|
||||
private WebElement setDelayToLiveButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ExportButton")
|
||||
private WebElement exportButton;
|
||||
|
||||
//@FindBy(how = BySeleniumId.class, using = "ExportPopup")
|
||||
|
||||
private static final Logger logger = Logger.getLogger(TrackedRacesListPO.class.getName());
|
||||
|
||||
public TrackedRacesListPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public void setFilterForTrackedRaces(String filter) {
|
||||
this.trackedRacesFilterTextBox.clear();
|
||||
this.trackedRacesFilterTextBox.sendKeys(filter);
|
||||
}
|
||||
|
||||
public List<DataEntryPO> getTrackedRaces() {
|
||||
// List<TrackedRaceDescriptor> descriptors = new LinkedList<>();
|
||||
CellTablePO<DataEntryPO> table = getTrackedRacesTable();
|
||||
|
||||
// for(DataEntryPO entry : table.getEntries()) {
|
||||
// String regatta = entry.getColumnContent(0);
|
||||
// String boatClass = entry.getColumnContent(1);
|
||||
// String race = entry.getColumnContent(2);
|
||||
//
|
||||
// descriptors.add(new TrackedRaceDescriptor(regatta, boatClass, race));
|
||||
// }
|
||||
|
||||
return table.getEntries();
|
||||
}
|
||||
|
||||
// public WebElement getTrackedRace(String regatta, String race) {
|
||||
// for (WebElement raceRow : getTrackedRaces()) {
|
||||
// List<WebElement> fields = raceRow.findElements(By.tagName("td"));
|
||||
// if (regattaName.equals(fields.get(0).getText()) && raceName.equals(fields.get(2).getText())) {
|
||||
// return raceRow;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public Object getStatus(TrackedRaceDescriptor race) {
|
||||
List<Status> status = getStatus(Arrays.asList(race));
|
||||
|
||||
return status.get(0);
|
||||
}
|
||||
|
||||
public List<Status> getStatus(List<TrackedRaceDescriptor> races) {
|
||||
List<Status> result = new ArrayList<>(Collections.<Status>nCopies(races.size(), null));
|
||||
|
||||
CellTablePO<DataEntryPO> table = getTrackedRacesTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String race = entry.getColumnContent(2);
|
||||
String status = entry.getColumnContent(6);
|
||||
|
||||
TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, race);
|
||||
|
||||
if(races.contains(descriptor)) {
|
||||
result.set(races.indexOf(descriptor), Status.fromString(status));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void stopTracking(TrackedRaceDescriptor race) {
|
||||
stopTracking(Arrays.asList(race));
|
||||
}
|
||||
|
||||
public void stopTracking(List<TrackedRaceDescriptor> races) {
|
||||
selectRaces(races);
|
||||
|
||||
this.stopTrackingButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void remove(TrackedRaceDescriptor race) {
|
||||
remove(Arrays.asList(race));
|
||||
}
|
||||
|
||||
public void remove(List<TrackedRaceDescriptor> races) {
|
||||
selectRaces(races);
|
||||
|
||||
this.removeButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
this.refreshButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void waitForTrackedRace(TrackedRaceDescriptor race) {
|
||||
waitForTrackedRaces(Arrays.asList(race));
|
||||
}
|
||||
|
||||
public void waitForTrackedRace(TrackedRaceDescriptor race, int timeout) {
|
||||
waitForTrackedRaces(Arrays.asList(race), timeout);
|
||||
}
|
||||
|
||||
public void waitForTrackedRaces(List<TrackedRaceDescriptor> races) {
|
||||
waitForTrackedRaces(races, DEFAULT_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
public void waitForTrackedRaces(List<TrackedRaceDescriptor> races, int timeout) {
|
||||
logger.info("Try to resolve status for races.");
|
||||
FluentWait<List<TrackedRaceDescriptor>> wait = createFluentWait(races, timeout, DEFAULT_POLLING_INTERVAL);
|
||||
wait.until(new Function<List<TrackedRaceDescriptor>, Object>() {
|
||||
@Override
|
||||
public Object apply(List<TrackedRaceDescriptor> races) {
|
||||
logger.info("Try to refresh and resolve status for races.");
|
||||
try {
|
||||
refresh();
|
||||
|
||||
for(Status status : getStatus(races)) {
|
||||
if(status != Status.TRACKING)
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
} catch(TimeoutException exception) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// public void waitForTrackedRaceLoadingFinished(String regattaName, String raceName, long timeoutInMillis) throws InterruptedException {
|
||||
// waitForAjaxRequests(); // wait for the Start Tracking request to succeed; then check Tracked races table and keep refreshing until we time out
|
||||
// TrackedRacesPanel trp = getTrackedRacesPanel();
|
||||
// long started = System.currentTimeMillis();
|
||||
// WebElement raceRow = trp.getTrackedRace(regattaName, raceName);
|
||||
// while ((raceRow == null || !"TRACKING".equals(raceRow.findElements(By.tagName("td")).get(6).getText()))
|
||||
// && System.currentTimeMillis()-started < timeoutInMillis) {
|
||||
// Thread.sleep(2000); // wait 2s for the race to appear
|
||||
// trp.refresh();
|
||||
// raceRow = trp.getTrackedRace(regattaName, raceName);
|
||||
// }
|
||||
// }
|
||||
|
||||
private CellTablePO<DataEntryPO> getTrackedRacesTable() {
|
||||
// if(!this.trackedRacesTable.isDisplayed()) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
return new GenericCellTablePO<>(this.driver, this.trackedRacesTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
private List<DataEntryPO> getTrackedRaces(List<TrackedRaceDescriptor> races) {
|
||||
List<DataEntryPO> result = new ArrayList<>(Collections.<DataEntryPO>nCopies(races.size(), null));
|
||||
|
||||
CellTablePO<DataEntryPO> table = getTrackedRacesTable();
|
||||
List<DataEntryPO> rows = table.getEntries();
|
||||
Iterator<DataEntryPO> iterator = rows.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
DataEntryPO entry = iterator.next();
|
||||
|
||||
String regatta = entry.getColumnContent(0);
|
||||
String boatClass = entry.getColumnContent(1);
|
||||
String race = entry.getColumnContent(2);
|
||||
|
||||
TrackedRaceDescriptor descriptor = new TrackedRaceDescriptor(regatta, boatClass, race);
|
||||
|
||||
if(races.contains(descriptor)) {
|
||||
result.set(races.indexOf(descriptor), entry);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void selectRaces(List<TrackedRaceDescriptor> races) {
|
||||
List<DataEntryPO> trackedRaces = getTrackedRaces(races);
|
||||
Iterator<DataEntryPO> iterator = trackedRaces.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
DataEntryPO trackedRace = iterator.next();
|
||||
|
||||
if(trackedRace == null) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
CellTablePO<DataEntryPO> table = getTrackedRacesTable();
|
||||
table.selectEntries(trackedRaces);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tracking;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public class TrackedRacesManagementPanelPO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesListComposite")
|
||||
private WebElement trackedRacesListCoposite;
|
||||
|
||||
public TrackedRacesManagementPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
public TrackedRacesListPO getTrackedRacesList() {
|
||||
return new TrackedRacesListPO(this.driver, this.trackedRacesListCoposite);
|
||||
}
|
||||
}
|
||||
+271
@@ -0,0 +1,271 @@
|
||||
package com.sap.sailing.selenium.pages.adminconsole.tractrac;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.regatta.RegattaListCompositePO.RegattaDescriptor;
|
||||
import com.sap.sailing.selenium.pages.adminconsole.tracking.TrackedRacesListPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.DataEntryPO;
|
||||
import com.sap.sailing.selenium.pages.gwt.CellTablePO;
|
||||
import com.sap.sailing.selenium.pages.gwt.GenericCellTablePO;
|
||||
|
||||
/**
|
||||
* <p>The page object representing the TracTrac Events tab.</p>
|
||||
*
|
||||
* @author
|
||||
* D049941
|
||||
*/
|
||||
public class TracTracEventManagementPanelPO extends PageArea {
|
||||
public static class TrackableRaceDescriptor {
|
||||
public final String eventName;
|
||||
public final String raceName;
|
||||
public final String boatClass;
|
||||
//public Object startTime;
|
||||
//public Object raceStatus;
|
||||
|
||||
public TrackableRaceDescriptor(String eventName, String raceName, String boatClass) {
|
||||
this.eventName = eventName;
|
||||
this.raceName = raceName;
|
||||
this.boatClass = boatClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.boatClass, this.eventName, this.raceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (this == object)
|
||||
return true;
|
||||
|
||||
if (object == null)
|
||||
return false;
|
||||
|
||||
if (getClass() != object.getClass())
|
||||
return false;
|
||||
|
||||
TrackableRaceDescriptor other = (TrackableRaceDescriptor) object;
|
||||
|
||||
if(!Objects.equals(this.boatClass, other.boatClass))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.eventName, other.eventName))
|
||||
return false;
|
||||
|
||||
if(!Objects.equals(this.raceName, other.raceName))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO [D049941]: Prefix the Ids with the component (e.g. "Button")
|
||||
@FindBy(how = BySeleniumId.class, using = "LiveURITextBox")
|
||||
private WebElement liveURITextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StoredURITextBox")
|
||||
private WebElement storedURITextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "JsonURLTextBox")
|
||||
private WebElement jsonURLTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "ListRacesButton")
|
||||
private WebElement listRacesButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "AvailableRegattasListBox")
|
||||
private WebElement availableRegattasListBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackWindCheckBox")
|
||||
private WebElement trackWindCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CorrectWindCheckBox")
|
||||
private WebElement correctWindCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "SimulateWithStartTimeNowCheckBox")
|
||||
private WebElement simulateWithStartTimeNowCheckBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackableRacesFilterTextBox")
|
||||
private WebElement trackableRacesFilterTextBox;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackableRacesCellTable")
|
||||
private WebElement trackableRacesCellTable;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "StartTrackingButton")
|
||||
private WebElement startTrackingButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "TrackedRacesListComposite")
|
||||
private WebElement trackedRacesListComposite;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param driver
|
||||
*
|
||||
* @param element
|
||||
*
|
||||
*/
|
||||
public TracTracEventManagementPanelPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>Lists all available trackable races for the given URL. The list of the races can be obtained via
|
||||
* {@link #getTrackableRaces()}.</p>
|
||||
*
|
||||
* @param url
|
||||
* The URL for which the races are to list.
|
||||
*/
|
||||
public void listTrackableRaces(String url) {
|
||||
listTrackableRaces("", "", url); //$NON-NLS-1$//$NON-NLS-2$
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Lists all available trackable races for the given URL. The list of the races can be obtained via
|
||||
* {@link #getTrackableRaces()}.</p>
|
||||
*
|
||||
* @param url
|
||||
* The URL for which the races are to list.
|
||||
*/
|
||||
public void listTrackableRaces(String liveURI, String storedURI, String jsonURL) {
|
||||
this.liveURITextBox.clear();
|
||||
this.liveURITextBox.sendKeys(liveURI);
|
||||
|
||||
this.storedURITextBox.clear();
|
||||
this.storedURITextBox.sendKeys(storedURI);
|
||||
|
||||
this.jsonURLTextBox.clear();
|
||||
this.jsonURLTextBox.sendKeys(jsonURL);
|
||||
|
||||
this.listRacesButton.click();
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the list of all available trackable races. This list will be empty if no race is available or if no
|
||||
* race was specified before.</p>
|
||||
*
|
||||
* @return
|
||||
* The list of all available trackable races.
|
||||
*/
|
||||
public List<TrackableRaceDescriptor> getTrackableRaces() {
|
||||
List<TrackableRaceDescriptor> descriptors = new LinkedList<>();
|
||||
CellTablePO<DataEntryPO> table = getTrackableRacesTable();
|
||||
|
||||
for(DataEntryPO entry : table.getEntries()) {
|
||||
String event = entry.getColumnContent(0);
|
||||
String race = entry.getColumnContent(1);
|
||||
String boatClass = entry.getColumnContent(2);
|
||||
|
||||
descriptors.add(new TrackableRaceDescriptor(event, race, boatClass));
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
public List<RegattaDescriptor> getAvailableReggatasForTracking() {
|
||||
List<RegattaDescriptor> result = new ArrayList<>();
|
||||
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
|
||||
for(WebElement option : select.getOptions()) {
|
||||
RegattaDescriptor regatta = RegattaDescriptor.fromString(option.getAttribute("value"));
|
||||
|
||||
result.add(regatta);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public RegattaDescriptor getReggataForTracking() {
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
WebElement option = select.getFirstSelectedOption();
|
||||
RegattaDescriptor regatta = RegattaDescriptor.fromString(option.getAttribute("value"));
|
||||
|
||||
return regatta;
|
||||
}
|
||||
|
||||
public void setReggataForTracking(RegattaDescriptor regatta) {
|
||||
Select select = new Select(this.availableRegattasListBox);
|
||||
|
||||
select.selectByValue(regatta.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Sets the filter for the trackable races. After the filter is set you can obtain the new resulting list via
|
||||
* {@link #getTrackableRaces}</p>
|
||||
*
|
||||
* @param filter
|
||||
* The filter to apply to the trackable races.
|
||||
*/
|
||||
public void setFilterForTrackableRaces(String filter) {
|
||||
this.trackableRacesFilterTextBox.clear();
|
||||
this.trackableRacesFilterTextBox.sendKeys(filter);
|
||||
}
|
||||
|
||||
public void setTrackSettings(boolean trackWind, boolean correctWind, boolean simulateWithNow) {
|
||||
setSelection(this.trackWindCheckBox, trackWind);
|
||||
setSelection(this.correctWindCheckBox, correctWind);
|
||||
setSelection(this.simulateWithStartTimeNowCheckBox, simulateWithNow);
|
||||
}
|
||||
|
||||
public void startTrackingForRace(TrackableRaceDescriptor race) {
|
||||
startTrackingForRaces(Arrays.asList(race));
|
||||
}
|
||||
|
||||
public void startTrackingForRaces(List<TrackableRaceDescriptor> races) {
|
||||
CellTablePO<DataEntryPO> table = getTrackableRacesTable();
|
||||
List<DataEntryPO> entries = table.getEntries();
|
||||
Iterator<DataEntryPO> iterator = entries.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
DataEntryPO entry = iterator.next();
|
||||
|
||||
String event = entry.getColumnContent(0);
|
||||
String race = entry.getColumnContent(1);
|
||||
String boatClass = entry.getColumnContent(2);
|
||||
|
||||
TrackableRaceDescriptor descriptor = new TrackableRaceDescriptor(event, race, boatClass);
|
||||
|
||||
if(!races.contains(descriptor))
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
table.selectEntries(entries);
|
||||
|
||||
this.startTrackingButton.click();
|
||||
|
||||
// TODO: Dialog ignore
|
||||
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public TrackedRacesListPO getTrackedRacesList() {
|
||||
return new TrackedRacesListPO(this.driver, this.trackedRacesListComposite);
|
||||
}
|
||||
|
||||
private CellTablePO<DataEntryPO> getTrackableRacesTable() {
|
||||
return new GenericCellTablePO<>(this.driver, this.trackableRacesCellTable, DataEntryPO.class);
|
||||
}
|
||||
|
||||
private void setSelection(WebElement checkbox, boolean selected) {
|
||||
WebElement input = checkbox.findElement(By.tagName("input"));
|
||||
|
||||
if(input.isSelected() != selected)
|
||||
input.click();
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.sap.sailing.selenium.pages.common;
|
||||
|
||||
public interface CSSConstants {
|
||||
|
||||
public static final String CSS_CLASS_ATTRIBUTE_NAME = "class"; //$NON-NLS-1$
|
||||
|
||||
public static final String CSS_STYLE_ATTRIBUTE_NAME = "style"; //$NON-NLS-1$
|
||||
|
||||
public static final String CSS_BACKGROUND_IMAGE = "background-image"; //$NON-NLS-1$
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package com.sap.sailing.selenium.pages.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
public class CSSHelper {
|
||||
public static List<String> getCSSClassNames(WebElement element) {
|
||||
String cssClasses = element.getAttribute(CSSConstants.CSS_CLASS_ATTRIBUTE_NAME);
|
||||
|
||||
if(cssClasses == null)
|
||||
return Collections.emptyList();
|
||||
|
||||
ArrayList<String> cssClassNames = new ArrayList<>();
|
||||
|
||||
for(String part : cssClasses.split(" ")) {
|
||||
String cssClass = part.trim();
|
||||
|
||||
if(!cssClass.isEmpty())
|
||||
cssClassNames.add(cssClass);
|
||||
}
|
||||
|
||||
return cssClassNames;
|
||||
}
|
||||
|
||||
public static boolean hasCSSClass(WebElement element, String cssClass) {
|
||||
if(cssClass == null || cssClass.isEmpty())
|
||||
return true;
|
||||
|
||||
List<String> cssClasses = getCSSClassNames(element);
|
||||
|
||||
return cssClasses.contains(cssClass);
|
||||
}
|
||||
|
||||
private CSSHelper() {
|
||||
// Do not instantiate a utility class
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.sap.sailing.selenium.pages.common;
|
||||
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.core.BySeleniumId;
|
||||
import com.sap.sailing.selenium.core.FindBy;
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public abstract class DataEntryDialogPO extends PageArea {
|
||||
@FindBy(how = BySeleniumId.class, using = "StatusLabel")
|
||||
private WebElement statusLabel;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "OkButton")
|
||||
private WebElement okButton;
|
||||
|
||||
@FindBy(how = BySeleniumId.class, using = "CancelButton")
|
||||
private WebElement cancelButton;
|
||||
|
||||
|
||||
public DataEntryDialogPO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
WebElement element = (WebElement) this.context;
|
||||
String cssClasses = element.getAttribute("class");
|
||||
|
||||
if(!cssClasses.contains("gwt-DialogBox"))
|
||||
throw new IllegalStateException("This is not a dialog");
|
||||
}
|
||||
|
||||
public String getStatusMessage() {
|
||||
if(this.statusLabel.isDisplayed())
|
||||
return this.statusLabel.getText();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isOkButtonEnabled() {
|
||||
return this.okButton.isEnabled();
|
||||
}
|
||||
|
||||
public boolean isCancelButtonEnabled() {
|
||||
return this.cancelButton.isEnabled();
|
||||
}
|
||||
|
||||
// QUESTION: What should we do, if the button is not enabled?
|
||||
public void pressOk() {
|
||||
this.okButton.click();
|
||||
|
||||
// Wait, since we do a callback usually
|
||||
waitForAjaxRequests();
|
||||
}
|
||||
|
||||
public void pressCancel() {
|
||||
this.cancelButton.click();
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package com.sap.sailing.selenium.pages.common;
|
||||
|
||||
public interface HTMLConstants {
|
||||
public static final String IMAGE_TAG_NAME = "img";
|
||||
}
|
||||
+310
@@ -0,0 +1,310 @@
|
||||
package com.sap.sailing.selenium.pages.gwt;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
import com.sap.sailing.selenium.pages.common.CSSConstants;
|
||||
|
||||
/**
|
||||
* <p>Abstract base implementation for a page objects representing a GWT CellTable. The abstract implementation provides
|
||||
* common functionality like sorting and the selection of entries.</p>
|
||||
*
|
||||
* <p>For a basic CellTable you can use the concrete implementation GenericCellTable, which use a factory to create the
|
||||
* data entries. If you have a customized CellTable with extended functionality you should extend this class to add
|
||||
* these functionality as a service of the page object.</p>
|
||||
*
|
||||
* @author
|
||||
* Riccardo Nimser (D049941)
|
||||
* @param <T>
|
||||
* The type of the data entries the table contains.
|
||||
*/
|
||||
public abstract class CellTablePO<T extends DataEntryPO> extends PageArea {
|
||||
/**
|
||||
* <p></p>
|
||||
*/
|
||||
public enum SortingOrder {
|
||||
Ascending,
|
||||
Descending,
|
||||
None;
|
||||
}
|
||||
|
||||
protected static final String TABLE_TAG_NAME = "table"; //$NON-NLS-1$
|
||||
|
||||
protected static final String HEAD_TAG_NAME = "thead"; //$NON-NLS-1$
|
||||
|
||||
protected static final String BODY_TAG_NAME = "tbody"; //$NON-NLS-1$
|
||||
|
||||
protected static final String FOOT_TAG_NAME = "tfoot"; //$NON-NLS-1$
|
||||
|
||||
private static final String TABLE_HEADER_XPATH = "./thead/tr/th";
|
||||
|
||||
private static final String SORTING_INDICATOR_XPATH = ".//div/div/img";
|
||||
|
||||
private static final String LOADING_ANIMATION_XPATH = ".//td/div/div/div/img";
|
||||
|
||||
// It seems that the css class is not allways the same
|
||||
//private static final String CELL_TABLE_CSS_CLASS = "GJTB2DRDFQ"; //$NON-NLS-1$
|
||||
|
||||
protected static final String SELECTED_ROW_CSS_CLASS = "GJTB2DRDPP"; //$NON-NLS-1$
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CellTablePO.class.getName());
|
||||
|
||||
private static final String LOADING_ANIMATION_IMAGE = "url(\"data:image/gif;base64," + //$NON-NLS-1$
|
||||
"R0lGODlhKwALAPEAAP///0tKSqampktKSiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGx" + //$NON-NLS-1$
|
||||
"vYWQuaW5mbwAh+QQJCgAAACwAAAAAKwALAAACMoSOCMuW2diD88UKG95W88uF4DaGWFmhZid93pq+pwxnLUnXh8" + //$NON-NLS-1$
|
||||
"ou+sSz+T64oCAyTBUAACH5BAkKAAAALAAAAAArAAsAAAI9xI4IyyAPYWOxmoTHrHzzmGHe94xkmJifyqFKQ0pwL" + //$NON-NLS-1$
|
||||
"LgHa82xrekkDrIBZRQab1jyfY7KTtPimixiUsevAAAh+QQJCgAAACwAAAAAKwALAAACPYSOCMswD2FjqZpqW9xv" + //$NON-NLS-1$
|
||||
"4g8KE7d54XmMpNSgqLoOpgvC60xjNonnyc7p+VKamKw1zDCMR8rp8pksYlKorgAAIfkECQoAAAAsAAAAACsACwA" + //$NON-NLS-1$
|
||||
"AAkCEjgjLltnYmJS6Bxt+sfq5ZUyoNJ9HHlEqdCfFrqn7DrE2m7Wdj/2y45FkQ13t5itKdshFExC8YCLOEBX6Ah" + //$NON-NLS-1$
|
||||
"QAADsAAAAAAAAAAAA=\")"; //$NON-NLS-1$
|
||||
|
||||
private static final String ASCENDING_IMAGE = "url(\"data:image/png;base64," + //$NON-NLS-1$
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAsAAAAHCAYAAADebrddAAAAiklEQVR42mNgwALyKrumFRf3iDAQAvmVXVVAxf/" + //$NON-NLS-1$
|
||||
"zKjq341WYV95hk1fZ+R+MK8C4HqtCkLW5FZ2PQYpyK6AaKjv/5VV1OmIozq3s3AFR0AXFUNMrO5/lV7WKI6yv6m" + //$NON-NLS-1$
|
||||
"xCksSGDyTU13Mw5JV2qeaWd54FWn0BRAMlLgPZl/NAuBKMz+dWdF0H2hwCAPwcZIjfOFLHAAAAAElFTkSuQmCC\")"; //$NON-NLS-1$
|
||||
|
||||
private static final String DESCENDING_IMAGE = "url(\"data:image/png;base64," + //$NON-NLS-1$
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAsAAAAHCAYAAADebrddAAAAiklEQVR42mPIrewMya3oup5X2XkeiC/nVXRezgV" + //$NON-NLS-1$
|
||||
"iEDu3vPMskH0BROeVdqkyJNTXcwAlDgDxfwxcAaWrOpsYYCC/qlUcKPgMLlnZBcWd/4E272BAB0DdjkDJf2AFFR" + //$NON-NLS-1$
|
||||
"BTgfTj4uIeEQZsAKigHmE6EJd32DDgA0DF20FOyK/sqmIgBEDWAhVPwyYHAJAqZIiNwsHKAAAAAElFTkSuQmCC\")"; //$NON-NLS-1$
|
||||
|
||||
// @FindBy(how = ByTagName.class, using = HEAD_TAG_NAME)
|
||||
// private WebElement head;
|
||||
//
|
||||
// @FindBy(how = ByTagName.class, using = FOOT_TAG_NAME)
|
||||
// private WebElement foot;
|
||||
//
|
||||
// @FindBy(how = ByTagName.class, using = BODY_TAG_NAME)
|
||||
// private List<WebElement> bodies;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param driver
|
||||
*
|
||||
* @param element
|
||||
*
|
||||
*/
|
||||
public CellTablePO(WebDriver driver, WebElement element) {
|
||||
super(driver, element);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the number of columns of the table. Note that the result can change if the table is updated in some
|
||||
* way.</p>
|
||||
*
|
||||
* @return
|
||||
* The number of columns of the table.
|
||||
*/
|
||||
public int numberOfColumns() {
|
||||
return this.context.findElements(By.xpath(TABLE_HEADER_XPATH)).size();
|
||||
}
|
||||
|
||||
public int getColumnIndex(String header) {
|
||||
return getColumnHeaders().indexOf(header);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns a string representation for all columns.</p>
|
||||
*
|
||||
* @return
|
||||
* A string representation for all columns.
|
||||
*/
|
||||
public List<String> getColumnHeaders() {
|
||||
List<String> headers = new ArrayList<>();
|
||||
|
||||
for(WebElement header : findGWTHeaders()) {
|
||||
headers.add(header.getText());
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @param column
|
||||
*
|
||||
* @param order
|
||||
*
|
||||
*/
|
||||
public void sortByColumn(int column, SortingOrder order) {
|
||||
List<WebElement> headers = this.context.findElements(By.xpath(TABLE_HEADER_XPATH));
|
||||
WebElement header = headers.get(column);
|
||||
String role = header.getAttribute(GWTConstants.ROLE_ATTRIBUTE_NAME);
|
||||
|
||||
if(header.isDisplayed() && GWTConstants.ROLE_BUTTON.equals(role)) {
|
||||
if(order == SortingOrder.None && getSortingOrder(column) != SortingOrder.None)
|
||||
throw new IllegalArgumentException("Can't change sorting order back to NONE");
|
||||
|
||||
while(order != getSortingOrder(column)) {
|
||||
header.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void sortByColumn(String header, SortingOrder order) {
|
||||
sortByColumn(getColumnIndex(header), order);
|
||||
}
|
||||
|
||||
public SortingOrder getSortingOrder(int column) {
|
||||
List<WebElement> headers = this.context.findElements(By.xpath(TABLE_HEADER_XPATH));
|
||||
WebElement header = headers.get(column);
|
||||
|
||||
// NOTE: We use "findElements", since "findElement" throws an exception if there is no image (not sorted)
|
||||
List<WebElement> images = header.findElements(By.xpath(SORTING_INDICATOR_XPATH));
|
||||
|
||||
if(images.size() == 0)
|
||||
return SortingOrder.None;
|
||||
|
||||
String image = images.get(0).getCssValue(CSSConstants.CSS_BACKGROUND_IMAGE);
|
||||
|
||||
if(ASCENDING_IMAGE.equals(image))
|
||||
return SortingOrder.Ascending;
|
||||
|
||||
if(DESCENDING_IMAGE.equals(image))
|
||||
return SortingOrder.Descending;
|
||||
|
||||
throw new RuntimeException("Unkown sorting indicator");
|
||||
}
|
||||
|
||||
public SortingOrder getSortingOrder(String header) {
|
||||
return getSortingOrder(getColumnIndex(header));
|
||||
}
|
||||
|
||||
public List<T> getEntries() {
|
||||
List<T> entries = new ArrayList<>();
|
||||
|
||||
for(WebElement row : getRows()) {
|
||||
entries.add(createDataEntry(row));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Selects the specified entry.</p>
|
||||
*
|
||||
* <p>Note: If the entry is not contained in the table it will not be selected.</p>
|
||||
*
|
||||
* @param entry
|
||||
* The entry to select.
|
||||
*/
|
||||
public void selectEntry(T entry) {
|
||||
if(this.getWebElement().equals(entry.table.getWebElement())) {
|
||||
entry.select();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Selects the specified entries.</p>
|
||||
*
|
||||
* <p>Note: If an entry is not contained in the table it will not be selected.</p>
|
||||
*
|
||||
* @param entries
|
||||
* The entries to select.
|
||||
*/
|
||||
public void selectEntries(List<T> entries) {
|
||||
// First deselect all selected entries
|
||||
for(T entry : getSelectedEntries()) {
|
||||
entry.deselect();
|
||||
}
|
||||
|
||||
logger.info("Try to select " + entries.size() + " entries");
|
||||
// Select all specified entries
|
||||
for(T entry : entries) {
|
||||
logger.info("Entry belongs " + (this.getWebElement().equals(entry.table.getWebElement()) ? "" : "not ") + "to the table");
|
||||
if(this.getWebElement().equals(entry.table.getWebElement())) {
|
||||
entry.appendToSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns all currently selected entries. If no entry is selected, an empty list is returned.</p>
|
||||
*
|
||||
* @return
|
||||
* All currently selected entries.
|
||||
*/
|
||||
public List<T> getSelectedEntries() {
|
||||
List<T> entries = getEntries();
|
||||
Iterator<T> iterator = entries.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
T entry = iterator.next();
|
||||
|
||||
if(!entry.isSelected())
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
protected WebDriver getWebDriver() {
|
||||
return this.driver;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
WebElement element = getWebElement();
|
||||
String tagName = element.getTagName();
|
||||
|
||||
if(!TABLE_TAG_NAME.equalsIgnoreCase(tagName) /*|| !CSSHelper.hasCSSClass(element, CELL_TABLE_CSS_CLASS)*/)
|
||||
throw new IllegalArgumentException("WebElement does not represent a CellTable");
|
||||
}
|
||||
|
||||
protected List<WebElement> findGWTHeaders() {
|
||||
return this.context.findElements(By.xpath("./thead/tr//*[@__gwt_header]"));
|
||||
}
|
||||
|
||||
protected List<WebElement> getRows() {
|
||||
List<WebElement> bodies = this.context.findElements(By.tagName(BODY_TAG_NAME));
|
||||
|
||||
for(WebElement body : bodies) {
|
||||
if(!body.isDisplayed())
|
||||
continue;
|
||||
|
||||
List<WebElement> rows = body.findElements(By.tagName("tr"));
|
||||
|
||||
Iterator<WebElement> iterator = rows.iterator();
|
||||
|
||||
while(iterator.hasNext()) {
|
||||
WebElement row = iterator.next();
|
||||
|
||||
if(isRowForLoadingIndicator(row) || isRowForEmptyTableWidget(row))
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
return rows;
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
protected abstract T createDataEntry(WebElement element);
|
||||
|
||||
// TODO [D049941]: Implement this method
|
||||
private boolean isRowForEmptyTableWidget(WebElement row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isRowForLoadingIndicator(WebElement row) {
|
||||
List<WebElement> images = row.findElements(By.xpath(LOADING_ANIMATION_XPATH));
|
||||
|
||||
if(images.isEmpty() || images.size() > 1)
|
||||
return false;
|
||||
|
||||
String image = images.get(0).getCssValue(CSSConstants.CSS_BACKGROUND_IMAGE);
|
||||
|
||||
return LOADING_ANIMATION_IMAGE.equals(image);
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.selenium.pages.gwt;
|
||||
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import com.sap.sailing.selenium.pages.PageArea;
|
||||
|
||||
public abstract class CellTableRowPO extends PageArea {
|
||||
protected static final String ROW_TAG_NAME = "tr"; //$NON-NLS-1$
|
||||
|
||||
protected final CellTablePO<?> table;
|
||||
|
||||
public CellTableRowPO(CellTablePO<?> table, WebElement element) {
|
||||
super(table.getWebDriver(), element);
|
||||
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>NOTE: This constructor is only used for creating an alias!</p>
|
||||
*/
|
||||
protected CellTableRowPO() {
|
||||
super(null, null);
|
||||
|
||||
this.table = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void verify() {
|
||||
WebElement element = (WebElement) this.context;
|
||||
|
||||
if(!ROW_TAG_NAME.equalsIgnoreCase(element.getTagName()))
|
||||
throw new IllegalArgumentException("WebElement does not represent a Row"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 200 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user