Project

General

Profile

« Previous | Next » 

Revision 0bae5e5a

Added by Patrick Plitzner over 8 years ago

Add selection listener to media detail element to allow showing
supplemental data (#3367)

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/ISelectableElement.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
13 13

  
14 14

  
15 15
/**
16
 * <p>ISelectableElement interface.</p>
16
 * Implementors of this interface provide a {@link SelectionArbitrator}.<br>
17
 * The arbitrator allows the element to be selected to show e.g.
18
 * supplemental data.<br>
19
 * An arbitrator can be added like in the following code example:
20
 * <br>
21
 * <br>
22
 * <pre>
23
 * //make element selectable
24
 *  if(cdmFormFactory.getSelectionProvider() != null){
25
 *     selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
26
 *  }
27
 *  </pre>
17 28
 *
18 29
 * @author n.hoffmann
19 30
 * @created Mar 5, 2010
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
20 20
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
21 21
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
22 22
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
23
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
23 24
import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
25
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
24 26
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
25 27
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
26 28
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
......
30 32
 * @created Nov 17, 2009
31 33
 * @version 1.0
32 34
 */
33
public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ITogglableMediaElement{
35
public class MediaMetaElement extends AbstractEntityCollectionElement<Media> implements ISelectableElement, ITogglableMediaElement{
34 36

  
35 37
    private EntitySelectionElement<AgentBase> selection_artist;
36 38
    private LanguageStringWithLabelElement text_description;
37 39
    private LanguageStringWithLabelElement text_title;
38 40
    private MediaDetailElement mediaDetailElement;
41
    private SelectionArbitrator selectionArbitrator;
39 42

  
40 43
    public MediaMetaElement(CdmFormFactory cdmFormFactory,
41 44
            AbstractFormSection<?> formElement, Media element,
42 45
            SelectionListener removeListener, boolean isChoosableEntity, int style) {
43 46
        super(cdmFormFactory, formElement, element, removeListener, isChoosableEntity, null, style);
47
        //make element selectable
48
        if(cdmFormFactory.getSelectionProvider() != null){
49
            selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
50
        }
44 51
    }
45 52

  
46 53
    /** {@inheritDoc} */
......
108 115
        }
109 116
    }
110 117

  
118
    @Override
119
    public SelectionArbitrator getSelectionArbitrator() {
120
        return selectionArbitrator;
121
    }
122

  
111 123
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
69 69
	public NameDetailElement(CdmFormFactory cdmFormFactory, ICdmFormElement formElement,
70 70
			int style) {
71 71
		super(cdmFormFactory, formElement);
72
		// register as selection listener
72
		// make this element selectable
73 73
		if(cdmFormFactory.getSelectionProvider() != null){
74 74
			selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
75 75
		}

Also available in: Unified diff