mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-16 09:11:02 +00:00
Adjustments/Fixes for AdminConsole styling
This commit is contained in:
1 parent
47f3767396
commit
8c8b07e8f5
5 files changed
+1734
-459
No files matched your search
@@ -1,214 +1,125 @@
|
||||
@import url(fontface.css);
|
||||
@import url(CommonControls.css);
|
||||
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
* {
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #777777;
|
||||
margin: 40px 0px 70px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: 6px 6px;
|
||||
margin: 8px 3px 10px 2px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
padding: 0px 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.chartLegend {
|
||||
float: left;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.chartTitle {
|
||||
font: 20px bold;
|
||||
}
|
||||
|
||||
.sendButton {
|
||||
display: block;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
/** Most GWT widgets already have a style name defined */
|
||||
|
||||
.dialogVPanel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.serverResponseLabelError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||
#closeButton {
|
||||
margin: 15px 6px 6px;
|
||||
}
|
||||
|
||||
.gwt-TabPanelBottom {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.global-alert-message {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
font-size: 120%;
|
||||
text-align: right;
|
||||
padding: 0px 50px 0px 0px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.errorLabel {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.linkNoBorder {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.refreshLink {
|
||||
border: none;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.valignMiddle {
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.boldLabel {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.boldAnchor {
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.gwt-ListBox {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.legColumnHeader {
|
||||
background-color: #FFFFFF;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
|
||||
.dialogMessageLabel {
|
||||
font-weight: bold;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.gwt-DialogBox {
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .Caption {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogTopLeft {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogTopRight {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogMiddleLeft {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogMiddleRight {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogBottomCenter {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogBottomLeft {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-DialogBox .dialogBottomRight {
|
||||
background: none repeat scroll 0 0 #e5e5e5;
|
||||
}
|
||||
|
||||
.gwt-Button {
|
||||
margin: 3px 2px 3px 5px;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.gwt-Button:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.gwt-Button[disabled] {
|
||||
color: #888888;
|
||||
cursor: default;
|
||||
background: #f1f1f1 !important;
|
||||
border: 1px solid #A3A3A3 !important;
|
||||
}
|
||||
|
||||
.gwt-Button[disabled]:hover {
|
||||
color: #888888;
|
||||
cursor: default;
|
||||
background: #f1f1f1 !important;
|
||||
border: 1px solid #A3A3A3 !important;
|
||||
}
|
||||
|
||||
.gwt-TextBox {
|
||||
font-family: Arial !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
select {
|
||||
font-family: Arial !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.leftPaddedPanel {
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.paddedPanel {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.gwt-SuggestBoxPopup {
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
border: 1px solid #666;
|
||||
border-top: 0;
|
||||
background-color: #fff;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
.gwt-SuggestBoxPopup .item {
|
||||
border: 1px dotted #aaa;
|
||||
}
|
||||
|
||||
.gwt-SuggestBoxPopup .item-selected {
|
||||
background-color: #ffc;
|
||||
}
|
||||
|
||||
.wrap-cols td div {
|
||||
white-space: normal;
|
||||
/** Add css rules here for your application. */
|
||||
|
||||
* {
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
font-weight: bold;
|
||||
color: #777777;
|
||||
margin: 40px 0px 70px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding: 6px 6px;
|
||||
margin: 8px 3px 10px 2px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
padding: 0px 4px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.chartLegend {
|
||||
float: left;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.chartTitle {
|
||||
font: 20px bold;
|
||||
}
|
||||
|
||||
.sendButton {
|
||||
display: block;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
/** Most GWT widgets already have a style name defined */
|
||||
|
||||
.dialogVPanel {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.serverResponseLabelError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||
#closeButton {
|
||||
margin: 15px 6px 6px;
|
||||
}
|
||||
|
||||
.gwt-TabPanelBottom {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.global-alert-message {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
font-size: 120%;
|
||||
text-align: right;
|
||||
padding: 0px 50px 0px 0px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.errorLabel {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.linkNoBorder {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.refreshLink {
|
||||
border: none;
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.valignMiddle {
|
||||
position: relative;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.boldLabel {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.boldAnchor {
|
||||
font-weight: bold;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.legColumnHeader {
|
||||
background-color: #FFFFFF;
|
||||
padding: 0 0 0 0;
|
||||
}
|
||||
|
||||
.dialogMessageLabel {
|
||||
font-weight: bold;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
select {
|
||||
font-family: Arial !important;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
.leftPaddedPanel {
|
||||
padding-left: 50px;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.paddedPanel {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.wrap-cols td div {
|
||||
white-space: normal;
|
||||
}
|
||||
@@ -20,7 +20,10 @@
|
||||
<!-- -->
|
||||
<title>SAP Sailing Analytics Administration Console</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="clean/clean.css">
|
||||
<!-- AdminConsole is not prepared to work with nomalize. -->
|
||||
<!-- <link rel="stylesheet" type="text/css" href="sailing-normalize-3.0.2.cache.css"> -->
|
||||
<link rel="stylesheet" type="text/css" href="clean/sailing-clean-1.0.cache.css">
|
||||
<link rel="stylesheet" type="text/css" href="sailing-fontface-1.0.cache.css">
|
||||
<link rel="stylesheet" type="text/css" href="AdminConsole.css">
|
||||
<link rel="stylesheet" type="text/css" href="AdminConsoleDateTimePicker.css">
|
||||
<link rel="stylesheet" type="text/css" href="AdminConsoleProgressBar.css">
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,125 @@
|
||||
/* Generated by Font Squirrel (http://www.fontsquirrel.com) on October 17, 2012 06:01:42 AM America/New_York */
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansLight';
|
||||
src: url('fonts/OpenSans-Light-webfont.eot');
|
||||
src: url('fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-Light-webfont.woff') format('woff'), url('fonts/OpenSans-Light-webfont.ttf') format('truetype'), url('fonts/OpenSans-Light-webfont.svg#OpenSansLight') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansLightItalic';
|
||||
src: url('fonts/OpenSans-LightItalic-webfont.eot');
|
||||
src: url('fonts/OpenSans-LightItalic-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-LightItalic-webfont.woff') format('woff'), url('fonts/OpenSans-LightItalic-webfont.ttf') format('truetype'), url('fonts/OpenSans-LightItalic-webfont.svg#OpenSansLightItalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansRegular';
|
||||
src: url('fonts/OpenSans-Regular-webfont.eot');
|
||||
src: url('fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-Regular-webfont.woff') format('woff'), url('fonts/OpenSans-Regular-webfont.ttf') format('truetype'), url('fonts/OpenSans-Regular-webfont.svg#OpenSansRegular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansItalic';
|
||||
src: url('fonts/OpenSans-Italic-webfont.eot');
|
||||
src: url('fonts/OpenSans-Italic-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-Italic-webfont.woff') format('woff'), url('fonts/OpenSans-Italic-webfont.ttf') format('truetype'), url('fonts/OpenSans-Italic-webfont.svg#OpenSansItalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansSemibold';
|
||||
src: url('fonts/OpenSans-Semibold-webfont.eot');
|
||||
src: url('fonts/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-Semibold-webfont.woff') format('woff'), url('fonts/OpenSans-Semibold-webfont.ttf') format('truetype'), url('fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansSemiboldItalic';
|
||||
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot');
|
||||
src: url('fonts/OpenSans-SemiboldItalic-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-SemiboldItalic-webfont.woff') format('woff'), url('fonts/OpenSans-SemiboldItalic-webfont.ttf') format('truetype'), url('fonts/OpenSans-SemiboldItalic-webfont.svg#OpenSansSemiboldItalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansBold';
|
||||
src: url('fonts/OpenSans-Bold-webfont.eot');
|
||||
src: url('fonts/OpenSans-Bold-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-Bold-webfont.woff') format('woff'), url('fonts/OpenSans-Bold-webfont.ttf') format('truetype'), url('fonts/OpenSans-Bold-webfont.svg#OpenSansBold') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansBoldItalic';
|
||||
src: url('fonts/OpenSans-BoldItalic-webfont.eot');
|
||||
src: url('fonts/OpenSans-BoldItalic-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-BoldItalic-webfont.woff') format('woff'), url('fonts/OpenSans-BoldItalic-webfont.ttf') format('truetype'), url('fonts/OpenSans-BoldItalic-webfont.svg#OpenSansBoldItalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansExtrabold';
|
||||
src: url('fonts/OpenSans-ExtraBold-webfont.eot');
|
||||
src: url('fonts/OpenSans-ExtraBold-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-ExtraBold-webfont.woff') format('woff'), url('fonts/OpenSans-ExtraBold-webfont.ttf') format('truetype'), url('fonts/OpenSans-ExtraBold-webfont.svg#OpenSansExtrabold') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansExtraboldItalic';
|
||||
src: url('fonts/OpenSans-ExtraBoldItalic-webfont.eot');
|
||||
src: url('fonts/OpenSans-ExtraBoldItalic-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/OpenSans-ExtraBoldItalic-webfont.woff') format('woff'), url('fonts/OpenSans-ExtraBoldItalic-webfont.ttf') format('truetype'), url('fonts/OpenSans-ExtraBoldItalic-webfont.svg#OpenSansExtraboldItalic') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansCondensedLight';
|
||||
src: url('fonts/OpenSans-CondLight-webfont.eot');
|
||||
src: url('fonts/OpenSans-CondLight-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('fonts/OpenSans-CondLight-webfont.woff') format('woff'),
|
||||
url('fonts/OpenSans-CondLight-webfont.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansCondensedLightItalic';
|
||||
src: url('fonts/OpenSans-CondLightItalic-webfont.eot');
|
||||
src: url('fonts/OpenSans-CondLightItalic-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('fonts/OpenSans-CondLightItalic-webfont.woff') format('woff'),
|
||||
url('fonts/OpenSans-CondLightItalic-webfont.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'OpenSansCondensedBold';
|
||||
src: url('fonts/OpenSans-CondBold-webfont.eot');
|
||||
src: url('fonts/OpenSans-CondBold-webfont.eot?#iefix') format('embedded-opentype'),
|
||||
url('fonts/OpenSans-CondBold-webfont.woff') format('woff'),
|
||||
url('fonts/OpenSans-CondBold-webfont.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
+245
-245
@@ -1,245 +1,245 @@
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.TabLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.TextArea;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
|
||||
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.VenueDTO;
|
||||
import com.sap.sse.gwt.client.controls.listedit.StringConstantsListEditorComposite;
|
||||
import com.sap.sse.gwt.client.controls.listedit.StringListInlineEditorComposite;
|
||||
|
||||
public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO> {
|
||||
private final AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
protected StringMessages stringMessages;
|
||||
protected TextBox nameEntryField;
|
||||
protected TextArea descriptionEntryField;
|
||||
protected TextBox venueEntryField;
|
||||
protected BetterDateTimeBox startDateBox;
|
||||
protected BetterDateTimeBox endDateBox;
|
||||
protected CheckBox isPublicCheckBox;
|
||||
protected UUID id;
|
||||
protected TextBox officialWebsiteURLEntryField;
|
||||
protected TextBox logoImageURLEntryField;
|
||||
protected StringListInlineEditorComposite courseAreaNameList;
|
||||
protected StringListInlineEditorComposite imageURLList;
|
||||
protected StringListInlineEditorComposite videoURLList;
|
||||
protected StringListInlineEditorComposite sponsorImageURLList;
|
||||
protected StringConstantsListEditorComposite leaderboardGroupList;
|
||||
protected List<LeaderboardGroupDTO> availableLeaderboardGroups;
|
||||
|
||||
protected static class EventParameterValidator implements Validator<EventDTO> {
|
||||
|
||||
private StringMessages stringMessages;
|
||||
private ArrayList<EventDTO> existingEvents;
|
||||
|
||||
public EventParameterValidator(StringMessages stringMessages, Collection<EventDTO> existingEvents) {
|
||||
this.stringMessages = stringMessages;
|
||||
this.existingEvents = new ArrayList<EventDTO>(existingEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(EventDTO eventToValidate) {
|
||||
String errorMessage = null;
|
||||
boolean nameNotEmpty = eventToValidate.getName() != null && eventToValidate.getName().length() > 0;
|
||||
boolean venueNotEmpty = eventToValidate.venue.getName() != null && eventToValidate.venue.getName().length() > 0;
|
||||
boolean courseAreaNotEmpty = eventToValidate.venue.getCourseAreas() != null && eventToValidate.venue.getCourseAreas().size() > 0;
|
||||
|
||||
if (courseAreaNotEmpty) {
|
||||
for (CourseAreaDTO courseArea : eventToValidate.venue.getCourseAreas()) {
|
||||
courseAreaNotEmpty = courseArea.getName() != null && courseArea.getName().length() > 0;
|
||||
if (!courseAreaNotEmpty)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean unique = true;
|
||||
for (EventDTO event : existingEvents) {
|
||||
if (event.getName().equals(eventToValidate.getName())) {
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Date startDate = eventToValidate.startDate;
|
||||
Date endDate = eventToValidate.endDate;
|
||||
String datesErrorMessage = null;
|
||||
// remark: startDate == null and endDate == null is valid
|
||||
if(startDate != null && endDate != null) {
|
||||
if(startDate.after(endDate)) {
|
||||
datesErrorMessage = stringMessages.pleaseEnterStartAndEndDate();
|
||||
}
|
||||
} else if((startDate != null && endDate == null) || (startDate == null && endDate != null)) {
|
||||
datesErrorMessage = stringMessages.pleaseEnterStartAndEndDate();
|
||||
}
|
||||
|
||||
if(datesErrorMessage != null) {
|
||||
errorMessage = datesErrorMessage;
|
||||
} else if (!nameNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterAName();
|
||||
} else if (!venueNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterNonEmptyVenue();
|
||||
} else if (!courseAreaNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterNonEmptyCourseArea();
|
||||
} else if (!unique) {
|
||||
errorMessage = stringMessages.eventWithThisNameAlreadyExists();
|
||||
}
|
||||
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leaderboardGroupsOfEvent even though not editable in this dialog, this parameter gives an editing subclass a chance to "park" the leaderboard group
|
||||
* assignments for re-association with the new {@link EventDTO} created by the {@link #getResult} method.
|
||||
*/
|
||||
public EventDialog(EventParameterValidator validator, StringMessages stringMessages, List<LeaderboardGroupDTO> availableLeaderboardGroups,
|
||||
Iterable<LeaderboardGroupDTO> leaderboardGroupsOfEvent, DialogCallback<EventDTO> callback) {
|
||||
super(stringMessages.event(), null, stringMessages.ok(), stringMessages.cancel(), validator,
|
||||
callback);
|
||||
this.stringMessages = stringMessages;
|
||||
this.availableLeaderboardGroups = availableLeaderboardGroups;
|
||||
getDialogBox().setWidth("750px");
|
||||
final ValueChangeHandler<Iterable<String>> valueChangeHandler = new ValueChangeHandler<Iterable<String>>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Iterable<String>> event) {
|
||||
validate();
|
||||
}
|
||||
};
|
||||
|
||||
courseAreaNameList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(), /* suggestValues */
|
||||
SuggestedCourseAreaNames.suggestedCourseAreaNames, stringMessages.enterCourseAreaName(), 50));
|
||||
courseAreaNameList.addValueChangeHandler(valueChangeHandler);
|
||||
final List<String> imageSuggestionURLs = Arrays.asList(new String[] { "http://", "https://", "http://www.", "https://www" });
|
||||
imageURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ imageSuggestionURLs, stringMessages.enterImageURL(), 80));
|
||||
imageURLList.addValueChangeHandler(valueChangeHandler);
|
||||
List<String> videoURLSuggestions = new ArrayList<>(imageSuggestionURLs);
|
||||
videoURLSuggestions.add("http://www.youtube.com/watch?v=");
|
||||
videoURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ videoURLSuggestions, stringMessages.enterVideoURL(), 80));
|
||||
videoURLList.addValueChangeHandler(valueChangeHandler);
|
||||
sponsorImageURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ imageSuggestionURLs, stringMessages.enterSponsorImageURL(), 80));
|
||||
sponsorImageURLList.addValueChangeHandler(valueChangeHandler);
|
||||
List<String> leaderboardGroupNames = new ArrayList<>();
|
||||
for(LeaderboardGroupDTO leaderboardGroupDTO: availableLeaderboardGroups) {
|
||||
leaderboardGroupNames.add(leaderboardGroupDTO.getName());
|
||||
}
|
||||
leaderboardGroupList = new StringConstantsListEditorComposite(Collections.<String> emptyList(),
|
||||
new StringConstantsListEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
leaderboardGroupNames, "Select a leaderboard group..."));
|
||||
leaderboardGroupList.addValueChangeHandler(valueChangeHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EventDTO getResult() {
|
||||
EventDTO result = new EventDTO();
|
||||
List<String> leaderboardGroupNames = leaderboardGroupList.getValue();
|
||||
for(LeaderboardGroupDTO lg: availableLeaderboardGroups) {
|
||||
if(leaderboardGroupNames.contains(lg.getName())) {
|
||||
result.addLeaderboardGroup(lg);
|
||||
}
|
||||
}
|
||||
result.setName(nameEntryField.getText());
|
||||
result.setDescription(descriptionEntryField.getText());
|
||||
result.setOfficialWebsiteURL(officialWebsiteURLEntryField.getText().trim().isEmpty() ? null : officialWebsiteURLEntryField.getText().trim());
|
||||
result.setLogoImageURL(logoImageURLEntryField.getText().trim().isEmpty() ? null : logoImageURLEntryField.getText().trim());
|
||||
result.startDate = startDateBox.getValue();
|
||||
result.endDate = endDateBox.getValue();
|
||||
result.isPublic = isPublicCheckBox.getValue();
|
||||
result.id = id;
|
||||
|
||||
List<CourseAreaDTO> courseAreas = new ArrayList<CourseAreaDTO>();
|
||||
for (String courseAreaName : courseAreaNameList.getValue()) {
|
||||
CourseAreaDTO courseAreaDTO = new CourseAreaDTO();
|
||||
courseAreaDTO.setName(courseAreaName);
|
||||
courseAreas.add(courseAreaDTO);
|
||||
}
|
||||
for (String imageURL : imageURLList.getValue()) {
|
||||
result.addImageURL(imageURL);
|
||||
}
|
||||
for (String videoURL : videoURLList.getValue()) {
|
||||
result.addVideoURL(videoURL);
|
||||
}
|
||||
for (String sponsorImageURL : sponsorImageURLList.getValue()) {
|
||||
result.addSponsorImageURL(sponsorImageURL);
|
||||
}
|
||||
result.venue = new VenueDTO(venueEntryField.getText(), courseAreas);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final VerticalPanel panel = new VerticalPanel();
|
||||
panel.setWidth("100%");
|
||||
Widget additionalWidget = super.getAdditionalWidget();
|
||||
if (additionalWidget != null) {
|
||||
panel.add(additionalWidget);
|
||||
}
|
||||
|
||||
Grid formGrid = new Grid(8, 2);
|
||||
panel.add(formGrid);
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.name() + ":"));
|
||||
formGrid.setWidget(0, 1, nameEntryField);
|
||||
formGrid.setWidget(1, 0, new Label(stringMessages.description() + ":"));
|
||||
formGrid.setWidget(1, 1, descriptionEntryField);
|
||||
formGrid.setWidget(2, 0, new Label(stringMessages.venue() + ":"));
|
||||
formGrid.setWidget(2, 1, venueEntryField);
|
||||
formGrid.setWidget(3, 0, new Label(stringMessages.startDate() + ":"));
|
||||
formGrid.setWidget(3, 1, startDateBox);
|
||||
formGrid.setWidget(4, 0, new Label(stringMessages.endDate() + ":"));
|
||||
formGrid.setWidget(4, 1, endDateBox);
|
||||
formGrid.setWidget(5, 0, new Label(stringMessages.isPublic() + ":"));
|
||||
formGrid.setWidget(5, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(6, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(6, 1, officialWebsiteURLEntryField);
|
||||
formGrid.setWidget(7, 0, new Label(stringMessages.eventLogoImageURL() + ":"));
|
||||
formGrid.setWidget(7, 1, logoImageURLEntryField);
|
||||
|
||||
TabLayoutPanel tabPanel = new TabLayoutPanel(30, Unit.PX);
|
||||
tabPanel.setHeight("250px");
|
||||
panel.add(tabPanel);
|
||||
tabPanel.add(new ScrollPanel(leaderboardGroupList), stringMessages.leaderboardGroups());
|
||||
tabPanel.add(new ScrollPanel(courseAreaNameList), stringMessages.courseAreas());
|
||||
tabPanel.add(new ScrollPanel(imageURLList), stringMessages.imageURLs());
|
||||
tabPanel.add(new ScrollPanel(videoURLList), stringMessages.videoURLs());
|
||||
tabPanel.add(new ScrollPanel(sponsorImageURLList), stringMessages.sponsorImageURLs());
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
nameEntryField.setFocus(true);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.gwt.ui.adminconsole;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Grid;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.TabLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.TextArea;
|
||||
import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
|
||||
import com.sap.sailing.gwt.ui.shared.CourseAreaDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.EventDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.VenueDTO;
|
||||
import com.sap.sse.gwt.client.controls.listedit.StringConstantsListEditorComposite;
|
||||
import com.sap.sse.gwt.client.controls.listedit.StringListInlineEditorComposite;
|
||||
|
||||
public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO> {
|
||||
private final AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
|
||||
protected StringMessages stringMessages;
|
||||
protected TextBox nameEntryField;
|
||||
protected TextArea descriptionEntryField;
|
||||
protected TextBox venueEntryField;
|
||||
protected BetterDateTimeBox startDateBox;
|
||||
protected BetterDateTimeBox endDateBox;
|
||||
protected CheckBox isPublicCheckBox;
|
||||
protected UUID id;
|
||||
protected TextBox officialWebsiteURLEntryField;
|
||||
protected TextBox logoImageURLEntryField;
|
||||
protected StringListInlineEditorComposite courseAreaNameList;
|
||||
protected StringListInlineEditorComposite imageURLList;
|
||||
protected StringListInlineEditorComposite videoURLList;
|
||||
protected StringListInlineEditorComposite sponsorImageURLList;
|
||||
protected StringConstantsListEditorComposite leaderboardGroupList;
|
||||
protected List<LeaderboardGroupDTO> availableLeaderboardGroups;
|
||||
|
||||
protected static class EventParameterValidator implements Validator<EventDTO> {
|
||||
|
||||
private StringMessages stringMessages;
|
||||
private ArrayList<EventDTO> existingEvents;
|
||||
|
||||
public EventParameterValidator(StringMessages stringMessages, Collection<EventDTO> existingEvents) {
|
||||
this.stringMessages = stringMessages;
|
||||
this.existingEvents = new ArrayList<EventDTO>(existingEvents);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(EventDTO eventToValidate) {
|
||||
String errorMessage = null;
|
||||
boolean nameNotEmpty = eventToValidate.getName() != null && eventToValidate.getName().length() > 0;
|
||||
boolean venueNotEmpty = eventToValidate.venue.getName() != null && eventToValidate.venue.getName().length() > 0;
|
||||
boolean courseAreaNotEmpty = eventToValidate.venue.getCourseAreas() != null && eventToValidate.venue.getCourseAreas().size() > 0;
|
||||
|
||||
if (courseAreaNotEmpty) {
|
||||
for (CourseAreaDTO courseArea : eventToValidate.venue.getCourseAreas()) {
|
||||
courseAreaNotEmpty = courseArea.getName() != null && courseArea.getName().length() > 0;
|
||||
if (!courseAreaNotEmpty)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
boolean unique = true;
|
||||
for (EventDTO event : existingEvents) {
|
||||
if (event.getName().equals(eventToValidate.getName())) {
|
||||
unique = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Date startDate = eventToValidate.startDate;
|
||||
Date endDate = eventToValidate.endDate;
|
||||
String datesErrorMessage = null;
|
||||
// remark: startDate == null and endDate == null is valid
|
||||
if(startDate != null && endDate != null) {
|
||||
if(startDate.after(endDate)) {
|
||||
datesErrorMessage = stringMessages.pleaseEnterStartAndEndDate();
|
||||
}
|
||||
} else if((startDate != null && endDate == null) || (startDate == null && endDate != null)) {
|
||||
datesErrorMessage = stringMessages.pleaseEnterStartAndEndDate();
|
||||
}
|
||||
|
||||
if(datesErrorMessage != null) {
|
||||
errorMessage = datesErrorMessage;
|
||||
} else if (!nameNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterAName();
|
||||
} else if (!venueNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterNonEmptyVenue();
|
||||
} else if (!courseAreaNotEmpty) {
|
||||
errorMessage = stringMessages.pleaseEnterNonEmptyCourseArea();
|
||||
} else if (!unique) {
|
||||
errorMessage = stringMessages.eventWithThisNameAlreadyExists();
|
||||
}
|
||||
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param leaderboardGroupsOfEvent even though not editable in this dialog, this parameter gives an editing subclass a chance to "park" the leaderboard group
|
||||
* assignments for re-association with the new {@link EventDTO} created by the {@link #getResult} method.
|
||||
*/
|
||||
public EventDialog(EventParameterValidator validator, StringMessages stringMessages, List<LeaderboardGroupDTO> availableLeaderboardGroups,
|
||||
Iterable<LeaderboardGroupDTO> leaderboardGroupsOfEvent, DialogCallback<EventDTO> callback) {
|
||||
super(stringMessages.event(), null, stringMessages.ok(), stringMessages.cancel(), validator,
|
||||
callback);
|
||||
this.stringMessages = stringMessages;
|
||||
this.availableLeaderboardGroups = availableLeaderboardGroups;
|
||||
getDialogBox().getWidget().setWidth("730px");
|
||||
final ValueChangeHandler<Iterable<String>> valueChangeHandler = new ValueChangeHandler<Iterable<String>>() {
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Iterable<String>> event) {
|
||||
validate();
|
||||
}
|
||||
};
|
||||
|
||||
courseAreaNameList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(), /* suggestValues */
|
||||
SuggestedCourseAreaNames.suggestedCourseAreaNames, stringMessages.enterCourseAreaName(), 50));
|
||||
courseAreaNameList.addValueChangeHandler(valueChangeHandler);
|
||||
final List<String> imageSuggestionURLs = Arrays.asList(new String[] { "http://", "https://", "http://www.", "https://www" });
|
||||
imageURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ imageSuggestionURLs, stringMessages.enterImageURL(), 80));
|
||||
imageURLList.addValueChangeHandler(valueChangeHandler);
|
||||
List<String> videoURLSuggestions = new ArrayList<>(imageSuggestionURLs);
|
||||
videoURLSuggestions.add("http://www.youtube.com/watch?v=");
|
||||
videoURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ videoURLSuggestions, stringMessages.enterVideoURL(), 80));
|
||||
videoURLList.addValueChangeHandler(valueChangeHandler);
|
||||
sponsorImageURLList = new StringListInlineEditorComposite(Collections.<String> emptyList(),
|
||||
new StringListInlineEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
/* suggestValues */ imageSuggestionURLs, stringMessages.enterSponsorImageURL(), 80));
|
||||
sponsorImageURLList.addValueChangeHandler(valueChangeHandler);
|
||||
List<String> leaderboardGroupNames = new ArrayList<>();
|
||||
for(LeaderboardGroupDTO leaderboardGroupDTO: availableLeaderboardGroups) {
|
||||
leaderboardGroupNames.add(leaderboardGroupDTO.getName());
|
||||
}
|
||||
leaderboardGroupList = new StringConstantsListEditorComposite(Collections.<String> emptyList(),
|
||||
new StringConstantsListEditorComposite.ExpandedUi(stringMessages, resources.removeIcon(),
|
||||
leaderboardGroupNames, "Select a leaderboard group..."));
|
||||
leaderboardGroupList.addValueChangeHandler(valueChangeHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EventDTO getResult() {
|
||||
EventDTO result = new EventDTO();
|
||||
List<String> leaderboardGroupNames = leaderboardGroupList.getValue();
|
||||
for(LeaderboardGroupDTO lg: availableLeaderboardGroups) {
|
||||
if(leaderboardGroupNames.contains(lg.getName())) {
|
||||
result.addLeaderboardGroup(lg);
|
||||
}
|
||||
}
|
||||
result.setName(nameEntryField.getText());
|
||||
result.setDescription(descriptionEntryField.getText());
|
||||
result.setOfficialWebsiteURL(officialWebsiteURLEntryField.getText().trim().isEmpty() ? null : officialWebsiteURLEntryField.getText().trim());
|
||||
result.setLogoImageURL(logoImageURLEntryField.getText().trim().isEmpty() ? null : logoImageURLEntryField.getText().trim());
|
||||
result.startDate = startDateBox.getValue();
|
||||
result.endDate = endDateBox.getValue();
|
||||
result.isPublic = isPublicCheckBox.getValue();
|
||||
result.id = id;
|
||||
|
||||
List<CourseAreaDTO> courseAreas = new ArrayList<CourseAreaDTO>();
|
||||
for (String courseAreaName : courseAreaNameList.getValue()) {
|
||||
CourseAreaDTO courseAreaDTO = new CourseAreaDTO();
|
||||
courseAreaDTO.setName(courseAreaName);
|
||||
courseAreas.add(courseAreaDTO);
|
||||
}
|
||||
for (String imageURL : imageURLList.getValue()) {
|
||||
result.addImageURL(imageURL);
|
||||
}
|
||||
for (String videoURL : videoURLList.getValue()) {
|
||||
result.addVideoURL(videoURL);
|
||||
}
|
||||
for (String sponsorImageURL : sponsorImageURLList.getValue()) {
|
||||
result.addSponsorImageURL(sponsorImageURL);
|
||||
}
|
||||
result.venue = new VenueDTO(venueEntryField.getText(), courseAreas);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Widget getAdditionalWidget() {
|
||||
final VerticalPanel panel = new VerticalPanel();
|
||||
panel.setWidth("100%");
|
||||
Widget additionalWidget = super.getAdditionalWidget();
|
||||
if (additionalWidget != null) {
|
||||
panel.add(additionalWidget);
|
||||
}
|
||||
|
||||
Grid formGrid = new Grid(8, 2);
|
||||
panel.add(formGrid);
|
||||
|
||||
formGrid.setWidget(0, 0, new Label(stringMessages.name() + ":"));
|
||||
formGrid.setWidget(0, 1, nameEntryField);
|
||||
formGrid.setWidget(1, 0, new Label(stringMessages.description() + ":"));
|
||||
formGrid.setWidget(1, 1, descriptionEntryField);
|
||||
formGrid.setWidget(2, 0, new Label(stringMessages.venue() + ":"));
|
||||
formGrid.setWidget(2, 1, venueEntryField);
|
||||
formGrid.setWidget(3, 0, new Label(stringMessages.startDate() + ":"));
|
||||
formGrid.setWidget(3, 1, startDateBox);
|
||||
formGrid.setWidget(4, 0, new Label(stringMessages.endDate() + ":"));
|
||||
formGrid.setWidget(4, 1, endDateBox);
|
||||
formGrid.setWidget(5, 0, new Label(stringMessages.isPublic() + ":"));
|
||||
formGrid.setWidget(5, 1, isPublicCheckBox);
|
||||
formGrid.setWidget(6, 0, new Label(stringMessages.eventOfficialWebsiteURL() + ":"));
|
||||
formGrid.setWidget(6, 1, officialWebsiteURLEntryField);
|
||||
formGrid.setWidget(7, 0, new Label(stringMessages.eventLogoImageURL() + ":"));
|
||||
formGrid.setWidget(7, 1, logoImageURLEntryField);
|
||||
|
||||
TabLayoutPanel tabPanel = new TabLayoutPanel(30, Unit.PX);
|
||||
tabPanel.setHeight("250px");
|
||||
panel.add(tabPanel);
|
||||
tabPanel.add(new ScrollPanel(leaderboardGroupList), stringMessages.leaderboardGroups());
|
||||
tabPanel.add(new ScrollPanel(courseAreaNameList), stringMessages.courseAreas());
|
||||
tabPanel.add(new ScrollPanel(imageURLList), stringMessages.imageURLs());
|
||||
tabPanel.add(new ScrollPanel(videoURLList), stringMessages.videoURLs());
|
||||
tabPanel.add(new ScrollPanel(sponsorImageURLList), stringMessages.sponsorImageURLs());
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
nameEntryField.setFocus(true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user