Project

General

Profile

Download (4.03 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.cdm.model.metadata.PreferencePredicate;
21
import eu.etaxonomy.taxeditor.l10n.Messages;
22
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
23

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

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

    
35
    StringFieldEditor mapService;
36

    
37

    
38

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

    
50
       mobot.setLayoutData(gridDataLabel);
51

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

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

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

    
61

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

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

    
70
       reference.setLayoutData(gridDataLabel);
71
       maxWidth = new IntegerFieldEditor(
72
               PreferencesUtil.createPreferenceString(PreferencePredicate.MobotOpenUrlServiceMaxWidth.getKey()),
73
               Messages.ExternalServicesPreferences_max_width,
74
               mobotComp);
75
       maxWidth.setPreferenceStore(getPreferenceStore());
76
       maxWidth.load();
77

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

    
88

    
89

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

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

    
100
       parent.layout();
101

    
102
       return top;
103

    
104
    }
105

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

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

    
123

    
124
}
(16-16/55)