You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2017/10/17 20:44:29 UTC
[15/20] wicket git commit: WICKET-6105 Decommission wicket-datetime
WICKET-6105 Decommission wicket-datetime
Move DateLabel and all Date formatters from wicket-datetime to wicket-extensions module
WIP!
WIP: Move some more code from -datetime to -extensions while trying to keep old APIs (j.u.Date based ones) available for easier migration
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2bb684c1
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2bb684c1
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2bb684c1
Branch: refs/heads/master
Commit: 2bb684c11a1d8b91db5c3d3040da734ed357a2bc
Parents: 9e3e167
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Feb 26 23:28:11 2016 +0100
Committer: Sven Meier <sv...@apache.org>
Committed: Tue Oct 17 22:32:39 2017 +0200
----------------------------------------------------------------------
NOTICE | 6 -
README.md | 4 -
pom.xml | 6 -
testing/wicket-common-tests/pom.xml | 5 -
testing/wicket-js-tests/Gruntfile.js | 4 -
.../markup/html/form/FormComponentPanel.java | 3 +-
wicket-datetime/pom.xml | 64 -
.../apache/wicket/datetime/DateConverter.java | 219 -
.../wicket/datetime/PatternDateConverter.java | 104 -
.../wicket/datetime/StyleDateConverter.java | 122 -
.../datetime/markup/html/basic/DateLabel.java | 304 -
.../markup/html/form/DateTextField.java | 243 -
.../org/apache/wicket/extensions/yui/VERSION | 2 -
.../apache/wicket/extensions/yui/YuiLib.java | 71 -
.../extensions/yui/assets/skins/sam/sprite.png | Bin 3745 -> 0 bytes
.../yui/calendar/AbstractCalendar.java | 260 -
.../extensions/yui/calendar/DateField.java | 81 -
.../extensions/yui/calendar/DatePicker.java | 890 ---
.../extensions/yui/calendar/DatePicker.js | 21 -
.../extensions/yui/calendar/DatePickerInit.js | 57 -
.../extensions/yui/calendar/DateTimeField.html | 26 -
.../extensions/yui/calendar/DateTimeField.java | 616 --
.../extensions/yui/calendar/TimeField.java | 71 -
.../yui/calendar/assets/skins/sam/calendar.css | 8 -
.../extensions/yui/calendar/calendar-min.js | 18 -
.../wicket/extensions/yui/calendar/calendar.js | 7390 ------------------
.../wicket/extensions/yui/calendar/icon1.gif | Bin 970 -> 0 bytes
.../wicket/extensions/yui/calendar/icon2.gif | Bin 1083 -> 0 bytes
.../wicket/extensions/yui/calendar/icon3.gif | Bin 1086 -> 0 bytes
.../extensions/yui/calendar/wicket-date.js | 432 -
.../apache/wicket/extensions/yui/dom/dom-min.js | 9 -
.../org/apache/wicket/extensions/yui/dom/dom.js | 1846 -----
.../wicket/extensions/yui/event/event-min.js | 11 -
.../apache/wicket/extensions/yui/event/event.js | 2537 ------
.../wicket/extensions/yui/yahoo/yahoo-min.js | 8 -
.../apache/wicket/extensions/yui/yahoo/yahoo.js | 1229 ---
.../yui/yahoodomevent/yahoo-dom-event.js | 14 -
.../extensions/yui/yuiloader/yuiloader-min.js | 11 -
.../extensions/yui/yuiloader/yuiloader.js | 4065 ----------
.../src/main/resources/META-INF/NOTICE | 14 -
wicket-datetime/src/test/java/log4j.properties | 18 -
.../wicket/datetime/DateConverterTest.java | 86 -
.../extensions/yui/calendar/DatePickerTest.java | 763 --
.../yui/calendar/DateTimeFieldTest.java | 71 -
.../extensions/yui/calendar/DatesPage1.html | 25 -
.../extensions/yui/calendar/DatesPage1.java | 201 -
.../yui/calendar/DatesPage1_ExpectedResult.html | 142 -
.../extensions/yui/calendar/DatesPage2.html | 11 -
.../extensions/yui/calendar/DatesPage2.java | 53 -
.../util/license/ApacheLicenceHeaderTest.java | 60 -
.../util/markup/xhtml/WellFormedXmlTest.java | 34 -
wicket-examples/.tomcatplugin | 2 -
wicket-examples/pom.xml | 124 +-
.../ajax/builtin/modal/ModalContent1Page.html | 12 +-
.../ajax/builtin/modal/ModalContent1Page.java | 9 +-
.../ajax/builtin/modal/ModalContent2Page.java | 1 +
.../ajax/builtin/modal/ModalPanel1.java | 21 +-
.../ajax/builtin/modal/ModalWindowPage.java | 6 +
.../bean/validation/BeanValidationPage.html | 21 +-
.../bean/validation/BeanValidationPage.java | 12 +-
.../wicket/examples/bean/validation/Person.java | 12 +-
.../wicket/examples/dates/DatesApplication.java | 32 -
.../apache/wicket/examples/dates/DatesPage.html | 47 -
.../apache/wicket/examples/dates/DatesPage.java | 217 -
.../examples/datetime/DateTimeApplication.java | 33 +
.../wicket/examples/datetime/DateTimePage.html | 34 +
.../wicket/examples/datetime/DateTimePage.java | 79 +
.../src/main/resources/META-INF/NOTICE | 3 -
.../wicket/examples/homepage/HomePage.html | 2 +-
wicket-examples/src/main/webapp/WEB-INF/web.xml | 29 +-
.../form/datetime/AbstractDateTimeField.html | 23 +
.../form/datetime/AbstractDateTimeField.java | 244 +
.../markup/html/form/datetime/DateField.java | 252 +
.../html/form/datetime/DateTimeField.java | 123 +
.../html/form/datetime/LocalDateConverter.java | 104 +
.../html/form/datetime/LocalTimeConverter.java | 104 +
.../form/datetime/PatternDateConverter.java | 85 +
.../form/datetime/PatternTimeConverter.java | 85 +
.../datetime/PatternZonedDateTimeConverter.java | 97 +
.../html/form/datetime/StyleDateConverter.java | 118 +
.../html/form/datetime/StyleTimeConverter.java | 114 +
.../datetime/StyleZonedDateTimeConverter.java | 168 +
.../markup/html/form/datetime/TimeField.html | 25 +
.../markup/html/form/datetime/TimeField.java | 520 ++
.../form/datetime/ZonedDateTimeConverter.java | 203 +
.../html/form/datetime/ZonedDateTimeField.java | 154 +
.../html/form/datetime/DateConverterTest.java | 109 +
.../html/form/datetime/DateTimeFieldTest.java | 172 +
.../main/asciidoc/helloWorld/helloWorld_1.adoc | 1 -
89 files changed, 2970 insertions(+), 22662 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index c2b4544..7cc91f9 100644
--- a/NOTICE
+++ b/NOTICE
@@ -59,9 +59,6 @@ src/./wicket-examples
This product includes ASM, released under a BSD style license (http://asm.objectweb.org).
Copyright (c) 2000-2005 INRIA, France Telecom
- This product includes software developed by
- Joda.org (http://www.joda.org/).
-
This product includes jhighlight (https://jhighlight.dev.java.net/)
which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php).
@@ -114,9 +111,6 @@ src/./wicket-datetime
http://developer.yahoo.net/yui/license.txt
Copyright (c) 2010, Yahoo! Inc.
- This product includes software developed by
- Joda.org (http://www.joda.org/).
-
---------------------------------------------------------------------------
src/./wicket-metrics
---------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 3ff8f95..a17dd27 100644
--- a/README.md
+++ b/README.md
@@ -157,10 +157,6 @@ the src/ folder.
As the following projects all depend on wicket, they inherit these
dependencies.
- - wicket-datetime:
-
- Joda-Time 2.4 (http://joda-time.sourceforge.net/)
-
- wicket-velocity:
Apache Velocity 1.7 (http://velocity.apache.org/) and it's dependencies
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a5cf4db..3c2657e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,6 @@
<module>wicket</module>
<module>wicket-core</module>
<module>wicket-util</module>
- <module>wicket-datetime</module>
<module>wicket-request</module>
<module>wicket-devutils</module>
<module>wicket-extensions</module>
@@ -248,11 +247,6 @@
<version>1</version>
</dependency>
<dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>${joda-time.version}</version>
- </dependency>
- <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/testing/wicket-common-tests/pom.xml
----------------------------------------------------------------------
diff --git a/testing/wicket-common-tests/pom.xml b/testing/wicket-common-tests/pom.xml
index 62ccc61..a8a3750 100644
--- a/testing/wicket-common-tests/pom.xml
+++ b/testing/wicket-common-tests/pom.xml
@@ -59,11 +59,6 @@
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
- <artifactId>wicket-datetime</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.wicket</groupId>
<artifactId>wicket-devutils</artifactId>
<scope>test</scope>
</dependency>
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/testing/wicket-js-tests/Gruntfile.js
----------------------------------------------------------------------
diff --git a/testing/wicket-js-tests/Gruntfile.js b/testing/wicket-js-tests/Gruntfile.js
index 6cb79bd..29b746b 100644
--- a/testing/wicket-js-tests/Gruntfile.js
+++ b/testing/wicket-js-tests/Gruntfile.js
@@ -34,9 +34,6 @@ module.exports = function(grunt) {
"../../wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js",
"../../wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/wicket-filterform.js"
],
- datetimeJs = [
- "../../wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js"
- ],
nativeWebSocketJs = [
"../../wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/res/js/wicket-websocket-jquery.js"
],
@@ -75,7 +72,6 @@ module.exports = function(grunt) {
jshint: {
core: coreJs,
extensions: extensionsJs,
- datetime: datetimeJs,
nativeWebSocket: nativeWebSocketJs,
testsJs: testsJs,
gymTestsJs: gymTestsJs,
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
index 0112614..c85772a 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
@@ -40,8 +40,7 @@ import org.apache.wicket.util.visit.IVisitor;
* <p>
* Here is a simple example of a panel with two components that multiplies and sets that as the
* master model object. Note that for this simple example, setting the model value wouldn't make
- * sense, as the lhs and rhs cannot be known. For more complete examples of using this class, see
- * the wicket-datetime project.
+ * sense, as the lhs and rhs cannot be known.
* </p>
*
* <pre>
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/pom.xml
----------------------------------------------------------------------
diff --git a/wicket-datetime/pom.xml b/wicket-datetime/pom.xml
deleted file mode 100644
index 26330c3..0000000
--- a/wicket-datetime/pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-parent</artifactId>
- <version>8.0.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>wicket-datetime</artifactId>
- <packaging>bundle</packaging>
- <name>Wicket Date/Time</name>
- <description>Date/Time components and utilities for Wicket</description>
- <dependencies>
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-core</artifactId>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- <configuration>
- <instructions>
- <Export-Package>
- !org.apache.wicket.extensions.yui.yahoo-dom-event,*
- </Export-Package>
- </instructions>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java
deleted file mode 100644
index 1c752c6..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java
+++ /dev/null
@@ -1,219 +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.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import org.apache.wicket.Session;
-import org.apache.wicket.core.request.ClientInfo;
-import org.apache.wicket.protocol.http.request.WebClientInfo;
-import org.apache.wicket.util.convert.ConversionException;
-import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.util.string.Strings;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormatter;
-
-
-/**
- * Base class for Joda Time based date converters. It contains the logic to parse and format,
- * optionally taking the time zone difference between clients and the server into account.
- * <p>
- * Converters of this class are best suited for per-component use.
- * </p>
- *
- * @author eelcohillenius
- */
-public abstract class DateConverter implements IConverter<Date>
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Whether to apply the time zone difference when interpreting dates.
- */
- private final boolean applyTimeZoneDifference;
-
- /**
- * Construct. </p> When applyTimeZoneDifference is true, the current time is applied on the
- * parsed date, and the date will be corrected for the time zone difference between the server
- * and the client. For instance, if I'm in Seattle and the server I'm working on is in
- * Amsterdam, the server is 9 hours ahead. So, if I'm inputting say 12/24 at a couple of hours
- * before midnight, at the server it is already 12/25. If this boolean is true, it will be
- * transformed to 12/25, while the client sees 12/24. </p>
- *
- * @param applyTimeZoneDifference
- * whether to apply the difference in time zones between client and server
- */
- public DateConverter(boolean applyTimeZoneDifference)
- {
- this.applyTimeZoneDifference = applyTimeZoneDifference;
- }
-
- /**
- * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String,
- * java.util.Locale)
- */
- @Override
- public Date convertToObject(String value, Locale locale)
- {
- if (Strings.isEmpty(value))
- {
- return null;
- }
-
- DateTimeFormatter format = getFormat(locale);
- if (format == null)
- {
- throw new IllegalStateException("format must be not null");
- }
-
- if (applyTimeZoneDifference)
- {
- TimeZone zone = getClientTimeZone();
- DateTime dateTime;
-
- // set time zone for client
- format = format.withZone(getTimeZone());
-
- try
- {
- // parse date retaining the time of the submission
- dateTime = format.parseDateTime(value);
- }
- catch (RuntimeException e)
- {
- throw newConversionException(e, locale);
- }
- // apply the server time zone to the parsed value
- if (zone != null)
- {
- dateTime = dateTime.withZoneRetainFields(DateTimeZone.forTimeZone(zone));
- }
-
- return dateTime.toDate();
- }
- else
- {
- try
- {
- DateTime date = format.parseDateTime(value);
- return date.toDate();
- }
- catch (RuntimeException e)
- {
- throw newConversionException(e, locale);
- }
- }
- }
-
- /**
- * Creates a ConversionException and sets additional context information to it.
- *
- * @param cause
- * - {@link RuntimeException} cause
- * @param locale
- * - {@link Locale} used to set 'format' variable with localized pattern
- * @return {@link ConversionException}
- */
- private ConversionException newConversionException(RuntimeException cause, Locale locale)
- {
- return new ConversionException(cause)
- .setVariable("format", getDatePattern(locale));
- }
-
- /**
- * @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object,
- * java.util.Locale)
- */
- @Override
- public String convertToString(Date value, Locale locale)
- {
- DateTime dt = new DateTime(value.getTime(), getTimeZone());
- DateTimeFormatter format = getFormat(locale);
-
- if (applyTimeZoneDifference)
- {
- TimeZone zone = getClientTimeZone();
- if (zone != null)
- {
- // apply time zone to formatter
- format = format.withZone(DateTimeZone.forTimeZone(zone));
- }
- }
- return format.print(dt);
- }
-
- /**
- * Gets whether to apply the time zone difference when interpreting dates.
- *
- * </p> When true, the current time is applied on the parsed date, and the date will be
- * corrected for the time zone difference between the server and the client. For instance, if
- * I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9 hours ahead.
- * So, if I'm inputting say 12/24 at a couple of hours before midnight, at the server it is
- * already 12/25. If this boolean is true, it will be transformed to 12/25, while the client
- * sees 12/24. </p>
- *
- * @return whether to apply the difference in time zones between client and server
- */
- public final boolean getApplyTimeZoneDifference()
- {
- return applyTimeZoneDifference;
- }
-
- /**
- * @param locale
- * The locale used to convert the value
- * @return Gets the pattern that is used for printing and parsing
- */
- public abstract String getDatePattern(Locale locale);
-
- /**
- * Gets the client's time zone.
- *
- * @return The client's time zone or null
- */
- protected TimeZone getClientTimeZone()
- {
- ClientInfo info = Session.get().getClientInfo();
- if (info instanceof WebClientInfo)
- {
- return ((WebClientInfo)info).getProperties().getTimeZone();
- }
- return null;
- }
-
- /**
- * @param locale
- * The locale used to convert the value
- *
- * @return formatter The formatter for the current conversion
- */
- protected abstract DateTimeFormatter getFormat(Locale locale);
-
- /**
- * Gets the server time zone. Override this method if you want to fix to a certain time zone,
- * regardless of what actual time zone the server is in.
- *
- * @return The server time zone
- */
- protected DateTimeZone getTimeZone()
- {
- return DateTimeZone.getDefault();
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/datetime/PatternDateConverter.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/PatternDateConverter.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/PatternDateConverter.java
deleted file mode 100644
index 7b257cb..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/PatternDateConverter.java
+++ /dev/null
@@ -1,104 +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.text.SimpleDateFormat;
-import java.util.Locale;
-
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-
-/**
- * Date converter that uses Joda Time and can be configured to take the time zone difference between
- * clients and server into account. This converter is hard coded to use the provided custom date
- * pattern, no matter what current locale is used. See {@link SimpleDateFormat} for available
- * patterns.
- * <p>
- * This converter is especially suited on a per-component base.
- * </p>
- *
- * @see SimpleDateFormat
- * @see StyleDateConverter
- * @see DateTextField
- * @see DateTime
- * @see DateTimeFormat
- * @see DateTimeZone
- *
- * @author eelcohillenius
- */
-public class PatternDateConverter extends DateConverter
-{
-
- private static final long serialVersionUID = 1L;
-
- /** pattern to use. */
- private final String datePattern;
-
- /**
- * Construct.
- * </p>
- * When applyTimeZoneDifference is true, the current time is applied on the parsed date, and the
- * date will be corrected for the time zone difference between the server and the client. For
- * instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9
- * hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the
- * server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while
- * the client sees 12/24.
- * </p>
- *
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @param applyTimeZoneDifference
- * whether to apply the difference in time zones between client and server
- * @throws IllegalArgumentException
- * in case the date pattern is null
- */
- public PatternDateConverter(String datePattern, boolean applyTimeZoneDifference)
- {
-
- super(applyTimeZoneDifference);
- if (datePattern == null)
- {
- throw new IllegalArgumentException("datePattern must be not null");
- }
- this.datePattern = datePattern;
- }
-
- /**
- * Gets the optional date pattern.
- *
- * @return datePattern
- */
- @Override
- public final String getDatePattern(Locale locale)
- {
- return datePattern;
- }
-
- /**
- * @return formatter The formatter for the current conversion
- */
- @Override
- protected DateTimeFormatter getFormat(Locale locale)
- {
- return DateTimeFormat.forPattern(datePattern).withLocale(locale).withPivotYear(2000);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/datetime/StyleDateConverter.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/StyleDateConverter.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/StyleDateConverter.java
deleted file mode 100644
index 317026e..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/StyleDateConverter.java
+++ /dev/null
@@ -1,122 +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.Locale;
-
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-import org.joda.time.format.DateTimeFormatter;
-
-
-/**
- * Date converter that uses Joda Time and can be configured to take the time zone difference between
- * clients and server into account, and that is configured for a certain date style. The pattern
- * will always be locale specific.
- * <p>
- * This converter is especially suited on a per-component base.
- * </p>
- *
- * @see DateTextField
- * @see DateTime
- * @see DateTimeFormat
- * @see DateTimeZone
- *
- * @author eelcohillenius
- */
-public class StyleDateConverter extends DateConverter
-{
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Date style to use. See {@link DateTimeFormat#forStyle(String)}.
- */
- private final String dateStyle;
-
- /**
- * Construct. The dateStyle 'S-' (which is the same as {@link DateTimeFormat#shortDate()}) will
- * be used for constructing the date format for the current locale. </p> When
- * applyTimeZoneDifference is true, the current time is applied on the parsed date, and the date
- * will be corrected for the time zone difference between the server and the client. For
- * instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9
- * hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the
- * server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while
- * the client sees 12/24. </p>
- *
- * @param applyTimeZoneDifference
- * whether to apply the difference in time zones between client and server
- */
- public StyleDateConverter(boolean applyTimeZoneDifference)
- {
- this("S-", applyTimeZoneDifference);
- }
-
- /**
- * Construct. The provided pattern will be used as the base format (but they will be localized
- * for the current locale) and if null, {@link DateTimeFormat#shortDate()} will be used. </p>
- * When applyTimeZoneDifference is true, the current time is applied on the parsed date, and the
- * date will be corrected for the time zone difference between the server and the client. For
- * instance, if I'm in Seattle and the server I'm working on is in Amsterdam, the server is 9
- * hours ahead. So, if I'm inputting say 12/24 at a couple of hours before midnight, at the
- * server it is already 12/25. If this boolean is true, it will be transformed to 12/25, while
- * the client sees 12/24. </p>
- *
- * @param dateStyle
- * Date style to use. The first character is the date style, and the second character
- * is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
- * for long, and 'F' for full. A date or time may be ommitted by specifying a style
- * character '-'. See {@link DateTimeFormat#forStyle(String)}.
- * @param applyTimeZoneDifference
- * whether to apply the difference in time zones between client and server
- * @throws IllegalArgumentException
- * in case dateStyle is null
- */
- public StyleDateConverter(String dateStyle, boolean applyTimeZoneDifference)
- {
- super(applyTimeZoneDifference);
- if (dateStyle == null)
- {
- throw new IllegalArgumentException("dateStyle must be not null");
- }
- this.dateStyle = dateStyle;
- }
-
- /**
- * Gets the optional date pattern.
- *
- * @return datePattern
- */
- @Override
- public final String getDatePattern(Locale locale)
- {
- return DateTimeFormat.patternForStyle(dateStyle, locale);
- }
-
- /**
- * @return formatter The formatter for the current conversion
- */
- @Override
- protected DateTimeFormatter getFormat(Locale locale)
- {
- return DateTimeFormat.forPattern(getDatePattern(locale))
- .withLocale(locale)
- .withPivotYear(2000);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
deleted file mode 100644
index 3459397..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
+++ /dev/null
@@ -1,304 +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.markup.html.basic;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.wicket.IGenericComponent;
-import org.apache.wicket.datetime.DateConverter;
-import org.apache.wicket.datetime.PatternDateConverter;
-import org.apache.wicket.datetime.StyleDateConverter;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.MarkupStream;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.util.convert.IConverter;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-
-
-/**
- * A label that is mapped to a <code>java.util.Date</code> object and that uses Joda time to format
- * values.
- * <p>
- * You can provide a date pattern in two of the constructors. When not provided,
- * {@link DateTimeFormat#shortDate()} will be used.
- * </p>
- * <p>
- * A special option is applyTimeZoneDifference which is an option that says whether to correct for
- * the difference between the client's time zone and server's time zone. This is true by default.
- * </p>
- *
- * @see DateTime
- * @see DateTimeFormat
- * @see DateTimeZone
- *
- * @author eelcohillenius
- */
-public class DateLabel extends Label implements IGenericComponent<Date, DateLabel>
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDatePattern(String id, IModel<Date> model, String datePattern)
- {
- return new DateLabel(id, model, new PatternDateConverter(datePattern, true));
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDatePattern(String id, String datePattern)
- {
- return forDatePattern(id, null, datePattern);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param dateStyle
- * style to use in case no pattern is provided. Must be two characters from the set
- * {"S", "M", "L", "F", "-"}. Must be not null. See
- * {@link DateTimeFormat#forStyle(String)} for options.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDateStyle(String id, IModel<Date> model, String dateStyle)
- {
- return new DateLabel(id, model, new StyleDateConverter(dateStyle, true));
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param dateStyle
- * style to use in case no pattern is provided. Must be two characters from the set
- * {"S", "M", "L", "F", "-"}. Must be not null. See
- * {@link DateTimeFormat#forStyle(String)} for options.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDateStyle(String id, String dateStyle)
- {
- return forDateStyle(id, null, dateStyle);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forShortStyle(String id)
- {
- return forShortStyle(id, null);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forShortStyle(String id, IModel<Date> model)
- {
- return new DateLabel(id, model, new StyleDateConverter(true));
- }
-
- /**
- * Creates a new DateLabel using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param converter
- * the date converter
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel withConverter(String id, DateConverter converter)
- {
- return withConverter(id, null, converter);
- }
-
- /**
- * Creates a new DateLabel using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param converter
- * the date converter
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel withConverter(String id, IModel<Date> model, DateConverter converter)
- {
- return new DateLabel(id, model, converter);
- }
-
- /** optionally prepend to label. */
- private String after;
-
- /** optionally append to label. */
- private String before;
-
- /**
- * The converter for the Label
- */
- private final DateConverter converter;
-
- /**
- * Construct with a converter.
- *
- * @param id
- * The component id
- * @param converter
- * The converter to use
- */
- public DateLabel(String id, DateConverter converter)
- {
- this(id, null, converter);
- }
-
- /**
- * Construct with a converter.
- *
- * @param id
- * The component id
- * @param model
- * The model
- * @param converter
- * The converter to use
- */
- public DateLabel(String id, IModel<Date> model, DateConverter converter)
- {
- super(id, model);
- if (converter == null)
- {
- throw new IllegalStateException("converter may not be null");
- }
- this.converter = converter;
- }
-
- /**
- * @return after append to label or null
- */
- public String getAfter()
- {
- return after;
- }
-
- /**
- * @return before prepend to label or null
- */
- public String getBefore()
- {
- return before;
- }
-
- /**
- * Returns the specialized converter.
- */
- @Override
- protected IConverter<?> createConverter(Class<?> type)
- {
- if (Date.class.isAssignableFrom(type))
- {
- return converter;
- }
- return null;
- }
-
- /**
- * @param after
- * append to label
- */
- public void setAfter(String after)
- {
- this.after = after;
- }
-
- /**
- * @param before
- * prepend to label
- */
- public void setBefore(String before)
- {
- this.before = before;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
- {
- String s = getDefaultModelObjectAsString();
- if (before != null)
- {
- s = before + s;
- }
- if (after != null)
- {
- s = s + after;
- }
- replaceComponentTagBody(markupStream, openTag, s);
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/form/DateTextField.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/form/DateTextField.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/form/DateTextField.java
deleted file mode 100644
index f537653..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/form/DateTextField.java
+++ /dev/null
@@ -1,243 +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.markup.html.form;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.wicket.datetime.DateConverter;
-import org.apache.wicket.datetime.PatternDateConverter;
-import org.apache.wicket.datetime.StyleDateConverter;
-import org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.util.lang.Args;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-
-/**
- * A TextField that is mapped to a <code>java.util.Date</code> object and that uses Joda time to
- * parse and format values.
- * <p>
- * You should use on of the factory methods to construct the kind you want or use the public
- * constructor and pass in the converter to use.
- * </p>
- * <p>
- * This component tries to apply the time zone difference between the client and server. See the
- * {@link DateConverter#getApplyTimeZoneDifference() date converter} of this package for more
- * information on that.
- * </p>
- *
- * @see StyleDateConverter
- * @see DateTime
- * @see DateTimeFormat
- * @see DateTimeZone
- *
- * @author eelcohillenius
- */
-public class DateTextField extends TextField<Date> implements ITextFormatProvider
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new DateTextField defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return DateTextField
- */
- public static DateTextField forDatePattern(String id, IModel<Date> model, String datePattern)
- {
- return new DateTextField(id, model, new PatternDateConverter(datePattern, true));
- }
-
- /**
- * Creates a new DateTextField defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return DateTextField
- */
- public static DateTextField forDatePattern(String id, String datePattern)
- {
- return forDatePattern(id, null, datePattern);
- }
-
- /**
- * Creates a new DateTextField using the provided date style.
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param dateStyle
- * Date style to use. The first character is the date style, and the second character
- * is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
- * for long, and 'F' for full. A date or time may be ommitted by specifying a style
- * character '-'. See {@link DateTimeFormat#forStyle(String)}.
- * @return DateTextField
- */
- public static DateTextField forDateStyle(String id, IModel<Date> model, String dateStyle)
- {
- return new DateTextField(id, model, new StyleDateConverter(dateStyle, true));
- }
-
- /**
- * Creates a new DateTextField using the provided date style.
- *
- * @param id
- * The id of the text field
- * @param dateStyle
- * Date style to use. The first character is the date style, and the second character
- * is the time style. Specify a character of 'S' for short style, 'M' for medium, 'L'
- * for long, and 'F' for full. A date or time may be ommitted by specifying a style
- * character '-'. See {@link DateTimeFormat#forStyle(String)}.
- * @return DateTextField
- */
- public static DateTextField forDateStyle(String id, String dateStyle)
- {
- return forDateStyle(id, null, dateStyle);
- }
-
- /**
- * Creates a new DateTextField defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @return DateTextField
- */
- public static DateTextField forShortStyle(String id)
- {
- return forShortStyle(id, null, true);
- }
-
- /**
- * Creates a new DateTextField defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param applyTimeZoneDifference
- * Whether to apply the time zone difference between client and server
- * @return DateTextField
- */
- public static DateTextField forShortStyle(String id, IModel<Date> model,
- boolean applyTimeZoneDifference)
- {
- return new DateTextField(id, model, new StyleDateConverter(applyTimeZoneDifference));
- }
-
- /**
- * Creates a new DateTextField using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param converter
- * the date converter
- * @return DateTextField
- */
- public static DateTextField withConverter(String id, DateConverter converter)
- {
- return withConverter(id, null, converter);
- }
-
- /**
- * Creates a new DateTextField using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param converter
- * the date converter
- * @return DateTextField
- */
- public static DateTextField withConverter(String id, IModel<Date> model, DateConverter converter)
- {
- return new DateTextField(id, model, converter);
- }
-
- /**
- * The converter for the TextField
- */
- private final DateConverter converter;
-
- /**
- * Construct with a converter.
- *
- * @param id
- * The component id
- * @param model
- * The model
- * @param converter
- * The converter to use
- */
- public DateTextField(String id, IModel<Date> model, DateConverter converter)
- {
- super(id, model, Date.class);
-
- Args.notNull(converter, "converter");
- this.converter = converter;
- }
-
- /**
- * Construct with a converter, and a null model.
- *
- * @param id
- * The component id
- * @param converter
- * The converter to use
- */
- public DateTextField(String id, DateConverter converter)
- {
- this(id, null, converter);
- }
-
- /**
- * @return The specialized converter.
- * @see org.apache.wicket.Component#createConverter(java.lang.Class)
- */
- @Override
- protected IConverter<?> createConverter(Class<?> clazz)
- {
- if (Date.class.isAssignableFrom(clazz))
- {
- return converter;
- }
- return null;
- }
-
- /**
- * @see org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider#getTextFormat()
- */
- @Override
- public final String getTextFormat()
- {
- return converter.getDatePattern(getLocale());
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION
deleted file mode 100644
index 094e00c..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION
+++ /dev/null
@@ -1,2 +0,0 @@
-http://developer.yahoo.com/yui/
-this version: 2.8.2r1
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
deleted file mode 100644
index f8cfec5..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.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;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-
-/**
- * Use the {@link #load(org.apache.wicket.markup.head.IHeaderResponse)} method to initialize the YUI library using the YUI loader.
- * It is OK to call this multiple times.
- *
- * By default the resource stream gets gzipped. You may disable it via
- * Application.get().getResourceSettings().getDisableGZipCompression()
- *
- * @author eelcohillenius
- */
-public final class YuiLib
-{
- private static ResourceReference YUILOADER;
-
- /**
- * Load the YUI loader script. After that, you can declare YUI dependencies using
- * YAHOO.util.YUILoader.
- *
- * @param response
- * header response
- */
- public static void load(IHeaderResponse response)
- {
- response.render(JavaScriptHeaderItem.forReference(getYuiLoader()));
- }
-
- private static ResourceReference getYuiLoader()
- {
- if (YUILOADER == null)
- {
- StringBuilder sb = new StringBuilder("yuiloader/yuiloader");
- if (Application.get().usesDeploymentConfig())
- {
- sb.append("-min");
- }
- sb.append(".js");
- YUILOADER = new PackageResourceReference(YuiLib.class, sb.toString());
- }
- return YUILOADER;
- }
-
- /**
- * Prevent construction.
- */
- private YuiLib()
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png
deleted file mode 100644
index 73634d6..0000000
Binary files a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java
deleted file mode 100644
index b448196..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java
+++ /dev/null
@@ -1,260 +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.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import org.apache.wicket.extensions.yui.YuiLib;
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.html.WebComponent;
-import org.apache.wicket.request.resource.PackageResourceReference;
-
-
-/**
- * Abstract calendar component based on the YUI (Yahoo User Interface library) javascript widget.
- * <p>
- * Although this component by itself is fully functional, it doesn't do much other than just
- * displaying the calendar. Hence, this class is abstract.
- * </p>
- * <p>
- * An easy way to build upon this component is to override
- * {@link #appendToInit(String, String, String, StringBuffer)} and add event handlers etc. in the
- * YUI widget's initialization function.
- * </p>
- * See <a href="http://developer.yahoo.com/yui/calendar/">YUI's calendar documentation</a> for more
- * info.
- *
- * @author eelcohillenius
- *
- * @see DatePicker
- */
-// TODO provide localization strings (base them on the messages of
-// JsDatePicker?)
-public abstract class AbstractCalendar extends WebComponent
-{
- private static final long serialVersionUID = 1L;
-
- private final boolean contributeDependencies;
-
- /**
- * Construct. Contributes packaged dependencies.
- *
- * @param id
- * The component id
- */
- public AbstractCalendar(String id)
- {
- this(id, true);
- }
-
- /**
- * Construct.
- *
- * @param id
- * The component id
- * @param contributeDependencies
- * Whether to contribute the packaged dependencies. Pass false in case you want to
- * include the dependencies manually in your own page, e.g. when you want to keep
- * them in your web application dir. To contribute yourself (in case you want to pass
- * false), your page header should look like:
- *
- * <pre>
- * <script type="text/javascript" src="yahoo.js"></script>
- * <script type="text/javascript" src="dom.js"></script>
- * <script type="text/javascript" src="event.js"></script>
- * <script type="text/javascript" src="calendar.js"></script>
- * <link rel="stylesheet" type="text/css" href="calendar.css" />
- * </pre>
- */
- public AbstractCalendar(String id, boolean contributeDependencies)
- {
-
- super(id);
- setOutputMarkupId(true);
- this.contributeDependencies = contributeDependencies;
- }
-
- /**
- * Gets the id of the javascript widget. Note that this is the non-namespaced id, so depending
- * on what you want to do with it, you may need to prepend 'YAHOO.wicket.' to it. Or you can
- * call {@link #getJavaScriptWidgetId()}.
- *
- * @return The javascript id
- * @see #getJavaScriptWidgetId()
- */
- public final String getJavaScriptId()
- {
- return getMarkupId() + "Js";
- }
-
- /**
- * The name spaced id of the widget.
- *
- * @return The widget id
- * @see #getJavaScriptId()
- */
- public final String getJavaScriptWidgetId()
- {
- return "YAHOO.wicket." + getJavaScriptId();
- }
-
- /**
- * add header contributions for packaged resources.
- *
- * @param response
- * the header response to contribute to
- */
- private void contributeDependencies(IHeaderResponse response)
- {
- response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(
- YuiLib.class, "yahoodomevent/yahoo-dom-event.js")));
- response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(
- AbstractCalendar.class, "calendar-min.js")));
- response.render(CssHeaderItem.forReference(new PackageResourceReference(
- AbstractCalendar.class, "assets/skins/sam/calendar.css")));
- }
-
- /**
- * Append javascript to the initialization function for the YUI widget. Can be used by
- * subclasses to conveniently extend configuration without having to write a separate
- * contribution.
- *
- * @param markupId
- * The markup id of the calendar component
- * @param javascriptId
- * the non-name spaced javascript id of the widget
- * @param javascriptWidgetId
- * the name space id of the widget
- * @param b
- * the buffer to append the script to
- */
- protected void appendToInit(String markupId, String javascriptId, String javascriptWidgetId,
- StringBuilder b)
- {
- }
-
- /**
- * Gives overriding classes the option of adding (or even changing/ removing) configuration
- * properties for the javascript widget. See <a
- * href="http://developer.yahoo.com/yui/calendar/">the widget's documentation</a> for the
- * available options. If you want to override/ remove properties, you obviously should call
- * <code>super.configureWidgetProperties(properties)</code>.
- *
- * @param widgetProperties
- * the current widget properties
- */
- protected void configureWidgetProperties(Map<Object, Object> widgetProperties)
- {
- }
-
- @Override
- public void renderHead(IHeaderResponse response)
- {
- if (contributeDependencies)
- {
- contributeDependencies(response);
- }
-
-
- // not pretty to look at, but cheaper than using a template
- String markupId = AbstractCalendar.this.getMarkupId();
- String javascriptId = getJavaScriptId();
- String javascriptWidgetId = getJavaScriptWidgetId();
- StringBuilder b = new StringBuilder();
- // initialize wicket namespace and register the init function
- // for the YUI widget
- b.append("YAHOO.namespace(\"wicket\");\nfunction init");
- b.append(javascriptId);
- b.append("() {\n");
-
- // instantiate the calendar object
- b.append(" ");
- b.append(javascriptWidgetId);
- b.append(" = new YAHOO.widget.Calendar(\"");
- b.append(javascriptId);
- b.append("\",\"");
- b.append(markupId);
-
- Properties p = new Properties();
- configureWidgetProperties(p);
- b.append("\", { ");
- for (Iterator<Entry<Object, Object>> i = p.entrySet().iterator(); i.hasNext();)
- {
- Entry<Object, Object> entry = i.next();
- b.append(entry.getKey());
- Object value = entry.getValue();
- if (value instanceof CharSequence)
- {
- b.append(":\"");
- b.append(value);
- b.append("\"");
- }
- else if (value instanceof CharSequence[])
- {
- b.append(":[");
- CharSequence[] valueArray = (CharSequence[])value;
- for (int j = 0; j < valueArray.length; j++)
- {
- CharSequence tmpValue = valueArray[j];
- b.append("\"");
- b.append(tmpValue);
- b.append("\"");
- if (j < valueArray.length - 1)
- {
- b.append(",");
- }
- }
- b.append("]");
- }
- else
- {
- b.append(":");
- b.append(value);
- }
- // TODO handle arrays
- if (i.hasNext())
- {
- b.append(",");
- }
- }
-
- b.append(" });\n");
-
- // append the javascript we want for our init function; call
- // this in an overridable method so that clients can add their
- // stuff without needing a big ass API
- appendToInit(markupId, javascriptId, javascriptWidgetId, b);
-
- // trigger rendering
- b.append(" ");
- b.append(javascriptWidgetId);
- b.append(".render();\n");
-
- b.append("}\n");
- // register the function for execution when the page is loaded
- b.append("YAHOO.util.Event.addListener(window, \"load\", init");
- b.append(javascriptId);
- b.append(");");
-
- response.render(JavaScriptHeaderItem.forScript(b, null));
- }
-}
http://git-wip-us.apache.org/repos/asf/wicket/blob/2bb684c1/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateField.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateField.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateField.java
deleted file mode 100644
index 5c08241..0000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateField.java
+++ /dev/null
@@ -1,81 +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.datetime.markup.html.form.DateTextField;
-import org.apache.wicket.model.IModel;
-
-/**
- * Works on a {@link java.util.Date} object. Displays a {@link DateTextField} and a
- * {@link DatePicker calendar popup}.<br/>
- * <p>
- * Note: {@link DateField} must <strong>not</strong> be associated with an
- * <code><input></code> tag, as opposed to {@link DateTextField}! The corresponding tag is
- * typically either a <code><div></code> or a <code><span></code> tag.
- * </p>
- *
- * Example:
- * <p>
- * <u>Java:</u>
- *
- * <pre>
- * DateField dateField = new DateField("birthday");
- * </pre>
- *
- * </p>
- * <p>
- * <u>Markup:</u>
- *
- * <pre>
- * <div wicket:id="birthday"></div>
- * </pre>
- *
- * </p>
- *
- * @author eelcohillenius
- */
-public class DateField extends DateTimeField
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct.
- *
- * @param id
- */
- public DateField(String id)
- {
- this(id, null);
- }
-
- /**
- * Construct.
- *
- * @param id
- * @param model
- */
- public DateField(String id, IModel<Date> model)
- {
- super(id, model);
-
- get(HOURS).setVisibilityAllowed(false);
- get(MINUTES).setVisibilityAllowed(false);
- get(AM_OR_PM_CHOICE).setVisibilityAllowed(false);
- }
-}