Project

General

Profile

« Previous | Next » 

Revision 4d1c9e9b

Added by Patrick Plitzner about 10 years ago

  • renamed TextWithLabelElement to avoid import/name conflicts (ma be renamed if we fully refactor using MVC pattern)

View differences:

.gitattributes
1390 1390
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/GeographicPointElement.java -text
1391 1391
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermCombo.java -text
1392 1392
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/combo/EnumTermComboController.java -text
1393
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElement.java -text
1394 1393
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElementController.java -text
1394
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElementMVC.java -text
1395 1395
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/interfaces/CdmCompositeController.java -text
1396 1396
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/interfaces/ICdmComposite.java -text
1397 1397
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/openurl/IOpenUrlEnabled.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/DerivedUnitGeneralDetailElementMVC.java
23 23
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
24 24
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
25 25
import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermCombo;
26
import eu.etaxonomy.taxeditor.ui.mvc.element.TextWithLabelElement;
26
import eu.etaxonomy.taxeditor.ui.mvc.element.TextWithLabelElementMVC;
27 27

  
28 28
/**
29 29
 * @author pplitzner
......
33 33
public class DerivedUnitGeneralDetailElementMVC extends AbstractCdmComposite {
34 34

  
35 35
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
36
    private final TextWithLabelElement textWithLabelElement;
36
    private final TextWithLabelElementMVC textWithLabelElement;
37 37
    private final EnumTermCombo enumTermCombo;
38 38

  
39 39
    /**
......
91 91

  
92 92
        Label lblCollectingNumber = toolkit.createLabel(this, "Collecting Number", SWT.NONE);
93 93

  
94
        TextWithLabelElement textWithLabelElement_1 = new TextWithLabelElement(this, (String) null, (Integer) null, 0);
94
        TextWithLabelElementMVC textWithLabelElement_1 = new TextWithLabelElementMVC(this, (String) null, (Integer) null, 0);
95 95
        toolkit.adapt(textWithLabelElement_1);
96 96
        toolkit.paintBordersFor(textWithLabelElement_1);
97 97

  
......
100 100

  
101 101
        Label lblAccessionNumber = toolkit.createLabel(this, "Accession Number", SWT.NONE);
102 102

  
103
        textWithLabelElement = new TextWithLabelElement(this, (String) null, (Integer) null, 0);
103
        textWithLabelElement = new TextWithLabelElementMVC(this, (String) null, (Integer) null, 0);
104 104
        TableWrapLayout tableWrapLayout = (TableWrapLayout) textWithLabelElement.getLayout();
105 105
        tableWrapLayout.verticalSpacing = 0;
106 106
        tableWrapLayout.topMargin = 0;
......
115 115

  
116 116
    }
117 117

  
118
    public TextWithLabelElement getTextWithLabelElement() {
118
    public TextWithLabelElementMVC getTextWithLabelElement() {
119 119
        return textWithLabelElement;
120 120
    }
121 121
    public EnumTermCombo getEnumTermCombo() {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/GeographicPointElement.java
21 21

  
22 22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23 23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24
import eu.etaxonomy.taxeditor.ui.mvc.element.TextWithLabelElement;
24
import eu.etaxonomy.taxeditor.ui.mvc.element.TextWithLabelElementMVC;
25 25

  
26 26
/**
27 27
 * @author pplitzner
......
67 67

  
68 68
        Label lblErrorRadius = toolkit.createLabel(this, "Error Radius", SWT.NONE);
69 69

  
70
        TextWithLabelElement textWithLabelElement = new TextWithLabelElement(this, (String) null, (Integer) null, 0);
70
        TextWithLabelElementMVC textWithLabelElement = new TextWithLabelElementMVC(this, (String) null, (Integer) null, 0);
71 71
        TableWrapData twd_textWithLabelElement = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP, 1, 1);
72 72
        twd_textWithLabelElement.grabHorizontal = true;
73 73
        textWithLabelElement.setLayoutData(twd_textWithLabelElement);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElement.java
1
// $Id$
2
/**
3
* Copyright (C) 2014 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.taxeditor.ui.mvc.element;
11

  
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.DisposeEvent;
14
import org.eclipse.swt.events.DisposeListener;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Display;
17
import org.eclipse.swt.widgets.Text;
18
import org.eclipse.ui.forms.widgets.FormToolkit;
19
import org.eclipse.ui.forms.widgets.TableWrapData;
20
import org.eclipse.ui.forms.widgets.TableWrapLayout;
21

  
22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24
import eu.etaxonomy.taxeditor.ui.mvc.AbstractCdmComposite;
25

  
26
/**
27
 * @author pplitzner
28
 * @date 11.02.2014
29
 *
30
 */
