[
https://issues.apache.org/jira/browse/WICKET-3480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13053759#comment-13053759
]
Martin Grigorov commented on WICKET-3480:
-----------------------------------------
Because these are the implementations we are aware of, but who knows what is in
the wild.
I think we should keep the old AbstractXYZColumn classes unless they are proven
to be useless.
Unfortunately it is not possible to both keep them and introduce the
AbstractPropertyColumn because for PTC is has to extend from AbstractColumn as
-2.patch does it but for PRC it has to extend from AbstractRenderableColumn.
Indeed a trait will solve that quite elegantly.
Now I'm thinking about composition with a helper instead of inheritance. But I
have to try it to see whether it will work.
> org/apache/wicket/extensions/markup/html/tree/table/{PropertyRenderableColumn,PropertyTreeColumn}
> common code
> -------------------------------------------------------------------------------------------------------------
>
> Key: WICKET-3480
> URL: https://issues.apache.org/jira/browse/WICKET-3480
> Project: Wicket
> Issue Type: Improvement
> Components: wicket-extensions
> Affects Versions: 1.5-RC1
> Environment: all
> Reporter: Richard Emberson
> Assignee: Juergen Donnerstag
> Priority: Trivial
> Attachments: wicket-3480-2.patch, wicket-3480.patch
>
>
> org/apache/wicket/extensions/markup/html/tree/table/PropertyRenderableColumn
> and
> org/apache/wicket/extensions/markup/html/tree/table/PropertyTreeColumn
> both inherit from AbstractColumn
> and have the following very similar methods:
> In PropertyRenderableColumn
> @Override
> public String getNodeValue(TreeNode node)
> {
> Object result = PropertyResolver.getValue(propertyExpression, node);
> if (converter != null)
> {
> Locale locale = this.locale;
> if (locale == null)
> {
> locale = Session.get().getLocale();
> }
> return converter.convertToString(result, locale);
> }
> else
> {
> return result != null ? result.toString() : "";
> }
> }
> and
> In PropertyTreeColumn
> @Override
> public String renderNode(TreeNode node)
> {
> Object result = PropertyResolver.getValue(propertyExpression, node);
> if (converter != null)
> {
> Locale locale = this.locale;
> if (locale == null)
> {
> locale = Session.get().getLocale();
> }
> return converter.convertToString(result, locale);
> }
> else
> {
> return result != null ? result.toString() : null;
> }
> }
> One returns null and the other returns "" when result is null.
> Question 1: Can the two methods be merged?
> Question 2: Why null in one case and "" in the other?
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira