Project

General

Profile

Download (2.04 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2018 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
package eu.etaxonomy.cdm.vaadin.component.distributionStatus;
11

    
12
import java.io.IOException;
13

    
14
import org.apache.commons.io.IOUtils;
15

    
16
import com.vaadin.ui.AbstractLayout;
17
import com.vaadin.ui.AbstractOrderedLayout;
18
import com.vaadin.ui.Alignment;
19
import com.vaadin.ui.CustomComponent;
20
import com.vaadin.ui.RichTextArea;
21
import com.vaadin.ui.VerticalLayout;
22
import com.vaadin.ui.Window;
23

    
24
import eu.etaxonomy.cdm.i18n.Messages;
25
import eu.etaxonomy.cdm.vaadin.view.distributionStatus.IDistributionTableView;
26

    
27
/**
28
 * @author freimeier
29
 * @date 9 Mar 2018
30
 *
31
 */
32
public class HelpWindow extends CustomComponent{
33
    private Window window;
34
    private AbstractOrderedLayout mainLayout;
35
    private IDistributionTableView view;
36

    
37
    public HelpWindow(IDistributionTableView view) {
38
        this.view = view;
39
        buildMainLayout();
40
    }
41

    
42
    private AbstractLayout buildMainLayout() {
43
        mainLayout = new VerticalLayout();
44
        mainLayout.setSizeFull();
45
        String text = "";
46
        try {
47
            text = IOUtils.toString(this.getClass().getResourceAsStream(Messages.getLocalizedString(Messages.HelpWindow_RESOURCE)),
48
                    "UTF-8");
49
        } catch (IOException e) {
50
        }
51

    
52
        RichTextArea textArea = new RichTextArea();
53
        textArea.setValue(text);
54
        textArea.setReadOnly(true);
55
        textArea.setWidth("95%");
56
        mainLayout.addComponent(textArea);
57
        mainLayout.setComponentAlignment(textArea, Alignment.TOP_CENTER);
58

    
59
        return mainLayout;
60
    }
61

    
62
    public Window createWindow(String caption) {
63
        window = new Window();
64
        window.setModal(true);
65
        window.setWidth("40%"); //$NON-NLS-1$
66
        window.setHeight("70%"); //$NON-NLS-1$
67
        window.setCaption(caption);
68
        window.setContent(mainLayout);
69
        return window;
70
    }
71
}
(5-5/6)