Revision 44297 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.swing/org.gvsig.fmap.dal.swing.impl/src/main/java/org/gvsig/fmap/dal/swing/impl/searchpanel/DefaultSearchPanel.java

View differences:

DefaultSearchPanel.java
133 133
            if (attrdesc == null) {
134 134
                return String.class;
135 135
            }
136
            return attrdesc.getDataType().getDefaultClass();
136
            Class theClass = attrdesc.getDataType().getDefaultClass();
137
            if( theClass==null ) {
138
                return String.class;
139
            }
140
            return theClass;
137 141
        }
138 142

  
139 143
        @Override
......
215 219
    private ExpressionPickerController advancedExpression;
216 220
    private final Map<String, ActionButtons> actions;
217 221
    private boolean showActions = true;
222
    private int maxSearhFields = 4;
218 223

  
219 224
    public DefaultSearchPanel(FeatureStore store) {
220 225
        this.store = store;
......
331 336
                    Search.STR_INT_LONG_LABEL_ORDER,
332 337
                    5
333 338
            );
339
            this.maxSearhFields = Integer.min(orderedAttributes.size(), 4);
334 340
            int n = 0;
335 341
            for (SearchFieldController searchField : searchFields) {
336
                searchField.setAttribute(orderedAttributes.get(n++).getName());
342
                if( n<this.maxSearhFields ) {
343
                    searchField.setAttribute(orderedAttributes.get(n++).getName());
344
                } else {
345
                    searchField.setEnabled(false);
346
                }
337 347
            }
338 348
        } catch (DataException ex) {
339 349
            LOGGER.warn("Can't determine order of attributes", ex);
......
384 394
        if( this.searchFields==null ) {
385 395
            initComponents();
386 396
        }
397
        int n=0;
387 398
        for (SearchFieldController searchField : searchFields) {
388
            searchField.setEnabled(enabled);
399
            if( n<this.maxSearhFields ) {
400
                searchField.setEnabled(enabled);
401
            } else {
402
                searchField.setEnabled(false);
403
            }
404
            n++;
389 405
        }
390 406
        this.btnClear.setEnabled(enabled);
391 407
        this.btnSearch.setEnabled(enabled);

Also available in: Unified diff