Project

General

Profile

Revision 97352439

ID9735243958a5fc8d3fab2148177fb52fa271686d
Parent 8309769f
Child eee3eb03

Added by Patrick Plitzner about 1 year ago

ref #7439 Move event list to editor input

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java
124 124

  
125 125
    private BulkEditorQuery lastQuery = null;
126 126

  
127
    private BasicEventList<CdmBase> list;
128

  
129 127
    private Composite bottomComposite;
130 128

  
131 129
    @Inject
......
236 234
        }
237 235

  
238 236
        //++++NatTable++++
239
        list = new BasicEventList<>();
240 237
        Map<String, String> propertyToLabels = new HashMap<>();
241 238
        propertyToLabels.put(getEditorInput().getName(), getEditorInput().getName());
242 239
        propertyToLabels.put(TYPE_PROPERTY, TYPE_PROPERTY);
243 240
        String[] propertyNames = new String[] { getEditorInput().getName(), TYPE_PROPERTY };
244
        bodyDataProvider = new ListDataProvider<CdmBase>(list,
241
        bodyDataProvider = new ListDataProvider<CdmBase>(getEditorInput().getModel(),
245 242
                new BulkEditorPropertyAccessor(getEditorInput()));
246 243

  
247 244

  
......
251 248
                bodyDataProvider);
252 249

  
253 250
        DataLayer dataLayer = new DataLayer(bodyDataProvider);
254
        GlazedListsEventLayer<CdmBase> eventLayer = new GlazedListsEventLayer<>(dataLayer, list);
251
        GlazedListsEventLayer<CdmBase> eventLayer = new GlazedListsEventLayer<>(dataLayer, getEditorInput().getModel());
255 252
        DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(eventLayer);
256 253
        selectionLayer = bodyLayer.getSelectionLayer();
257 254

  
......
312 309

  
313 310
            @Override
314 311
            public Serializable getRowId(CdmBase rowObject) {
315
                return list.indexOf(rowObject);
312
                return getEditorInput().getModel().indexOf(rowObject);
316 313
            }
317 314

  
318 315
        }));
......
417 414
//            getEditorInput().bind();
418 415
            getEditorInput().performSearch(query);
419 416
            lastQuery = query;
420
            List model = getEditorInput().getModel();
421 417
//            viewer.setInput(model);
422
            list.clear();
423
            list.addAll(model);
424 418

  
425 419
            refresh();
426 420
        }
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
19 19
import java.util.Set;
20 20
import java.util.UUID;
21 21

  
22
import ca.odell.glazedlists.BasicEventList;
22 23
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
23 24
import eu.etaxonomy.cdm.api.service.config.DeleteConfiguratorBase;
24 25
import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
......
51 52

  
52 53
	private UUID entityUuid;
53 54

  
54
	private List<T> model = new ArrayList<>();
55
	private BasicEventList<T> model = new BasicEventList<>();
55 56

  
56 57
	private Map<T, DeleteConfiguratorBase> toDelete = new HashMap<>();
57 58
	private List<T> saveCandidates = new ArrayList<>();
......
135 136
	}
136 137

  
137 138
	public void performSearch(final BulkEditorQuery bulkEditorQuery) {
138

  
139
		List<T> entityList = new ArrayList<T>();
139
	    model.clear();
140
	    BasicEventList<T> entityList = new BasicEventList<>();
140 141

  
141 142
		if(getEntityUuid() != null){
142 143

  
143 144
			T entity = loadEntity(getEntityUuid());
144 145
			entityList.add(entity);
145
			model = entityList;
146
			model.addAll(entityList);
146 147
		}
147 148
		else if(bulkEditorQuery != null){
148 149

  
149 150
			IIdentifiableEntityServiceConfigurator configurator = bulkEditorQuery.getSearchConfigurator();
150 151
			Comparator queryComparator = (bulkEditorQuery.getComparator() != null) ? bulkEditorQuery.getComparator() : new TitleCacheComparator();
151 152

  
152
			entityList = listEntities(configurator);
153
			entityList.addAll(listEntities(configurator));
153 154

  
154 155
			Collections.sort(entityList, queryComparator);
155

  
156

  
157 156
		}
158

  
159
		model = entityList;
157
		model.addAll(entityList);
160 158
	}
161 159

  
162 160
	public boolean isMergingEnabled() {
......
269 267
		return "No text. Implement in subclass";
270 268
	}
271 269

  
272
	public List<T> getModel() {
270
	public BasicEventList<T> getModel() {
273 271
		return model;
274 272
	}
275 273

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)