Project

General

Profile

« Previous | Next » 

Revision a3ebe576

Added by Katja Luther almost 3 years ago

ref #9655: adapt TeamMemberSection to call selection dialog when click on +

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/agent/TeamMemberSection.java
17 17
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
18 18
import eu.etaxonomy.cdm.model.agent.Person;
19 19
import eu.etaxonomy.cdm.model.agent.Team;
20
import eu.etaxonomy.taxeditor.ui.dialog.selection.PersonSelectionDialog;
20 21
import eu.etaxonomy.taxeditor.ui.element.CacheRelevance;
21 22
import eu.etaxonomy.taxeditor.ui.element.CacheRelevanceHelper;
22 23
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23 24
import eu.etaxonomy.taxeditor.ui.element.ICacheRelevantFormElement;
24 25
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
25 26
import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
26
import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AbstractUnboundEntityCollectionSection;
27
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
27 28

  
28 29
/**
29 30
 * TeamMemberSection class.
......
32 33
 * @created Apr 30, 2010
33 34
 */
34 35
public class TeamMemberSection
35
        extends AbstractUnboundEntityCollectionSection<Team, Person>
36
        extends AbstractEntityCollectionSection<Team, Person>
36 37
        implements ICacheRelevantFormElement {
37 38

  
38 39
    private boolean isNomenclaturalTeam = false;
......
63 64
	}
64 65

  
65 66
	@Override
66
	public Person createNewElement() {
67
		return Person.NewTitledInstance("");
67
	public Person createNewElement()  {
68
	    Person selection = PersonSelectionDialog.select(getShell(), null);
69
	    return selection;
68 70
	}
69 71

  
70 72
	@Override
......
82 84
		getEntity().removeTeamMember(element);
83 85
	}
84 86

  
85
    @Override
86
    protected Collection<Person> getEntityCollection(Team entity) {
87
        return getEntity().getTeamMembers();
88
    }
87

  
89 88

  
90 89
    @Override
91 90
    public Comparator<Person> getComparator() {
......
122 121

  
123 122
    @Override
124 123
    public boolean allowAddExisting() {
125
        return false;
124
        return true;
126 125
    }
127 126

  
128 127
    @Override
......
140 139
    public CacheRelevance cacheRelevance() {
141 140
        return cacheRelevanceHelper.cacheRelevance();
142 141
    }
142

  
143
    @Override
144
    public Collection<Person> getCollection(Team entity) {
145
        return entity.getTeamMembers();
146

  
147
    }
148
//    @Override
149
//    protected Control createToolbar() {
150
//        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
151
//
152
//        Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
153
//
154
//            @Override
155
//            public void run() {
156
//
157
//                if(! getSection().isExpanded()) {
158
//                    getSection().setExpanded(true);
159
//                }
160
//                addElement(createNewElement());
161
//                internalUpdateSection(true);
162
//            }
163
//        };
164
//        addAction.setImageDescriptor(new ImageDescriptor() {
165
//
166
//            @Override
167
//            public ImageData getImageData() {
168
//                return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
169
//            }
170
//        });
171
//        addAction.setToolTipText(getTooltipString());
172
//
173
//        toolBarManager.add(addAction);
174
//
175
//        return toolBarManager.createControl(this);
176
//    }
177

  
178

  
179

  
143 180
}

Also available in: Unified diff