Project

General

Profile

« Previous | Next » 

Revision f561b00c

Added by Niels Hoffmann about 13 years ago

Refactoring selection elements so they can be configured

View differences:

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

  
11 11
package eu.etaxonomy.taxeditor.ui.selection;
12 12

  
13
import org.apache.log4j.Logger;
14 13
import org.eclipse.swt.events.SelectionEvent;
15 14

  
16 15
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
......
21 20
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
22 21

  
23 22
/**
24
 * <p>NamedAreaSelectionElement class.</p>
25
 *
23
 * <p>
24
 * NamedAreaSelectionElement class.
25
 * </p>
26
 * 
26 27
 * @author n.hoffmann
27 28
 * @created May 11, 2010
28 29
 * @version 1.0
29 30
 */
30
public class NamedAreaSelectionElement extends AbstractSelectionElement<NamedArea> {
31
	
31
public class NamedAreaSelectionElement extends
32
		AbstractSelectionElement<NamedArea> {
33

  
34
	public static final int DEFAULT = NOTHING;
35

  
32 36
	/**
33
	 * <p>Constructor for NamedAreaSelectionElement.</p>
34
	 *
35
	 * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
36
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
37
	 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
38
	 * @param labelString a {@link java.lang.String} object.
39
	 * @param entity a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
40
	 * @param style a int.
37
	 * <p>
38
	 * Constructor for NamedAreaSelectionElement.
39
	 * </p>
40
	 * 
41
	 * @param formFactory
42
	 *            a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory}
43
	 *            object.
44
	 * @param conversation
45
	 *            a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
46
	 *            object.
47
	 * @param parentElement
48
	 *            a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement}
49
	 *            object.
50
	 * @param labelString
51
	 *            a {@link java.lang.String} object.
52
	 * @param entity
53
	 *            a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
54
	 * @param style
55
	 *            a int.
41 56
	 */
42
	public NamedAreaSelectionElement(CdmFormFactory formFactory, ConversationHolder conversation,
43
			ICdmFormElement parentElement, String labelString,
44
			NamedArea entity, int style) {
57
	public NamedAreaSelectionElement(CdmFormFactory formFactory,
58
			ConversationHolder conversation, ICdmFormElement parentElement,
59
			String labelString, NamedArea entity, int mode, int style) {
45 60
		super(formFactory, conversation, parentElement, labelString, entity,
46
				false, false, false, style);
61
				mode, style);
47 62
	}
48 63

  
49 64
	/** {@inheritDoc} */
65
	@Override
50 66
	public void widgetSelected(SelectionEvent e) {
51
		NamedArea newSelection = NamedAreaSelectionDialog.select(getLayoutComposite().getShell(), getConversationHolder(), entity);
67
		NamedArea newSelection = NamedAreaSelectionDialog.select(
68
				getLayoutComposite().getShell(), getConversationHolder(),
69
				entity);
52 70
		setSelectionInternal(newSelection);
53 71
	}
54
	
72

  
55 73
	/** {@inheritDoc} */
56 74
	@Override
57 75
	protected String getTitle() {
58
		return (entity != null) ? NamedArea.labelWithLevel(entity, CdmStore.getDefaultLanguage()) : "";
76
		return (entity != null) ? NamedArea.labelWithLevel(entity,
77
				CdmStore.getDefaultLanguage()) : "";
59 78
	}
60 79
}

Also available in: Unified diff