http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/main/resources/META-INF/NOTICE b/wicket-datetime/src/main/resources/META-INF/NOTICE deleted file mode 100644 index 932e9eb..0000000 --- a/wicket-datetime/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,14 +0,0 @@ - Apache Wicket Date Time - Copyright 2006-2016 Apache Software Foundation - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - Contains code of the Yahoo User Interface library (version: 2.8.2r1), - released under the BSD License: - http://developer.yahoo.net/yui/license.txt - Copyright (c) 2010, Yahoo! Inc. - - This product includes software developed by - Joda.org (http://www.joda.org/). - \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/log4j.properties ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/log4j.properties b/wicket-datetime/src/test/java/log4j.properties deleted file mode 100644 index e3bc2c7..0000000 --- a/wicket-datetime/src/test/java/log4j.properties +++ /dev/null @@ -1,18 +0,0 @@ -log4j.debug=false - -log4j.rootLogger=INFO,Stdout - -# please keep this setting FATAL to avoid questions from users -# why there are stacktraces in the test output. You can turn it -# down if you need to when testing, but don't check it in. (eelco) - -# changing back to ERROR. Looks like in some cases the log4j.properties -# in wicket gets picked which results in not printing the exceptions -# and that can be a bit dangerous (matej) -log4j.logger.org.apache.wicket=ERROR -#log4j.logger.org.apache.wicket.resource=FATAL -#log4j.logger.org.apache.wicket.Localizer=FATAL - -log4j.appender.Stdout=org.apache.log4j.ConsoleAppender -log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/datetime/DateConverterTest.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/datetime/DateConverterTest.java b/wicket-datetime/src/test/java/org/apache/wicket/datetime/DateConverterTest.java deleted file mode 100644 index 5c9c4df..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/datetime/DateConverterTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.datetime; - -import java.util.Calendar; -import java.util.Locale; - -import org.apache.wicket.util.convert.converter.CalendarConverter; -import org.joda.time.format.DateTimeFormatter; -import org.junit.Assert; -import org.junit.Test; - -/** - * Tests for {@link DateConverter} and subclasses. - * - * @author akiraly - */ -public class DateConverterTest -{ - /** - * WICKET-3598 - */ - @Test - public void testLocaleUsed() - { - Locale locale = Locale.GERMAN; - - StyleDateConverter styleDateConverter = new StyleDateConverter("F-", false); - DateTimeFormatter styleFormatter = styleDateConverter.getFormat(locale); - - Assert.assertEquals(locale, styleFormatter.getLocale()); - - PatternDateConverter patternDateConverter = new PatternDateConverter( - styleDateConverter.getDatePattern(locale), false); - DateTimeFormatter patternFormatter = patternDateConverter.getFormat(locale); - - Assert.assertEquals(locale, patternFormatter.getLocale()); - - Calendar now = Calendar.getInstance(); - - String actual = styleDateConverter.convertToString(now.getTime(), locale); - String expected = patternDateConverter.convertToString(now.getTime(), locale); - - Assert.assertEquals(expected, actual); - } - - /** - * WICKET-3658 - */ - @Test - public void testCalendarConverterWithDelegate() - { - Locale locale = Locale.GERMAN; - - Calendar input = Calendar.getInstance(locale); - input.clear(); - input.set(2011, Calendar.MAY, 7); - - StyleDateConverter styleDateConverter = new StyleDateConverter("F-", false); - - CalendarConverter calendarConverter = new CalendarConverter(styleDateConverter); - - String expected = styleDateConverter.convertToString(input.getTime(), locale); - String actual = calendarConverter.convertToString(input, locale); - - Assert.assertEquals(expected, actual); - - Calendar revert = calendarConverter.convertToObject(actual, locale); - - Assert.assertEquals(input, revert); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatePickerTest.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatePickerTest.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatePickerTest.java deleted file mode 100644 index 478d7d4..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatePickerTest.java +++ /dev/null @@ -1,763 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.extensions.yui.calendar; - -import java.text.DateFormat; -import java.text.ParseException; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Locale; -import java.util.TimeZone; - -import org.apache.wicket.Page; -import org.apache.wicket.datetime.StyleDateConverter; -import org.apache.wicket.extensions.yui.calendar.DateTimeField.AM_PM; -import org.apache.wicket.protocol.http.request.WebClientInfo; -import org.apache.wicket.util.tester.DiffUtil; -import org.apache.wicket.util.tester.FormTester; -import org.apache.wicket.util.tester.WicketTestCase; -import org.joda.time.DateTimeFieldType; -import org.joda.time.DateTimeZone; -import org.joda.time.MutableDateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; -import org.junit.After; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - */ -public class DatePickerTest extends WicketTestCase -{ - /** log. */ - private static final Logger log = LoggerFactory.getLogger(DatePickerTest.class); - - private TimeZone defaultTz = TimeZone.getDefault(); - - /** - * @see org.apache.wicket.util.tester.WicketTestCase#tearDown() - */ - @Override - @After - public void commonAfter() - { - TimeZone.setDefault(defaultTz); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(defaultTz)); - - super.commonAfter(); - } - - /** - * - * @throws Exception - */ - @Test - public void test1() throws Exception - { - log.debug("=========== test1() ================="); - myTestExecution(DatesPage1.class, "DatesPage1_ExpectedResult.html"); - } - - /** - * Tests conversion of input for DateTimeField and DateField. - * - * @throws Exception - */ - @Test - public void testDateFieldInput() throws Exception - { - log.debug("=========== testDateFieldInput() ================="); - Class<? extends Page> pageClass = DatesPage2.class; - Date date = new GregorianCalendar(2010, 10, 6, 0, 0).getTime(); - tester.getSession().setLocale(Locale.GERMAN); - tester.startPage(pageClass); - tester.assertRenderedPage(pageClass); - FormTester formTester = tester.newFormTester("form"); - formTester.setValue("dateTimeField:date", "06.11.2010"); - formTester.setValue("dateTimeField:hours", "00"); - formTester.setValue("dateTimeField:minutes", "00"); - formTester.setValue("dateField:date", "06.11.2010"); - formTester.submit(); - DatesPage2 page = (DatesPage2)tester.getLastRenderedPage(); - - log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " + - page.dateTime.getTime()); - log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime); - assertEquals(0, date.compareTo(page.dateTime)); - assertEquals(0, date.compareTo(page.date)); - } - - /** - * Tests conversion of input for DateTimeField and DateField when the client and server are in - * different time zones. - * - * @throws Exception - */ - @Test - public void testDateFieldInputTimezone() throws Exception - { - log.debug("=========== testDateFieldInputTimezone() ================="); - TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles"); - TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - - Class<? extends Page> pageClass = DatesPage2.class; - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 0, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - - tester.getSession().setLocale(Locale.GERMANY); - tester.startPage(pageClass); - tester.assertRenderedPage(pageClass); - FormTester formTester = tester.newFormTester("form"); - formTester.setValue("dateTimeField:date", "06.11.2010"); - formTester.setValue("dateTimeField:hours", "00"); - formTester.setValue("dateTimeField:minutes", "00"); - formTester.setValue("dateField:date", "06.11.2010"); - formTester.submit(); - - DatesPage2 page = (DatesPage2)tester.getLastRenderedPage(); - - log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " + - page.dateTime.getTime()); - log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime); - assertEquals(0, date.compareTo(page.dateTime)); - assertEquals(0, date.compareTo(page.date)); - } - - /** - * Tests joda & jvm default time zone handling - */ - @Test - public void testJodaTimeDefaultTimeZone() - { - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - - // lets find a timezone different from current default - String newId = null; - for (String id : TimeZone.getAvailableIDs()) - { - if (!id.equals(origJvmDef.getID())) - { - newId = id; - break; - } - } - - assertNotNull(newId); - - TimeZone.setDefault(TimeZone.getTimeZone(newId)); - - TimeZone newJvmDef = TimeZone.getDefault(); - DateTimeZone newJodaDef = DateTimeZone.getDefault(); - - // if this fails we are under security manager - // and we have no right to set default timezone - assertNotSame(origJvmDef, newJvmDef); - - // this should be true because joda caches the - // default timezone and even for the first - // lookup it uses a System property if possible - // for more info see org.joda.time.DateTimeZone.getDefault() - assertSame(origJodaDef, newJodaDef); - } - - /** - * Test date conversion with the server's time zone having a different current date than the - * client time zone. - * - * @throws ParseException - */ - @Test - public void testDifferentDateTimeZoneConversion() throws ParseException - { - log.debug("=========== testDifferentDateTimeZoneConversion() ================="); - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - TimeZone tzClient = TimeZone.getTimeZone("GMT+14"); - TimeZone tzServer = TimeZone.getTimeZone("GMT-12"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - - Class<? extends Page> pageClass = DatesPage2.class; - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 0, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - - tester.getSession().setLocale(Locale.GERMANY); - tester.startPage(pageClass); - tester.assertRenderedPage(pageClass); - FormTester formTester = tester.newFormTester("form"); - formTester.setValue("dateTimeField:date", "06.11.2010"); - formTester.setValue("dateTimeField:hours", "00"); - formTester.setValue("dateTimeField:minutes", "00"); - formTester.setValue("dateField:date", "06.11.2010"); - formTester.submit(); - - DatesPage2 page = (DatesPage2)tester.getLastRenderedPage(); - - log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " + - page.dateTime.getTime()); - log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime); - assertEquals(0, date.compareTo(page.dateTime)); - assertEquals(0, date.compareTo(page.date)); - - TimeZone.setDefault(origJvmDef); - DateTimeZone.setDefault(origJodaDef); - } - - /** - * Test date conversion with the server's time zone having a different current date than the - * client time zone using a Locale with am/pm style time. - */ - @Test - public void testDifferentDateTimeZoneConversionAMPM() - { - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - TimeZone tzClient = TimeZone.getTimeZone("GMT+14"); - TimeZone tzServer = TimeZone.getTimeZone("GMT-12"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - - Class<? extends Page> pageClass = DatesPage2.class; - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 22, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - - tester.getSession().setLocale(Locale.US); - tester.startPage(pageClass); - tester.assertRenderedPage(pageClass); - FormTester formTester = tester.newFormTester("form"); - formTester.setValue("dateTimeField:date", "11/06/2010"); - formTester.setValue("dateTimeField:hours", "10"); - formTester.setValue("dateTimeField:minutes", "00"); - formTester.setValue("dateTimeField:amOrPmChoice", "1"); - formTester.submit(); - - DatesPage2 page = (DatesPage2)tester.getLastRenderedPage(); - - log.debug("orig: " + date.getTime() + "; dateTime: " + page.dateTime.getTime()); - log.debug("orig: " + date + "; dateTime: " + page.dateTime); - assertEquals(0, date.compareTo(page.dateTime)); - - TimeZone.setDefault(origJvmDef); - DateTimeZone.setDefault(origJodaDef); - } - - /** - * Test time conversion for TimeField. The day, month, year of the TimeField model should not be - * changed. The hours and minutes should be converted to the server's time zone based on the - * day, month and year of the Date model. - */ - @Test - public void testTimeFieldDST() - { - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - TimeZone tzClient = TimeZone.getTimeZone("Canada/Eastern"); - TimeZone tzServer = TimeZone.getTimeZone("GMT"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - tester.getSession().setLocale(Locale.GERMAN); - - // Test with standard time (in client time zone) - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 1, 15, 0, 0, 0, 0); - Date date = new Date(dt.getMillis()); - DatesPage2 testPage = new DatesPage2(); - testPage.time = date; - tester.startPage(testPage); - FormTester formTester = tester.newFormTester("form"); - formTester.setValue("timeField:hours", "00"); - formTester.setValue("timeField:minutes", "00"); - formTester.submit(); - assertEquals(date, testPage.time); - - // Test with daylight savings time (in client time zone) - dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 7, 15, 0, 0, 0, 0); - date = new Date(dt.getMillis()); - testPage = new DatesPage2(); - testPage.time = date; - tester.startPage(testPage); - formTester = tester.newFormTester("form"); - formTester.setValue("timeField:hours", "00"); - formTester.setValue("timeField:minutes", "00"); - formTester.submit(); - assertEquals(date, testPage.time); - - TimeZone.setDefault(origJvmDef); - DateTimeZone.setDefault(origJodaDef); - } - - /** - * Test StyleDateConverter with the server's time zone having a different current date than the - * client time zone. - * - * @throws ParseException - */ - @Test - public void testStyleDateConverterTimeZoneDifference() throws ParseException - { - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - - TimeZone tzClient = TimeZone.getTimeZone("GMT+14"); - TimeZone tzServer = TimeZone.getTimeZone("GMT-12"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - - StyleDateConverter converter = new StyleDateConverter(true); - - Calendar cal = Calendar.getInstance(tzClient); - cal.set(2011, 10, 5, 0, 0, 0); - cal.set(Calendar.MILLISECOND, 0); - - Date dateRef = cal.getTime(); - Date date = converter.convertToObject("05.11.2011", Locale.GERMANY); - log.debug("ref: " + dateRef.getTime() + "; converted: " + date.getTime()); - log.debug("ref: " + dateRef + "; date: " + date); - assertEquals(dateRef, date); - - TimeZone.setDefault(origJvmDef); - DateTimeZone.setDefault(origJodaDef); - } - - /** - * Validates the "value" tags of the <input> fields for DateTimeField, DateField and - * TimeField when they are given Date models containing Date instances. - */ - @Test - public void testDateFieldsWithDateModels() - { - TimeZone origJvmDef = TimeZone.getDefault(); - DateTimeZone origJodaDef = DateTimeZone.getDefault(); - - TimeZone tzClient = TimeZone.getTimeZone("GMT-12"); - TimeZone tzServer = TimeZone.getTimeZone("GMT+14"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo(); - clientInfo.getProperties().setTimeZone(tzClient); - - Calendar cal = Calendar.getInstance(tzServer); - cal.set(2011, 5, 15, 10, 30, 0); - cal.set(Calendar.MILLISECOND, 0); - Date date = cal.getTime(); - - DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN); - format.setTimeZone(tzClient); - String dateRefString = format.format(date); - cal.setTimeZone(tzClient); - String hoursRefString = Integer.toString(cal.get(Calendar.HOUR_OF_DAY)); - String minutesRefString = Integer.toString(cal.get(Calendar.MINUTE)); - - DatesPage2 testPage = new DatesPage2(); - testPage.dateTime = date; - testPage.date = date; - testPage.time = date; - tester.getSession().setLocale(Locale.GERMAN); - tester.startPage(testPage); - - String dateTimeFieldDateValue = tester.getTagByWicketId("dateTimeField") - .getChild("wicket:id", "date") - .getAttribute("value"); - assertEquals(dateRefString, dateTimeFieldDateValue); - String dateTimeFieldHoursValue = tester.getTagByWicketId("dateTimeField") - .getChild("wicket:id", "hours") - .getAttribute("value"); - assertEquals(hoursRefString, dateTimeFieldHoursValue); - String dateTimeFieldMinutesValue = tester.getTagByWicketId("dateTimeField") - .getChild("wicket:id", "minutes") - .getAttribute("value"); - assertEquals(minutesRefString, dateTimeFieldMinutesValue); - String dateFieldValue = tester.getTagByWicketId("dateField") - .getChild("wicket:id", "date") - .getAttribute("value"); - assertEquals(dateRefString, dateFieldValue); - String timeFieldHoursValue = tester.getTagByWicketId("timeField") - .getChild("wicket:id", "hours") - .getAttribute("value"); - assertEquals(hoursRefString, timeFieldHoursValue); - String timeFieldMinutesValue = tester.getTagByWicketId("timeField") - .getChild("wicket:id", "minutes") - .getAttribute("value"); - assertEquals(minutesRefString, timeFieldMinutesValue); - - TimeZone.setDefault(origJvmDef); - DateTimeZone.setDefault(origJodaDef); - } - - /** - * - * @throws ParseException - */ - @Test - public void testDates1() throws ParseException - { - log.debug("=========== testDates1() ================="); - TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles"); - TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - Locale.setDefault(Locale.GERMANY); - -// Date orig = convertDate("06.11.2010", null, null, null, false, tzClient); -// Date origJoda = convertDateJoda("06.11.2010", null, null, null, false, tzClient); - Date orig3 = convertDateNew("06.11.2010", null, null, null, false, tzClient); - - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 0, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " + - orig3.getTime() + "; expected: " + date.getTime()); - log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 + - "; expected: " + date); - assertEquals(date.getTime(), orig3.getTime()); -// assertEquals(date.getTime(), orig.getTime()); -// assertEquals(origJoda.getTime(), orig.getTime()); - } - - /** - * - * @throws ParseException - */ - @Test - public void testDates2() throws ParseException - { - log.debug("=========== testDates2() ================="); - TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles"); - TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - Locale.setDefault(Locale.GERMANY); - -// Date orig = convertDate("06.11.2010", 0, 0, AM_PM.AM, false, tzClient); -// Date origJoda = convertDateJoda("06.11.2010", 0, 0, AM_PM.AM, false, tzClient); - Date orig3 = convertDateNew("06.11.2010", 0, 0, AM_PM.AM, false, tzClient); - - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 0, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " + - orig3.getTime() + "; expected: " + date.getTime()); - log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 + - "; expected: " + date); - assertEquals(date.getTime(), orig3.getTime()); -// assertEquals(date.getTime(), orig.getTime()); -// assertEquals(origJoda.getTime(), orig.getTime()); - } - - /** - * - * @throws ParseException - */ - @Test - public void testDates3() throws ParseException - { - log.debug("=========== testDates3() ================="); - TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles"); - TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin"); - - TimeZone.setDefault(tzServer); - DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer)); - Locale.setDefault(Locale.GERMANY); - -// Date orig = convertDate("06.11.2010", 12, 0, null, false, tzClient); -// Date origJoda = convertDateJoda("06.11.2010", 12, 0, null, false, tzClient); - Date orig3 = convertDateNew("06.11.2010", 12, 0, null, false, tzClient); - - MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient)); - dt.setDateTime(2010, 11, 6, 12, 0, 0, 0); - Date date = new Date(dt.getMillis()); - - log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " + - orig3.getTime() + "; expected: " + date.getTime()); - log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 + - "; expected: " + date); - assertEquals(date.getTime(), orig3.getTime()); -// assertEquals(date.getTime(), orig.getTime()); -// assertEquals(origJoda.getTime(), orig.getTime()); - } - - /** - * Simulate what DateTimeField does - * - * @param dateStr - * @param hours - * @param minutes - * @param amOrPm - * @param use12HourFormat - * @param tzClient - * @return Date - * @throws ParseException - */ - public Date convertDate(final String dateStr, final Integer hours, final Integer minutes, - final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient) - throws ParseException - { - log.debug(">>> convertDate()"); - Date dateFieldInput = (dateStr != null ? DateFormat.getDateInstance().parse(dateStr) : null); - - // Default to today, if date entry was invisible - final MutableDateTime date; - if (dateFieldInput != null) - { - log.debug("1. dateFieldInput: " + dateFieldInput.getTime() + " " + dateFieldInput); - date = new MutableDateTime(dateFieldInput); - } - else - { - log.debug("1. dateFieldInput: null"); - // Current date - date = new MutableDateTime(); - } - log.debug("2. mutable date: " + date.getMillis() + " " + date); - - // always set secs to 0 - date.setSecondOfMinute(0); - log.debug("3. secs = 0: " + date.getMillis() + " " + date); - - // The AM/PM field - if (use12HourFormat) - { - date.set(DateTimeFieldType.halfdayOfDay(), amOrPm == AM_PM.PM ? 1 : 0); - } - log.debug("4. AM/PM: " + date.getMillis() + " " + date); - - // The hours - if (hours == null) - { - date.setHourOfDay(0); - } - else - { - date.set(DateTimeFieldType.hourOfDay(), hours % (use12HourFormat ? 12 : 24)); - } - log.debug("5. hours: " + date.getMillis() + " " + date); - - // The minutes - if (minutes == null) - { - date.setMinuteOfHour(0); - } - else - { - date.setMinuteOfHour(minutes); - } - log.debug("6. minutes: " + date.getMillis() + " " + date); - - // Use the client timezone to properly calculate the millisecs - if (tzClient != null) - { - date.setZoneRetainFields(DateTimeZone.forTimeZone(tzClient)); - log.debug("7. zone: " + date.getMillis() + " " + date); - } - - Date rtn = new Date(date.getMillis()); - log.debug("8. final date: " + rtn.getTime() + " " + rtn); - return rtn; - } - - /** - * Simulate what DateTimeField does - * - * @param dateStr - * @param hours - * @param minutes - * @param amOrPm - * @param use12HourFormat - * @param tzClient - * @return Date - * @throws ParseException - */ - private Date convertDateNew(final String dateStr, final Integer hours, final Integer minutes, - final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient) - throws ParseException - { - log.debug(">>> convertDateNew()"); - // This is what I get from field.getConvertedInput() - Date dateFieldInput = (dateStr != null ? DateFormat.getDateInstance().parse(dateStr) : null); - - // Default with "now" - if (dateFieldInput == null) - { - dateFieldInput = new Date(); - } - - // Get year, month and day ignoring any timezone of the Date object - Calendar cal = Calendar.getInstance(); - cal.setTime(dateFieldInput); - int year = cal.get(Calendar.YEAR); - int month = cal.get(Calendar.MONTH) + 1; - int day = cal.get(Calendar.DAY_OF_MONTH); - int iHours = (hours == null ? 0 : hours % 24); - int iMins = (minutes == null ? 0 : minutes); - - // Use the input to create a date object with proper timezone - MutableDateTime date = new MutableDateTime(year, month, day, iHours, iMins, 0, 0, - DateTimeZone.forTimeZone(tzClient)); - - // Use the input to create a date object. Ignore the timezone provided by dateFieldInput and - // use tzClient instead. No re-calculation will happen. It should be the same as above. -// MutableDateTime date = new MutableDateTime(dateFieldInput, -// DateTimeZone.forTimeZone(tzClient)); - log.debug("1. date: " + date.getMillis() + " " + date); - - // Adjust for halfday if needed - int halfday; - if (use12HourFormat) - { - halfday = (amOrPm == AM_PM.PM ? 1 : 0); - date.set(DateTimeFieldType.halfdayOfDay(), halfday); - date.set(DateTimeFieldType.hourOfDay(), iHours % 12); - } - log.debug("2. halfday adjustments: " + date.getMillis() + " " + date); - - Date rtn = new Date(date.getMillis()); - log.debug("3. final date: " + rtn.getTime() + " " + rtn); - return rtn; - } - - /** - * Simulate what DateTimeField does - * - * @param dateStr - * @param hours - * @param minutes - * @param amOrPm - * @param use12HourFormat - * @param tzClient - * @return Date - * @throws ParseException - */ - private Date convertDateJoda(final String dateStr, final Integer hours, final Integer minutes, - final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient) - throws ParseException - { - log.debug(">>> convertDateJoda()"); - - DateTimeFormatter fmt = DateTimeFormat.shortDate(); - // fmt.withZone(timeZone).parseDateTime("10/1/06 5:00 AM"); - MutableDateTime date = (dateStr != null ? fmt.parseMutableDateTime(dateStr) - : new MutableDateTime()); - - log.debug("1. mutable date: " + date.getMillis() + " " + date); - - // always set secs to 0 - date.setSecondOfMinute(0); - log.debug("2. secs = 0: " + date.getMillis() + " " + date); - - // The AM/PM field - if (use12HourFormat) - { - date.set(DateTimeFieldType.halfdayOfDay(), amOrPm == AM_PM.PM ? 1 : 0); - } - log.debug("3. AM/PM: " + date.getMillis() + " " + date); - - // The hours - if (hours == null) - { - date.setHourOfDay(0); - } - else - { - date.set(DateTimeFieldType.hourOfDay(), hours % (use12HourFormat ? 12 : 24)); - } - log.debug("4. hours: " + date.getMillis() + " " + date); - - // The minutes - if (minutes == null) - { - date.setMinuteOfHour(0); - } - else - { - date.setMinuteOfHour(minutes); - } - log.debug("5. minutes: " + date.getMillis() + " " + date); - - // Use the client timezone to properly calculate the millisecs - if (tzClient != null) - { - date.setZoneRetainFields(DateTimeZone.forTimeZone(tzClient)); - } - log.debug("6. timezone: " + date.getMillis() + " " + date); - - Date rtn = new Date(date.getMillis()); - log.debug("7. final date: " + rtn.getTime() + " " + rtn); - return rtn; - } - - /** - * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected - * output file. - * - * @param <T> - * - * @param pageClass - * @param filename - * @throws Exception - */ - protected <T extends Page> void myTestExecution(final Class<T> pageClass, final String filename) - throws Exception - { - System.out.println("=== " + pageClass.getName() + " ==="); - - tester.getSession().setLocale(Locale.ITALIAN); - tester.startPage(pageClass); - tester.assertRenderedPage(pageClass); - - String document = tester.getLastResponseAsString(); - document = document.replaceAll("\\d\\d\\.\\d\\d\\.\\d\\d", "xx.xx.xx"); - document = document.replaceAll("\\d\\d/\\d\\d/\\d\\d\\d\\d", "xx/xx/xxxx"); - document = document.replaceAll("\\d\\d/\\d\\d/\\d\\d", "xx/xx/xx"); - document = document.replaceAll("\\d\\d/\\d\\d\\d\\d", "xx/xxxx"); - - DiffUtil.validatePage(document, pageClass, filename, true); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java deleted file mode 100644 index c5f636b..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.extensions.yui.calendar; - -import java.util.TimeZone; - -import org.apache.wicket.model.Model; -import org.apache.wicket.util.tester.WicketTestCase; -import org.joda.time.DateTime; -import org.joda.time.DateTimeZone; -import org.junit.Assert; -import org.junit.Test; - -/** - * Tests for DateTimeField - */ -public class DateTimeFieldTest extends WicketTestCase -{ - /** - * https://issues.apache.org/jira/browse/WICKET-5204 - */ - @Test - public void testTimeZones() - { - DateTimeZone defaultTimeZone = DateTimeZone.getDefault(); - - try - { - // The server is using UTC as it's default timezone - DateTimeZone.setDefault(DateTimeZone.forID("UTC")); - - final String clientTimezone = "America/Toronto"; - - DateTime jan01_10am = new DateTime(2013, 01, 01, 10, 0, 0, - DateTimeZone.forID(clientTimezone)); - - DateTimeField dateTimeField = new DateTimeField("foo", Model.of(jan01_10am.toDate())) - { - @Override - protected TimeZone getClientTimeZone() - { - return TimeZone.getTimeZone(clientTimezone); - } - }; - - tester.startComponentInPage(dateTimeField); - - Assert.assertEquals("The hour of day is incorrect!", jan01_10am.getHourOfDay(), - dateTimeField.getHours().intValue()); - } - finally - { - DateTimeZone.setDefault(defaultTimeZone); - } - } - -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html deleted file mode 100644 index 2288856..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<title>Wicket Examples - dates</title> -<link rel="stylesheet" type="text/css" href="style.css" /> -<style type="text/css"> -th { - color: grey; -} -</style> -</head> -<body> -<form wicket:id="localeForm"> -<p><select wicket:id="localeSelect" /> [<a href="#" - wicket:id="localeUSLink">set to english</a>]</p> -</form> -<p> -<form wicket:id="form"><input type="text" - wicket:id="dateTextField" /> <input type="submit" value="submit" /></form> -</p> -<p> - <div wicket:id="feedback"></div> -</p> -</body> -</html> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java deleted file mode 100644 index a632e97..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.extensions.yui.calendar; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Locale; - -import org.apache.wicket.Session; -import org.apache.wicket.datetime.StyleDateConverter; -import org.apache.wicket.datetime.markup.html.form.DateTextField; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.form.ChoiceRenderer; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.form.FormComponentUpdatingBehavior; -import org.apache.wicket.markup.html.link.Link; -import org.apache.wicket.markup.html.panel.FeedbackPanel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.PropertyModel; - -/** - * Demonstrates components from the wicket-date project and a bunch of locale fiddling. - */ -public class DatesPage1 extends WebPage -{ - private static final long serialVersionUID = 1L; - - /** - * Choice for a locale. - */ - private final class LocaleChoiceRenderer extends ChoiceRenderer<Locale> - { - private static final long serialVersionUID = 1L; - - /** - * Constructor. - */ - public LocaleChoiceRenderer() - { - } - - /** - * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getDisplayValue(Object) - */ - @Override - public Object getDisplayValue(Locale locale) - { - String enName = locale.getDisplayName(LOCALE_EN); - String localizedName = locale.getDisplayName(selectedLocale); - return localizedName + (!enName.equals(localizedName) ? (" (" + enName + ")") : ""); - } - } - - /** - * Dropdown with Locales. - */ - private final class LocaleDropDownChoice extends DropDownChoice<Locale> - { - private static final long serialVersionUID = 1L; - - /** - * Construct. - * - * @param id - * component id - */ - public LocaleDropDownChoice(String id) - { - super(id); - // sort locales on strings of selected locale - setChoices(new IModel<List<Locale>>() - { - private static final long serialVersionUID = 1L; - - @Override - public List<Locale> getObject() - { - getSelectedLocale(); - List<Locale> locales = new ArrayList<>(LOCALES); - Collections.sort(locales, new Comparator<Locale>() - { - @Override - public int compare(Locale o1, Locale o2) - { - return o1.getDisplayName(selectedLocale).compareTo( - o2.getDisplayName(selectedLocale)); - } - }); - return locales; - } - }); - setChoiceRenderer(new LocaleChoiceRenderer()); - setDefaultModel(new PropertyModel<>(DatesPage1.this, "selectedLocale")); - - add(new FormComponentUpdatingBehavior()); - } - - @Override - public String getModelValue() - { - return super.getModelValue(); - } - } - - private static final Locale LOCALE_EN = new Locale("en"); - - private static final List<Locale> LOCALES; - static - { - LOCALES = Arrays.asList(Locale.CANADA, Locale.CANADA_FRENCH, Locale.CHINA, Locale.ENGLISH, - Locale.FRANCE, Locale.FRENCH, Locale.GERMAN, Locale.GERMANY, Locale.ITALIAN, - Locale.ITALY, Locale.JAPAN, Locale.JAPANESE, Locale.KOREA, Locale.KOREAN, Locale.PRC, - Locale.SIMPLIFIED_CHINESE, Locale.TAIWAN, Locale.TRADITIONAL_CHINESE, Locale.UK, - Locale.US); - } - - private final Date date = new Date(); - - private Locale selectedLocale = LOCALE_EN; - - /** - * Constructor - */ - public DatesPage1() - { - selectedLocale = Session.get().getLocale(); - Form<?> localeForm = new Form<>("localeForm"); - localeForm.add(new LocaleDropDownChoice("localeSelect")); - localeForm.add(new Link<Void>("localeUSLink") - { - private static final long serialVersionUID = 1L; - - @Override - public void onClick() - { - selectedLocale = LOCALE_EN; - } - }); - add(localeForm); - DateTextField dateTextField = new DateTextField("dateTextField", new PropertyModel<Date>( - this, "date"), new StyleDateConverter("S-", true)) - { - private static final long serialVersionUID = 1L; - - @Override - public Locale getLocale() - { - return selectedLocale; - } - }; - Form<?> form = new Form<Void>("form") - { - private static final long serialVersionUID = 1L; - - @Override - protected void onSubmit() - { - info("set date to " + date); - } - }; - add(form); - form.add(dateTextField); - dateTextField.add(new DatePicker()); - add(new FeedbackPanel("feedback")); - } - - /** - * @return the selected locale - */ - public final Locale getSelectedLocale() - { - return selectedLocale; - } - - /** - * @param selectedLocale - */ - public final void setSelectedLocale(Locale selectedLocale) - { - this.selectedLocale = selectedLocale; - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html deleted file mode 100644 index 907ce6c..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html +++ /dev/null @@ -1,142 +0,0 @@ - -<html xmlns="http://www.w3.org/1999/xhtml"> -<head><script type="text/javascript" src="../resource/org.apache.wicket.extensions.yui.YuiLib/yuiloader/yuiloader.js"></script> -<script type="text/javascript" src="../resource/org.apache.wicket.resource.JQueryResourceReference/jquery/jquery-2.2.4.js"></script> -<script type="text/javascript" src="../resource/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/res/js/wicket-event-jquery.js"></script> - -<title>Wicket Examples - dates</title> -<link rel="stylesheet" type="text/css" href="../../style.css"/> -<style type="text/css"> -/*<![CDATA[*/ - -th { - color: grey; -} - -/*]]>*/ -</style> -<script type="text/javascript" > -/*<![CDATA[*/ -Wicket.Event.add(window, "domready", function(event) { -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -if (typeof(Wicket) === 'undefined') { - window.Wicket = {}; -} -if (typeof(Wicket.DateTimeInit) === 'undefined') { - Wicket.DateTimeInit = {}; -} - -Wicket.DateTimeInit.CalendarInits = []; -Wicket.DateTimeInit.CalendarInitFinished = false; -Wicket.DateTimeInit.CalendarI18n = {}; -Wicket.DateTimeInit.CalendarAdd = function(initFn) { - if (Wicket.DateTimeInit.CalendarInitFinished) { - // when a DatePicker is added via ajax, the loader is already finished, so - // we call the init function directly. - initFn(); - } else { - // when page is rendered, all calendar components will be initialized after - // the required js libraries have been loaded. - Wicket.DateTimeInit.CalendarInits.push(initFn); - } -}; - -Wicket.DateTimeInit.YuiLoader = new YAHOO.util.YUILoader({ - base: "../resource/org.apache.wicket.extensions.yui.YuiLib/", - filter: "RAW", - allowRollup: false, - require: ["wicket-date"], - onSuccess: function() { - Wicket.DateTimeInit.CalendarInitFinished = true; - while (Wicket.DateTimeInit.CalendarInits.length > 0) { - Wicket.DateTimeInit.CalendarInits.pop()(); - } - } -}); -Wicket.DateTimeInit.YuiLoader.addModule({ - name: "wicket-date", - type: "js", - requires: ["calendar"], - fullpath: "../resource/org.apache.wicket.extensions.yui.calendar.DatePicker/wicket-date.js" -}); -Wicket.DateTimeInit.YuiLoader.insert(); -; -Wicket.DateTimeInit.CalendarI18n["it"]={MONTHS_SHORT:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],MONTHS_LONG:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],WEEKDAYS_MEDIUM:["dom","lun","mar","mer","gio","ven","sab"],WEEKDAYS_LONG:["domenica","luned\u00EC","marted\u00EC","mercoled\u00EC","gioved\u00EC","venerd\u00EC","sabato"],START_WEEKDAY:1,WEEKDAYS_1CHAR:["d","l","m","m","g","v","s"],WEEKDAYS_SHORT:["do","lu","ma","me","gi","ve","sa"]};; -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -Wicket.DateTimeInit.CalendarAdd(function() { - Wicket.DateTime.init2("dateTextField1", "dateTextField1", {close:true,selected:"xx/xx/xxxx",pagedate:"xx/xxxx"}, "dd/MM/yy", - true, true, true, false, Wicket.DateTimeInit.CalendarI18n["it"], false, ""); - -}); -; -Wicket.Event.publish(Wicket.Event.Topic.AJAX_HANDLERS_BOUND); -;}); -/*]]>*/ -</script> -</head> -<body> -<form wicket:id="localeForm" id="localeForm2" method="post" action="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-localeForm"> -<p><select wicket:id="localeSelect" name="localeSelect" onchange="if (event.target.name !== 'localeSelect') return; var f = document.getElementById('localeForm2'); f.action='./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.0-localeForm-localeSelect';f.submit();"> -<option value="0">cinese (Cina) (Chinese (China))</option> -<option value="1">cinese (Cina) (Chinese (China))</option> -<option value="2">cinese (Cina) (Chinese (China))</option> -<option value="3">cinese (Taiwan) (Chinese (Taiwan))</option> -<option value="4">cinese (Taiwan) (Chinese (Taiwan))</option> -<option value="5">coreano (Korean)</option> -<option value="6">coreano (Corea del Sud) (Korean (South Korea))</option> -<option value="7">francese (French)</option> -<option value="8">francese (Canada) (French (Canada))</option> -<option value="9">francese (Francia) (French (France))</option> -<option value="10">giapponese (Japanese)</option> -<option value="11">giapponese (Giappone) (Japanese (Japan))</option> -<option value="12">inglese (English)</option> -<option value="13">inglese (Canada) (English (Canada))</option> -<option value="14">inglese (Regno Unito) (English (United Kingdom))</option> -<option value="15">inglese (Stati Uniti) (English (United States))</option> -<option selected="selected" value="16">italiano (Italian)</option> -<option value="17">italiano (Italia) (Italian (Italy))</option> -<option value="18">tedesco (German)</option> -<option value="19">tedesco (Germania) (German (Germany))</option> -</select> [<a href="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-localeForm-localeUSLink" wicket:id="localeUSLink">set to english</a>]</p> -</form> -<p> -<form wicket:id="form" id="form3" method="post" action="./org.apache.wicket.extensions.yui.calendar.DatesPage1?0-1.-form"><input type="text" wicket:id="dateTextField" value="xx/xx/xx" name="dateTextField" id="dateTextField1"/> -<span class="yui-skin-sam"> <span style="display:none;position:absolute;z-index: 99999;" id="dateTextField1Dp"></span><img style="cursor: pointer; border: none;" id="dateTextField1Icon" src="../resource/org.apache.wicket.extensions.yui.calendar.DatePicker/icon1.gif" alt="" title=""/></span> <input type="submit" value="submit" /></form> -</p> -<p> - <div wicket:id="feedback"><wicket:panel> - -</wicket:panel></div> -</p> -</body> -</html> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html deleted file mode 100644 index 09bde3a..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html> -<body> - <form wicket:id="form"> - <span wicket:id="dateTimeField">[dateTime field]</span> - <span wicket:id="dateField">[date field]</span> - <span wicket:id="timeField">[time field]</span> - <input type="submit" value="submit" /> - </form> -</body> -</html> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java deleted file mode 100644 index 827d10d..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.extensions.yui.calendar; - -import java.util.Date; - -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.model.PropertyModel; - -/** - * Demonstrates components from the wicket-date project and a bunch of locale fiddling. - */ -public class DatesPage2 extends WebPage -{ - private static final long serialVersionUID = 1L; - - /** */ - public Date dateTime; - - /** */ - public Date date; - - /** */ - public Date time; - - /** - * Constructor - */ - public DatesPage2() - { - Form<?> form = new Form<>("form"); - add(form); - - form.add(new DateTimeField("dateTimeField", new PropertyModel<Date>(this, "dateTime"))); - form.add(new DateField("dateField", new PropertyModel<Date>(this, "date"))); - form.add(new TimeField("timeField", new PropertyModel<Date>(this, "time"))); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java b/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java deleted file mode 100644 index 23887a3..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.util.license; - -/** - * Test that the license headers are in place in this project. The tests are run from - * {@link ApacheLicenseHeaderTestCase}, but you can add project specific tests here if needed. - * - * @author Frank Bille Jensen (frankbille) - */ -public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase -{ - /** - * Construct. - */ - public ApacheLicenceHeaderTest() - { - // addHeaders = true; - - /* - * See NOTICE.txt - */ - htmlIgnore.add("src/main/java/org/apache/wicket/util/diff"); - - /* - * YUI lib. See NOTICE - */ - cssIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/assets/skins/sam/calendar.css"); - cssIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/assets/skins/sam/calendar.css"); - - /* - * YUI lib. See NOTICE - */ - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yuiloader/yuiloader.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yuiloader/yuiloader-min.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoodomevent/yahoo-dom-event.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/event/event.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/event/event-min.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/dom/dom.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/dom/dom-min.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/calendar.js"); - javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/calendar-min.js"); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java ---------------------------------------------------------------------- diff --git a/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java b/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java deleted file mode 100644 index a8e7628..0000000 --- a/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.util.markup.xhtml; - -import org.junit.Test; - -/** - * Checks that the html markup files are well formed xml-s. - * - * @author akiraly - */ -public class WellFormedXmlTest extends WellFormedXmlTestCase -{ - @Test - @Override - public void markupFiles() - { - super.markupFiles(); - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/.tomcatplugin ---------------------------------------------------------------------- diff --git a/wicket-examples/.tomcatplugin b/wicket-examples/.tomcatplugin index d0a1479..75ef825 100644 --- a/wicket-examples/.tomcatplugin +++ b/wicket-examples/.tomcatplugin @@ -10,7 +10,6 @@ <webPath>/wicket</webPath> <webClassPathEntries> <webClassPathEntry>/wicket-auth-roles/target/classes</webClassPathEntry> - <webClassPathEntry>/wicket-datetime/target/classes</webClassPathEntry> <webClassPathEntry>/wicket-examples/target/classes</webClassPathEntry> <webClassPathEntry>/wicket-extensions/target/classes</webClassPathEntry> <webClassPathEntry>/wicket-guice/target/classes</webClassPathEntry> @@ -28,7 +27,6 @@ <webClassPathEntry>M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar</webClassPathEntry> <webClassPathEntry>M2_REPO/easymock/easymock/1.2_Java1.3/easymock-1.2_Java1.3.jar</webClassPathEntry> <webClassPathEntry>M2_REPO/javax/portlet/portlet-api/1.0/portlet-api-1.0.jar</webClassPathEntry> - <webClassPathEntry>M2_REPO/joda-time/joda-time/1.4/joda-time-1.4.jar</webClassPathEntry> <webClassPathEntry>M2_REPO/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.jar</webClassPathEntry> <webClassPathEntry>M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar</webClassPathEntry> <webClassPathEntry>M2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar</webClassPathEntry> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/pom.xml ---------------------------------------------------------------------- diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml index 76366e2..7849780 100644 --- a/wicket-examples/pom.xml +++ b/wicket-examples/pom.xml @@ -31,32 +31,32 @@ action. </description> - <properties> - <docker-maven-plugin.version>1.0.0</docker-maven-plugin.version> - </properties> + <properties> + <docker-maven-plugin.version>1.0.0</docker-maven-plugin.version> + </properties> <dependencyManagement> - <dependencies> - <dependency> - <groupId>com.github.axet</groupId> - <artifactId>kaptcha</artifactId> - <version>0.0.9</version> - </dependency> - <dependency> - <groupId>com.github.cage</groupId> - <artifactId>cage</artifactId> - <version>1.0</version> - </dependency> - <dependency> - <groupId>org.codelibs</groupId> - <artifactId>jhighlight</artifactId> - <version>1.0.3</version> - <exclusions> - <exclusion> - <groupId>javax.servlet</groupId> - <artifactId>servlet-api</artifactId> - </exclusion> - </exclusions> + <dependencies> + <dependency> + <groupId>com.github.axet</groupId> + <artifactId>kaptcha</artifactId> + <version>0.0.9</version> + </dependency> + <dependency> + <groupId>com.github.cage</groupId> + <artifactId>cage</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>org.codelibs</groupId> + <artifactId>jhighlight</artifactId> + <version>1.0.3</version> + <exclusions> + <exclusion> + <groupId>javax.servlet</groupId> + <artifactId>servlet-api</artifactId> + </exclusion> + </exclusions> </dependency> </dependencies> </dependencyManagement> @@ -120,10 +120,6 @@ </dependency> <dependency> <groupId>org.apache.wicket</groupId> - <artifactId>wicket-datetime</artifactId> - </dependency> - <dependency> - <groupId>org.apache.wicket</groupId> <artifactId>wicket-devutils</artifactId> </dependency> <dependency> @@ -146,10 +142,10 @@ <groupId>org.apache.wicket</groupId> <artifactId>wicket-velocity</artifactId> </dependency> - <dependency> - <groupId>org.apache.wicket</groupId> - <artifactId>wicket-native-websocket-javax</artifactId> - </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-native-websocket-javax</artifactId> + </dependency> <dependency> <groupId>org.codelibs</groupId> <artifactId>jhighlight</artifactId> @@ -239,38 +235,38 @@ </plugins> <pluginManagement> <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-javadoc-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-war-plugin</artifactId> - <configuration> - <!-- include the manifest entries so that we can emit the version of the examples. --> - <archive> - <manifest> - <addDefaultImplementationEntries>true</addDefaultImplementationEntries> - <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> - </manifest> - </archive> - </configuration> - </plugin> - <plugin> - <groupId>org.mortbay.jetty</groupId> - <artifactId>jetty-maven-plugin</artifactId> - <version>${jetty.version}</version> - <dependencies> - <dependency> - <groupId>javax.validation</groupId> - <artifactId>validation-api</artifactId> - <version>1.1.0.Final</version> - </dependency> - </dependencies> - </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-javadoc-plugin</artifactId> + <configuration> + <skip>true</skip> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <!-- include the manifest entries so that we can emit the version of the examples. --> + <archive> + <manifest> + <addDefaultImplementationEntries>true</addDefaultImplementationEntries> + <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> + </manifest> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty-maven-plugin</artifactId> + <version>${jetty.version}</version> + <dependencies> + <dependency> + <groupId>javax.validation</groupId> + <artifactId>validation-api</artifactId> + <version>1.1.0.Final</version> + </dependency> + </dependencies> + </plugin> </plugins> </pluginManagement> </build> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html index c5e8099..528940e 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html @@ -2,11 +2,11 @@ <html xmlns:wicket="http://wicket.apache.org"> <head> <title>This is modal window</title> - <style type="text/css"> + <style type="text/css"> body { font-family: verdana, sans-serif; font-size: 82%; - background-color: white; + background-color: white; } </style> </head> @@ -18,13 +18,11 @@ </p> <p> <div wicket:id="modal"></div> - <a wicket:id="open">Open another modal dialog</a> + <a wicket:id="open">Open another modal dialog</a> </p> - <p> - <div>An example of a component that uses header contributions</div> - <div wicket:id="dateTimeField" /> + <div>An example of a component that uses header contributions</div> + <div wicket:id="dateTimeField" /> </p> - </body> </html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java index eb9d800..5c252e4 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java @@ -20,7 +20,7 @@ import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.extensions.yui.calendar.DateTimeField; +import org.apache.wicket.extensions.markup.html.form.datetime.DateTimeField; import org.apache.wicket.markup.html.WebPage; @@ -30,6 +30,7 @@ import org.apache.wicket.markup.html.WebPage; */ public class ModalContent1Page extends WebPage { + private static final long serialVersionUID = 1L; /** * @@ -40,6 +41,8 @@ public class ModalContent1Page extends WebPage { add(new AjaxLink<Void>("closeOK") { + private static final long serialVersionUID = 1L; + @Override public void onClick(AjaxRequestTarget target) { @@ -51,6 +54,8 @@ public class ModalContent1Page extends WebPage add(new AjaxLink<Void>("closeCancel") { + private static final long serialVersionUID = 1L; + @Override public void onClick(AjaxRequestTarget target) { @@ -85,6 +90,8 @@ public class ModalContent1Page extends WebPage add(new AjaxLink<Void>("open") { + private static final long serialVersionUID = 1L; + @Override public void onClick(AjaxRequestTarget target) { http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent2Page.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent2Page.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent2Page.java index 0189a93..4b668ac 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent2Page.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent2Page.java @@ -28,6 +28,7 @@ import org.apache.wicket.markup.html.WebPage; */ public class ModalContent2Page extends WebPage { + private static final long serialVersionUID = 1L; /** * @param window http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java index 6a5f5ab..3a9389a 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java @@ -16,9 +16,7 @@ */ package org.apache.wicket.examples.ajax.builtin.modal; -import java.util.Map; - -import org.apache.wicket.extensions.yui.calendar.DateTimeField; +import org.apache.wicket.extensions.markup.html.form.datetime.DateTimeField; import org.apache.wicket.markup.html.panel.Panel; /** @@ -26,6 +24,7 @@ import org.apache.wicket.markup.html.panel.Panel; */ public class ModalPanel1 extends Panel { + private static final long serialVersionUID = 1L; /** * @param id @@ -33,20 +32,6 @@ public class ModalPanel1 extends Panel public ModalPanel1(String id) { super(id); - - add(new DateTimeField("dateTimeField") - { - /** - * @see org.apache.wicket.extensions.yui.calendar.DateTimeField#configure(java.util.Map) - */ - @Override - protected void configure(Map<String, Object> widgetProperties) - { - super.configure(widgetProperties); - // IE 6 breaks layout with iframe - is that a YUI bug? - widgetProperties.put("iframe", false); - } - }); + add(new DateTimeField("dateTimeField")); } - } http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java index 7de1620..f8376ff 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java @@ -29,6 +29,8 @@ import org.apache.wicket.model.PropertyModel; */ public class ModalWindowPage extends BasePage { + private static final long serialVersionUID = 1L; + public ModalWindowPage() { final Label result; @@ -53,6 +55,8 @@ public class ModalWindowPage extends BasePage add(new AjaxLink<Void>("showModal1") { + private static final long serialVersionUID = 1L; + @Override public void onClick(AjaxRequestTarget target) { @@ -80,6 +84,8 @@ public class ModalWindowPage extends BasePage add(new AjaxLink<Void>("showModal2") { + private static final long serialVersionUID = 1L; + @Override public void onClick(AjaxRequestTarget target) { http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html index a459fd9..db04a1c 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.html @@ -5,15 +5,17 @@ <style> .note { font-size:.8em; } .required {font-weight: bold;} + table {border-collapse: collapse; border-spacing: 0;} + th, td {padding: 4px;} </style> </head> <body> - <span wicket:id="mainNavigation" /> + <span wicket:id="mainNavigation"></span> <div wicket:id="feedbackErrors"></div> - + <form wicket:id="form" novalidate="novalidate"> - <table cellspacing="0" cellpadding="4"> + <table style="border-collapse: collapse; border-spacing: 0;"> <tr> <td><label wicket:for="name"><wicket:label>Name</wicket:label></label></td> <td><input wicket:id="name" type="text" size="30"/></td> @@ -35,11 +37,12 @@ <td><pre class="note">m/d/yyyy field with @Past</pre></td> </tr> <tr> - <td><label wicket:for="password"><wicket:label>Password</wicket:label></label></td> - <td><input wicket:id="password" type="text" size="10"/></td> - <td><pre class="note">Custom constraint @ValidPassword with custom message bundles.<br/>A valid password must contain only alphanumeric chars and at least two digits.</pre> - </td> - </tr> + <td><label wicket:for="password"><wicket:label>Password</wicket:label></label></td> + <td><input wicket:id="password" type="text" size="10"/></td> + <td> + <pre class="note">Custom constraint @ValidPassword with custom message bundles.<br/>A valid password must contain only alphanumeric chars and at least two digits.</pre> + </td> + </tr> <tr> <td></td> <td> @@ -49,6 +52,6 @@ </tr> </table> </form> - <div wicket:id="feedbackSuccess"></div> + <div wicket:id="feedbackSuccess"></div> </body> </html> http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java index faec290..e1eb59d 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/BeanValidationPage.java @@ -17,8 +17,8 @@ package org.apache.wicket.examples.bean.validation; import org.apache.wicket.bean.validation.PropertyValidator; -import org.apache.wicket.datetime.StyleDateConverter; -import org.apache.wicket.datetime.markup.html.form.DateTextField; +import org.apache.wicket.extensions.markup.html.form.datetime.DateField; +import org.apache.wicket.extensions.markup.html.form.datetime.StyleDateConverter; import org.apache.wicket.examples.WicketExamplePage; import org.apache.wicket.feedback.ExactLevelFeedbackMessageFilter; import org.apache.wicket.feedback.FeedbackMessage; @@ -29,7 +29,7 @@ import org.apache.wicket.model.PropertyModel; public class BeanValidationPage extends WicketExamplePage { - + private static final long serialVersionUID = 1L; Person person = new Person(); public BeanValidationPage() @@ -37,6 +37,8 @@ public class BeanValidationPage extends WicketExamplePage add(new FeedbackPanel("feedbackErrors", new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR))); Form<?> form = new Form<Void>("form") { + private static final long serialVersionUID = 1L; + @Override protected void onSubmit() { @@ -50,8 +52,8 @@ public class BeanValidationPage extends WicketExamplePage form.add(new TextField<>("name", new PropertyModel<String>(this, "person.name")).add(new PropertyValidator<>())); form.add(new TextField<>("phone", new PropertyModel<String>(this, "person.phone")).add(new PropertyValidator<>())); form.add(new TextField<>("email", new PropertyModel<String>(this, "person.email")).add(new PropertyValidator<>())); - form.add(new DateTextField("birthdate", new PropertyModel<>(this, "person.birthdate"), - new StyleDateConverter("S-", true)).add(new PropertyValidator<>())); + form.add(new DateField("birthdate", new PropertyModel<>(this, "person.birthdate"), + new StyleDateConverter("S-")).add(new PropertyValidator<>())); form.add(new TextField<>("password", new PropertyModel<String>(this, "person.password")).add(new PropertyValidator<>())); add(new FeedbackPanel("feedbackSuccess", new ExactLevelFeedbackMessageFilter(FeedbackMessage.INFO))); http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java index 59293dc..feb0564 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/bean/validation/Person.java @@ -17,18 +17,20 @@ package org.apache.wicket.examples.bean.validation; import java.io.Serializable; -import java.util.Date; +import java.time.LocalDate; +import javax.validation.constraints.Email; import javax.validation.constraints.NotNull; import javax.validation.constraints.Past; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import org.apache.wicket.examples.bean.validation.constraint.ValidPassword; -import org.hibernate.validator.constraints.Email; public class Person implements Serializable { + private static final long serialVersionUID = 1L; + @NotNull @Size(min = 2, max = 30) private String name; @@ -41,7 +43,7 @@ public class Person implements Serializable private String phone; @Past - private Date birthdate; + private LocalDate birthdate; @ValidPassword private String password; @@ -76,12 +78,12 @@ public class Person implements Serializable this.phone = phone; } - public Date getBirthdate() + public LocalDate getBirthdate() { return birthdate; } - public void setBirthdate(Date birthdate) + public void setBirthdate(LocalDate birthdate) { this.birthdate = birthdate; } http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesApplication.java ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesApplication.java b/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesApplication.java deleted file mode 100644 index 2db0032..0000000 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesApplication.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.examples.dates; - -import org.apache.wicket.Page; -import org.apache.wicket.examples.WicketExampleApplication; - -/** - * Application class for the dates example. - */ -public class DatesApplication extends WicketExampleApplication -{ - @Override - public Class< ? extends Page> getHomePage() - { - return DatesPage.class; - } -} http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesPage.html ---------------------------------------------------------------------- diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesPage.html b/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesPage.html deleted file mode 100644 index ad22d67..0000000 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/dates/DatesPage.html +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <head> - <title>Wicket Examples - dates</title> - <link rel="stylesheet" type="text/css" href="style.css" /> - <style type="text/css"> - th { - color: grey; - } - </style> - </head> - <body> - <span wicket:id="mainNavigation"></span> - <form wicket:id="localeForm"> - <p><select wicket:id="localeSelect" /> [<a href="#" - wicket:id="localeUSLink">set to english</a>]</p> - </form> - <p> - Example using DateTextField (auto-hides the picker when clicking on the document):  - <form wicket:id="form"><input type="text" - wicket:id="dateTextField" /> <input type="submit" value="submit" /></form> - </p> - - <br/> - <p> - Example using DateTimeField:  - <form wicket:id="form2"> - <span wicket:id="dateTimeField"></span> - <input type="submit" value="submit" /> - </form> - </p> - - <br/> - <p> - Example using TimeField:  - <form wicket:id="form3"> - <span wicket:id="timeField"></span> - <input type="submit" value="submit" /> - </form> - </p> - - <p> - <div wicket:id="feedback"></div> - </p> - - </body> -</html>
