You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Richard Emberson (JIRA)" <ji...@apache.org> on 2010/11/27 19:46:37 UTC

[jira] Updated: (WICKET-3201) icket/markup/html/debug/PageView clearing and possibly sorting empty list

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

Richard Emberson updated WICKET-3201:
-------------------------------------

    Priority: Trivial  (was: Major)

> icket/markup/html/debug/PageView clearing and possibly sorting empty list
> -------------------------------------------------------------------------
>
>                 Key: WICKET-3201
>                 URL: https://issues.apache.org/jira/browse/WICKET-3201
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5-M3
>         Environment: all
>            Reporter: Richard Emberson
>            Priority: Trivial
>
> In the constructor for the class icket/markup/html/debug/PageView a list is created,
> then the empty list is cleared, possibly elements are added to the list and
> the list is sorted (even if no element were added):
>     // Create an empty list. It'll be filled later
>     final List<ComponentData> data = new ArrayList<ComponentData>();
>     // Name of page
>     add(new Label("info", page == null ? "[Stateless Page]" : page.toString()));
>     // Get the components data and fill and sort the list
>     data.clear();
>     if (page != null)
>     {
>       data.addAll(getComponentData(page));
>     }
>     Collections.sort(data, new Comparator<ComponentData>()
>     {
>       public int compare(ComponentData o1, ComponentData o2)
>       {
>         return (o1).path.compareTo((o2).path);
>       }
>     });
>     // Create the table containing the list the components
>     add(new ListView<ComponentData>("components", data)
>     { ..... }
> Consider the re-write:
>   // Name of page
>   add(new Label("info", page == null ? "[Stateless Page]" : page.toString()));
>     
>   // Create an empty list. It'll be filled later
>   List<ComponentData> data = null;
>   
>   if (page != null) {
>     // Get the components data and fill and sort the list
>     data =  new ArrayList<ComponentData>(getComponentData(page));
>     Collections.sort(data, new Comparator<ComponentData>() {
>         public int compare(ComponentData o1, ComponentData o2) {
>           return (o1).path.compareTo((o2).path);
>         }                         
>     }); 
>   } else {
>     data = Collections.emptyList;
>   }
>   
>   // Create the table containing the list the components
>   add(new ListView<ComponentData>("components", data)
>   { ...... }
> The list is not cleared and is only sorted if there is something in it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.