Project

General

Profile

Revision 92a795af

ID92a795af6aa31d7e6beb26d685d9ddf26e900bea
Parent 097d348b
Child 436a661e

Added by Patrick Plitzner about 3 years ago

ref #7502 Add id and uuid to bulk editor

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4Composite.java
91 91

  
92 92
    public static final String TYPE_PROPERTY = Messages.BulkEditorE4_TYPE;
93 93

  
94
    public static final String ID_PROPERTY = "Id";
95

  
96
    public static final String UUID_PROPERTY = "Uuid";
97

  
94 98
    public static final String CANDIDATE_LABEL = "candidate";
95 99

  
96 100
    public static final String TARGET_LABEL = "target";
97 101

  
102
    public static final List<String> columnList = new ArrayList<>();
103

  
98 104
    private Composite topComposite;
99 105

  
100 106
    @Inject
......
137 143
	@SuppressWarnings("unused")
138 144
    public void init(AbstractBulkEditorInput<?> input){
139 145

  
146
        columnList.add(input.getName());
147
        columnList.add(TYPE_PROPERTY);
148
        columnList.add(UUID_PROPERTY);
149
        columnList.add(ID_PROPERTY);
150

  
140 151
	    new BulkEditorSearchE4(this, topComposite, SWT.NONE);
141 152
	    //layout needed because the search bar is added after @PostConstuct method
142 153
	    topComposite.getParent().layout();
......
165 176
	    ConfigRegistry configRegistry = new ConfigRegistry();
166 177
	    //property map
167 178
        Map<String, String> propertyToLabels = new HashMap<>();
168
        propertyToLabels.put(bulkEditor.getEditorInput().getName(), bulkEditor.getEditorInput().getName());
169
        propertyToLabels.put(TYPE_PROPERTY, TYPE_PROPERTY);
170
        String[] propertyNames = new String[] { bulkEditor.getEditorInput().getName(), TYPE_PROPERTY };
179
        for(String columnLabel:columnList){
180
            propertyToLabels.put(columnLabel, columnLabel);
181
        }
182
        String[] propertyNames = columnList.toArray(columnList.toArray(new String[columnList.size()]));
171 183
        //sorted list
172 184
        SortedList<CdmBase> sortedList = new SortedList<>(bulkEditor.getEditorInput().getModel(), bulkEditor.getEditorInput().getTitleComparator());
173 185
        //data provider
......
185 197
        bodyLayer = new DefaultBodyLayerStack(eventLayer);
186 198

  
187 199
        dataLayer.setColumnPercentageSizing(0, true);
188
        dataLayer.setColumnWidthPercentageByPosition(0, 85);
200
        dataLayer.setColumnWidthPercentageByPosition(0, 65);
189 201
        dataLayer.setColumnWidthByPosition(1, 100);
202
        dataLayer.setColumnWidthByPosition(2, 70);
203
        dataLayer.setColumnWidthByPosition(3, 50);
190 204

  
191 205
        //column
192 206
        DataLayer columnHeaderDataLayer = new DataLayer(colHeaderDataProvider);
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorPropertyAccessor.java
22 22

  
23 23
        private AbstractBulkEditorInput input;
24 24

  
25

  
26 25
        public BulkEditorPropertyAccessor(AbstractBulkEditorInput<CdmBase> input) {
27 26
            super();
28 27
            this.input = input;
......
30 29

  
31 30
        @Override
32 31
        public Object getDataValue(CdmBase rowObject, int columnIndex) {
33
            if(columnIndex==0){
32
            String property = BulkEditorE4Composite.columnList.get(columnIndex);
33
            if(property.equals(input.getName())){
34 34
                return input.getText(rowObject);
35
            }else if(columnIndex==1){
35
            }if(property.equals(BulkEditorE4Composite.TYPE_PROPERTY)){
36 36
                return input.getTypeText(rowObject);
37
            }if(property.equals(BulkEditorE4Composite.UUID_PROPERTY)){
38
                return rowObject.getUuid();
39
            }if(property.equals(BulkEditorE4Composite.ID_PROPERTY)){
40
                return rowObject.getId();
37 41
            }
38 42
            return null;
39 43
        }
......
45 49

  
46 50
        @Override
47 51
        public int getColumnCount() {
48
            return 2;
52
            return BulkEditorE4Composite.columnList.size();
49 53
        }
50 54

  
51 55
        @Override
52 56
        public String getColumnProperty(int columnIndex) {
53
            if(columnIndex==0){
54
                return input.getName();
55
            }else if(columnIndex==1){
56
                return BulkEditorE4Composite.TYPE_PROPERTY;
57
            }
58
            return null;
57
            return BulkEditorE4Composite.columnList.get(columnIndex);
59 58
        }
60 59

  
61 60
        @Override
62 61
        public int getColumnIndex(String propertyName) {
63
            if(propertyName.equals(input.getName())){
64
                return 0;
65
            }
66
            else if(propertyName.equals(BulkEditorE4Composite.TYPE_PROPERTY)){
67
                return 1;
68
            }
69
            return 0;
62
            return BulkEditorE4Composite.columnList.indexOf(propertyName);
70 63
        }
71 64
    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)