Project

General

Profile

Revision f9840e06

IDf9840e06dc7c41c6e2a6846b31f97ae867355be4
Parent 525deb12
Child a60ccec4

Added by Katja Luther about 1 year ago

ref #8385: correct preference handling for provider list

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/AbcdImportProviderAdminPreferencePage.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10 10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.layout.GridLayout;
11
import org.apache.commons.lang.StringUtils;
14 12
import org.eclipse.swt.widgets.Composite;
15 13
import org.eclipse.swt.widgets.Control;
16 14

  
......
18 16
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19 17
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
20 18
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
21
import eu.etaxonomy.taxeditor.l10n.Messages;
22
import eu.etaxonomy.taxeditor.preference.AbcdImportPreference;
19
import eu.etaxonomy.taxeditor.preference.AbcdImportProvider;
23 20
import eu.etaxonomy.taxeditor.preference.ListComponent;
24 21
import eu.etaxonomy.taxeditor.store.CdmStore;
25 22

  
......
28 25
 * @since 23.03.2018
29 26
 *
30 27
 */
31
public class AbcdImportProviderAdminPreferencePage extends AbcdImportPreference implements IE4AdminPreferencePage{
28
public class AbcdImportProviderAdminPreferencePage extends AbcdImportProvider implements IE4AdminPreferencePage{
32 29

  
33 30
    private ListComponent biocaseProviderList;
34 31

  
35 32
    @Override
36 33
    protected Control createContents(Composite parent) {
37
        final Composite composite = new Composite(parent, SWT.NULL);
38
        final CLabel description = new CLabel(composite, SWT.NULL);
39
        description.setText(Messages.AbcdImportProvider_description);
40
        GridLayout gridLayout = new GridLayout();
41
        composite.setLayout(gridLayout);
42

  
43
        gridLayout.numColumns = 3;
44
        //gridLayout.horizontalSpacing= 5;
45
        //gridLayout.makeColumnsEqualWidth = true;
46

  
47
        composite.setLayout(gridLayout);
48
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE, true);
34
        Control composite = super.createContents(parent);
35
        biocaseProviderList.setAdmin(true);
49 36
        setApply(true);
50 37
        return composite;
51 38
    }
......
64 51
                return false;
65 52
            }
66 53
            IPreferenceService service = controller.getPreferenceService();
67
            service.set(pref);
54
            if (StringUtils.isBlank(providerList)){
55
                service.remove(pref.getKey());
56
            }else{
57
                service.set(pref);
58
            }
68 59
        }
69 60

  
70 61
        return true;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ListComponent.java
45 45
    private Text providerURI;
46 46
    boolean isAdmin = false;
47 47

  
48

  
48 49
    public ListComponent(Composite parent, int style, boolean isAdmin) {
49 50
        this.isAdmin= isAdmin;
50 51
        list = new List(parent, SWT.BORDER |  SWT.V_SCROLL);
......
104 105
        removeButton.addMouseListener(new RemoveListener());
105 106
    }
106 107

  
108

  
109
    public boolean isAdmin() {
110
        return isAdmin;
111
    }
112

  
113
    public void setAdmin(boolean isAdmin) {
114
        this.isAdmin = isAdmin;
115
    }
116

  
107 117
    class RemoveListener implements MouseListener {
108 118
        @Override
109 119
        public void mouseUp(MouseEvent e)  {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)