OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 21 | Rev 63 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 25
Line 59... Line 59...
59
 
59
 
60
    private static final String DEFAULTVALUE = "";
60
    private static final String DEFAULTVALUE = "";
61
 
61
 
62
    private final String defaultValue;
62
    private final String defaultValue;
63
    private final ComboLockedMode locked;
63
    private final ComboLockedMode locked;
64
    private final ValueChangeSupport supp;
64
    private final ValueChangeSupport<String> supp;
65
    protected final boolean autoComplete;
65
    protected final boolean autoComplete;
66
    protected boolean keyPressed;
66
    protected boolean keyPressed;
67
    private boolean completing;
67
    private boolean completing;
68
 
68
 
69
    // cache
69
    // cache
Line 179... Line 179...
179
            }
179
            }
180
 
180
 
181
            public void removeCurrentText() {
181
            public void removeCurrentText() {
182
                ITextCombo.this.removeCurrentText();
182
                ITextCombo.this.removeCurrentText();
183
            }
183
            }
-
 
184
 
-
 
185
            @Override
-
 
186
            public boolean canReload() {
-
 
187
                return true;
-
 
188
            }
-
 
189
 
-
 
190
            @Override
-
 
191
            public void reload() {
-
 
192
                ITextCombo.this.loadCache(true);
-
 
193
            }
184
        }).listen();
194
        }).listen();
185
 
195
 
186
        this.loadCache();
196
        this.loadCache(false);
187
 
197
 
188
        // ATTN marche car locked est final
198
        // ATTN marche car locked est final
189
        if (!this.isLocked()) {
199
        if (!this.isLocked()) {
190
            this.getTextComp().addKeyListener(new KeyAdapter() {
200
            this.getTextComp().addKeyListener(new KeyAdapter() {
191
                @Override
201
                @Override
Line 283... Line 293...
283
    }
293
    }
284
 
294
 
285
    // *** cache
295
    // *** cache
286
 
296
 
287
    // charge les elements de completion si besoin
297
    // charge les elements de completion si besoin
288
    private synchronized final void loadCache() {
298
    private synchronized final void loadCache(final boolean force) {
289
        if (!this.cacheLoading) {
299
        if (!this.cacheLoading) {
290
            this.modeToSet = this.isEnabled();
300
            this.modeToSet = this.isEnabled();
291
            this.setEnabled(false);
301
            this.setEnabled(false);
-
 
302
            this.objToSelect = this.getValue();
292
            this.cacheLoading = true;
303
            this.cacheLoading = true;
293
            final SwingWorker sw = new SwingWorker<List<String>, Object>() {
304
            final SwingWorker<List<String>, Object> sw = new SwingWorker<List<String>, Object>() {
294
                @Override
305
                @Override
295
                protected List<String> doInBackground() throws Exception {
306
                protected List<String> doInBackground() throws Exception {
296
                    return ITextCombo.this.cache.getCache();
307
                    return force ? ITextCombo.this.cache.loadCache(false) : ITextCombo.this.cache.getCache();
297
                }
308
                }
298
 
309
 
299
                @Override
310
                @Override
300
                protected void done() {
311
                protected void done() {
301
                    synchronized (this) {
312
                    synchronized (this) {