Merge branch 'bug4210'

This commit is contained in:
Kai Boernert committed 2017-12-06 11:22:46 +01:00
commit 25af934a66
62 files changed
+1021 -772

No files matched your search

@@ -23,12 +23,6 @@
<version>1.0.0.GA</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<!-- This dependency is required because the GWT Maven Plugin searches
other GWT modules only in Maven dependencies -->
-1
View File
@@ -5,7 +5,6 @@
<classpathentry excluding="com/sap/sailing/gwt/ui/jre/" kind="src" path="src/main/java"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/gwt-maps-api-3.9.0-build-17.jar"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/gwt-ajaxloader.jar"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/lib/gwt-bootstrap-2.3.2.0.jar"/>
<classpathentry exported="true" kind="lib" path="WEB-INF/classes/"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
@@ -26,8 +26,6 @@
<link rel="stylesheet" type="text/css" href="/sailing-fontface-1.0.cache.css">
<link rel="stylesheet" type="text/css" href="SettingsDialog.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">
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
@@ -1,88 +0,0 @@
/*!
* Extracted from Bootstrap v3.0.2 by @fat and @mdo
* Copyright 2013 Twitter, Inc.
* Licensed under http://www.apache.org/licenses/LICENSE-2.0
*/
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding: 5px;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
list-style: none;
background-color: #ffffff;
border: 1px solid #cccccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
background-clip: padding-box;
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
color: #333333;
white-space: nowrap;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
color: #ffffff;
text-decoration: none;
background-color: #428bca;
outline: 0;
}
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
color: #999999;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
@@ -1,226 +0,0 @@
/*!
* Bootstrap v2.3.2
*
* Copyright 2013 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
.clearfix {
*zoom: 1;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
line-height: 0;
}
.clearfix:after {
clear: both;
}
.hide-text {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.input-block-level {
display: block;
width: 100%;
min-height: 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-moz-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-ms-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-o-keyframes progress-bar-stripes {
from {
background-position: 0 0;
}
to {
background-position: 40px 0;
}
}
@keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
.progress {
overflow: hidden;
height: 20px;
margin-bottom: 20px;
background-color: #f7f7f7;
background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9));
background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9);
background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9);
background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0);
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.progress .bar {
width: 0%;
height: 100%;
color: #ffffff;
float: left;
font-size: 12px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
background-color: #0e90d2;
background-image: -moz-linear-gradient(top, #149bdf, #0480be);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be));
background-image: -webkit-linear-gradient(top, #149bdf, #0480be);
background-image: -o-linear-gradient(top, #149bdf, #0480be);
background-image: linear-gradient(to bottom, #149bdf, #0480be);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0);
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-transition: width 0.6s ease;
-moz-transition: width 0.6s ease;
-o-transition: width 0.6s ease;
transition: width 0.6s ease;
}
.progress .bar + .bar {
-webkit-box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);
-moz-box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);
box-shadow: inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15);
}
.progress-striped .bar {
background-color: #149bdf;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-webkit-background-size: 40px 40px;
-moz-background-size: 40px 40px;
-o-background-size: 40px 40px;
background-size: 40px 40px;
}
.progress.active .bar {
-webkit-animation: progress-bar-stripes 2s linear infinite;
-moz-animation: progress-bar-stripes 2s linear infinite;
-ms-animation: progress-bar-stripes 2s linear infinite;
-o-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite;
}
.progress-danger .bar,
.progress .bar-danger {
background-color: #dd514c;
background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), to(#c43c35));
background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
background-image: linear-gradient(to bottom, #ee5f5b, #c43c35);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b', endColorstr='#ffc43c35', GradientType=0);
}
.progress-danger.progress-striped .bar,
.progress-striped .bar-danger {
background-color: #ee5f5b;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-success .bar,
.progress .bar-success {
background-color: #5eb95e;
background-image: -moz-linear-gradient(top, #62c462, #57a957);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), to(#57a957));
background-image: -webkit-linear-gradient(top, #62c462, #57a957);
background-image: -o-linear-gradient(top, #62c462, #57a957);
background-image: linear-gradient(to bottom, #62c462, #57a957);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462', endColorstr='#ff57a957', GradientType=0);
}
.progress-success.progress-striped .bar,
.progress-striped .bar-success {
background-color: #62c462;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-info .bar,
.progress .bar-info {
background-color: #4bb1cf;
background-image: -moz-linear-gradient(top, #5bc0de, #339bb9);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), to(#339bb9));
background-image: -webkit-linear-gradient(top, #5bc0de, #339bb9);
background-image: -o-linear-gradient(top, #5bc0de, #339bb9);
background-image: linear-gradient(to bottom, #5bc0de, #339bb9);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff339bb9', GradientType=0);
}
.progress-info.progress-striped .bar,
.progress-striped .bar-info {
background-color: #5bc0de;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-warning .bar,
.progress .bar-warning {
background-color: #faa732;
background-image: -moz-linear-gradient(top, #fbb450, #f89406);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), to(#f89406));
background-image: -webkit-linear-gradient(top, #fbb450, #f89406);
background-image: -o-linear-gradient(top, #fbb450, #f89406);
background-image: linear-gradient(to bottom, #fbb450, #f89406);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450', endColorstr='#fff89406', GradientType=0);
}
.progress-warning.progress-striped .bar,
.progress-striped .bar-warning {
background-color: #fbb450;
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
@@ -69,8 +69,7 @@ Import-Package: javax.servlet;version="3.1.0",
Web-ContextPath: /gwt
Bundle-ClassPath: WEB-INF/classes/,
WEB-INF/lib/gwt-maps-api-3.9.0-build-17.jar,
WEB-INF/lib/gwt-ajaxloader.jar,
WEB-INF/lib/gwt-bootstrap-2.3.2.0.jar
WEB-INF/lib/gwt-ajaxloader.jar
TrackLifecycle: true
Export-Package: com.google.gwt.user.client.rpc.core.com.sap.sailing.domain.common.confidence.impl,
com.google.gwt.user.client.rpc.core.com.sap.sailing.domain.common.impl,
@@ -37,10 +37,8 @@ bin.includes = META-INF/,\
com.sap.sailing.gwt.ui.DataMining/,\
DataMining.css,\
DataMining.html,\
AdminConsoleDateTimePicker.css,\
qrcode/,\
js/,\
AdminConsoleProgressBar.css,\
AutoPlay.css,\
AutoPlay.html,\
Home.css,\
-10
View File
@@ -333,16 +333,6 @@
],
"key": "ASL2.0"
},
{
"name": "GWT-Bootstrap",
"version": "2.3.2.0",
"owner": "GWT-Bootstrap",
"homepage": "http://gwtbootstrap.github.com/",
"acknowledgements": [
"Copyright ${year} GWT-Bootstrap"
],
"key": "ASL2.0"
},
{
"name": "gwt-google-apis",
"version": "ajaxloader-svn",
-6
View File
@@ -104,12 +104,6 @@
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sse.security.common</artifactId>
@@ -17,10 +17,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the paths for translatable code -->
<!-- module containing locale configuration -->
<inherits name='com.sap.sailing.gwt.common.SailingLocalesAllPermutations' />
@@ -22,10 +22,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- module containing locale configuration -->
<inherits name='com.sap.sailing.gwt.common.SailingLocalesAllPermutations' />
@@ -19,10 +19,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the app entry point class. -->
<entry-point class='com.sap.sailing.gwt.regattaoverview.client.RegattaOverviewEntryPoint'/>
@@ -28,11 +28,6 @@
<inherits name="com.sap.sse.security.ui.LoginPanel" />
<inherits name="com.sap.sse.Security" />
<!-- Fancy DateTimePicker (without the rest of Bootstrap!) -->
<!-- GWT-Bootstrap License: Apache License, Version 2.0 -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<super-source path="jre" />
<entry-point class='com.sap.sailing.gwt.ui.adminconsole.AdminConsoleEntryPoint'/>
@@ -17,17 +17,18 @@ import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.RankingMetrics;
import com.sap.sailing.domain.common.ScoringSchemeType;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
import com.sap.sailing.gwt.ui.leaderboard.RankingMetricTypeFormatter;
import com.sap.sailing.gwt.ui.leaderboard.ScoringSchemeTypeFormatter;
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.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.SeriesDTO;
import com.sap.sse.common.Util;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.controls.listedit.ListEditorComposite;
/**
@@ -39,13 +40,13 @@ import com.sap.sse.gwt.client.controls.listedit.ListEditorComposite;
*
* @param <T>
*/
public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEntryDialogWithBootstrap<T> {
public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEntryDialogWithDateTimeBox<T> {
protected StringMessages stringMessages;
private final RegattaDTO regatta;
protected final BetterDateTimeBox startDateBox;
protected final BetterDateTimeBox endDateBox;
protected final DateAndTimeInput startDateBox;
protected final DateAndTimeInput endDateBox;
protected final ListBox scoringSchemeListBox;
protected final ListBox courseAreaListBox;
protected final ListBox sailingEventsListBox;
@@ -72,11 +73,9 @@ public abstract class AbstractRegattaWithSeriesAndFleetsDialog<T> extends DataEn
final NodeList<OptionElement> options = selectElement.getOptions();
options.getItem(options.getLength()-1).setTitle(RankingMetricTypeFormatter.getDescription(rankingMetricType, stringMessages));
}
startDateBox = createDateTimeBox(regatta.startDate);
startDateBox.setFormat("dd/mm/yyyy hh:ii");
startDateBox = createDateTimeBox(regatta.startDate, Accuracy.MINUTES);
startDateBox.ensureDebugId("StartDateTimeBox");
endDateBox = createDateTimeBox(regatta.endDate);
endDateBox.setFormat("dd/mm/yyyy hh:ii");
endDateBox = createDateTimeBox(regatta.endDate, Accuracy.MINUTES);
endDateBox.ensureDebugId("EndDateTimeBox");
scoringSchemeListBox = createListBox(false);
scoringSchemeListBox.ensureDebugId("ScoringSchemeListBox");
@@ -28,7 +28,6 @@ import com.sap.sailing.gwt.ui.client.RegattaRefresher;
import com.sap.sailing.gwt.ui.client.RegattasDisplayer;
import com.sap.sailing.gwt.ui.client.RemoteServiceMappingConstants;
import com.sap.sailing.gwt.ui.masterdataimport.MasterDataImportPanel;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
import com.sap.sailing.gwt.ui.shared.RegattaDTO;
import com.sap.sailing.gwt.ui.shared.SecurityStylesheetResources;
@@ -87,7 +86,6 @@ public class AdminConsoleEntryPoint extends AbstractSailingEntryPoint implements
sailingService, getStringMessages().releaseNotes(), "/release_notes_admin.html", /* error reporter */ this, SecurityStylesheetResources.INSTANCE.css(), getStringMessages());
panel.addStyleName("adminConsolePanel");
BetterDateTimeBox.initialize();
regattasDisplayers = new HashSet<>();
leaderboardsDisplayers = new HashSet<>();
leaderboardGroupsDisplayers = new HashSet<>();
@@ -10,6 +10,7 @@ import com.sap.sailing.gwt.ui.client.StringMessages;
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.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.media.ImageDTO;
import com.sap.sse.gwt.client.media.VideoDTO;
@@ -31,11 +32,9 @@ public class EventCreateDialog extends EventDialog {
venueEntryField.setVisibleLength(35);
venueEntryField.ensureDebugId("VenueTextBox");
final Date now = new Date();
startDateBox = createDateTimeBox(now);
startDateBox.setFormat("dd/mm/yyyy hh:ii");
startDateBox = createDateTimeBox(now, Accuracy.MINUTES);
startDateBox.ensureDebugId("StartDateTimeBox");
endDateBox = createDateTimeBox(now);
endDateBox.setFormat("dd/mm/yyyy hh:ii");
endDateBox = createDateTimeBox(now, Accuracy.MINUTES);
endDateBox.ensureDebugId("EndDateTimeBox");
isPublicCheckBox = createCheckbox("");
isPublicCheckBox.setValue(false);
@@ -22,28 +22,28 @@ 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.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.common.client.DateAndTimeFormatterUtil;
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.IconResources;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.listedit.GenericStringListInlineEditorComposite;
import com.sap.sse.gwt.client.controls.listedit.StringConstantsListEditorComposite;
import com.sap.sse.gwt.client.media.ImageDTO;
import com.sap.sse.gwt.client.media.VideoDTO;
public abstract class EventDialog extends DataEntryDialogWithBootstrap<EventDTO> {
public abstract class EventDialog extends DataEntryDialogWithDateTimeBox<EventDTO> {
protected StringMessages stringMessages;
protected TextBox nameEntryField;
protected TextArea descriptionEntryField;
protected TextBox venueEntryField;
protected BetterDateTimeBox startDateBox;
protected BetterDateTimeBox endDateBox;
protected DateAndTimeInput startDateBox;
protected DateAndTimeInput endDateBox;
protected CheckBox isPublicCheckBox;
protected UUID id;
protected TextBox baseURLEntryField;
@@ -8,6 +8,7 @@ import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.EventDTO;
import com.sap.sailing.gwt.ui.shared.LeaderboardGroupDTO;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
public class EventEditDialog extends EventDialog {
public EventEditDialog(EventDTO event, Collection<EventDTO> otherExistingEvents, List<LeaderboardGroupDTO> availableLeaderboardGroups,
@@ -21,10 +22,8 @@ public class EventEditDialog extends EventDialog {
descriptionEntryField.getElement().getStyle().setProperty("resize", "none");
venueEntryField = createTextBox(event.venue.getName());
venueEntryField.setVisibleLength(35);
startDateBox = createDateTimeBox(event.startDate);
startDateBox.setFormat("dd/mm/yyyy hh:ii");
endDateBox = createDateTimeBox(event.endDate);
endDateBox.setFormat("dd/mm/yyyy hh:ii");
startDateBox = createDateTimeBox(event.startDate, Accuracy.MINUTES);
endDateBox = createDateTimeBox(event.endDate, Accuracy.MINUTES);
isPublicCheckBox = createCheckbox("");
isPublicCheckBox.setValue(event.isPublic);
baseURLEntryField = createTextBox(event.getBaseURL());
@@ -5,18 +5,18 @@ import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.Position;
import com.sap.sailing.domain.common.impl.DegreePosition;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sailing.domain.common.impl.DegreePosition;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.gwt.client.controls.datetime.DateInput;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class PositionEntryDialog extends DataEntryDialog<Pair<Position, TimePoint>> {
private final DoubleBox lat;
private final DoubleBox lng;
private final BetterDateTimeBox timePointBox;
private final DateInput timePointBox;
private final StringMessages stringMessages;
private static final double ERROR_VAL = Double.MIN_VALUE;
@@ -44,7 +44,7 @@ public class PositionEntryDialog extends DataEntryDialog<Pair<Position, TimePoin
this.stringMessages = stringMessages;
lat = createDoubleBox(10);
lng = createDoubleBox(10);
timePointBox = new BetterDateTimeBox();
timePointBox = new DateInput();
}
@Override
@@ -20,11 +20,10 @@ import com.sap.sailing.domain.common.racelog.tracking.DeviceMappingConstants;
import com.sap.sailing.domain.common.racelog.tracking.MappableToDevice;
import com.sap.sailing.domain.common.racelog.tracking.QRCodeURLCreationException;
import com.sap.sailing.gwt.ui.adminconsole.ItemToMapToDeviceSelectionPanel.SelectionChangedHandler;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.GwtUrlHelper;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sailing.gwt.ui.shared.DeviceIdentifierDTO;
import com.sap.sailing.gwt.ui.shared.DeviceMappingDTO;
import com.sap.sailing.gwt.ui.shared.EventDTO;
@@ -32,14 +31,15 @@ import com.sap.sailing.gwt.ui.shared.MarkDTO;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.controls.GenericListBox;
import com.sap.sse.gwt.client.controls.GenericListBox.ValueBuilder;
import com.sap.sse.gwt.client.controls.datetime.DateInput;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class RegattaLogAddDeviceMappingDialog extends DataEntryDialogWithBootstrap<DeviceMappingDTO> {
public class RegattaLogAddDeviceMappingDialog extends DataEntryDialogWithDateTimeBox<DeviceMappingDTO> {
private final String leaderboardName;
private final GenericListBox<EventDTO> events;
protected final BetterDateTimeBox from;
protected final BetterDateTimeBox to;
protected final DateInput from;
protected final DateInput to;
protected final ListBox deviceType;
protected final TextBox deviceId;
protected final DeviceMappingQRCodeWidget qrWidget;
@@ -83,9 +83,9 @@ public class RegattaLogAddDeviceMappingDialog extends DataEntryDialogWithBootstr
this.stringMessages = stringMessages;
this.sailingService = sailingService;
from = createDateTimeBox(new Date());
from = createDateBox(new Date());
from.setValue(null);
to = createDateTimeBox(new Date());
to = createDateBox(new Date());
to.setValue(null);
deviceType = createListBox(false);
@@ -8,13 +8,15 @@ import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sailing.gwt.ui.shared.RaceLogSetFinishingAndFinishTimeDTO;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class SetFinishingAndFinishedTimeDialog extends SetTimeDialog<RaceLogSetFinishingAndFinishTimeDTO> {
private BetterDateTimeBox finishTimeBox;
private DateAndTimeInput finishTimeBox;
private Label currentFinishTimeLabel;
public SetFinishingAndFinishedTimeDialog(SailingServiceAsync service, ErrorReporter errorReporter, String leaderboardName,
@@ -65,7 +67,7 @@ public class SetFinishingAndFinishedTimeDialog extends SetTimeDialog<RaceLogSetF
});
}
void setDate(Date date, Label currentValueLabel, BetterDateTimeBox dateTimeBox) {
void setDate(Date date, Label currentValueLabel, DateTimeInput dateTimeBox) {
if (date == null) {
currentValueLabel.setText(stringMessages.unknown());
} else {
@@ -115,8 +117,7 @@ public class SetFinishingAndFinishedTimeDialog extends SetTimeDialog<RaceLogSetF
@Override
protected void additionalInput(Grid content) {
finishTimeBox = createDateTimeBox(new Date());
finishTimeBox.setFormat("dd/mm/yyyy hh:ii:ss");
finishTimeBox = createDateTimeBox(new Date(), Accuracy.SECONDS);
finishTimeBox.ensureDebugId("FinishTimeBox");
content.setWidget(1, 0, createLabel(stringMessages.finishTimeString()));
content.setWidget(1, 1, finishTimeBox);
@@ -2,30 +2,136 @@ package com.sap.sailing.gwt.ui.adminconsole;
import java.util.Date;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.PushButton;
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.domain.common.racelog.RacingProcedureType;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.RaceLogSetStartTimeAndProcedureDTO;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class SetStartTimeDialog extends SetTimeDialog<RaceLogSetStartTimeAndProcedureDTO> {
protected ListBox racingProcedureSelection;
protected CheckBox advancePassIdCheckbox;
public class SetStartTimeDialog extends DataEntryDialogWithDateTimeBox<RaceLogSetStartTimeAndProcedureDTO> {
public SetStartTimeDialog(SailingServiceAsync service, ErrorReporter errorReporter, String leaderboardName,
String raceColumnName, String fleetName, StringMessages stringMessages,
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
private final SailingServiceAsync service;
private final ErrorReporter errorReporter;
private final String leaderboardName;
private final String raceColumnName;
private final String fleetName;
private final StringMessages stringMessages;
private int currentPassId = -1;
private Label currentStartTimeLabel;
private Label currentPassIdBox;
private DateAndTimeInput timeBox;
private TextBox authorNameBox;
private com.sap.sse.gwt.client.controls.IntegerBox authorPriorityBox;
private ListBox racingProcedureSelection;
private CheckBox advancePassIdCheckbox;
public SetStartTimeDialog(SailingServiceAsync service, ErrorReporter errorReporter, String leaderboardName,
String raceColumnName, String fleetName, StringMessages stringMessages,
DataEntryDialog.DialogCallback<RaceLogSetStartTimeAndProcedureDTO> callback) {
super(service, errorReporter, stringMessages.setStartTime(), stringMessages.setStartTimeDescription(),
stringMessages.setStartTime(), stringMessages.cancel(), leaderboardName, raceColumnName, fleetName,
stringMessages, new StartTimeValidator(stringMessages), callback);
super(stringMessages.setStartTime(), stringMessages.setStartTimeDescription(), stringMessages.setStartTime(),
stringMessages.cancel(), new StartTimeValidator(stringMessages), callback);
this.service = service;
this.errorReporter = errorReporter;
this.stringMessages = stringMessages;
this.leaderboardName = leaderboardName;
this.raceColumnName = raceColumnName;
this.fleetName = fleetName;
this.ensureDebugId("SetStartTimeDialog");
}
@Override
protected Widget getAdditionalWidget() {
VerticalPanel content = new VerticalPanel();
content.add(createCurrentPanel());
content.add(createInputPanel());
refreshCurrentStartTime();
return content;
}
private Widget createCurrentPanel() {
CaptionPanel current = new CaptionPanel(stringMessages.liveData());
HorizontalPanel currentPanel = new HorizontalPanel();
currentPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
Grid grid = new Grid(2,2);
currentStartTimeLabel = new Label("");
grid.setWidget(0, 0, createLabel(stringMessages.startTime()));
grid.setWidget(0, 1, currentStartTimeLabel);
currentPassIdBox = new Label("");
grid.setWidget(1, 0, createLabel(stringMessages.currentPass()));
grid.setWidget(1, 1, currentPassIdBox);
currentPanel.add(grid);
PushButton refreshButton = new PushButton(new Image(resources.reloadIcon()));
refreshButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
refreshCurrentStartTime();
}
});
currentPanel.add(refreshButton);
current.add(currentPanel);
return current;
}
private Widget createInputPanel() {
Grid content = new Grid(5, 2);
timeBox = createDateTimeBox(new Date(), Accuracy.SECONDS);
timeBox.ensureDebugId("StartTimeTimeBox");
content.setWidget(0, 0, createLabel(stringMessages.startTime()));
content.setWidget(0, 1, timeBox);
authorNameBox = createTextBox("Shore");
authorNameBox.ensureDebugId("AuthorNameTextBox");
content.setWidget(1, 0, createLabel(stringMessages.authorName()));
content.setWidget(1, 1, authorNameBox);
authorPriorityBox = createIntegerBox(4, 2);
authorPriorityBox.ensureDebugId("AuthorPriorityIntegerBox");
content.setWidget(2, 0, createLabel(stringMessages.authorPriority()));
content.setWidget(2, 1, authorPriorityBox);
racingProcedureSelection = createListBox(false);
ListBoxUtils.setupRacingProcedureTypeListBox(racingProcedureSelection, RacingProcedureType.RRS26, stringMessages.no());
int racingCounter = 0;
for (RacingProcedureType racingType : RacingProcedureType.values()) {
racingProcedureSelection.setValue(racingCounter++, racingType.name());
}
racingProcedureSelection.ensureDebugId("RacingProcedureListBox");
content.setWidget(3, 0, createLabel(stringMessages.racingProcedure()));
content.setWidget(3, 1, racingProcedureSelection);
advancePassIdCheckbox = createCheckbox(stringMessages.advancePassId());
advancePassIdCheckbox.setValue(false);
advancePassIdCheckbox.ensureDebugId("AnvancePassIdCheckBox");
content.setWidget(4, 1, advancePassIdCheckbox);
return content;
}
@Override
protected RaceLogSetStartTimeAndProcedureDTO getResult() {
@@ -37,94 +143,64 @@ public class SetStartTimeDialog extends SetTimeDialog<RaceLogSetStartTimeAndProc
dto.authorPriority = authorPriorityBox.getValue();
dto.logicalTimePoint = new Date();
dto.startTime = timeBox.getValue();
dto.passId = advancePassIdCheckbox.getValue() ? currentPassId + 1 : currentPassId;
dto.passId = advancePassIdCheckbox.getValue() ? currentPassId+1 : currentPassId;
dto.racingProcedure = RacingProcedureType.values()[racingProcedureSelection.getSelectedIndex()];
return dto;
}
@Override
protected void refreshCurrentTime() {
service.getStartTimeAndProcedure(leaderboardName, raceColumnName, fleetName,
new AsyncCallback<com.sap.sse.common.Util.Triple<Date, Integer, RacingProcedureType>>() {
@Override
public void onSuccess(com.sap.sse.common.Util.Triple<Date, Integer, RacingProcedureType> result) {
if (result == null) {
currentStartOrFinishingTimeLabel.setText(stringMessages.notAvailable());
currentPassIdBox.setText(stringMessages.notAvailable());
} else {
Date startTime = result.getA();
if (startTime == null) {
currentStartOrFinishingTimeLabel.setText(stringMessages.unknown());
} else {
currentStartOrFinishingTimeLabel.setText(DateTimeFormat
.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(startTime));
}
currentPassId = result.getB().intValue();
currentPassIdBox.setText(result.getB().toString());
int racingProcedureIndex = 0;
for (RacingProcedureType racingProcedureSelect : RacingProcedureType.values()) {
if (racingProcedureSelect.equals(result.getC())) {
break;
}
racingProcedureIndex++;
}
racingProcedureSelection.setSelectedIndex(racingProcedureIndex);
private void refreshCurrentStartTime() {
service.getStartTimeAndProcedure(leaderboardName, raceColumnName, fleetName, new AsyncCallback<com.sap.sse.common.Util.Triple<Date,Integer, RacingProcedureType>>() {
@Override
public void onSuccess(com.sap.sse.common.Util.Triple<Date, Integer, RacingProcedureType> result) {
if (result == null) {
currentStartTimeLabel.setText(stringMessages.notAvailable());
currentPassIdBox.setText(stringMessages.notAvailable());
} else {
Date startTime = result.getA();
if (startTime == null) {
currentStartTimeLabel.setText(stringMessages.unknown());
} else {
currentStartTimeLabel.setText(DateTimeFormat.getFormat(
DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM).format(startTime));
}
currentPassId = result.getB().intValue();
currentPassIdBox.setText(result.getB().toString());
int racingProcedureIndex = 0;
for (RacingProcedureType racingProcedureSelect : RacingProcedureType.values()) {
if (racingProcedureSelect.equals(result.getC())) {
break;
}
racingProcedureIndex++;
}
@Override
public void onFailure(Throwable caught) {
errorReporter.reportError(caught.getMessage());
}
});
racingProcedureSelection.setSelectedIndex(racingProcedureIndex);
}
}
@Override
public void onFailure(Throwable caught) {
errorReporter.reportError(caught.getMessage());
}
});
}
private static class StartTimeValidator implements Validator<RaceLogSetStartTimeAndProcedureDTO> {
private final StringMessages stringMessages;
public StartTimeValidator(StringMessages stringMessages) {
this.stringMessages = stringMessages;
}
@Override
public String getErrorMessage(RaceLogSetStartTimeAndProcedureDTO dto) {
if (dto.authorName == null || dto.authorName.isEmpty() || dto.authorPriority == null
|| dto.startTime == null) {
if (dto.authorName == null || dto.authorName.isEmpty() ||
dto.authorPriority == null || dto.startTime == null) {
return stringMessages.pleaseEnterAValue();
}
return null;
}
}
@Override
protected String getTimeLabel() {
return stringMessages.startTime();
}
@Override
protected void addAdditionalInput(Grid content) {
racingProcedureSelection = createListBox(false);
ListBoxUtils.setupRacingProcedureTypeListBox(racingProcedureSelection, RacingProcedureType.RRS26,
stringMessages.no());
int racingCounter = 0;
for (RacingProcedureType racingType : RacingProcedureType.values()) {
racingProcedureSelection.setValue(racingCounter++, racingType.name());
}
racingProcedureSelection.ensureDebugId("RacingProcedureListBox");
content.setWidget(4, 0, createLabel(stringMessages.racingProcedure()));
content.setWidget(4, 1, racingProcedureSelection);
advancePassIdCheckbox = createCheckbox(stringMessages.advancePassId());
advancePassIdCheckbox.setValue(false);
advancePassIdCheckbox.ensureDebugId("AnvancePassIdCheckBox");
content.setWidget(5, 0, advancePassIdCheckbox);
}
@Override
protected void additionalInput(Grid content) {
}
}
@@ -5,16 +5,17 @@ import java.util.Date;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class SetStartTimeReceivedDialog extends DataEntryDialogWithBootstrap<Date> {
public class SetStartTimeReceivedDialog extends DataEntryDialogWithDateTimeBox<Date> {
private final StringMessages stringMessages;
private BetterDateTimeBox timeBox;
private DateAndTimeInput timeBox;
public SetStartTimeReceivedDialog(StringMessages stringMessages, DataEntryDialog.DialogCallback<Date> callback) {
super(stringMessages.setStartTimeReceived(), stringMessages.setStartTimeReceivedDescription(), stringMessages.ok(), stringMessages.cancel(), new ReceivedStartTimeDialog(stringMessages), callback);
@@ -27,7 +28,7 @@ public class SetStartTimeReceivedDialog extends DataEntryDialogWithBootstrap<Dat
Label timeBoxLabel = new Label(stringMessages.startTime() + ":");
content.setWidget(0, 0, timeBoxLabel);
timeBox = createDateTimeBox(new Date());
timeBox = createDateTimeBox(new Date(), Accuracy.SECONDS);
content.setWidget(0, 1, timeBox);
return content;
@@ -15,14 +15,15 @@ import com.google.gwt.user.client.ui.PushButton;
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.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public abstract class SetTimeDialog<T> extends DataEntryDialogWithBootstrap<T> {
public abstract class SetTimeDialog<T> extends DataEntryDialogWithDateTimeBox<T> {
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
@@ -36,7 +37,7 @@ public abstract class SetTimeDialog<T> extends DataEntryDialogWithBootstrap<T> {
protected int currentPassId = -1;
protected Label currentStartOrFinishingTimeLabel;
protected Label currentPassIdBox;
protected BetterDateTimeBox timeBox;
protected DateTimeInput timeBox;
protected TextBox authorNameBox;
protected com.sap.sse.gwt.client.controls.IntegerBox authorPriorityBox;
@@ -99,9 +100,7 @@ public abstract class SetTimeDialog<T> extends DataEntryDialogWithBootstrap<T> {
private Widget createInputPanel() {
Grid content = new Grid(7, 2);
timeBox = createDateTimeBox(new Date());
timeBox.setFormat("dd/mm/yyyy hh:ii:ss");
timeBox.ensureDebugId("StartTimeTimeBox");
timeBox = createDateTimeBox(new Date(), Accuracy.SECONDS);
content.setWidget(0, 0, createLabel(getTimeLabel()));
content.setWidget(0, 1, timeBox);
@@ -5,13 +5,14 @@ import java.util.Date;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class SetTimePointDialog extends DataEntryDialogWithBootstrap<Date> {
private final BetterDateTimeBox time;
public class SetTimePointDialog extends DataEntryDialogWithDateTimeBox<Date> {
private final DateAndTimeInput time;
private final StringMessages stringMessages;
public SetTimePointDialog(final StringMessages stringMessages, String title, DialogCallback<Date> callback) {
@@ -25,7 +26,7 @@ public class SetTimePointDialog extends DataEntryDialogWithBootstrap<Date> {
this.stringMessages = stringMessages;
time = createDateTimeBox(new Date());
time = createDateTimeBox(new Date(), Accuracy.SECONDS);
}
@Override
@@ -12,6 +12,7 @@ import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CaptionPanel;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
@@ -22,17 +23,18 @@ import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLog;
import com.sap.sailing.domain.common.abstractlog.TimePointSpecificationFoundInLogImpl;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithBootstrap;
import com.sap.sailing.gwt.ui.client.DataEntryDialogWithDateTimeBox;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.common.Util;
import com.sap.sse.common.Util.Pair;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.gwt.client.ErrorReporter;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public class SetTrackingTimesDialog extends DataEntryDialogWithBootstrap<RaceLogSetTrackingTimesDTO> {
public class SetTrackingTimesDialog extends DataEntryDialogWithDateTimeBox<RaceLogSetTrackingTimesDTO> {
private static AdminConsoleResources resources = GWT.create(AdminConsoleResources.class);
@@ -49,7 +51,7 @@ public class SetTrackingTimesDialog extends DataEntryDialogWithBootstrap<RaceLog
private Label currentEndLabel;
private TimePointSpecificationFoundInLog currentEnd;
private BetterDateTimeBox startTimeBox;
private DateAndTimeInput startTimeBox;
/**
* Decides whether the start time value shall be set; if checked, even an empty value (translated
* to {@code null} will be stored as an event with the author's priority in the log; if unchecked,
@@ -58,7 +60,7 @@ public class SetTrackingTimesDialog extends DataEntryDialogWithBootstrap<RaceLog
* make the revoke succeed.
*/
private CheckBox startTimeSetCheckbox;
private BetterDateTimeBox endTimeBox;
private DateAndTimeInput endTimeBox;
/**
* Decides whether the end time value shall be set; if checked, even an empty value (translated
* to {@code null} will be stored as an event with the author's priority in the log; if unchecked,
@@ -110,7 +112,8 @@ public class SetTrackingTimesDialog extends DataEntryDialogWithBootstrap<RaceLog
});
}
private void updateDateTimeLabelAndTimeBoxFromDate(final TimePointSpecificationFoundInLog timePoint, final Label label, final BetterDateTimeBox dateTimeBox, CheckBox setCheckBox) {
private void updateDateTimeLabelAndTimeBoxFromDate(final TimePointSpecificationFoundInLog timePoint,
final Label label, final HasValue<Date> dateTimeBox, CheckBox setCheckBox) {
if (timePoint == null) {
label.setText(stringMessages.notAvailable());
dateTimeBox.setValue(null);
@@ -142,18 +145,16 @@ public class SetTrackingTimesDialog extends DataEntryDialogWithBootstrap<RaceLog
}
});
startTimeBox = createDateTimeBox(null);
startTimeBox = createDateTimeBox(null, Accuracy.SECONDS);
startTimeBox.addValueChangeHandler(e->startTimeSetCheckbox.setValue(true)); // when the start time is manipulated, assume the user wants to really set it
startTimeBox.setFormat("dd/mm/yyyy hh:ii:ss");
content.setWidget(0, 0, createLabel(stringMessages.startOfTracking()));
content.setWidget(0, 1, startTimeBox);
startTimeSetCheckbox = createCheckbox(stringMessages.set());
content.setWidget(0, 2, startTimeSetCheckbox);
content.setWidget(0, 3, startNow);
endTimeBox = createDateTimeBox(null);
endTimeBox = createDateTimeBox(null, Accuracy.SECONDS);
endTimeBox.addValueChangeHandler(e->endTimeSetCheckbox.setValue(true)); // when the end time is manipulated, assume the user wants to really set it
endTimeBox.setFormat("dd/mm/yyyy hh:ii:ss");
content.setWidget(1, 0, createLabel(stringMessages.endOfTracking()));
content.setWidget(1, 1, endTimeBox);
endTimeSetCheckbox = createCheckbox(stringMessages.set());
@@ -1,26 +0,0 @@
package com.sap.sailing.gwt.ui.adminconsole;
import com.github.gwtbootstrap.client.ui.ProgressBar;
public class StructureImportProgressBar extends ProgressBar{
double percent;
public StructureImportProgressBar(int amountOfRegattas){
this(amountOfRegattas, Style.DEFAULT);
}
public StructureImportProgressBar(int amountOfRegattas, Style style){
super(style);
percent = 100.0/amountOfRegattas;
setPercent(0);
}
public void setPercent(int parsed) {
super.setPercent((int)(percent*parsed));
}
}
@@ -1,55 +0,0 @@
package com.sap.sailing.gwt.ui.client;
import java.util.Date;
import com.github.gwtbootstrap.datetimepicker.client.ui.base.HasViewMode.ViewMode;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.logical.shared.AttachEvent.Handler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.sap.sailing.gwt.ui.shared.BetterDateTimeBox;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
import com.sap.sse.gwt.client.dialog.DialogUtils;
public abstract class DataEntryDialogWithBootstrap<T> extends DataEntryDialog<T> {
public DataEntryDialogWithBootstrap(String title, String message, String okButtonName, String cancelButtonName,
com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator<T> validator, boolean animationEnabled,
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<T> callback) {
super(title, message, okButtonName, cancelButtonName, validator, animationEnabled, callback);
}
protected DataEntryDialogWithBootstrap(String title, String message, String okButtonName, String cancelButtonName,
com.sap.sse.gwt.client.dialog.DataEntryDialog.Validator<T> validator,
com.sap.sse.gwt.client.dialog.DataEntryDialog.DialogCallback<T> callback) {
super(title, message, okButtonName, cancelButtonName, validator, callback);
}
/**
* Call something like <code>setFormat("dd/mm/yyyy hh:ii")</code> on the result to set the date / time entry format.
*/
public BetterDateTimeBox createDateTimeBox(Date initialValue) {
final BetterDateTimeBox result = new BetterDateTimeBox();
result.setValue(initialValue);
result.addValueChangeHandler(new ValueChangeHandler<Date>() {
@Override
public void onValueChange(ValueChangeEvent<Date> event) {
validateAndUpdate();
}
});
result.addAttachHandler(new Handler() {
@Override
public void onAttachOrDetach(AttachEvent event) {
if (event.isAttached()) {
addAutoHidePartner(result.getPicker());
}
}
});
result.setAutoClose(true);
result.setStartView(ViewMode.HOUR);
DialogUtils.linkEnterToButton(getOkButton(), result.getBox());
DialogUtils.linkEscapeToButton(getCancelButton(), result.getBox());
return result;
}
}
@@ -0,0 +1,78 @@
package com.sap.sailing.gwt.ui.client;
import java.util.Date;
import com.sap.sse.gwt.client.controls.datetime.DateAndTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput;
import com.sap.sse.gwt.client.controls.datetime.DateTimeInput.Accuracy;
import com.sap.sse.gwt.client.controls.datetime.TimeInput;
import com.sap.sse.gwt.client.dialog.DataEntryDialog;
public abstract class DataEntryDialogWithDateTimeBox<T> extends DataEntryDialog<T> {
protected DataEntryDialogWithDateTimeBox(String title, String message, String okButtonName, String cancelButtonName,
Validator<T> validator, boolean animationEnabled, DialogCallback<T> callback) {
super(title, message, okButtonName, cancelButtonName, validator, animationEnabled, callback);
}
protected DataEntryDialogWithDateTimeBox(String title, String message, String okButtonName, String cancelButtonName,
Validator<T> validator, DialogCallback<T> callback) {
super(title, message, okButtonName, cancelButtonName, validator, callback);
}
/**
* Creates a new {@link DateAndTimeInput} instance using the provided {@link Accuracy accuracy} and initial
* {@link Date date value}.
*
* @param initialValue
* the {@link Date date value} to show by default; <code>null</code> is permissible
* @param accuracy
* the {@link Accuracy accuracy} of the input
* @return the newly created {@link DateAndTimeInput} instance
*
* @see DateAndTimeInput#DateAndTimeInput(Accuracy)
*/
protected DateAndTimeInput createDateTimeBox(Date initialValue, Accuracy accuracy) {
return createDateTimeInput(new DateAndTimeInput(accuracy), initialValue);
}
/**
* Creates a new {@link DateInput} instance using the provided initial {@link Date date value}.
*
* @param initialValue
* the {@link Date date value} to show by default; <code>null</code> is permissible
* @return the newly created {@link DateInput} instance
*
* @see DateInput#DateInput()
*/
protected DateInput createDateBox(Date initialValue) {
return createDateTimeInput(new DateInput(), initialValue);
}
/**
* Creates a new {@link TimeInput} instance using the provided {@link Accuracy accuracy} and initial {@link Date
* date value}.
*
* @param initialValue
* the {@link Date date value} to show by default; <code>null</code> is permissible
* @param accuracy
* the {@link Accuracy accuracy} of the input
* @return the newly created {@link TimeInput} instance
*
* @see TimeInput#TimeInput(Accuracy)
*/
protected TimeInput createTimeBox(Date initialValue, Accuracy accuracy) {
return createDateTimeInput(new TimeInput(accuracy), initialValue);
}
private <I extends DateTimeInput> I createDateTimeInput(I input, Date initialValue) {
input.setValue(initialValue);
input.addValueChangeHandler(event -> validateAndUpdate());
// TODO: Enable DateTimeInputs for enter and escape linking
// DialogUtils.linkEnterToButton(getOkButton(), input);
// DialogUtils.linkEscapeToButton(getCancelButton(), input);
return input;
}
}
@@ -7,8 +7,6 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import com.github.gwtbootstrap.client.ui.ProgressBar;
import com.github.gwtbootstrap.client.ui.base.ProgressBarBase.Style;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
@@ -22,6 +20,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.ScrollPanel;
@@ -36,6 +35,7 @@ import com.sap.sailing.gwt.ui.client.MediaTracksRefresher;
import com.sap.sailing.gwt.ui.client.RegattaRefresher;
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
import com.sap.sailing.gwt.ui.client.StringMessages;
import com.sap.sse.gwt.client.controls.progressbar.CustomProgressBar;
public class MasterDataImportPanel extends VerticalPanel {
@@ -125,12 +125,12 @@ public class MasterDataImportPanel extends VerticalPanel {
String[] groupNames = createLeaderBoardGroupNamesFromListBox();
final Label overallName = new Label(stringMessages.overallProgress() + ":");
this.add(overallName);
final ProgressBar overallProgressBar = new ProgressBar(Style.ANIMATED);
final CustomProgressBar overallProgressBar = CustomProgressBar.determinate();
overallProgressBar.ensureDebugId("overallProgressBar");
this.add(overallProgressBar);
final Label subProgressName = new Label();
this.add(subProgressName);
final ProgressBar subProgressBar = new ProgressBar(Style.ANIMATED);
final CustomProgressBar subProgressBar = CustomProgressBar.determinate();
this.add(subProgressBar);
if (groupNames.length >= 1) {
disableAllButtons();
@@ -183,12 +183,10 @@ public class MasterDataImportPanel extends VerticalPanel {
subProgressName, subProgressBar);
showCreationMessage(creationCount);
} else {
overallProgressBar.setPercent((int) (result
.getOverallProgressPct() * 100));
overallProgressBar.setValue(result.getOverallProgressPct());
subProgressName.setText(result.getCurrentSubProgress()
.getMessage(stringMessages));
subProgressBar.setPercent((int) (result
.getCurrentSubProgressPct() * 100));
subProgressBar.setValue(result.getCurrentSubProgressPct());
}
}
}
@@ -415,12 +413,8 @@ public class MasterDataImportPanel extends VerticalPanel {
changeButtonStateAccordingToApplicationState();
}
private void deleteProgressIndication(final Label overallName, final ProgressBar overallProgressBar,
final Label subProgressName, final ProgressBar subProgressBar) {
this.remove(overallProgressBar);
this.remove(subProgressBar);
this.remove(subProgressName);
this.remove(overallName);
private void deleteProgressIndication(IsWidget... widgetsToRemove) {
Arrays.asList(widgetsToRemove).forEach(this::remove);
}
}
@@ -1,33 +0,0 @@
package com.sap.sailing.gwt.ui.shared;
import com.github.gwtbootstrap.client.ui.resources.ResourceInjector;
import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
import com.github.gwtbootstrap.datetimepicker.client.ui.resources.DatetimepickerResourceInjector;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Element;
public class BetterDateTimeBox extends DateTimeBox {
/**
* Initializes all needed JavaScript and CSS. Should be called once per {@link EntryPoint}.
*/
public static void initialize() {
// We don't want the full bootstrap css...
ResourceInjector.injectResourceCssAsFile("font-awesome.min.css");
ResourceInjector.configure();
DatetimepickerResourceInjector.configureWithCssFile();
}
public Element getPicker() {
return getNativePickerElement(getBox().getElement());
}
private native Element getNativePickerElement(Element boxElement) /*-{
return $wnd.jQuery(boxElement).data('datetimepicker').picker[0];
}-*/;
@Override
public com.github.gwtbootstrap.client.ui.TextBox getBox() {
return super.getBox();
}
}
@@ -0,0 +1,33 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:g2="urn:import:com.google.gwt.user.datepicker.client">
<ui:style>
.datebox {
height: 2em;
line-height: 2em;
box-sizing: border-box;
padding: 1px;
font-size: 14px;
border: 1px solid #ccc;
border-top: 1px solid #999;
vertical-align: baseline;
font: 14px 'Open Sans', Arial, Verdana, sans-serif;
}
.timebox {
height: 2em;
line-height: 2em;
box-sizing: border-box;
padding: 1px;
font-size: 14px;
border: 1px solid #ccc;
border-top: 1px solid #999;
vertical-align: baseline;
font: 14px 'Open Sans', Arial, Verdana, sans-serif;
}
</ui:style>
<g:HTMLPanel>
<g2:DateBox addStyleNames="{style.datebox}" ui:field="datebox"/>
<input type="time" class="{style.timebox}" ui:field="timebox"/>
</g:HTMLPanel>
</ui:UiBinder>
@@ -11,9 +11,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<inherits name='com.sap.sailing.gwt.common.AuthenticationCommon'/>
<!-- Other module inherits -->
@@ -18,10 +18,6 @@
<!-- Highcharts API -->
<inherits name="com.sap.sse.gwt.Highcharts_Autoinject" />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the app entry point class. -->
<entry-point class='com.sap.sailing.gwt.ui.raceboard.EmbeddedMapAndWindChartEntryPoint'/>
@@ -12,11 +12,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits
name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Other module inherits -->
<inherits name="com.sap.sse.gwt.SSESharedGWT" />
<inherits name="com.sap.sse.SSECommon" />
@@ -26,10 +26,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the app entry point class. -->
<entry-point class='com.sap.sailing.gwt.ui.leaderboardedit.LeaderboardEditPage'/>
@@ -32,11 +32,6 @@
<inherits name="com.sap.sse.gwt.dispatch.Dispatch" />
<!-- Fancy DateTimePicker (without the rest of Bootstrap!) -->
<!-- GWT-Bootstrap License: Apache License, Version 2.0 -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<super-source path="jre" />
<set-property name="gwt.logging.enabled" value="TRUE"/>
@@ -18,10 +18,6 @@
<!-- Highcharts API -->
<inherits name="com.sap.sse.gwt.Highcharts_Autoinject" />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the app entry point class. -->
<entry-point class='com.sap.sailing.gwt.ui.raceboard.RaceBoardEntryPoint'/>
@@ -19,10 +19,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- module containing locale configuration -->
<inherits name='com.sap.sailing.gwt.common.SailingLocalesAllPermutations' />
@@ -18,10 +18,6 @@
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
<!-- Bootstrap API -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Specify the app entry point class. -->
<entry-point class='com.sap.sailing.gwt.ui.spectator.SpectatorEntryPoint'/>
@@ -8,10 +8,6 @@
<inherits name="com.sap.sse.security.ui.LoginPanel" />
<inherits name="com.sap.sailing.domain.SailingDomain" />
<inherits name="com.sap.sse.gwt.AdminConsole" />
<!-- Fancy DateTimePicker (without the rest of Bootstrap!) -->
<!-- GWT-Bootstrap License: Apache License, Version 2.0 -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Highcharts API -->
<inherits name="com.sap.sse.gwt.Highcharts_Autoinject" />
@@ -12,10 +12,6 @@
<inherits name="com.sap.sse.gwt.AdminConsole" />
<!-- Highcharts API -->
<inherits name="com.sap.sse.gwt.Highcharts_Autoinject" />
<!-- Fancy DateTimePicker (without the rest of Bootstrap!) -->
<!-- GWT-Bootstrap License: Apache License, Version 2.0 -->
<inherits name="com.github.gwtbootstrap.BootstrapNoResources" />
<inherits name='com.github.gwtbootstrap.datetimepicker.DatetimepickerNoResources' />
<!-- Google Maps API -->
<inherits name='com.google.gwt.ajaxloader.AjaxLoader' />
<inherits name='com.google.gwt.maps.Maps' />
@@ -72,9 +72,9 @@ public class PageObject {
".//div[contains(@class, \"gwt-VerticalTabLayoutPanelTabInner\")]/div[text()=\"{0}\"]/../..");
/**
* </p>The default timeout of 10 seconds for the lookup of other elements.</p>
* </p>The default timeout of 15 seconds for the lookup of other elements.</p>
*/
protected static final int DEFAULT_LOOKUP_TIMEOUT = 5;
protected static final int DEFAULT_LOOKUP_TIMEOUT = 60;
/**
* <p>The web driver to use.</p>
@@ -9,8 +9,8 @@ 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;
import com.sap.sailing.selenium.pages.gwt.BetterDateTimeBoxPO;
import com.sap.sailing.selenium.pages.gwt.CheckBoxPO;
import com.sap.sailing.selenium.pages.gwt.DateAndTimeInputPO;
import com.sap.sailing.selenium.pages.gwt.TextAreaPO;
import com.sap.sailing.selenium.pages.gwt.TextBoxPO;
@@ -50,8 +50,8 @@ public class EventCreateDialogPO extends DataEntryDialogPO {
TextBoxPO.create(driver, nameTextBox).appendText(name);
TextAreaPO.create(driver, descriptionTextArea).appendText(description);
TextBoxPO.create(driver, venueTextBox).appendText(venue);
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(start);
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(end);
DateAndTimeInputPO.create(driver, startDateTimeBox).setValue(start, false);
DateAndTimeInputPO.create(driver, endDateTimeBox).setValue(end, false);
CheckBoxPO.create(driver, isPublicCheckBox).setSelected(isPublic);
}
@@ -8,7 +8,7 @@ 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;
import com.sap.sailing.selenium.pages.gwt.BetterDateTimeBoxPO;
import com.sap.sailing.selenium.pages.gwt.DateAndTimeInputPO;
public class SetStartTimeDialogPO extends DataEntryDialogPO {
@@ -28,7 +28,7 @@ public class SetStartTimeDialogPO extends DataEntryDialogPO {
}
public void setStartTimeValue(Date startTime) {
BetterDateTimeBoxPO.create(driver, startTimeTimeBox, true).setDate(startTime);
DateAndTimeInputPO.create(driver, startTimeTimeBox).setValue(startTime, true);
}
public void pressSetStartTime() {
@@ -8,7 +8,7 @@ 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;
import com.sap.sailing.selenium.pages.gwt.BetterDateTimeBoxPO;
import com.sap.sailing.selenium.pages.gwt.DateAndTimeInputPO;
import com.sap.sailing.selenium.pages.gwt.ListBoxPO;
import com.sap.sailing.selenium.pages.gwt.TextBoxPO;
@@ -56,8 +56,8 @@ public class RegattaCreateDialogPO extends DataEntryDialogPO {
public void setValues(String name, String boatClass, Date startDate, Date endDate) {
this.setRegattaName(name);
this.setBoatClass(boatClass);
BetterDateTimeBoxPO.create(driver, startDateTimeBox).setDate(startDate);
BetterDateTimeBoxPO.create(driver, endDateTimeBox).setDate(endDate);
DateAndTimeInputPO.create(driver, startDateTimeBox).setValue(startDate, false);
DateAndTimeInputPO.create(driver, endDateTimeBox).setValue(endDate, false);
}
// TODO: Scoring System, Event and Course Area
@@ -1,76 +0,0 @@
package com.sap.sailing.selenium.pages.gwt;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.sap.sailing.selenium.pages.PageObject;
/**
* {@link PageObject} implementation for better date time boxes.
*/
public class BetterDateTimeBoxPO extends TextBoxPO {
private static final DateFormat TIME_FORMAT_HOURS_MINUTES = new SimpleDateFormat("dd/MM/yyyy hh:mm");
private static final DateFormat TIME_FORMAT_HOURS_MINUTES_SECONDS = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
private final DateFormat timeFormat;
/**
* Factory method to create a {@link BetterDateTimeBoxPO} using {@link DateFormat} <code>dd/MM/yyyy hh:mm</code> by
* default.
*
* @param driver the web driver to use
* @param element the element representing the date time box on the page
* @return a new {@link BetterDateTimeBoxPO} instance
*/
public static BetterDateTimeBoxPO create(WebDriver driver, WebElement element) {
return new BetterDateTimeBoxPO(driver, element, TIME_FORMAT_HOURS_MINUTES);
}
/**
* Factory method to create a {@link BetterDateTimeBoxPO}.
*
* @param driver the web driver to use
* @param element the element representing the date time box on the page
* @param includeSeconds <code>true</code> to use the {@link DateFormat} <code>dd/MM/yyyy hh:mm:ss</code>,
* <code>false</code> to use the default {@link DateFormat} <code>dd/MM/yyyy hh:mm</code>
* @return a new {@link BetterDateTimeBoxPO} instance
*/
public static BetterDateTimeBoxPO create(WebDriver driver, WebElement element, boolean includeSeconds) {
DateFormat timeFormat = includeSeconds ? TIME_FORMAT_HOURS_MINUTES_SECONDS : TIME_FORMAT_HOURS_MINUTES;
return new BetterDateTimeBoxPO(driver, element, timeFormat);
}
/**
* @see TextBoxPO#TextBoxPO(WebDriver, WebElement)
*/
protected BetterDateTimeBoxPO(WebDriver driver, WebElement element, DateFormat timeFormat) {
super(driver, element);
this.timeFormat = timeFormat;
}
/**
* Sets the underlying {@link WebElement}s text by formatting the given {@link Date} using the internal date format
* (<code>dd/MM/yyyy hh:mm</code> or <code>dd/MM/yyyy hh:mm:ss</code>).
*
* @param date the {@link Date} object to set
*
* @see DateFormat#format(Date)
* @see #setText(String)
*/
public void setDate(Date date) {
this.setText(timeFormat.format(date));
}
@Override
public void appendText(String text) {
super.appendText(text);
// Send tabulator key after changing text to ensure the date time boxes datepicker popup is closed.
// Otherwise, the popup potentially overlaps other controls, which can cause unexpected errors.
super.appendText("\t");
}
}
@@ -0,0 +1,56 @@
package com.sap.sailing.selenium.pages.gwt;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
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 DateAndTimeInputPO extends PageArea {
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("MMM d, y");
private static final DateFormat TIME_FORMAT_MINUTES = new SimpleDateFormat("h:mm a");
private static final DateFormat TIME_FORMAT_SECONDS = new SimpleDateFormat("h:mm:ss a");
@FindBy(how = BySeleniumId.class, using = "dateInput")
private WebElement dateInput;
@FindBy(how = BySeleniumId.class, using = "timeInput")
private WebElement timeInput;
private DateAndTimeInputPO(WebDriver driver, WebElement element) {
super(driver, element);
}
/**
* Sets the provided {@link Date date value} to the underlying {@link WebElement}.
*
* @param date
* the {@link Date date value} to set to the input field
* @param enterSeconds
* <code>true</code> to enter seconds fragment as well, <code>false</code> otherwise
*
* @see DateFormat#format(Date)
* @see WebElement#sendKeys(CharSequence...)
*/
public void setValue(Date date, boolean enterSeconds) {
this.setValue(dateInput, date, DATE_FORMAT);
this.setValue(timeInput, date, enterSeconds ? TIME_FORMAT_SECONDS : TIME_FORMAT_MINUTES);
}
private void setValue(WebElement input, Date date, DateFormat format) {
final String value = format.format(date);
input.clear();
input.sendKeys(value);
input.sendKeys("\t"); // ensure popup closing!
}
public static DateAndTimeInputPO create(WebDriver driver, WebElement element) {
return new DateAndTimeInputPO(driver, element);
}
}
@@ -124,7 +124,7 @@ select {
background: #F1F1F1;
padding: 4px 8px 4px 4px;
cursor: default;
font-family: Arial Unicode MS, Arial, sans-serif;
font-family: 'Open sans', Arial Unicode MS, Arial, sans-serif;
font-weight: bold;
border-bottom: 1px solid #bbbbbb;
border-top: 1px solid #D2D2D2;
@@ -269,7 +269,7 @@ select {
}
.gwt-MenuBar .gwt-MenuItem {
cursor: default;
font-family: Arial Unicode MS, Arial, sans-serif;
font-family: 'Open sans', Arial Unicode MS, Arial, sans-serif;
}
.gwt-MenuBar .gwt-MenuItem-selected {
background: #E3E8F3;
@@ -722,7 +722,7 @@ select {
border: 1px solid #ccc;
border-top: 1px solid #999;
font-size: 100%;
font-family: Arial Unicode MS, Arial, sans-serif;
font-family: 'Open sans', Arial Unicode MS, Arial, sans-serif;
}
.gwt-SuggestBoxPopup {
@@ -959,7 +959,7 @@ select {
border: 1px solid #ccc;
border-top: 1px solid #666;
font-size: 100%;
font-family: Arial Unicode MS, Arial, sans-serif;
font-family: 'Open sans', Arial Unicode MS, Arial, sans-serif;
}
.gwt-TextArea-readonly {
color: #888;
@@ -970,7 +970,7 @@ select {
border: 1px solid #ccc;
border-top: 1px solid #999;
font-size: small;
font-family: Arial Unicode MS, Arial, sans-serif;
font-family: 'Open sans', Arial Unicode MS, Arial, sans-serif;
}
.gwt-TextBox-readonly {
color: #888;
@@ -28,9 +28,11 @@ Export-Package: com.google.gwt.user.client.rpc.core.java.util,
com.sap.sse.gwt.client.controls,
com.sap.sse.gwt.client.controls.busyindicator,
com.sap.sse.gwt.client.controls.carousel,
com.sap.sse.gwt.client.controls.datetime,
com.sap.sse.gwt.client.controls.filestorage,
com.sap.sse.gwt.client.controls.languageselect,
com.sap.sse.gwt.client.controls.listedit,
com.sap.sse.gwt.client.controls.progressbar,
com.sap.sse.gwt.client.controls.slider,
com.sap.sse.gwt.client.dialog,
com.sap.sse.gwt.client.event,
@@ -0,0 +1,56 @@
package com.sap.sse.gwt.client.controls.datetime;
import java.util.Date;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.IsWidget;
/**
* Abstract implementation for classes wrapping date and/or time inputs providing a fallback widget if the respective
* native input type is not supported.
*/
abstract class AbstractInput extends Composite implements DateTimeInput {
private final HasValue<Date> delegate;
/**
* Creates a new {@link AbstractInput} instance passing method calls to the provided delegate.
*
* @param delegate
* the native or fallback input for the respective input type
*/
protected <T extends HasValue<Date> & IsWidget> AbstractInput(T delegate) {
DateTimeInputResources.INSTANCE.css().ensureInjected();
this.delegate = delegate;
initWidget(delegate.asWidget());
}
@Override
protected final void onEnsureDebugId(String baseId) {
getWidget().ensureDebugId(baseId);
}
@Override
public final Date getValue() {
return delegate.getValue();
}
@Override
public final void setValue(Date value) {
this.delegate.setValue(value);
}
@Override
public void setValue(Date value, boolean fireEvents) {
this.delegate.setValue(value, fireEvents);
}
@Override
public final HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler) {
return delegate.addValueChangeHandler(handler);
}
}
@@ -0,0 +1,84 @@
package com.sap.sse.gwt.client.controls.datetime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.FlowPanel;
/**
* Extension of {@link AbstractInput} for date and time inputs, providing a native input field of type "datetime-local",
* if supported. Otherwise a panel containing a {@link DateInput} and a {@link TimeInput} is used as fallback widget.
*/
public class DateAndTimeInput extends AbstractInput {
/**
* Created a new {@link DateAndTimeInput} instance which the provided {@link Accuracy accuracy}.
*
* @param accuracy
* {@link Accuracy} for the new input
*/
public DateAndTimeInput(Accuracy accuracy) {
super(DateTimeInputType.DATETIME_LOCAL.isSupported() ? NativeDateTimeInput.datetimeLocale(accuracy)
: new DateAndTimePanel(accuracy));
}
private static class DateAndTimePanel extends FlowPanel implements DateTimeInput {
private final DateInput dateInput;
private final TimeInput timeInput;
private final DateTimeFormat dateFormat, timeFormat, datetimeFormat;
private DateAndTimePanel(Accuracy accuracy) {
add(this.dateInput = new DateInput());
add(this.timeInput = new TimeInput(accuracy));
this.dateInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.timeInput.addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.dateFormat = Accuracy.getDateFormat();
this.timeFormat = accuracy.getTimeFormat();
this.datetimeFormat = accuracy.getDatetimeFormat();
}
@Override
protected void onEnsureDebugId(String baseId) {
super.onEnsureDebugId(baseId);
this.dateInput.ensureDebugId("dateInput");
this.timeInput.ensureDebugId("timeInput");
}
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler) {
final ValueChangeHandler<Date> internalHandler = event -> ValueChangeEvent.fire(this, getValue());
final List<HandlerRegistration> handlerRegistrations = new ArrayList<>();
handlerRegistrations.add(dateInput.addValueChangeHandler(internalHandler));
handlerRegistrations.add(timeInput.addValueChangeHandler(internalHandler));
handlerRegistrations.add(addHandler(handler, ValueChangeEvent.getType()));
return () -> handlerRegistrations.forEach(HandlerRegistration::removeHandler);
}
@Override
public Date getValue() {
final Date dateValue = dateInput.getValue(), timeValue = timeInput.getValue();
if (Objects.nonNull(dateValue) && Objects.nonNull(timeValue)) {
final String dateString = dateFormat.format(dateInput.getValue());
final String timeString = timeFormat.format(timeInput.getValue());
final String dateAndTimeString = dateString + "T" + timeString;
return datetimeFormat.parse(dateAndTimeString);
}
return null;
}
@Override
public void setValue(Date value) {
this.dateInput.setValue(value);
this.timeInput.setValue(value);
}
}
}
@@ -0,0 +1,32 @@
package com.sap.sse.gwt.client.controls.datetime;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.user.datepicker.client.DateBox;
/**
* Extension of {@link AbstractInput} for date inputs, providing a native input field of type "date", if supported.
* Otherwise a {@link DateBox} with {@link PredefinedFormat#DATE_MEDIUM medium date format} is used as fallback widget.
*/
public class DateInput extends AbstractInput {
/**
* Created a new {@link DateInput} instance.
*/
public DateInput() {
super(DateTimeInputType.TIME.isSupported() ? NativeDateTimeInput.date() : new CustomDateBox());
}
private static class CustomDateBox extends DateBox {
private final DateTimeFormat viewFormat = DateTimeFormat.getFormat(PredefinedFormat.DATE_MEDIUM);
private CustomDateBox() {
setFormat(new DefaultFormat(viewFormat));
addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
getElement().setAttribute("placeholder", viewFormat.getPattern());
}
}
}
@@ -0,0 +1,72 @@
package com.sap.sse.gwt.client.controls.datetime;
import java.util.Date;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.IsWidget;
/**
* Interface for date and/or time related input widgets holding a {@link Date date} value.
*
* @see com.google.gwt.user.client.ui.IsWidget
* @see com.google.gwt.user.client.ui.HasValue
*/
public interface DateTimeInput extends IsWidget, HasValue<Date> {
/**
* Enumeration describing the accuracy of an input field of type "datetime-local" or "time".
*/
public enum Accuracy {
MINUTES(60, "yyyy-MM-dd'T'HH:mm", "HH:mm"), SECONDS(1, "yyyy-MM-dd'T'HH:mm:ss", "HH:mm:ss");
private static final DateTimeFormat DATE_FORMAT = DateTimeFormat.getFormat("yyyy-MM-dd");
private final DateTimeFormat datetimeFormat, timeFormat;
private final String step;
private Accuracy(int step, String datetimeFormat, String timeFormat) {
this.step = String.valueOf(step);
this.datetimeFormat = DateTimeFormat.getFormat(datetimeFormat);
this.timeFormat = DateTimeFormat.getFormat(timeFormat);
}
/**
* @return the {@link DateTimeFormat} for date inputs (always the same)
*/
public static DateTimeFormat getDateFormat() {
return DATE_FORMAT;
}
/**
* @return the {@link DateTimeFormat} for time inputs
*/
public DateTimeFormat getTimeFormat() {
return timeFormat;
}
/**
* @return the {@link DateTimeFormat} for date and time inputs
*/
public DateTimeFormat getDatetimeFormat() {
return datetimeFormat;
}
/**
* @return the "step" attribute value to set on input fields of type "datetime-local" or "time"
*/
public String getStep() {
return step;
}
}
@Override
default void setValue(Date value, boolean fireEvents) {
this.setValue(value);
if (fireEvents) {
ValueChangeEvent.fire(this, value);
}
}
}
@@ -0,0 +1,18 @@
package com.sap.sse.gwt.client.controls.datetime;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
interface DateTimeInputResources extends ClientBundle {
static final DateTimeInputResources INSTANCE = GWT.create(DateTimeInputResources.class);
@Source("dateTimeInput.gss")
Style css();
interface Style extends CssResource {
String dateTimeInput();
}
}
@@ -0,0 +1,50 @@
package com.sap.sse.gwt.client.controls.datetime;
/**
* Enumeration of date and/or time related input {@link #getType() types} whose {@link #isSupported() support} in the
* currently used browser will be checked at runtime.
*/
public enum DateTimeInputType {
DATETIME_LOCAL("datetime-local"), DATE("date"), TIME("time");
private final String type;
private final boolean supported;
private DateTimeInputType(String type) {
this.type = type;
this.supported = checkSupport(type);
}
/**
* @return the type string for this {@link DateTimeInputType}
*/
public String getType() {
return type;
}
/**
* @return <code>true</code> if this {@link DateTimeInputType} is supported, <code>false</code> otherwise
*/
public boolean isSupported() {
return supported;
}
private static final native boolean checkSupport(String type) /*-{
var input = document.createElement("input");
input.setAttribute("type", type);
var desiredType = input.getAttribute('type');
var supported = false;
if (input.type === desiredType) {
supported = true;
}
input.value = 'Hello world';
var helloWorldAccepted = (input.value === 'Hello world');
if (helloWorldAccepted) {
supported = false;
}
input.value = '';
return supported;
}-*/;
}
@@ -0,0 +1,110 @@
package com.sap.sse.gwt.client.controls.datetime;
import java.util.Date;
import java.util.Objects;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Widget;
/**
* Factory class to create native input field of type "{@link #datetimeLocale(Accuracy) datetime-local}",
* "{@link #date() date}" or "{@link #time(Accuracy) time}".
*/
class NativeDateTimeInput extends Widget implements DateTimeInput {
private static final String ATTR_TYPE = "type", ATTR_STEP = "step";
/**
* Creates a native input field of type "date".
*
* @return the newly created instance as {@link DateTimeInput} abstraction
*/
static DateTimeInput date() {
return new NativeDateTimeInput(DateTimeInputType.DATE, "", Accuracy.getDateFormat());
}
/**
* Creates a native input field of type "time" which the provided {@link Accuracy accuracy}.
*
* @param accuracy
* {@link Accuracy} for the new native input field
*
* @return the newly created instance as {@link DateTimeInput} abstraction
*/
static DateTimeInput time(Accuracy accuracy) {
return new NativeDateTimeInput(DateTimeInputType.TIME, accuracy.getStep(), accuracy.getTimeFormat());
}
/**
* Creates a native input field of type "datetime-local" which the provided {@link Accuracy accuracy}.
*
* @param accuracy
* {@link Accuracy} for the new native input field
*
* @return the newly created instance as {@link DateTimeInput} abstraction
*/
static DateTimeInput datetimeLocale(Accuracy accuracy) {
return new NativeDateTimeInput(DateTimeInputType.DATETIME_LOCAL, accuracy.getStep(),
accuracy.getDatetimeFormat());
}
private final DateTimeFormat format;
private final InputElement input;
private NativeDateTimeInput(DateTimeInputType inputType, String step, DateTimeFormat format) {
this.input = Document.get().createElement(InputElement.TAG).cast();
this.input.setAttribute(ATTR_TYPE, inputType.getType());
this.input.setAttribute(ATTR_STEP, step);
this.input.addClassName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
this.format = format;
setElement(input);
sinkEvents(Event.ONCHANGE | Event.ONBLUR | Event.ONKEYUP);
}
@Override
public final void onBrowserEvent(Event event) {
// TODO: Cache latest value to avoid multiple ValueChangeEvents
final int type = event.getTypeInt();
if (type == Event.ONCHANGE || type == Event.ONBLUR || type == Event.ONKEYUP) {
ValueChangeEvent.fire(this, getValue());
}
super.onBrowserEvent(event);
}
@Override
public final Date getValue() {
try {
return this.format.parse(input.getValue());
} catch (IllegalArgumentException exc) {
try {
// at least Google Chrome omits the seconds, if they are 00 in input field
if (format == Accuracy.SECONDS.getDatetimeFormat()) {
return Accuracy.MINUTES.getDatetimeFormat().parse(input.getValue());
}
if (format == Accuracy.SECONDS.getTimeFormat()) {
return Accuracy.MINUTES.getTimeFormat().parse(input.getValue());
}
} catch (IllegalArgumentException exc2) {
return null;
}
}
return null;
}
@Override
public final void setValue(Date value) {
this.input.setValue(Objects.isNull(value) ? null : format.format(value));
}
@Override
public final HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler) {
return addHandler(handler, ValueChangeEvent.getType());
}
}
@@ -0,0 +1,74 @@
package com.sap.sse.gwt.client.controls.datetime;
import java.text.ParseException;
import java.util.Date;
import java.util.Objects;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.InputElement;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.text.shared.AbstractRenderer;
import com.google.gwt.text.shared.Parser;
import com.google.gwt.user.client.ui.ValueBox;
/**
* Extension of {@link AbstractInput} for time inputs, providing a native input field of type "time", if supported.
* Otherwise a {@link ValueBox} for {@link Date dates} is used as fallback widget using a
* {@link PredefinedFormat#TIME_SHORT short} or a {@link PredefinedFormat#TIME_MEDIUM medium} time format.
*/
public class TimeInput extends AbstractInput {
/**
* Created a new {@link TimeInput} instance which the provided {@link Accuracy accuracy}.
*
* @param accuracy
* {@link Accuracy} for the new input
*/
public TimeInput(Accuracy accuracy) {
super(DateTimeInputType.TIME.isSupported() ? NativeDateTimeInput.time(accuracy)
: new TimeBox(new TimeConverter(accuracy)));
}
private static class TimeBox extends ValueBox<Date> {
private TimeBox(TimeConverter converter) {
super(Document.get().createElement(InputElement.TAG), converter, converter);
addStyleName(DateTimeInputResources.INSTANCE.css().dateTimeInput());
getElement().setAttribute("placeholder", converter.viewFormat.getPattern());
}
}
private static class TimeConverter extends AbstractRenderer<Date> implements Parser<Date> {
private static final DateTimeFormat VIEW_FORMAT_SHORT = DateTimeFormat.getFormat(PredefinedFormat.TIME_SHORT);
private static final DateTimeFormat VIEW_FORMAT_MEDIUM = DateTimeFormat.getFormat(PredefinedFormat.TIME_MEDIUM);
private static final String EMPTY_VALUE = "";
private final DateTimeFormat viewFormat;
private TimeConverter(Accuracy accuracy) {
this.viewFormat = accuracy == Accuracy.SECONDS ? VIEW_FORMAT_MEDIUM : VIEW_FORMAT_SHORT;
}
@Override
public String render(Date object) {
return Objects.isNull(object) ? EMPTY_VALUE : viewFormat.format(object);
}
@Override
public Date parse(CharSequence text) throws ParseException {
if (EMPTY_VALUE.equals(text.toString())) {
return null;
}
try {
return viewFormat.parse(text.toString());
} catch (IllegalArgumentException e) {
throw new ParseException(e.getMessage(), 0);
}
}
}
}
@@ -0,0 +1,7 @@
.dateTimeInput {
font-family: 'Open Sans', 'Arial Unicode MS', Arial, sans-serif;
font-size: small;
border: 1px solid #ccc;
border-top: 1px solid #999;
padding: 2.75px 3px;
}
@@ -0,0 +1,98 @@
package com.sap.sse.gwt.client.controls.progressbar;
import java.util.Objects;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.Widget;
/**
* Custom widget implementation wrapping an HTML <code>progress</code> tag, providing static factory methods for
* {@link CustomProgressBar#determinate() determinate} and {@link CustomProgressBar#indeterminate() indeterminate}
* instances as well as getter and setter methods for the {@code max} and {@code value} attributes.
*/
public class CustomProgressBar extends Widget {
private static final String TAG = "progress", ATTR_MAX = "max", ATTR_VALUE = "value";
/**
* Creates a new {@link CustomProgressBar} instance in indeterminate state.
*
* @return the created {@link CustomProgressBar} instance
*/
public static CustomProgressBar indeterminate() {
return new CustomProgressBar();
}
/**
* Creates a new {@link CustomProgressBar} instance in determinate state with default {@code max} attribute.
*
* @return the created {@link CustomProgressBar} instance
*/
public static CustomProgressBar determinate() {
final CustomProgressBar progressBar = indeterminate();
progressBar.setValue(0.0d);
return progressBar;
}
/**
* Creates a new {@link CustomProgressBar} instance in determinate state with the provided {@code max} attribute.
*
* @param max
* numeric value for {@code max} attribute
* @return the created {@link CustomProgressBar} instance
*
* @see CustomProgressBar#determinate()
*/
public static CustomProgressBar determinate(double max) {
final CustomProgressBar progressBar = determinate();
progressBar.setMax(max);
return progressBar;
}
private CustomProgressBar() {
setElement(Document.get().createElement(TAG));
getElement().getStyle().setWidth(100, Unit.PCT);
getElement().getStyle().setHeight(2, Unit.EM);
}
/**
* @return numeric value of the {@link CustomProgressBar}'s {@code max} attribute
*/
public final double getMax() {
return this.getDoubleAttribute(ATTR_MAX);
}
/**
* @param max
* numeric value for the {@link CustomProgressBar}'s {@code max} attribute
*/
public final void setMax(double max) {
this.setDoubleAtrribute(ATTR_MAX, max);
}
/**
* @return numeric value of the {@link CustomProgressBar}'s {@code value} attribute
*/
public final double getValue() {
return this.getDoubleAttribute(ATTR_VALUE);
}
/**
* @param max
* numeric value for the {@link CustomProgressBar}'s {@code value} attribute
*/
public final void setValue(double value) {
this.setDoubleAtrribute(ATTR_VALUE, value);
}
private double getDoubleAttribute(String attrName) {
final String attrValue = getElement().getAttribute(attrName);
return (Objects.isNull(attrValue) || attrValue.isEmpty()) ? null : Double.parseDouble(attrValue);
}
private void setDoubleAtrribute(String attrName, double attrValue) {
getElement().setAttribute(attrName, Double.toString(attrValue));
}
}
@@ -1,5 +1,6 @@
package com.sap.sse.gwt.client.dialog;
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
@@ -9,8 +10,8 @@ import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FocusWidget;
public abstract class DialogUtils {
public static void linkEnterToButton(final Button button, FocusWidget... widgets) {
for (FocusWidget widget : widgets) {
public static void linkEnterToButton(final Button button, HasAllKeyHandlers... widgets) {
for (HasAllKeyHandlers widget : widgets) {
widget.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
@@ -22,8 +23,8 @@ public abstract class DialogUtils {
}
}
public static void linkEscapeToButton(final Button button, FocusWidget... widgets) {
for (FocusWidget widget : widgets) {
public static void linkEscapeToButton(final Button button, HasAllKeyHandlers... widgets) {
for (HasAllKeyHandlers widget : widgets) {
widget.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {