Project

General

Profile

« Previous | Next » 

Revision cd335a3a

Added by Cherian Mathew over 8 years ago

#5123, #5124 Make ChecklistEditor remoting session aware and fix performance issue with available distribution pereference page

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistEditor.java
12 12

  
13 13
import java.util.ArrayList;
14 14
import java.util.Arrays;
15
import java.util.Collection;
15 16
import java.util.Collections;
16 17
import java.util.HashMap;
17 18
import java.util.List;
......
57 58
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
58 59
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
59 60
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
61
import eu.etaxonomy.cdm.model.common.CdmBase;
60 62
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
61 63
import eu.etaxonomy.cdm.model.taxon.Classification;
62 64
import eu.etaxonomy.cdm.model.taxon.Taxon;
......
75 77
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
76 78
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
77 79
import eu.etaxonomy.taxeditor.preference.Resources;
80
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
81
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
78 82
import eu.etaxonomy.taxeditor.store.CdmStore;
79 83

  
80 84
/**
......
87 91
 * @version 1.0
88 92
 */
89 93
public class ChecklistEditor extends EditorPart implements ISelectionListener, IPartContentHasFactualData,
90
        IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable {
94
        IConversationEnabled, IContextListener, IPartContentHasDetails, IDirtyMarkable, ICdmEntitySessionEnabled {
91 95

  
92 96
    private static final Logger logger = Logger.getLogger(ChecklistEditor.class);
93 97
    /**
......
181 185

  
182 186
    private Label statusLabel;
183 187

  
188
    private final ICdmEntitySession cdmEntitySession;
189

  
184 190
    private SortedSet<DefinedTermBase> terms = null;
185 191
	private ToolItem toolItem;
186 192
	private ChecklistDropdownSelectionListener dropListener;
......
206 212
     * </p>
207 213
     */
208 214
    public ChecklistEditor() {
215
        cdmEntitySession = CdmStore.getCurrentSessionManager().newSession(this, true);
209 216
    }
210 217

  
211 218
    /** {@inheritDoc} */
......
439 446
    /** {@inheritDoc} */
440 447
    @Override
441 448
    public void dispose() {
449
        cdmEntitySession.dispose();
442 450
        super.dispose();
443 451
    }
444 452

  
445 453
    /** {@inheritDoc} */
446 454
    @Override
447 455
    public void setFocus() {
456
        cdmEntitySession.bind();
448 457
        viewer.getControl().setFocus();
449 458
    }
450 459

  
......
757 766
    public boolean isDirty() {
758 767
        return dirty;
759 768
    }
769

  
770
    /* (non-Javadoc)
771
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
772
     */
773
    @Override
774
    public ICdmEntitySession getCdmEntitySession() {
775
        // TODO Auto-generated method stub
776
        return null;
777
    }
778

  
779
    /* (non-Javadoc)
780
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
781
     */
782
    @Override
783
    public <T extends CdmBase> Collection<T> getRootEntities() {
784
        // TODO Auto-generated method stub
785
        return null;
786
    }
787

  
788
    /* (non-Javadoc)
789
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
790
     */
791
    @Override
792
    public Map<Object, List<String>> getPropertyPathsMap() {
793
        // TODO Auto-generated method stub
794
        return null;
795
    }
760 796
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionPage.java
11 11

  
12 12
import java.util.ArrayList;
13 13
import java.util.Arrays;
14
import java.util.Collection;
15
import java.util.HashMap;
14 16
import java.util.List;
17
import java.util.Map;
15 18
import java.util.Set;
16 19
import java.util.UUID;
17 20

  
......
32 35

  
33 36
import eu.etaxonomy.cdm.api.service.ITermService;
34 37
import eu.etaxonomy.cdm.api.service.IVocabularyService;
38
import eu.etaxonomy.cdm.model.common.CdmBase;
35 39
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
36 40
import eu.etaxonomy.cdm.model.common.TermType;
37 41
import eu.etaxonomy.cdm.model.common.TermVocabulary;
38 42
import eu.etaxonomy.taxeditor.editor.definedterm.TermContentProvider;
39 43
import eu.etaxonomy.taxeditor.editor.definedterm.TermLabelProvider;
40 44
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
45
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
46
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
41 47
import eu.etaxonomy.taxeditor.store.CdmStore;
42 48

  
43 49
/**
......
45 51
 * @date 21.07.2014
46 52
 *
47 53
 */
48
public class AvailableDistributionPage extends WizardPage {
54
public class AvailableDistributionPage extends WizardPage implements ICdmEntitySessionEnabled {
49 55

  
50 56
    private CheckboxTreeViewer viewer;
51 57

  
......
57 63
    protected AvailableDistributionPage(String pageName) {
58 64
        super(pageName);
59 65
        // TODO check if configuration exists
66
        CdmStore.getCurrentSessionManager().bindNullSession(this);
60 67
    }
61 68

  
62 69
    /*
......
245 252
        }
246 253
    }
247 254

  
255
    @Override
256
    public void dispose() {
257
        CdmStore.getCurrentSessionManager().dispose(this);
258
        super.dispose();
259
    }
260
    /* (non-Javadoc)
261
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getCdmEntitySession()
262
     */
263
    @Override
264
    public ICdmEntitySession getCdmEntitySession() {
265
        return CdmStore.getCurrentSessionManager().getNullSession();
266
    }
267

  
268
    /* (non-Javadoc)
269
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getRootEntities()
270
     */
271
    @Override
272
    public <T extends CdmBase> Collection<T> getRootEntities() {
273
        return null;
274
    }
275

  
276
    /* (non-Javadoc)
277
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled#getPropertyPathsMap()
278
     */
279
    @Override
280
    public Map<Object, List<String>> getPropertyPathsMap() {
281
        Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
282
        List<String> termsPropertyPaths = Arrays.asList(new String[] {
283
                "includes"
284
        });
285
        propertyPathsMap.put("includes", termsPropertyPaths);
286
        propertyPathsMap.put("terms", termsPropertyPaths);
287
        return propertyPathsMap;
288
    }
289

  
248 290
}

Also available in: Unified diff