added column in leaderboard group table; fixed UI parts; added storage test

This commit is contained in:
Axel Uhl committed 2014-08-05 00:19:06 +02:00
1 parent 2dd99d09ac
commit ec01ea43e2
5 files changed
+15 -6

No files matched your search

@@ -492,6 +492,13 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
return group.description.length() <= 100 ? group.description : group.description.substring(0, 98) + "...";
}
};
TextColumn<LeaderboardGroupDTO> groupDisplayNameColumn = new TextColumn<LeaderboardGroupDTO>() {
@Override
public String getValue(LeaderboardGroupDTO group) {
return group.getDisplayName() == null ? "" :
group.getDisplayName().length() <= 100 ? group.getDisplayName() : group.getDisplayName().substring(0, 98) + "...";
}
};
TextColumn<LeaderboardGroupDTO> hasOverallLeaderboardColumn = new TextColumn<LeaderboardGroupDTO>() {
@Override
public String getValue(LeaderboardGroupDTO group) {
@@ -533,6 +540,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
groupsTable.setWidth("100%");
groupsTable.addColumn(groupNameColumn, stringMessages.name());
groupsTable.addColumn(groupDescriptionColumn, stringMessages.description());
groupsTable.addColumn(groupDisplayNameColumn, stringMessages.displayName());
groupsTable.addColumn(hasOverallLeaderboardColumn, stringMessages.useOverallLeaderboard());
groupsTable.addColumn(groupActionsColumn, stringMessages.actions());
groupsTable.addColumnSortHandler(leaderboardGroupsListHandler);
@@ -671,6 +679,7 @@ public class LeaderboardGroupConfigPanel extends AbstractRegattaPanel implements
if (oldGroupName.equals(group.getName())) {
groupToUpdate.setName(updateDescriptor.getName());
groupToUpdate.description = updateDescriptor.getDescription();
groupToUpdate.setDisplayName(updateDescriptor.getDisplayName());
groupToUpdate.displayLeaderboardsInReverseOrder = updateDescriptor.isDisplayLeaderboardsInReverseOrder();
groupToUpdate.setOverallLeaderboardDiscardThresholds(updateDescriptor.getOverallLeaderboardDiscardThresholds());
groupToUpdate.setOverallLeaderboardScoringSchemeType(updateDescriptor.getOverallLeaderboardScoringSchemeType());
@@ -17,7 +17,7 @@ public class LeaderboardGroupCreateDialog extends LeaderboardGroupDialog {
descriptionEntryField = createTextArea(null);
descriptionEntryField.ensureDebugId("DescriptionTextArea");
displayNameEntryField = createTextArea(null);
displayNameEntryField = createTextBox("");
displayNameEntryField.ensureDebugId("DisplayNameTextArea");
displayLeaderboardsInReverseOrderCheckBox.setValue(false);
@@ -27,7 +27,7 @@ public class LeaderboardGroupDialog extends DataEntryDialog<LeaderboardGroupDial
protected StringMessages stringMessages;
protected TextBox nameEntryField;
protected TextArea descriptionEntryField;
protected TextArea displayNameEntryField;
protected TextBox displayNameEntryField;
protected CheckBox displayLeaderboardsInReverseOrderCheckBox;
protected CheckBox useOverallLeaderboardCheckBox;
private Panel overallLeaderboardConfigPanel;
@@ -180,8 +180,6 @@ public class LeaderboardGroupDialog extends DataEntryDialog<LeaderboardGroupDial
descriptionEntryField.getElement().getStyle().setProperty("resize", "none");
panel.add(descriptionEntryField);
panel.add(new Label(stringMessages.displayName()));
displayNameEntryField.setCharacterWidth(30);
displayNameEntryField.setVisibleLines(6);
displayNameEntryField.getElement().getStyle().setProperty("resize", "none");
panel.add(displayNameEntryField);
panel.add(displayLeaderboardsInReverseOrderCheckBox);
@@ -13,7 +13,7 @@ public class LeaderboardGroupEditDialog extends LeaderboardGroupDialog {
getOverallLeaderboardScoringSchemeListBox().setEnabled(!group.hasOverallLeaderboard());
nameEntryField = createTextBox(group.getName(), 50);
descriptionEntryField = createTextArea(group.description);
displayNameEntryField = createTextArea(group.getDisplayName());
displayNameEntryField = createTextBox(group.getDisplayName());
displayLeaderboardsInReverseOrderCheckBox.setValue(group.displayLeaderboardsInReverseOrder);
displayLeaderboardsInReverseOrderCheckBox.setEnabled(false);
useOverallLeaderboardCheckBox.setValue(group.hasOverallLeaderboard());
@@ -336,6 +336,7 @@ public class TestStoringAndRetrievingLeaderboardGroups extends AbstractMongoDBTe
final String groupName = "Leaderboard Group";
final String groupDescription = "A leaderboard group";
final String groupDisplayName = "Some short name";
final ArrayList<Leaderboard> leaderboards = new ArrayList<>();
Leaderboard leaderboard = new FlexibleLeaderboardImpl(leaderboardNames[0], new ThresholdBasedResultDiscardingRuleImpl(discardIndexResultsStartingWithHowManyRaces),
@@ -351,7 +352,7 @@ public class TestStoringAndRetrievingLeaderboardGroups extends AbstractMongoDBTe
new LowPoint(), null);
leaderboards.add(leaderboard);
final LeaderboardGroup leaderboardGroup = new LeaderboardGroupImpl(groupName, groupDescription, /* displayName */ null, false, leaderboards);
final LeaderboardGroup leaderboardGroup = new LeaderboardGroupImpl(groupName, groupDescription, groupDisplayName, false, leaderboards);
mongoObjectFactory.storeLeaderboardGroup(leaderboardGroup);
final LeaderboardGroup loadedLeaderboardGroup = domainObjectFactory.loadLeaderboardGroup(groupName, /* regattaRegistry */ null,
@@ -359,6 +360,7 @@ public class TestStoringAndRetrievingLeaderboardGroups extends AbstractMongoDBTe
Assert.assertEquals(groupName, loadedLeaderboardGroup.getName());
Assert.assertEquals(groupDescription, loadedLeaderboardGroup.getDescription());
Assert.assertEquals(groupDisplayName, loadedLeaderboardGroup.getDisplayName());
int c = 0;
for (Leaderboard board : leaderboardGroup.getLeaderboards()) {