Project

General

Profile

« Previous | Next » 

Revision 0caafa75

Added by Andreas Müller over 1 year ago

ref #10186 further remove ConversationHolder and cleanup

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/SuperAreaSelectionWizard.java
29 29
 */
30 30
public class SuperAreaSelectionWizard extends Wizard {
31 31

  
32
        private final SuperAreaPage aPage;
33
        DistributionAggregationConfiguration configurator;
32
    private final SuperAreaPage aPage;
33
    DistributionAggregationConfiguration configurator;
34 34

  
35
        public SuperAreaSelectionWizard(DistributionAggregationConfiguration configurator, NamedAreaLevel level) {
36
            setWindowTitle(Messages.AvailableDistributionWizard_WINDOW_TITLE);
37
            // TODO if preferenceStore has elements checked load elements in wizard
38
            aPage = new SuperAreaPage(Messages.AvailableDistributionWizard_PAGE_TITLE, level);
39
            this.configurator = configurator;
40
        }
35
    public SuperAreaSelectionWizard(DistributionAggregationConfiguration configurator, NamedAreaLevel level) {
36
        setWindowTitle(Messages.AvailableDistributionWizard_WINDOW_TITLE);
37
        // TODO if preferenceStore has elements checked load elements in wizard
38
        aPage = new SuperAreaPage(Messages.AvailableDistributionWizard_PAGE_TITLE, level);
39
        this.configurator = configurator;
40
    }
41 41

  
42
        @Override
43
        public boolean performFinish() {
44
            // TODO: get Selection and save in EditorPreferences
45
            if (!checkNoneChecked()) {
46
                Object[] checkedElements = aPage.getViewer().getCheckedElements();
47
                Object[] grayedElements = aPage.getViewer().getGrayedElements();
48
                List<Object> checkedList = new ArrayList<>(Arrays.asList(checkedElements));
49
                List<Object> grayedList = new ArrayList<>(Arrays.asList(grayedElements));
50
                checkedList = (ArrayList) CollectionUtils.subtract(checkedList, grayedList);
51
                ArrayList<UUID> listUIIDChecked = new ArrayList<>();
52
                ArrayList<UUID> listUIIDGrayed = new ArrayList<>();
53
                for (Object o : checkedList) {
54
                    if (o instanceof TermDto) {
55
                        listUIIDChecked.add(((TermDto) o).getUuid());
42
    @Override
43
    public boolean performFinish() {
44
        // TODO: get Selection and save in EditorPreferences
45
        if (!checkNoneChecked()) {
46
            Object[] checkedElements = aPage.getViewer().getCheckedElements();
47
            Object[] grayedElements = aPage.getViewer().getGrayedElements();
48
            List<Object> checkedList = new ArrayList<>(Arrays.asList(checkedElements));
49
            List<Object> grayedList = new ArrayList<>(Arrays.asList(grayedElements));
50
            checkedList = (ArrayList) CollectionUtils.subtract(checkedList, grayedList);
51
            ArrayList<UUID> listUIIDChecked = new ArrayList<>();
52
            ArrayList<UUID> listUIIDGrayed = new ArrayList<>();
53
            for (Object o : checkedList) {
54
                if (o instanceof TermDto) {
55
                    listUIIDChecked.add(((TermDto) o).getUuid());
56 56

  
57
                    }else if(o instanceof TermVocabularyDto){
58
                        TermVocabularyDto termVocDto = (TermVocabularyDto) o;
59
                        listUIIDGrayed.add(termVocDto.getUuid());
60
                    }
57
                }else if(o instanceof TermVocabularyDto){
58
                    TermVocabularyDto termVocDto = (TermVocabularyDto) o;
59
                    listUIIDGrayed.add(termVocDto.getUuid());
61 60
                }
61
            }
62 62
//                for (Object o : grayedList) {
63 63
//                    if (o instanceof TermDto) {
64 64
//                        listUIIDChecked.add(((TermDto) o).getUuid());
......
69 69
//                    }
70 70
//                }
71 71

  
72
               configurator.setSuperAreas(listUIIDChecked);
72
           configurator.setSuperAreas(listUIIDChecked);
73 73

  
74 74

  
75
                return true;
76
            } else {
77
                return false;
78
            }
75
            return true;
76
        } else {
77
            return false;
79 78
        }
79
    }
80 80

  
81
        @Override
82
        public void addPages() {
83
            addPage(aPage);
84
        }
81
    @Override
82
    public void addPages() {
83
        addPage(aPage);
84
    }
85 85

  
86
        private boolean checkNoneChecked() {
86
    private boolean checkNoneChecked() {
87 87

  
88
            if (aPage.getViewer().getCheckedElements().length == 0) {
89
                aPage.setMessage(Messages.AvailableDistributionWizard_CHECK_MESSAGE, aPage.WARNING);
90
                return true;
91
            } else {
92
                aPage.setMessage(null);
93
                return false;
94
            }
88
        if (aPage.getViewer().getCheckedElements().length == 0) {
89
            aPage.setMessage(Messages.AvailableDistributionWizard_CHECK_MESSAGE, aPage.WARNING);
90
            return true;
91
        } else {
92
            aPage.setMessage(null);
93
            return false;
95 94
        }
96
    //
97
//        @Override
98
//        public ConversationHolder getConversationHolder() {
99
//            if (conversation == null) {
100
//                conversation = CdmStore.createConversation();
101
//            }
102
//            return conversation;
103
//        }
104
    //
105
//        @Override
106
//        public void update(CdmDataChangeMap changeEvents) {
107
//        }
108 95
    }
109

  
96
}

Also available in: Unified diff