Project

General

Profile

« Previous | Next » 

Revision c919ebc6

Added by Patrick Plitzner over 5 years ago

ref #7674 Add icon to mark descriptions with sources

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
20 20
import java.util.stream.Collectors;
21 21

  
22 22
import javax.inject.Inject;
23
import javax.inject.Named;
24 23

  
25 24
import org.apache.commons.collections4.map.LinkedMap;
26 25
import org.eclipse.core.runtime.ICoreRunnable;
......
29 28
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
30 29
import org.eclipse.core.runtime.jobs.Job;
31 30
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
32
import org.eclipse.e4.core.di.annotations.Optional;
33 31
import org.eclipse.e4.ui.di.UISynchronize;
34 32
import org.eclipse.e4.ui.services.EMenuService;
35
import org.eclipse.e4.ui.services.IServiceConstants;
36 33
import org.eclipse.jface.layout.GridDataFactory;
37 34
import org.eclipse.jface.viewers.ComboViewer;
38 35
import org.eclipse.jface.viewers.IStructuredSelection;
......
81 78
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
82 79
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
83 80
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
81
import org.eclipse.nebula.widgets.nattable.ui.menu.DebugMenuConfiguration;
84 82
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction;
85 83
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
86 84
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
......
136 134
    static final String LABEL_TAXON_DEFAULT_DESCRIPTION = "TAXON_DEFAULT_DESCRIPTION"; //$NON-NLS-1$
137 135
    static final String LABEL_TAXON_LITERATURE_DESCRIPTION = "TAXON_LITERATURE_DESCRIPTION"; //$NON-NLS-1$
138 136
    static final String LABEL_TAXON_DESCRIPTION = "LABEL_TAXON_DESCRIPTION"; //$NON-NLS-1$
137
    static final String LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA = "LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA"; //$NON-NLS-1$
139 138

  
140 139
    @Inject
141 140
    private UISynchronize sync;
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixConfigLabelAccumulator.java
43 43
            configLabels.addLabel(CharacterMatrix.LABEL_TAXON_ROW);
44 44
        }
45 45
        else if(rowObject instanceof TaxonRowWrapperDTO){
46
            if(MatrixUtility.isAggregatedTaxonDescription((TaxonRowWrapperDTO) rowObject)){
46
            TaxonRowWrapperDTO taxonRowWrapper = (TaxonRowWrapperDTO) rowObject;
47
            if(MatrixUtility.isAggregatedTaxonDescription(taxonRowWrapper)){
47 48
                configLabels.addLabel(CharacterMatrix.LABEL_TAXON_AGGREGATED_DESCRIPTION);
48 49
                isEditable = false;
49 50
            }
50
            else if(MatrixUtility.isDefaultTaxonDescription((TaxonRowWrapperDTO) rowObject)){
51
            else if(MatrixUtility.isDefaultTaxonDescription(taxonRowWrapper)){
51 52
                configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DEFAULT_DESCRIPTION);
52 53
            }
53
            else if(MatrixUtility.isLiteratureTaxonDescription((TaxonRowWrapperDTO) rowObject)){
54
            else if(MatrixUtility.isLiteratureTaxonDescription(taxonRowWrapper)){
54 55
                configLabels.addLabel(CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION);
55 56
            }
57
            //check for supplemental data
58
            if(!taxonRowWrapper.getDescription().getSources().isEmpty() && columnPosition==0){
59
                configLabels.addLabel(CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
60
            }
56 61
            configLabels.addLabel(CharacterMatrix.LABEL_TAXON_DESCRIPTION);
57 62
        }
58 63

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixLabelStyleConfiguration.java
11 11
import org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration;
12 12
import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
13 13
import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
14
import org.eclipse.nebula.widgets.nattable.painter.cell.ImagePainter;
15
import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
16
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CellPainterDecorator;
14 17
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
15 18
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
16 19
import org.eclipse.nebula.widgets.nattable.style.Style;
20
import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
17 21
import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
18 22

  
19 23
/**
......
24 28
public final class CharacterMatrixLabelStyleConfiguration extends AbstractRegistryConfiguration {
25 29
    @Override
26 30
    public void configureRegistry(IConfigRegistry configRegistry) {
31
        //different background color styles
27 32
        Style taxonRowStyle = new Style();
28 33
        taxonRowStyle.setAttributeValue(
29 34
                CellStyleAttributes.BACKGROUND_COLOR,
......
64 69
                DisplayMode.NORMAL,
65 70
                CharacterMatrix.LABEL_TAXON_LITERATURE_DESCRIPTION);
66 71

  
72
        //cell painter for supplemental data
73
        configRegistry.registerConfigAttribute(
74
                CellConfigAttributes.CELL_PAINTER,
75
                new CellPainterDecorator(
76
                        new TextPainter(),
77
                        CellEdgeEnum.BOTTOM_RIGHT,
78
                        new ImagePainter(GUIHelper.getImage("plus")),
79
                        false),
80
                DisplayMode.NORMAL,
81
                CharacterMatrix.LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA);
82

  
83

  
67 84
    }
68 85
}

Also available in: Unified diff