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