Changeset 5527 for trunk/gli/src/org/greenstone/gatherer/gui/Filter.java
- Timestamp:
- 2003-09-23T14:58:18+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/gui/Filter.java
r5355 r5527 54 54 /** The other filters in this run of filters, used to ensure they all show the same thing. */ 55 55 private ArrayList others = null; 56 /** Is this the fi lterfilter of this run of filters created (later filters will share the same information). */56 /** Is this the first filter of this run of filters created (later filters will share the same information). */ 57 57 private boolean first = true; 58 58 /** Prevent any changes we make in the class from causing events which we then process causing events... */ … … 60 60 /** A reference to ourselves so inner classes can refer to us. */ 61 61 private Filter this_filter = null; 62 /** The check box to enable d/diable filter. */62 /** The check box to enable/disable filter. */ 63 63 private JCheckBox checkbox = null; 64 64 /** The editable combobox where you either choose a predefined filter, or type a new pseudo-regular expression. */ … … 74 74 /** Constructor. 75 75 * @param tree A reference to the <strong>JTree</strong> being affected. 76 76 */ 77 77 public Filter(DragTree tree) { 78 78 this(tree, null); 79 79 } 80 80 /** Constructor. 81 82 83 81 * @param tree A reference to the <strong>JTree</strong> being affected. 82 * @param others An <strong>ArrayList</strong> of the other Filters already in this run. 83 */ 84 84 public Filter(DragTree tree, ArrayList others) { 85 85 super(); … … 119 119 } 120 120 /** Retrieve the combobox associated with this filter. 121 122 121 * @return A <strong>GComboBox</strong>. 122 */ 123 123 public GComboBox getComboBox() { 124 124 return combobox; … … 126 126 127 127 /** Change the background color of the filter. 128 129 128 * @param color The new background <strong>Color</strong>. 129 */ 130 130 public void setBackground(Color color) { 131 131 super.setBackground(color); … … 133 133 134 134 /** Used to restore the filter state to enabled, the normal state during collection editing. 135 136 135 * @param state The new state for the filter. <i>true</i> for enabled, <i>false</i> otherwise. 136 */ 137 137 public void setEnabled(boolean state) { 138 138 ignore = true; … … 142 142 } 143 143 /** Set the combobox model for this filter. 144 145 144 * @param model The new <strong>ComboBoxModel</strong> to use. 145 */ 146 146 public void setComboBoxModel(ComboBoxModel model) { 147 147 combobox.setModel(model); 148 148 } 149 149 /** Ensure that a certain entry is selected from the combobox. 150 151 150 * @param selection The <strong>Entry</strong> that should be selected. 151 */ 152 152 public void setComboBoxSelection(Entry selection) { 153 153 ignore = true; … … 156 156 } 157 157 /** Set to signify that this filter is the first in a new run of filters. 158 159 158 * @param first <i>true</i> if this is the first filter in a run, <i>false</i> if it will just be added to the current run. 159 */ 160 160 public void setFirst(boolean first) { 161 161 this.first = first; 162 162 } 163 163 /** Spawn produces a copy of this filter, which has new controls, but shares listeners wih this filter, and vice versa. Thus we can have two synchronized, but differing sets of controls. 164 165 166 164 * @param tree_spawn The <strong>JTree</strong> this filter will affect. 165 * @return A new <strong>Filter</strong> which is in the same run as this filter. 166 */ 167 167 public Filter spawn(DragTree tree_spawn) { 168 168 Filter filter = new Filter(tree_spawn, others); … … 173 173 } 174 174 /** Retrieve a phrase from the dictionary. 175 176 175 * @param key The unique identification <strong>String</strong> of a phrase from the dictionary. 176 */ 177 177 private String get(String key) { 178 178 return get(key, null); 179 179 } 180 180 /** Retrieve a phrase from the dictionary, augmenting with the given text fragments 181 182 183 184 185 181 * @param key The unique identification <strong>String</strong> of a phrase from the dictionary. 182 * @param args A <strong>String[]</strong> of arguments to be used to fill out parameter fields in the phrase returned. 183 * @see org.greenstone.gatherer.Dictionary 184 * @see org.greenstone.gatherer.Gatherer 185 */ 186 186 private String get(String key, String args[]) { 187 187 if(key.indexOf(".") == -1) { … … 191 191 } 192 192 /** Encode an expression in pseudo-regular expression into regular expression. 193 194 195 193 * @param raw The pseudo-regular expression <strong>String</strong> which includes several characters which differ in meaning from regular expression queries. 194 * @return A proper regular expression as a <strong>String</strong>. 195 */ 196 196 private String encode(String raw) { 197 197 StringBuffer working = new StringBuffer(); … … 234 234 private class ComboBoxListener 235 235 implements ActionListener { 236 /** Called when a new item is selected from the filter combobox, we treat the new entry as a pseudo-regular expression, compile it and then apply it to the tree.236 /** Called when a new item is selected from the filter combobox, we treat the new entry as a pseudo-regular expression, compile it and then apply it to the tree. 237 237 * @param event An <strong>ActionEvent</strong> containing more information about the change performed. 238 238 * @see org.greenstone.gatherer.gui.Filter.Entry … … 297 297 } 298 298 /** Constructor. 299 300 301 299 * @param name The name of this entry as a <strong>String</strong>. 300 * @param pattern The compiled regular expression as a <strong>Pattern</strong>. 301 */ 302 302 public Entry(String name, Pattern pattern) { 303 303 this.name = name; … … 305 305 } 306 306 /** Compare two Entrys for ordering. 307 308 309 307 * @param object The other Entry to compare to, as an <strong>Object</strong>. 308 * @return An <i>int</i> indicating the respective ordering, as defined in java.lang.String#compareTo 309 */ 310 310 public int compareTo(Object object) { 311 311 return toString().compareTo(object.toString()); 312 312 } 313 313 /** Retrieve the pattern associated with this entry. 314 315 314 * @return The <strong>Pattern</strong>. 315 */ 316 316 public Pattern getPattern() { 317 317 return pattern; 318 318 } 319 319 /** Translate this entry into a textual representation. 320 321 320 * @return A <strong>String</strong> containing the representation. 321 */ 322 322 public String toString() { 323 323 String result = null;
Note:
See TracChangeset
for help on using the changeset viewer.