1 package com.sslexplorer.extensions; 2 3 import java.util.ArrayList ; 4 import java.util.Iterator ; 5 import java.util.List ; 6 7 8 public class ExtensionBundleCategoryItem { 9 10 private String category ; 11 private List <ExtensionBundleTypeItem> types; 12 13 public ExtensionBundleCategoryItem(String category, ExtensionBundleItem extensionBundleItem) { 14 this.category = category; 15 this.types = new ArrayList <ExtensionBundleTypeItem>(); 16 addExtensionBundleItem(extensionBundleItem); 17 } 18 19 public String getCategory() { 20 return category; 21 } 22 23 public void setCategory(String category) { 24 this.category = category; 25 } 26 27 public void addExtensionBundleItem(ExtensionBundleItem extensionBundleItem){ 28 ExtensionBundleTypeItem typeItem = getTypeItem(new Integer (extensionBundleItem.getBundle().getType())); 29 if (typeItem == null){ 30 ExtensionBundleTypeItem newTypeItem = new ExtensionBundleTypeItem(new Integer (extensionBundleItem.getBundle().getType()), extensionBundleItem, this); 31 types.add(newTypeItem); 32 } 33 else{ 34 typeItem.addItem(extensionBundleItem); 35 } 36 } 37 38 private ExtensionBundleTypeItem getTypeItem(Integer type){ 39 for (Iterator iter = types.iterator(); iter.hasNext();) { 40 ExtensionBundleTypeItem element = (ExtensionBundleTypeItem) iter.next(); 41 if (element.getType().equals(type)){ 42 return element; 43 } 44 } 45 return null; 46 } 47 48 public List getTypes() { 49 return this.types; 50 } 51 52 public void setTypes(List types) { 53 this.types = types; 54 } 55 56 public void rebuild(String filterText) { 57 for(ExtensionBundleTypeItem item : types) { 58 item.getPager().rebuild(filterText); 59 } 60 } 61 } 62 | Popular Tags |