[
https://issues.apache.org/jira/browse/WICKET-3480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Juergen Donnerstag updated WICKET-3480:
---------------------------------------
Attachment: wicket-3480.patch
This one of the situation where I wish Java had mixins or traits.
I moved the logic and associated variable down to AbstractColumn (common super
class) and eliminated the now empty class in the middle.
I assume that is ok since probably only very few will derive their own columns
from AbstractColumn but rather extend PropertiesXXX anyway. So hopefully it's
theoretical point only.
I've attached the patch for others to review.
> 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.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