31
public class TextWithLabelElement extends AbstractCdmComposite {
32

  
33
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
34
    private final Text text;
35
    private final String initialText;
36
    private final Integer textHeight;
37

  
38
    /**
39
     * Create the composite.
40
     * @param parent
41
     * @param style
42
     */
43
    public TextWithLabelElement(Composite parent, String initialText, Integer textHeight, int style) {
44
        super(parent, SWT.BORDER);
45
        this.initialText = initialText;
46
        this.textHeight = textHeight;
47
        addDisposeListener(new DisposeListener() {
48
            @Override
49
            public void widgetDisposed(DisposeEvent e) {
50
                toolkit.dispose();
51
            }
52
        });
53
        toolkit.adapt(this);
54
        toolkit.paintBordersFor(this);
55
        {
56
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
57
            tableWrapLayout.verticalSpacing = 0;
58
            tableWrapLayout.topMargin = 0;
59
            tableWrapLayout.horizontalSpacing = 0;
60
            tableWrapLayout.bottomMargin = 0;
61
            tableWrapLayout.rightMargin = 0;
62
            tableWrapLayout.leftMargin = 0;
63
            setLayout(tableWrapLayout);
64
        }
65

  
66
        text = new Text(this, SWT.WRAP);
67
        text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
68
        toolkit.adapt(text, true, true);
69

  
70
    }
71

  
72
    public Text getText() {
73
        return text;
74
    }
75

  
76
    @Override
77
    protected void initInternalController(CdmFormFactory formFactory, ICdmFormElement parentElement){
78
        controller = new TextWithLabelElementController(this, formFactory, parentElement, this.initialText, this.textHeight, SWT.NONE);
79
    }
80
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElementController.java
63 63
     *            a int.
64 64
     * @wbp.parser.entryPoint
65 65
     */
66
    public TextWithLabelElementController(TextWithLabelElement textWithLabelElement, CdmFormFactory formFactory, ICdmFormElement parentElement,
66
    public TextWithLabelElementController(TextWithLabelElementMVC textWithLabelElement, CdmFormFactory formFactory, ICdmFormElement parentElement,
67 67
            String initialText, Integer textHeight, int style) {
68 68
        super(formFactory, parentElement);
69 69

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/mvc/element/TextWithLabelElementMVC.java
1
// $Id$
2
/**
3
* Copyright (C) 2014 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.taxeditor.ui.mvc.element;
11

  
12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.DisposeEvent;
14
import org.eclipse.swt.events.DisposeListener;
15
import org.eclipse.swt.widgets.Composite;
16
import org.eclipse.swt.widgets.Display;
17
import org.eclipse.swt.widgets.Text;
18
import org.eclipse.ui.forms.widgets.FormToolkit;
19
import org.eclipse.ui.forms.widgets.TableWrapData;
20
import org.eclipse.ui.forms.widgets.TableWrapLayout;
21

  
22
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
23
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
24
import eu.etaxonomy.taxeditor.ui.mvc.AbstractCdmComposite;
25

  
26
/**
27
 * @author pplitzner
28
 * @date 11.02.2014
29
 *
30
 */
31
public class TextWithLabelElementMVC extends AbstractCdmComposite {
32

  
33
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
34
    private final Text text;
35
    private final String initialText;
36
    private final Integer textHeight;
37

  
38
    /**
39
     * Create the composite.
40
     * @param parent
41
     * @param style
42
     */
43
    public TextWithLabelElementMVC(Composite parent, String initialText, Integer textHeight, int style) {
44
        super(parent, SWT.BORDER);
45
        this.initialText = initialText;
46
        this.textHeight = textHeight;
47
        addDisposeListener(new DisposeListener() {
48
            @Override
49
            public void widgetDisposed(DisposeEvent e) {
50
                toolkit.dispose();
51
            }
52
        });
53
        toolkit.adapt(this);
54
        toolkit.paintBordersFor(this);
55
        {
56
            TableWrapLayout tableWrapLayout = new TableWrapLayout();
57
            tableWrapLayout.verticalSpacing = 0;
58
            tableWrapLayout.topMargin = 0;
59
            tableWrapLayout.horizontalSpacing = 0;
60
            tableWrapLayout.bottomMargin = 0;
61
            tableWrapLayout.rightMargin = 0;
62
            tableWrapLayout.leftMargin = 0;
63
            setLayout(tableWrapLayout);
64
        }
65

  
66
        text = new Text(this, SWT.WRAP);
67
        text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
68
        toolkit.adapt(text, true, true);
69

  
70
    }
71

  
72
    public Text getText() {
73
        return text;
74
    }
75

  
76
    @Override
77
    protected void initInternalController(CdmFormFactory formFactory, ICdmFormElement parentElement){
78
        controller = new TextWithLabelElementController(this, formFactory, parentElement, this.initialText, this.textHeight, SWT.NONE);
79
    }
80
}

Also available in: Unified diff