~ubuntu-branches/ubuntu/natty/libswingx-java/natty

« back to all changes in this revision

Viewing changes to src/java/org/jdesktop/swingx/decorator/SearchPredicate.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2010-07-26 12:11:27 UTC
  • mfrom: (4.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100726121127-k0d3b21nhja0dn93
Tags: 1:1.6.1-1
* New upstream release.
* Switch to 3.0 (quilt) format.
* Bump Standards-Version to 3.9.1: no changes needed.
* Drop Depends on JRE: not requested anymore by new Java Policy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * $Id: SearchPredicate.java 3165 2009-01-02 13:26:07Z rah003 $
 
2
 * $Id: SearchPredicate.java 3678 2010-04-26 19:16:18Z kschaefe $
3
3
 *
4
4
 * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
5
5
 * Santa Clara, California 95054, U.S.A. All rights reserved.
30
30
 * row. <p>
31
31
 * 
32
32
 * Note: this differs from PatternPredicate in that it is focused
33
 
 * on the current cell (highlight coordinates == test coordiates)
 
33
 * on the current cell (highlight coordinates == test coordinates)
34
34
 * while the PatternPredicate can have separate test and highlight
35
 
 * coordiates. <p>
 
35
 * coordinates. <p>
36
36
 * 
37
37
 * 
38
38
 * @author Jeanette Winzenburg
71
71
     * is limited to matching cells in the given column and row. A
72
72
     * value of -1 indicates all rows/columns. <p>
73
73
     * 
74
 
     * Note: the coordinates are asymetric - rows are in view- and
 
74
     * Note: the coordinates are asymmetric - rows are in view- and
75
75
     * column in model-coordinates - due to corresponding methods in
76
76
     * ComponentAdapter. Hmm... no need to? This happens on the
77
77
     * current adapter state which is view always, so could use view
120
120
     * is limited to matching cells in the given column and row. A
121
121
     * value of ALL indicates all rows/columns. <p>
122
122
     * 
123
 
     * Note: the coordinates are asymetric - rows are in view- and
 
123
     * Note: the coordinates are asymmetric - rows are in view- and
124
124
     * column in model-coordinates - due to corresponding methods in
125
125
     * ComponentAdapter. Hmm... no need to? This happens on the
126
126
     * current adapter state which is view always, so could use view
184
184
    private boolean test(Component renderer, ComponentAdapter adapter) {
185
185
        // PENDING JW: why convert here? we are focused on the adapter's cell
186
186
        // looks like an oversight as of ol' days ;-)
187
 
         int  columnToTest = adapter.viewToModel(adapter.column);
 
187
         int  columnToTest = adapter.convertColumnIndexToModel(adapter.column);
188
188
         String value = adapter.getString(columnToTest);
189
189
         
190
190
         if ((value == null) || (value.length() == 0)) {
191
191
             return false;
192
192
         }
193
193
         return pattern.matcher(value).find();
194
 
         // PENDING JW: change to adapter.getString to use uniform string rep
195
 
      // this is pre-767-swingx: consistent string api
196
 
//        Object  value = adapter.getValue(columnToTest);
197
 
//        
198
 
//        if (value == null) {
199
 
//            return false;
200
 
//        }
201
 
//        else {
202
 
//            return pattern.matcher(value.toString()).find();
203
 
//        }
204
 
         
205
 
         
206
194
     }
207
195
 
208
196
    /**
219
207
        }
220
208
        return 
221
209
            ((highlightColumn < 0) ||
222
 
               (highlightColumn == adapter.viewToModel(adapter.column)));
 
210
               (highlightColumn == adapter.convertColumnIndexToModel(adapter.column)));
223
211
    }
224
212
 
225
213
    private boolean isEnabled() {