Author: andrei_exadel
Date: 2008-05-27 12:43:06 -0400 (Tue, 27 May 2008)
New Revision: 8788
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/IndexBean.java
Log:
component list sorting
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-05-27
16:31:17 UTC (rev 8787)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-05-27
16:43:06 UTC (rev 8788)
@@ -1,7 +1,10 @@
package org.ajax4jsf.bean;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class IndexBean {
@@ -31,33 +34,32 @@
return link;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof ComponentItem)) {
- return false;
- }
-
- if (obj == null) {
- return true;
- }
- return name.equals(((ComponentItem)obj).name);
- }
-
};
+ private void sortList () {
+ String [] names = new String [list.size()];
+ Map<String, ComponentItem> map = new HashMap<String, ComponentItem>();
+ for (int i=0; i < list.size(); i++) {
+ names [i] = list.get(i).name;
+ map.put(list.get(i).name, list.get(i));
+ }
+ Arrays.sort(names);
+ list = new ArrayList<ComponentItem>();
+ for (String name : names) {
+ list.add(map.get(name));
+ }
+ }
+
public IndexBean() {
list.add(new ComponentItem("<a4j:commandButton>",
"ajaxCommandButton/ajaxButtonTest.xhtml"));
list.add(new ComponentItem("<a4j:commandLink>",
"ajaxCommandLink/ajaxLinkTest.xhtml"));
list.add(new ComponentItem("<a4j:poll>",
"ajaxPoll/ajaxPollTest.xhtml"));
list.add(new ComponentItem("<a4j:region>",
"ajaxRegion/ajaxRegionTest.xhtml"));
- list.add(new ComponentItem("<rich:calendar>",
"ajaxStatus/ajaxStatusTest.xhtml"));
- list.add(new ComponentItem("<rich:combobox>",
"calendar/calendarTest.xhtml"));
- list.add(new ComponentItem("<rich:contextMenu>",
"comboBox/comboBoxTest.xhtml"));
- list.add(new ComponentItem("<rich:dataTable>",
"contextMenu/contextMenu.xhtml"));
- list.add(new ComponentItem("<rich:dropDownMenu>",
"dataTable/dataTableTest.xhtml"));
+ list.add(new ComponentItem("<rich:calendar>",
"calendar/calendarTest.xhtml"));
+ list.add(new ComponentItem("<rich:combobox>",
"comboBox/comboBoxTest.xhtml"));
+ list.add(new ComponentItem("<rich:contextMenu>",
"contextMenu/contextMenu.xhtml"));
+ list.add(new ComponentItem("<rich:dataTable>",
"dataTable/dataTableTest.xhtml"));
+ list.add(new ComponentItem("<rich:dropDownMenu>",
"dropDownMenu/dropDownMenuTest.xhtml"));
list.add(new ComponentItem("<rich:inplaceSelect>",
"inplaceSelect/inplaceSelectTest.xhtml"));
list.add(new ComponentItem("<rich:inputNumberSpinner>",
"inputNumberSpinner/inputNumberSpinnerTest.xhtml"));
list.add(new ComponentItem("<rich:jsFunction>",
"jsFunction/jsFunctionTest.xhtml"));
@@ -73,6 +75,8 @@
list.add(new ComponentItem("<rich:tabPanel>",
"tabPanel/tabPanelTest.xhtml"));
list.add(new ComponentItem("<rich:togglePanel>",
"togglePanel/togglePanelTest.xhtml"));
+ sortList();
+
}
/**
Show replies by date