Project

General

Profile

« Previous | Next » 

Revision 018b80b2

Added by Katja Luther about 5 years ago

ref #7854: improve handling of selection changes in distribution editor

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionCellSelectionListener.java
15 15
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
16 16
import org.eclipse.nebula.widgets.nattable.extension.e4.selection.E4SelectionListener;
17 17
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
18
import org.eclipse.nebula.widgets.nattable.layer.event.CellVisualChangeEvent;
18 19
import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
19 20
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
20 21
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent;
......
53 54
                    if(dataValue!=null){
54 55
                        part.getSelectionService().setSelection(new StructuredSelection(dataValue));
55 56
                        return;
57
                    }else{
58
                        part.getSelectionService().setSelection(new StructuredSelection());
59
                        return;
56 60
                    }
57 61
                }
58 62
            }
......
67 71
                    return;
68 72
                }
69 73
            }
74
        }else if (event instanceof CellVisualChangeEvent){
75
            CellVisualChangeEvent cellSelectionEvent = (CellVisualChangeEvent)event;
76
            int columnPosition = cellSelectionEvent.getColumnPosition();
77
            int rowPosition = cellSelectionEvent.getRowPosition();
78
            if(columnPosition>=part.getEditor().getFirstDataColumnIndex()){
79
                Object dataValue = cellSelectionEvent.getLayer().getDataValueByPosition(columnPosition, rowPosition);
80
                if(dataValue!=null){
81
                    part.getSelectionService().setSelection(new StructuredSelection(dataValue));
82
                    return;
83
                }else{
84
                    part.getSelectionService().setSelection(new StructuredSelection());
85
                    return;
86
                }
87

  
88
            }
70 89
        }
71 90
      //  part.getSelectionService().setSelection(new StructuredSelection());
72 91
    }
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionColumnAccessor.java
99 99
     */
100 100
    @Override
101 101
    public String getColumnProperty(int columnIndex) {
102
        return (String) editor.getPropertyToLabelMap().get(columnIndex);
102
        return editor.getPropertyToLabelMap().get(columnIndex);
103 103
    }
104 104

  
105 105
    /**
......
116 116
     */
117 117
    @Override
118 118
    public void setDataValue(TaxonDistributionDTO taxonWrapper, int columnIndex, Object newValue) {
119
            if (newValue instanceof PresenceAbsenceTerm){
119
           if (newValue instanceof PresenceAbsenceTerm){
120 120
                NamedArea area =editor.getAreaToColumnIndexMap().get(columnIndex);
121 121
                Map<NamedArea, Set<DescriptionElementBase>> distributionMap = editor.taxonDistributionMap.get(taxonWrapper.getTaxonUuid());
122 122
                if (distributionMap == null){
......
156 156

  
157 157
                }
158 158

  
159
                EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
160
            }
161 159

  
160
            }
161
            EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
162 162
    }
163 163

  
164 164
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java
27 27
import eu.etaxonomy.cdm.model.description.Distribution;
28 28
import eu.etaxonomy.cdm.model.description.TaxonDescription;
29 29
import eu.etaxonomy.cdm.model.location.NamedArea;
30
import eu.etaxonomy.taxeditor.event.EventUtility;
31
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
30 32

  
31 33
/**
32 34
 * @author k.luther
......
121 123
                    @Override
122 124
                    public void widgetSelected(SelectionEvent e) {
123 125
                        editor.setDirty();
126
                        EventUtility.postEvent(WorkbenchEventConstants.REFRESH_DETAILS, true);
124 127
                    }
125 128
                    @Override
126 129
                    public void widgetDefaultSelected(SelectionEvent e) {

Also available in: Unified diff