Project

General

Profile

« Previous | Next » 

Revision 248d15d9

Added by Patrick Plitzner over 5 years ago

ref #7095 Add remove description button

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/CharacterMatrix.java
196 196

  
197 197
    private ConfigRegistry configRegistry;
198 198

  
199
    private DefaultBodyLayerStack bodyLayer;
200

  
199 201

  
200 202
    public CharacterMatrix(Composite parent, CharacterMatrixPart part) {
201 203
        super(parent, SWT.NONE);
......
384 386
         * Add description button
385 387
         */
386 388
        Button btnAddDescription = new Button(buttonPanel, SWT.PUSH);
387
        btnAddDescription.setImage(ImageResources.getImage(ImageResources.ADD_ICON));
389
        btnAddDescription.setImage(ImageResources.getImage(ImageResources.ADD_ICON_GREEN));
388 390
        btnAddDescription.addSelectionListener(new SelectionAdapter() {
389 391
            @Override
390 392
            public void widgetSelected(SelectionEvent e) {
......
406 408
                }
407 409
            }
408 410
        });
411
        /**
412
         * Remove description button
413
         */
414
        Button btnRemoveDescription = new Button(buttonPanel, SWT.PUSH);
415
        btnRemoveDescription.setImage(ImageResources.getImage(ImageResources.ACTIVE_DELETE_ICON));
416
        btnRemoveDescription.addSelectionListener(new SelectionAdapter() {
417
            @Override
418
            public void widgetSelected(SelectionEvent e) {
419
                int[] fullySelectedRowPositions = bodyLayer.getSelectionLayer().getFullySelectedRowPositions();
420
                for (int i : fullySelectedRowPositions) {
421
                    Object rowObject = bodyDataProvider.getRowObject(i);
422
                    if(rowObject instanceof RowWrapper){
423
                        CharacterMatrix.this.descriptions.remove(rowObject);
424
                        workingSet.removeDescription(((RowWrapper) rowObject).getSpecimenDescription());
425
                        setDirty();
426
                    }
427
                }
428
            }
429
        });
409 430
    }
410 431

  
411 432
    private void applyStyles(){
......
584 605
        GlazedListTreeData treeData = new GlazedListTreeData<>(treeList);
585 606
        ITreeRowModel treeRowModel = new GlazedListTreeRowModel<>(treeData);
586 607

  
587
        final DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(
588
                bodyDataLayer);
608
        bodyLayer = new DefaultBodyLayerStack(
609
                eventLayer);
589 610
        viewportLayer = bodyLayer.getViewportLayer();
590 611
        final SelectionLayer selectionLayer = bodyLayer.getSelectionLayer();
591 612
        freezeLayer = new FreezeLayer(selectionLayer);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java
52 52
	************************************************************************************** */
53 53
	/** Constant <code>ADD_ICON="add_icon"</code> */
54 54
	public static final String ADD_ICON = "add_icon";
55
	public static final String ADD_ICON_GREEN = "add_icon_green";
56
	public static final String MIN_ICON = "min_icon";
55 57
	public static final String ADD_EDIT = "add_edit";
56 58
	/** Constant <code>TRASH_ICON="trash_icon"</code> */
57 59
	public static final String TRASH_ICON = "trash_icon";
......
269 271
	protected void initializeImageRegistry(ImageRegistry registry) {
270 272
		registerImage(registry, ADD_ICON,
271 273
				"add_no_bg.gif");
274
		registerImage(registry, ADD_ICON_GREEN,
275
		        "add.gif");
276
		registerImage(registry, MIN_ICON,
277
		        "min.gif");
272 278
		registerImage(registry, ADD_EDIT,
273 279
		        "add_edit.gif");
274 280
		registerImage(registry, TRASH_ICON,

Also available in: Unified diff