Project

General

Profile

Revision e5c6119c

IDe5c6119cb5009ca7706e15ae876147fda784513d
Parent d98abaef
Child 79eb8142

Added by Patrick Plitzner almost 2 years ago

ref #4363 Add message parameter to EmptySection for detail information

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
131 131
    public static String DefinedTermMenu_TERM_EDITOR;
132 132

  
133 133

  
134
    public static String DetailsViewerE4_TAXON_HAS_NO_NAME;
135

  
136

  
134 137
    public static String DetailsViewPart_VIEWER_NAME;
135 138
    public static String EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER;
136 139
    public static String EditPasswordElement_USERNAME_DOES_NOT_EXIST;
140

  
141

  
142
    public static String EmptySection_NO_VIEW_IMPLEMENTED;
137 143
    public static String PasswordWizard_COULD_NOT_CHANGE_PWD;
138 144
    public static String PasswordWizard_OLD_PWD_INCORRECT;
139 145
    public static String PasswordWizard_PROBLEM_WITH_CHANGING_PWD;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
124 124

  
125 125
EditPasswordElement_PLEASE_CREATE_OR_SAVE_USER=Please create or save user '%s' before changing password
126 126
EditPasswordElement_USERNAME_DOES_NOT_EXIST=Username does not exist
127
EmptySection_NO_VIEW_IMPLEMENTED=Unknown element. Details can not be shown.
127 128
PasswordWizard_COULD_NOT_CHANGE_PWD=Could not change password
128 129
PasswordWizard_OLD_PWD_INCORRECT=The old password is not correct.
129 130
PasswordWizard_PROBLEM_WITH_CHANGING_PWD=Problem with changing password
......
145 146
DefinedTermMenu_OTHER_S=Other %ss
146 147
DefinedTermMenu_OTHERS=Others
147 148
DefinedTermMenu_TERM_EDITOR=Term Editor
149
DetailsViewerE4_TAXON_HAS_NO_NAME=Taxon has no name. Details can not be shown.
148 150
DetailsViewPart_VIEWER_NAME=Details
149 151

  
150 152
AuthenticatedUserBar_LOGGED_IN_AS=Logged in as: %s         
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
1335 1335
        return element;
1336 1336
    }
1337 1337

  
1338

  
1339

  
1340 1338
    /**
1341
     * @param conversationHolder
1342
     * @param parent
1343
     * @param detailsViewer
1344
     * @param i
1345
     * @return
1339
     * Creates an empty section with the given message.<br>
1340
     * If message is <code>null</code> a default message will be displayed.
1346 1341
     */
1347
    public EmptySection createEmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1348
        EmptySection section = new EmptySection(formFactory, parentElement, style);
1342
    public EmptySection createEmptySection(String message, CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
1343
        EmptySection section = new EmptySection(message, formFactory, parentElement, style);
1349 1344
        parentElement.addElement(section);
1350 1345
        adapt(section);
1351 1346
        return section;
......
1385 1380
     *         object.
1386 1381
     */
1387 1382
    public DateDetailSection<VerbatimTimePeriod> createVerbatimDateDetailSection(ICdmFormElement parentElement, int style) {
1388
        DateDetailSection<VerbatimTimePeriod> section 
1383
        DateDetailSection<VerbatimTimePeriod> section
1389 1384
        	= new DateDetailSection<VerbatimTimePeriod>(this, parentElement, true, style);
1390 1385
        parentElement.addElement(section);
1391 1386
        adapt(section);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/EmptySection.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.occurrence;
10 10

  
11
import eu.etaxonomy.taxeditor.l10n.Messages;
11 12
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
12 13
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
13 14
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
......
20 21
 */
21 22
public class EmptySection extends AbstractCdmDetailSection<Object> {
22 23

  
23
    public EmptySection(CdmFormFactory formFactory, ICdmFormElement parentElement, int style) {
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) {
24 28
        super(formFactory, null, parentElement, null, style);
29
        this.message = message!=null?message:DEFAULT_MESSAGE;
25 30
    }
26 31

  
27 32
    /** {@inheritDoc} */
28 33
    @Override
29 34
    public String getHeading() {
30
        return "No view implemented for this element";
35
        return message!=null?message:DEFAULT_MESSAGE;
31 36
    }
32 37

  
33 38
    @Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/AbstractCdmDataViewerE4.java
93 93
	}
94 94

  
95 95

  
96
    protected void createEmptySection(RootElement parent) {
96
    protected void createEmptySection(String message, RootElement parent) {
97 97
        destroySections();
98 98

  
99
        EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
99
        EmptySection emptySection = formFactory.createEmptySection(message, formFactory, parent, SWT.NONE);
100 100

  
101 101
        addPart(emptySection);
102 102
    }
103 103

  
104
    public void showEmptyPage(){
104
    public void showEmptyPage(String message){
105 105
    	destroySections();
106
        createEmptySection(rootElement);
106
        createEmptySection(message, rootElement);
107 107
    }
108 108

  
109 109
    protected void markViewPartDirty(){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
59 59
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
60 60
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
61 61
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
62
import eu.etaxonomy.taxeditor.l10n.Messages;
62 63
import eu.etaxonomy.taxeditor.model.AbstractUtility;
63 64
import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
64 65
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
......
227 228
        destroySections();
228 229
        if (input instanceof TaxonBase) {
229 230
            if(((TaxonBase) input).getName()==null){
230
                createEmptySection(rootElement);
231
                createEmptySection(Messages.DetailsViewerE4_TAXON_HAS_NO_NAME, rootElement);
231 232
            }
232 233
            else{
233 234
                createTaxonSections(rootElement);
......
297 298
        } else if (input instanceof DerivedUnitFacade) {
298 299
            if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
299 300
                if(((DerivedUnitFacade) input).innerFieldUnit()==null){
300
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null);
301
                    MessagingUtils.error(DetailsViewerE4.class, "FieldUnit of facade is null", null); //$NON-NLS-1$
301 302
                }
302 303
                else{
303 304
                    createFieldUnitSection(rootElement);
......
305 306
            }
306 307
            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
307 308
                if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
308
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null);
309
                    MessagingUtils.error(DetailsViewerE4.class, "DerivedUnit of facade is null", null); //$NON-NLS-1$
309 310
                }
310 311
                else{
311 312
                    createDerivedUnitBaseElementSection(rootElement);
......
373 374
//            createDescriptionElementSection(rootElement);
374 375

  
375 376
        }else {
376
            createEmptySection(rootElement);
377
            createEmptySection(null, rootElement);
377 378
        }
378 379
        layout();
379 380

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)