OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Rev 65 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.sql.sqlobject;
15
 
16
import org.openconcerto.sql.model.SQLField;
17
import org.openconcerto.sql.request.SQLRowItemView;
18
import org.openconcerto.sql.sqlobject.SQLTextCombo.ITextComboCacheSQL;
19
import org.openconcerto.sql.sqlobject.itemview.RowItemViewComponent;
20
import org.openconcerto.ui.component.ComboLockedMode;
25 ilm 21
import org.openconcerto.ui.component.IComboCacheListModel;
17 ilm 22
import org.openconcerto.ui.component.combo.ISearchableTextCombo;
23
 
24
/**
25
 * An ISearchableTextCombo with the cache from COMPLETION.
26
 *
27
 * @author Sylvain CUAZ
28
 */
29
public class SQLSearchableTextCombo extends ISearchableTextCombo implements RowItemViewComponent {
30
 
31
    public SQLSearchableTextCombo() {
32
        this(ComboLockedMode.UNLOCKED);
33
    }
34
 
35
    public SQLSearchableTextCombo(boolean locked) {
36
        super(locked);
37
    }
38
 
39
    public SQLSearchableTextCombo(ComboLockedMode mode) {
40
        super(mode);
41
    }
42
 
43
    public SQLSearchableTextCombo(ComboLockedMode mode, int rows, int columns) {
44
        super(mode, rows, columns);
45
    }
46
 
47
    public SQLSearchableTextCombo(ComboLockedMode mode, boolean textArea) {
48
        super(mode, textArea);
49
    }
50
 
51
    public SQLSearchableTextCombo(ComboLockedMode mode, int rows, int columns, boolean textArea) {
52
        super(mode, rows, columns, textArea);
53
    }
54
 
55
    public void init(SQLRowItemView v) {
56
        // after uiInit since our superclass add listeners to our UI
19 ilm 57
        this.initCacheLater(new ISQLListModel(v.getField()));
58
    }
59
 
60
    /**
61
     * Load <code>cache</code> and only afterwards call
62
     * {@link #initCache(org.openconcerto.utils.model.IListModel)}.
63
     *
64
     * @param cache the cache to set.
65
     */
66
    public void initCacheLater(final ISQLListModel cache) {
25 ilm 67
        cache.initCacheLater(this);
17 ilm 68
    }
69
 
25 ilm 70
    public static class ISQLListModel extends IComboCacheListModel {
17 ilm 71
 
72
        public ISQLListModel(final SQLField f) {
19 ilm 73
            this(new ITextComboCacheSQL(f));
74
        }
75
 
76
        public ISQLListModel(final ITextComboCacheSQL c) {
25 ilm 77
            super(c);
17 ilm 78
        }
79
    }
80
}