Revision 321b9521
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java | ||
---|---|---|
22 | 22 |
import org.eclipse.jface.preference.IPreferenceStore; |
23 | 23 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
24 | 24 |
import org.eclipse.jface.viewers.LabelProvider; |
25 |
import org.eclipse.jface.viewers.TableViewer; |
|
26 | 25 |
import org.eclipse.swt.graphics.Image; |
27 |
import org.eclipse.swt.widgets.TableColumn; |
|
28 | 26 |
|
29 | 27 |
import eu.etaxonomy.cdm.api.service.IDescriptionService; |
30 | 28 |
import eu.etaxonomy.cdm.api.service.IVocabularyService; |
... | ... | |
42 | 40 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
43 | 41 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
44 | 42 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
43 |
import eu.etaxonomy.taxeditor.editor.view.checklist.e4.ChecklistEditorE4; |
|
45 | 44 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
46 | 45 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
47 | 46 |
|
... | ... | |
55 | 54 |
public static final String DEFAULT_ENTRY = ""; //$NON-NLS-1$ |
56 | 55 |
private IDescriptionService descriptionService; |
57 | 56 |
private SortedSet<DefinedTermBase> namedAreas; |
58 |
TableViewer viewer = null;
|
|
57 |
private ChecklistEditorE4 editor= null;
|
|
59 | 58 |
|
60 | 59 |
/** |
61 | 60 |
* |
... | ... | |
64 | 63 |
namedAreas = loadNamedAreas(); |
65 | 64 |
} |
66 | 65 |
|
67 |
public ChecklistLabelProvider(TableViewer viewer) {
|
|
66 |
public ChecklistLabelProvider(ChecklistEditorE4 editor) {
|
|
68 | 67 |
namedAreas = loadNamedAreas(); |
69 |
this.viewer = viewer;
|
|
68 |
this.editor = editor;
|
|
70 | 69 |
} |
71 | 70 |
|
72 | 71 |
/* |
... | ... | |
128 | 127 |
for (TaxonDescription td : listTaxonDescriptions) { |
129 | 128 |
for (DescriptionElementBase deb : td.getElements()) { |
130 | 129 |
if (deb instanceof Distribution) { |
131 |
Distribution distribution = HibernateProxyHelper.deproxy(deb, Distribution.class); |
|
132 |
String area = null; |
|
133 |
if (distribution.getArea() != null ){ |
|
134 |
if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
|
135 |
if (distribution.getArea().getIdInVocabulary() != null){ |
|
136 |
area = distribution.getArea().getIdInVocabulary(); |
|
137 |
} else{ |
|
138 |
area = distribution.getArea().getTitleCache(); |
|
139 |
} |
|
140 |
}else{ |
|
141 |
area = distribution.getArea().getTitleCache(); |
|
142 |
} |
|
143 | 130 |
|
144 |
}else{ |
|
145 |
continue; |
|
146 |
} |
|
147 | 131 |
|
148 |
if(viewer != null){
|
|
149 |
TableColumn column = viewer.getTable().getColumn(columnIndex);
|
|
150 |
if (area.equalsIgnoreCase(column.getText())) {
|
|
151 |
if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){
|
|
152 |
return (distribution.getStatus().getIdInVocabulary() != null)?distribution.getStatus().getIdInVocabulary():CdmUtils.Nz(distribution.getStatus().getTitleCache());
|
|
153 |
}else{
|
|
154 |
return (distribution.getStatus().getTitleCache() != null)?distribution.getStatus().getTitleCache():DEFAULT_ENTRY;
|
|
155 |
}
|
|
132 |
Distribution distribution = HibernateProxyHelper.deproxy(deb, Distribution.class);
|
|
133 |
if (distribution.getArea() != null){
|
|
134 |
if ( editor.getAreaPosition().get(distribution.getArea().getUuid()) != null && columnIndex == editor.getAreaPosition().get(distribution.getArea().getUuid())){
|
|
135 |
if (PreferencesUtil.isShowSymbolInChecklistEditor()){
|
|
136 |
return (distribution.getStatus().getSymbol() != null)?distribution.getStatus().getSymbol():CdmUtils.Nz(distribution.getStatus().getTitleCache());
|
|
137 |
}else{
|
|
138 |
return (distribution.getStatus().getTitleCache() != null)?distribution.getStatus().getTitleCache():DEFAULT_ENTRY;
|
|
139 |
}
|
|
156 | 140 |
} |
157 |
|
|
158 | 141 |
} |
142 |
// String area = null; |
|
143 |
// if (distribution.getArea() != null ){ |
|
144 |
// if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
|
145 |
// if (distribution.getArea().getIdInVocabulary() != null){ |
|
146 |
// area = distribution.getArea().getIdInVocabulary(); |
|
147 |
// } else{ |
|
148 |
// area = distribution.getArea().getTitleCache(); |
|
149 |
// } |
|
150 |
// }else{ |
|
151 |
// area = distribution.getArea().getTitleCache(); |
|
152 |
// } |
|
153 |
// |
|
154 |
// }else{ |
|
155 |
// continue; |
|
156 |
// } |
|
157 |
// |
|
158 |
// if(editor.getViewer() != null){ |
|
159 |
// TableColumn column = viewer.getTable().getColumn(columnIndex); |
|
160 |
// if (area.equalsIgnoreCase(column.getText())) { |
|
161 |
// |
|
162 |
// } |
|
163 |
// |
|
164 |
// } |
|
159 | 165 |
} |
160 | 166 |
} |
161 | 167 |
} |
Also available in: Unified diff
ref #7793: fix problem with details view after save in distribution editor