1 19 20 package org.netbeans.modules.java.navigation.base; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import javax.swing.Icon ; 25 26 29 public final class FiltersDescription { 30 31 public static FiltersManager createManager (FiltersDescription descr) { 32 return FiltersManager.create(descr); 33 } 34 35 36 private List <FilterItem> filters; 37 38 39 public FiltersDescription() { 40 filters = new ArrayList <FilterItem>(); 41 } 42 43 public void addFilter (String name, String displayName, String tooltip, 44 boolean isSelected, Icon selectedIcon, Icon unselectedIcon) { 45 FilterItem newItem = new FilterItem(name, displayName, tooltip, 46 isSelected, selectedIcon, unselectedIcon); 47 filters.add(newItem); 48 } 49 50 public int getFilterCount () { 51 return filters.size(); 52 } 53 54 public String getName (int index) { 55 return filters.get(index).name; 56 } 57 58 public String getDisplayName (int index) { 59 return filters.get(index).displayName; 60 } 61 62 public String getTooltip (int index) { 63 return filters.get(index).tooltip; 64 } 65 66 public Icon getSelectedIcon (int index) { 67 return filters.get(index).selectedIcon; 68 } 69 70 public Icon getUnselectedIcon (int index) { 71 return filters.get(index).unselectedIcon; 72 } 73 74 public boolean isSelected (int index) { 75 return filters.get(index).isSelected; 76 } 77 78 static class FilterItem { 79 String name; 80 String displayName; 81 String tooltip; 82 Icon selectedIcon; 83 Icon unselectedIcon; 84 boolean isSelected; 85 86 FilterItem (String name, String displayName, String tooltip, 87 boolean isSelected, Icon selectedIcon, Icon unselectedIcon) { 88 this.name = name; 89 this.displayName = displayName; 90 this.tooltip = tooltip; 91 this.selectedIcon = selectedIcon; 92 this.unselectedIcon = unselectedIcon; 93 this.isSelected = isSelected; 94 } 95 96 } 97 98 } 99 | Popular Tags |