1
|
/**
|
2
|
* Copyright (C) 2014 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.taxeditor.ui.section.occurrence;
|
10
|
|
11
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
12
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
13
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
14
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
|
15
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
|
16
|
|
17
|
/**
|
18
|
* @author pplitzner
|
19
|
* @date 27.01.2014
|
20
|
*
|
21
|
*/
|
22
|
public class EmptySection extends AbstractCdmDetailSection<Object> {
|
23
|
|
24
|
private static final String DEFAULT_MESSAGE = Messages.EmptySection_NO_VIEW_IMPLEMENTED;
|
25
|
private final String message;
|
26
|
|
27
|
public EmptySection(String message, CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
|
28
|
super(formFactory, null, parentElement, null, style);
|
29
|
this.message = message!=null?message:DEFAULT_MESSAGE;
|
30
|
}
|
31
|
|
32
|
/** {@inheritDoc} */
|
33
|
@Override
|
34
|
public String getHeading() {
|
35
|
return message!=null?message:DEFAULT_MESSAGE;
|
36
|
}
|
37
|
|
38
|
@Override
|
39
|
protected AbstractCdmDetailElement<Object> createCdmDetailElement(AbstractCdmDetailSection<Object> parentElement, int style) {
|
40
|
return formFactory.createEmptyElement(parentElement, message);
|
41
|
}
|
42
|
|
43
|
@Override
|
44
|
public void setEntity(Object entity) {
|
45
|
//update section title because getHeading is invoked
|
46
|
//before message is set via constructor
|
47
|
setSectionTitle();
|
48
|
}
|
49
|
}
|