Project

General

Profile

Download (3.91 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 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.preference;
10

    
11
import org.eclipse.jface.layout.GridLayoutFactory;
12
import org.eclipse.jface.preference.IntegerFieldEditor;
13
import org.eclipse.jface.preference.StringFieldEditor;
14
import org.eclipse.swt.SWT;
15
import org.eclipse.swt.layout.GridData;
16
import org.eclipse.swt.widgets.Composite;
17
import org.eclipse.swt.widgets.Control;
18
import org.eclipse.swt.widgets.Label;
19

    
20
import eu.etaxonomy.taxeditor.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
22

    
23
/**
24
 * @author k.luther
25
 * @since 18.01.2019
26
 *
27
 */
28
public class ExternalServicesPreferences extends CdmPreferencePage {
29

    
30
    StringFieldEditor openUrl;
31
    IntegerFieldEditor maxWidth;
32
    IntegerFieldEditor maxHeight;
33

    
34
    StringFieldEditor mapService;
35

    
36

    
37

    
38
    @Override
39
    protected Control createContents(Composite parent) {
40
       Composite top = new Composite(parent, SWT.LEFT);
41
       GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
42
       GridLayoutFactory.fillDefaults().applyTo(top);
43
       top.setLayoutData(gridData);
44
       Label mobot = new Label(top, SWT.NULL);
45
       mobot.setText("Mobot Open Url Service"); //$NON-NLS-1$
46
       GridData gridDataLabel = new GridData(GridData.FILL_HORIZONTAL);
47
       gridDataLabel.horizontalSpan=2;
48

    
49
       mobot.setLayoutData(gridDataLabel);
50

    
51
       Composite mobotComp = new Composite(top, SWT.NULL);
52

    
53
       GridLayoutFactory.fillDefaults().applyTo(mobotComp);
54

    
55
       GridData data = new GridData();
56
       data.horizontalIndent = 5;
57
       data.horizontalSpan = 2;
58
       mobotComp.setLayoutData(data);
59

    
60

    
61
       openUrl = new StringFieldEditor(PreferencesUtil.createPreferenceString(IPreferenceKeys.OPENURL_ACCESS_POINT),
62
               "Access Point", mobotComp); //$NON-NLS-1$
63
       openUrl.setPreferenceStore(getPreferenceStore());
64
       openUrl.load();
65

    
66
       Label reference = new Label(mobotComp, SWT.NULL);
67
       reference.setText("BHL Reference Image"); //$NON-NLS-1$
68

    
69
       reference.setLayoutData(gridDataLabel);
70
       maxWidth = new IntegerFieldEditor(
71
               PreferencesUtil.createPreferenceString(IPreferenceKeys.OPENURL_IMAGE_MAX_WIDTH),
72
               Messages.ExternalServicesPreferences_max_width,
73
               mobotComp);
74
       maxWidth.setPreferenceStore(getPreferenceStore());
75
       maxWidth.load();
76

    
77
       maxHeight = new IntegerFieldEditor(
78
               PreferencesUtil.createPreferenceString(IPreferenceKeys.OPENURL_IMAGE_MAX_HEIGHT),
79
               Messages.ExternalServicesPreferences_max_height,
80
               mobotComp);
81
       maxHeight.setPreferenceStore(getPreferenceStore());
82
       maxHeight.load();
83
       Label separator= new Label(top, SWT.HORIZONTAL | SWT.SEPARATOR);
84
       GridData sepGrid = createTextGridData();
85
       separator.setLayoutData(sepGrid);
86

    
87

    
88

    
89
       Label mapServiceLabel = new Label(top, SWT.NULL);
90
       mapServiceLabel.setText("EDIT Map Service"); //$NON-NLS-1$
91
       mapServiceLabel.setLayoutData(gridDataLabel);
92

    
93
       mapService = new StringFieldEditor(PreferencesUtil.createPreferenceString(
94
               IPreferenceKeys.EDIT_MAP_SERVICE_ACCES_POINT),
95
               "Access Point", top); //$NON-NLS-1$
96
       mapService.setPreferenceStore(getPreferenceStore());
97
       mapService.load();
98

    
99
       parent.layout();
100

    
101
       return top;
102

    
103
    }
104

    
105
    @Override
106
    public void createControl(Composite parent){
107
        super.createControl(parent);
108
        if (getApplyButton() != null){
109
            this.getApplyButton().setEnabled(true);
110
        }
111
    }
112

    
113
    @Override
114
    protected void performDefaults() {
115
        openUrl.loadDefault();
116
        maxHeight.loadDefault();
117
        maxWidth.loadDefault();
118
        mapService.loadDefault();
119
        super.performDefaults();
120
    }
121

    
122

    
123
}
(10-10/41)