[jira] [Resolved] (WICKET-6548) CSVDataExporter custom converters and resource strings

2018-04-06 Thread Sven Meier (JIRA)

 [ 
https://issues.apache.org/jira/browse/WICKET-6548?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sven Meier resolved WICKET-6548.

   Resolution: Fixed
Fix Version/s: 8.0.0

CSVDataExporter can now be used with a specific IConverterLocator and with 
wrapped models.

org.apache.wicket.examples.repeater.DataTablePage shows its usage.

> CSVDataExporter custom converters and resource strings
> --
>
> Key: WICKET-6548
> URL: https://issues.apache.org/jira/browse/WICKET-6548
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket-extensions
>Affects Versions: 8.0.0-M9
>Reporter: Sven Meier
>Assignee: Sven Meier
>Priority: Minor
> Fix For: 8.0.0
>
>
> CSVDataExporter renders its output without any component scope currently. 
> This has the disadvantage
>  * that no custom converters (besides the ones from the Application's 
> IConverterLocator) can be used
>  * any resource models in the columns (i.e. the display model for the header) 
> are not resolved relative to a component or one of its parents



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


wicket git commit: WICKET-6548 improve CSVDataExporter

2018-04-06 Thread svenmeier
Repository: wicket
Updated Branches:
  refs/heads/master 976f28de7 -> 71de9964f


WICKET-6548 improve CSVDataExporter

allow custom converter locator and wrapping of models


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/71de9964
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/71de9964
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/71de9964

Branch: refs/heads/master
Commit: 71de9964fd112eafdb71a8d70bd46d5d1840437e
Parents: 976f28d
Author: Sven Meier 
Authored: Fri Apr 6 20:08:24 2018 +0200
Committer: Sven Meier 
Committed: Fri Apr 6 22:07:35 2018 +0200

--
 .../wicket/examples/repeater/DataTablePage.java |  62 ++--
 .../repeater/DataTablePage.utf8.properties  |  21 +++
 .../data/table/export/CSVDataExporter.java  | 149 +--
 .../data/table/export/CSVDataExporterTest.java  |  71 +
 4 files changed, 245 insertions(+), 58 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/wicket/blob/71de9964/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/DataTablePage.java
--
diff --git 
a/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/DataTablePage.java
 
b/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/DataTablePage.java
index c99d65c..8383796 100644
--- 
a/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/DataTablePage.java
+++ 
b/wicket-examples/src/main/java/org/apache/wicket/examples/repeater/DataTablePage.java
@@ -16,10 +16,14 @@
  */
 package org.apache.wicket.examples.repeater;
 
+import java.text.DateFormat;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.wicket.AttributeModifier;
+import org.apache.wicket.IConverterLocator;
 import 
org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
 import 
org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
 import org.apache.wicket.extensions.markup.html.repeater.data.table.ColGroup;
@@ -33,7 +37,9 @@ import 
org.apache.wicket.extensions.markup.html.repeater.data.table.export.CSVDa
 import 
org.apache.wicket.extensions.markup.html.repeater.data.table.export.ExportToolbar;
 import org.apache.wicket.markup.repeater.Item;
 import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.util.convert.IConverter;
+import org.apache.wicket.util.convert.converter.DateConverter;
 
 
 /**
@@ -52,7 +58,7 @@ public class DataTablePage extends BasePage
{
List> columns = new ArrayList<>();
 
-   columns.add(new AbstractColumn(new 
Model<>("Actions"))
+   columns.add(new AbstractColumn(new 
ResourceModel("actions"))
{
@Override
public void populateItem(Item 
cellItem, String componentId,
@@ -62,7 +68,7 @@ public class DataTablePage extends BasePage
}
});
 
-   columns.add(new PropertyColumn(new 
Model<>("ID"), "id")
+   columns.add(new PropertyColumn(new 
ResourceModel("id"), "id")
{
@Override
public String getCssClass()
@@ -71,9 +77,9 @@ public class DataTablePage extends BasePage
}
});
 
-   columns.add(new LambdaColumn<>(Model.of("First Name"), 
"firstName", Contact::getFirstName));
+   columns.add(new LambdaColumn<>(new ResourceModel("firstName"), 
"firstName", Contact::getFirstName));
 
-   columns.add(new LambdaColumn(new Model<>("Last 
Name"), "lastName", Contact::getLastName)
+   columns.add(new LambdaColumn(new 
ResourceModel("lastName"), "lastName", Contact::getLastName)
{
@Override
public String getCssClass()
@@ -82,14 +88,35 @@ public class DataTablePage extends BasePage
}
});
 
-   columns.add(new PropertyColumn<>(new Model<>("Home Phone"), 
"homePhone"));
-   columns.add(new PropertyColumn<>(new Model<>("Cell Phone"), 
"cellPhone"));
+   columns.add(new PropertyColumn<>(new 
ResourceModel("homePhone"), "homePhone"));
+   columns.add(new PropertyColumn<>(new 
ResourceModel("cellPhone"), "cellPhone"));
+   columns.add(new PropertyColumn<>(new ResourceModel("bornDate"), 
"bornDate"));
 
   

[jira] [Commented] (WICKET-6548) CSVDataExporter custom converters and resource strings

2018-04-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-6548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16428875#comment-16428875
 ] 

ASF subversion and git services commented on WICKET-6548:
-

Commit 71de9964fd112eafdb71a8d70bd46d5d1840437e in wicket's branch 
refs/heads/master from [~svenmeier]
[ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=71de996 ]

WICKET-6548 improve CSVDataExporter

allow custom converter locator and wrapping of models


> CSVDataExporter custom converters and resource strings
> --
>
> Key: WICKET-6548
> URL: https://issues.apache.org/jira/browse/WICKET-6548
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket-extensions
>Affects Versions: 8.0.0-M9
>Reporter: Sven Meier
>Assignee: Sven Meier
>Priority: Minor
>
> CSVDataExporter renders its output without any component scope currently. 
> This has the disadvantage
>  * that no custom converters (besides the ones from the Application's 
> IConverterLocator) can be used
>  * any resource models in the columns (i.e. the display model for the header) 
> are not resolved relative to a component or one of its parents



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (WICKET-6548) CSVDataExporter custom converters and resource strings

2018-04-06 Thread Sven Meier (JIRA)
Sven Meier created WICKET-6548:
--

 Summary: CSVDataExporter custom converters and resource strings
 Key: WICKET-6548
 URL: https://issues.apache.org/jira/browse/WICKET-6548
 Project: Wicket
  Issue Type: Improvement
  Components: wicket-extensions
Affects Versions: 8.0.0-M9
Reporter: Sven Meier
Assignee: Sven Meier


CSVDataExporter renders its output without any component scope currently. This 
has the disadvantage
 * that no custom converters (besides the ones from the Application's 
IConverterLocator) can be used
 * any resource models in the columns (i.e. the display model for the header) 
are not resolved relative to a component or one of its parents



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WICKET-6321) Support Integrity and Crossorigin attributes for JavaScriptUrlReferenceHeaderItem

2018-04-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/WICKET-6321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16428647#comment-16428647
 ] 

ASF GitHub Bot commented on WICKET-6321:


Github user svenmeier commented on the issue:

https://github.com/apache/wicket/pull/273
  
@tremel thanks for your usage example.

It seems to me we're mixing at least three topics in this pull request:
- JavaScriptReferenceHeaderItem needs integrity and and crossOrigin ... fine
- JavaScriptUtils#writeJavaScriptUrl() is getting to many parameters, maybe 
an attribute map can help here?
- references cannot alter the attributes of their headerItem (besides the 
url of course): defer, async, charset and now integrity and crossOrigin

IMHO we should solve the last issue separately and uniformly, i.e. not 
IntegrityAttributed but maybe a broader interface for all attributes or just a 
callback that allows the reference to alter the headerItem.
For now you could use an IHeaderResponseDecorator to set the attributes.


> Support Integrity and Crossorigin attributes for 
> JavaScriptUrlReferenceHeaderItem 
> --
>
> Key: WICKET-6321
> URL: https://issues.apache.org/jira/browse/WICKET-6321
> Project: Wicket
>  Issue Type: Improvement
>  Components: wicket
>Affects Versions: 8.0.0-M3
>Reporter: Mikhail Fursov
>Priority: Major
> Fix For: 8.0.0
>
> Attachments: CORS.zip, wicket-6321-20180306.diff, wicket-6321.diff
>
>
> Example of secure script reference:
>  src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js";
>  integrity="sha256-+kIbbrvS+0dNOjhmQJzmwe/RILR/8lb/+4+PUNVW09k=" 
> crossorigin="anonymous">



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)