Project

General

Profile

« Previous | Next » 

Revision e6414409

Added by Katja Luther almost 3 years ago

ref #9337, #9680:remove set focus on titleCache and search for nomenclatural author and collector

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AgentSelectionDialog.java
136 136
    }
137 137
    @Override
138 138
    protected ILabelProvider createListLabelProvider() {
139
        return new CollectorLabelProvider();
139
        return new AgentLabelProvider();
140 140
    }
141 141

  
142
    public class CollectorLabelProvider extends LabelProvider {
142
    public class AgentLabelProvider extends LabelProvider {
143 143
        @Override
144 144
        public String getText(Object element) {
145 145
            if (element == null) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CollectorSelectionDialog.java
12 12
import org.eclipse.jface.viewers.LabelProvider;
13 13
import org.eclipse.swt.widgets.Shell;
14 14

  
15
import eu.etaxonomy.cdm.api.service.IAgentService;
15 16
import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
16 17
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
17 18
import eu.etaxonomy.cdm.model.agent.AgentBase;
19
import eu.etaxonomy.cdm.model.agent.Person;
18 20
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
19 21
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache;
20 22
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
21 23
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
22 25

  
23 26
/**
24 27
 * @author k.luther
......
58 61
                return null;
59 62
            }
60 63
            UuidAndTitleCache uuidAndTitleCache = (UuidAndTitleCache) element;
61
            String titleCache = uuidAndTitleCache.getTitleCache();
64
            String title = "";
62 65
            String abbrevTitleCache = uuidAndTitleCache.getAbbrevTitleCache();
66
            String titleCache = uuidAndTitleCache.getTitleCache();
63 67
            String collectorTitleCache = null;
64
            if (element instanceof TeamOrPersonUuidAndTitleCache){
65
                collectorTitleCache = ((TeamOrPersonUuidAndTitleCache)element).getCollectorTitleCache();
68
            if (element instanceof TeamOrPersonUuidAndTitleCache && ((TeamOrPersonUuidAndTitleCache)element).getCollectorTitleCache() != null){
69
                title = ((TeamOrPersonUuidAndTitleCache)element).getCollectorTitleCache();
66 70
            }
67
            if (!titleCache.equals(abbrevTitleCache)){
68
                titleCache += " - " + abbrevTitleCache;
71
            if (!title.equals(titleCache)){
72
                title += " - " + titleCache;
69 73
            }
70
            if (collectorTitleCache != null && !uuidAndTitleCache.getTitleCache().equals(collectorTitleCache) && !abbrevTitleCache.equals(collectorTitleCache)){
71
                titleCache += " - " + collectorTitleCache;
74
            if (abbrevTitleCache != null && !uuidAndTitleCache.getTitleCache().equals(abbrevTitleCache) && !abbrevTitleCache.equals(titleCache)){
75
                title += " - " + abbrevTitleCache;
72 76
            }
73 77
            if(PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey())){
74
                titleCache += " ["+uuidAndTitleCache.getId()+"]";
78
                title += " ["+uuidAndTitleCache.getId()+"]";
75 79
            }
76 80
            if (element instanceof EntityDTOBase){
77
                titleCache += "(" + ((IdentifiedEntityDTO)element).getIdentifier().getTypeLabel() +": " + ((IdentifiedEntityDTO)element).getIdentifier().getIdentifier() + ")";
81
                title += "(" + ((IdentifiedEntityDTO)element).getIdentifier().getTypeLabel() +": " + ((IdentifiedEntityDTO)element).getIdentifier().getIdentifier() + ")";
78 82
            }
79 83

  
80
            return titleCache;
84
            return title;
81 85
        }
82 86

  
83 87

  
84 88
    }
89
    @Override
90
    protected void callService(String pattern) {
91
        Class clazz = AgentBase.class;
92
        if (selectTeamMember){
93
            clazz = Person.class;
94
        }
95

  
96
        model = CdmStore.getService(IAgentService.class).getUuidAndTitleCacheWithCollectorTitleCache(clazz, limitOfInitialElements, pattern);
97
    }
98

  
85 99

  
86 100
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NomenclaturalAuthorSelectionDialog.java
12 12
import java.util.Comparator;
13 13
import java.util.List;
14 14

  
15
import org.eclipse.jface.viewers.ILabelProvider;
16
import org.eclipse.jface.viewers.LabelProvider;
15 17
import org.eclipse.swt.widgets.Shell;
16 18

  
17 19
import eu.etaxonomy.cdm.api.service.IAgentService;
20
import eu.etaxonomy.cdm.api.service.dto.EntityDTOBase;
21
import eu.etaxonomy.cdm.api.service.dto.IdentifiedEntityDTO;
18 22
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
19 23
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
24
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
25
import eu.etaxonomy.cdm.persistence.dto.TeamOrPersonUuidAndTitleCache;
20 26
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
21 27
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
22 28
import eu.etaxonomy.taxeditor.newWizard.NewPersonWizard;
23 29
import eu.etaxonomy.taxeditor.newWizard.NewTeamWizard;
30
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24 31
import eu.etaxonomy.taxeditor.store.CdmStore;
25 32

  
26 33
/**
......
83 90
        return ((INomenclaturalAuthor)cdmObject).getNomenclaturalTitleCache();
84 91
    }
85 92

  
86
//    public class FilteredCdmResourceAbbrevLabelProvider extends LabelProvider {
87
//		@Override
88
//		public String getText(Object element) {
89
//			if (element == null) {
90
//				return null;
91
//			}
92
//			UuidAndTitleCache<?> uuidAndTitleCache = (UuidAndTitleCache<?>) element;
93
//			String titleCache = uuidAndTitleCache.getTitleCache();
94
//			String abbrevTitleCache = uuidAndTitleCache.getAbbrevTitleCache();
95
//			if(titleCache!=null && abbrevTitleCache!=null){
96
//			    if (!titleCache.equals(abbrevTitleCache)){
97
//			        abbrevTitleCache += " - " + titleCache;
98
//			    }
99
//			    if(PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey())){
100
//			        abbrevTitleCache += " ["+uuidAndTitleCache.getId()+"]";
101
//			    }
102
//			}
103
//            return abbrevTitleCache!=null?abbrevTitleCache:"[title null]";
104
//		}
105
//	}
93
    @Override
94
    protected ILabelProvider createListLabelProvider() {
95
        return new NomenclaturalLabelProvider();
96
    }
97

  
98
    public class NomenclaturalLabelProvider extends LabelProvider {
99
        @Override
100
        public String getText(Object element) {
101
            if (element == null) {
102
                return null;
103
            }
104
            UuidAndTitleCache<?> uuidAndTitleCache = (UuidAndTitleCache<?>) element;
105
            String title = uuidAndTitleCache.getAbbrevTitleCache();
106
            String titleCache = uuidAndTitleCache.getTitleCache();
107
            String collectorTitleCache = null;
108
            if (element instanceof TeamOrPersonUuidAndTitleCache){
109
                collectorTitleCache = ((TeamOrPersonUuidAndTitleCache)element).getCollectorTitleCache();
110
            }
111
            if (!titleCache.equals(title)){
112
                title += " - " + titleCache;
113
            }
114
            if (collectorTitleCache != null && !uuidAndTitleCache.getTitleCache().equals(collectorTitleCache) && !titleCache.equals(collectorTitleCache)){
115
                title += " - " + collectorTitleCache;
116
            }
117
            if(PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey())){
118
                title += " ["+uuidAndTitleCache.getId()+"]";
119
            }
120
            if (element instanceof EntityDTOBase){
121
                title += "(" + ((IdentifiedEntityDTO)element).getIdentifier().getTypeLabel() +": " + ((IdentifiedEntityDTO)element).getIdentifier().getIdentifier() + ")";
122
            }
123

  
124
            return title;
125
        }
126
    }
106 127

  
107 128
	@Override
108 129
	protected Comparator<UuidAndTitleCache<TeamOrPersonBase<?>>> getItemsComparator() {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/feature/TermTreeDetailElement.java
62 62
	    if (entity.containsSubtrees()){
63 63
	        isFlat.setEnabled(false);
64 64
	    }
65
	    titleCacheText.setFocus();
65

  
66 66

  
67 67
	}
68 68

  
69 69
	@Override
70 70
	protected void updateControlStates() {
71 71
	    super.updateControlStates();
72
	    titleCacheText.setFocus();
73 72
	}
74 73

  
75 74
	@Override

Also available in: Unified diff