Project

General

Profile

Revision 46d40a62

ID46d40a62ab1ea9c563da042dae1d1bf7e170f017
Parent 71ef005a
Child 28b6d887

Added by Patrick Plitzner over 2 years ago

ref #7095 some UI enhancements

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/SpecimenSelectionDialog.java
24 24
import org.eclipse.jface.viewers.TableViewer;
25 25
import org.eclipse.jface.viewers.TableViewerColumn;
26 26
import org.eclipse.swt.SWT;
27
import org.eclipse.swt.events.FocusEvent;
28
import org.eclipse.swt.events.FocusListener;
27 29
import org.eclipse.swt.events.SelectionAdapter;
28 30
import org.eclipse.swt.events.SelectionEvent;
29 31
import org.eclipse.swt.graphics.Image;
......
32 34
import org.eclipse.swt.widgets.Button;
33 35
import org.eclipse.swt.widgets.Composite;
34 36
import org.eclipse.swt.widgets.Control;
37
import org.eclipse.swt.widgets.Label;
35 38
import org.eclipse.swt.widgets.Shell;
36 39
import org.eclipse.swt.widgets.Table;
37 40
import org.eclipse.swt.widgets.Text;
......
45 48
import eu.etaxonomy.cdm.model.taxon.Taxon;
46 49
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
47 50
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
51
import eu.etaxonomy.taxeditor.model.AbstractUtility;
48 52
import eu.etaxonomy.taxeditor.model.ImageResources;
53
import eu.etaxonomy.taxeditor.preference.Resources;
49 54
import eu.etaxonomy.taxeditor.store.CdmStore;
50 55
import eu.etaxonomy.taxeditor.ui.combo.taxon.TaxonNodeCombo;
51 56

  
......
58 63
 */
59 64
public class SpecimenSelectionDialog extends Dialog {
60 65

  
66
    private static String TEXT_FILTER_DEFAULT = "Enter text filter";
67

  
61 68
    private TableViewer list;
62 69

  
63 70
    private Collection<SpecimenOrObservationBase> selectedSpecimens = new ArrayList<>();
......
79 86

  
80 87
        Composite composite_1 = new Composite(composite, SWT.NONE);
81 88
        composite_1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
82
        composite_1.setLayout(new GridLayout(3, false));
89
        composite_1.setLayout(new GridLayout(4, false));
83 90

  
84
        txtTextFilter = new Text(composite_1, SWT.BORDER);
85
        txtTextFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
86
        txtTextFilter.addModifyListener(e->applyFilter());
91
        Label lblNewLabel = new Label(composite_1, SWT.NONE);
92
        lblNewLabel.setText("Taxon");
87 93

  
88 94
        comboTaxon = new TaxonNodeCombo(composite_1, SWT.NONE);
89 95
        comboTaxon.setInput(matrix.getWorkingSet().getTaxonSubtreeFilter());
90 96
        comboTaxon.addSelectionChangedListener(e->applyFilter());
91 97

  
98
        txtTextFilter = new Text(composite_1, SWT.BORDER);
99
        txtTextFilter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
100
        txtTextFilter.setText(TEXT_FILTER_DEFAULT);
101
        txtTextFilter.addFocusListener(new FocusListener() {
102

  
103
            @Override
104
            public void focusGained(FocusEvent e) {
105
                txtTextFilter.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOCUS));
106
                if (TEXT_FILTER_DEFAULT.equals(txtTextFilter.getText())) {
107
                    txtTextFilter.setText("");
108
                }
109
            }
110

  
111
            @Override
112
            public void focusLost(FocusEvent e) {
113
                if (CdmUtils.isBlank(txtTextFilter.getText())){
114
                    txtTextFilter.setForeground(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND));
115
                    txtTextFilter.setText(TEXT_FILTER_DEFAULT);
116
                }
117
            }
118
        });
119
        txtTextFilter.addModifyListener(e->applyFilter());
120

  
92 121
        Button btnRefreshButton = new Button(composite_1, SWT.NONE);
93 122
        btnRefreshButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
94 123
        btnRefreshButton.setToolTipText(Messages.SpecimenSelectionDialog_REFRESH);
......
138 167
                    filteredWrappers
139 168
                    .filter(wrapper->wrapper.getTaxonNode().equals(comboTaxon.getSelection()));
140 169
        }
141
        if(!CdmUtils.isBlank(txtTextFilter.getText())){
170
        if(!txtTextFilter.getForeground().equals(AbstractUtility.getColor(Resources.SEARCH_VIEW_FOREGROUND))
171
                &&!CdmUtils.isBlank(txtTextFilter.getText())){
142 172
            filteredWrappers =
143 173
                    filteredWrappers
144 174
                    .filter(wrapper->wrapper.getLabel().toLowerCase().contains(txtTextFilter.getText().toLowerCase()));

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)