syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [syncope] branch master updated: [SYNCOPE-1407] Passing conversion pattern to AjaxDatePicker (but not AjaxDateTimePicker)
Date Tue, 04 Dec 2018 15:57:54 GMT
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/master by this push:
     new e4a6d35  [SYNCOPE-1407] Passing conversion pattern to AjaxDatePicker (but not AjaxDateTimePicker)
e4a6d35 is described below

commit e4a6d350373fcde0b0937238badd82c901e0a67a
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
AuthorDate: Tue Dec 4 16:56:57 2018 +0100

    [SYNCOPE-1407] Passing conversion pattern to AjaxDatePicker (but not AjaxDateTimePicker)
---
 .../org/apache/syncope/client/console/SyncopeConsoleSession.java | 4 +---
 .../console/wicket/markup/html/form/AjaxDateFieldPanel.java      | 2 +-
 .../console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java  | 9 ++++++---
 .../client/console/wicket/markup/html/form/DateFieldPanel.java   | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
index 6f9d7a9..324b9ea 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
@@ -25,7 +25,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -338,7 +337,6 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
     }
 
     public FastDateFormat getDateFormat() {
-        Locale locale = getLocale() == null ? Locale.ENGLISH : getLocale();
-        return FastDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);
+        return FastDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, getLocale());
     }
 }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
index 8020b70..69e572c 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateFieldPanel.java
@@ -31,7 +31,7 @@ public class AjaxDateFieldPanel extends DateFieldPanel {
     public AjaxDateFieldPanel(final String id, final String name, final IModel<Date>
model, final String datePattern) {
         super(id, name, model, datePattern);
 
-        field = new AjaxDatePicker("field", model, SyncopeConsoleSession.get().getDateFormat().getLocale());
+        field = new AjaxDatePicker("field", model, SyncopeConsoleSession.get().getLocale(),
datePattern);
         add(field.setLabel(new Model<>(name)).setOutputMarkupId(true));
     }
 
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
index 723dd00..8d5fe2e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/AjaxDateTimeFieldPanel.java
@@ -29,10 +29,13 @@ public class AjaxDateTimeFieldPanel extends DateFieldPanel {
     private static final long serialVersionUID = -428975732068281726L;
 
     public AjaxDateTimeFieldPanel(
-            final String id, final String name, final IModel<Date> model, final String
datePattern) {
-        super(id, name, model, datePattern);
+            final String id, final String name, final IModel<Date> model, final String
dateTimePattern) {
 
-        field = new AjaxDateTimePicker("field", model, SyncopeConsoleSession.get().getDateFormat().getLocale());
+        super(id, name, model, dateTimePattern);
+
+        // dateTimePattern should be spit into separate date and time pattern strings in
order to be passed to the
+        // AjaxDateTimePicker constructor, but there is no safe way to do that - ignoring
+        field = new AjaxDateTimePicker("field", model, SyncopeConsoleSession.get().getLocale());
         add(field.setLabel(new Model<>(name)).setOutputMarkupId(true));
     }
 
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/DateFieldPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/DateFieldPanel.java
index 806f09d..436f724 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/DateFieldPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/DateFieldPanel.java
@@ -127,6 +127,6 @@ public class DateFieldPanel extends FieldPanel<Date> {
     public void renderHead(final IHeaderResponse response) {
         super.renderHead(response);
         response.render(JavaScriptHeaderItem.forReference(
-                new KendoCultureResourceReference(SyncopeConsoleSession.get().getDateFormat().getLocale())));
+                new KendoCultureResourceReference(SyncopeConsoleSession.get().getLocale())));
     }
 }


Mime
View raw message