You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2012/05/11 15:02:07 UTC
[1/2] git commit: Remove unused logic.
Updated Branches:
refs/heads/master 0754d1bc4 -> e211db8d6
Remove unused logic.
contributed-by: jesse long via github
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e211db8d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e211db8d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e211db8d
Branch: refs/heads/master
Commit: e211db8d62a6d82f9db8bf266f2d5602255f423f
Parents: 9e6e41d
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri May 11 16:01:14 2012 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri May 11 16:01:14 2012 +0300
----------------------------------------------------------------------
.../org/apache/wicket/datetime/DateConverter.java | 44 ++-------------
.../datetime/markup/html/basic/DateLabel.java | 1 -
.../datetime/markup/html/form/DateTextField.java | 1 -
3 files changed, 6 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/e211db8d/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
index 7962d3c..3aa95eb 100644
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java
+++ b/wicket-datetime/src/main/java/org/apache/wicket/datetime/DateConverter.java
@@ -20,10 +20,9 @@ import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-import org.apache.wicket.Component;
import org.apache.wicket.Session;
-import org.apache.wicket.protocol.http.request.WebClientInfo;
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;
@@ -51,11 +50,6 @@ public abstract class DateConverter implements IConverter<Date>
private final boolean applyTimeZoneDifference;
/**
- * Optional component to use for determining the locale.
- */
- private Component component = null;
-
- /**
* 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
@@ -75,6 +69,7 @@ public abstract class DateConverter implements IConverter<Date>
* @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))
@@ -91,7 +86,7 @@ public abstract class DateConverter implements IConverter<Date>
if (applyTimeZoneDifference)
{
TimeZone zone = getClientTimeZone();
- DateTime dateTime = null;
+ DateTime dateTime;
// set time zone for client
format = format.withZone(getTimeZone());
@@ -131,6 +126,7 @@ public abstract class DateConverter implements IConverter<Date>
* @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());
@@ -166,31 +162,13 @@ public abstract class DateConverter implements IConverter<Date>
}
/**
- * @return optional component to use for determining the locale.
- */
- public final Component getComponent()
- {
- return component;
- }
-
- /**
* @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);
/**
- * Sets component for getting the locale
- *
- * @param component
- * optional component to use for determining the locale.
- */
- public final void setComponent(Component component)
- {
- this.component = component;
- }
-
- /**
* Gets the client's time zone.
*
* @return The client's time zone or null
@@ -207,23 +185,13 @@ public abstract class DateConverter implements IConverter<Date>
/**
* @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 locale to use.
- *
- * @return the locale from either the component if that is set, or from the session
- */
- protected Locale getLocale()
- {
- Component c = getComponent();
- return (c != null) ? c.getLocale() : Session.get().getLocale();
- }
-
- /**
* 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.
*
http://git-wip-us.apache.org/repos/asf/wicket/blob/e211db8d/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
index e4a4c9a..550bfed 100644
--- 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
@@ -233,7 +233,6 @@ public class DateLabel extends Label
{
throw new IllegalStateException("converter may not be null");
}
- converter.setComponent(this);
this.converter = converter;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/e211db8d/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
index d555b6a..a358d97 100644
--- 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
@@ -202,7 +202,6 @@ public class DateTextField extends TextField<Date> implements ITextFormatProvide
super(id, model, Date.class);
Args.notNull(converter, "converter");
- converter.setComponent(this);
this.converter = converter;
}