}
String displayName = fo.getName();
final CustomFilter cf = new CustomFilter(displayName, code);
map.put(displayName, cf);
String after = (String) fo.getAttribute(AFTER_ID);
afterMap.put(cf, after);
Boolean enabled = (Boolean) fo.getAttribute(ENABLED_ID);
if (enabled != null && (boolean) enabled) {
enabledSet.add(cf);
}
cf.getChangedEvent().addListener(new FilterChangedListener(fo, cf));
customFilters.add(cf);
}
for (int j = 0; j < customFilters.size(); j++) {
for (int i = 0; i < customFilters.size(); i++) {
List<CustomFilter> copiedList = new ArrayList<CustomFilter>(customFilters);
for (CustomFilter cf : copiedList) {
String after = afterMap.get(cf);
if (map.containsKey(after)) {
CustomFilter afterCf = map.get(after);
int index = customFilters.indexOf(afterCf);
int currentIndex = customFilters.indexOf(cf);
if (currentIndex < index) {
customFilters.remove(currentIndex);