Project

General

Profile

« Previous | Next » 

Revision e29e2ebd

Added by Katja Luther over 7 years ago

smaller changes for specimen import and others

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/DataImportView.java
18 18
import org.eclipse.jface.action.IToolBarManager;
19 19
import org.eclipse.jface.viewers.CheckboxTableViewer;
20 20
import org.eclipse.swt.SWT;
21
import org.eclipse.swt.layout.GridData;
22
import org.eclipse.swt.layout.GridLayout;
23
import org.eclipse.swt.widgets.Button;
21 24
import org.eclipse.swt.widgets.Composite;
22 25
import org.eclipse.swt.widgets.Display;
26
import org.eclipse.swt.widgets.Event;
27
import org.eclipse.swt.widgets.Label;
28
import org.eclipse.swt.widgets.Listener;
23 29
import org.eclipse.swt.widgets.Table;
24 30
import org.eclipse.swt.widgets.TableItem;
31
import org.eclipse.swt.widgets.Text;
25 32
import org.eclipse.ui.IMemento;
26 33
import org.eclipse.ui.forms.widgets.FormToolkit;
27 34
import org.eclipse.ui.part.ViewPart;
35
import org.eclipse.wb.swt.ResourceManager;
28 36

  
29 37
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
30 38
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
31 39
import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
40
import eu.etaxonomy.cdm.model.taxon.Classification;
32 41
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
33 42
import eu.etaxonomy.taxeditor.model.IContextListener;
34 43
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
35 44
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
36 45
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
37 46
import eu.etaxonomy.taxeditor.store.CdmStore;
47
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
38 48

  
39 49
/**
40 50
 * View which shows a list of "data" that can be imported into the CDM
......
45 55
 */
46 56

  
47 57
public abstract class DataImportView<T> extends ViewPart implements IPartContentHasFactualData,
48
IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener{
58
IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData, IContextListener, Listener{
49 59

  
50 60
    protected final Logger logger = Logger.getLogger(DataImportView.class);
51 61

  
......
56 66
    private static ConversationHolder conversationHolder;
57 67

  
58 68
    private SaveImportedSpecimenAction saveImportedSpecimenAction;
69
    
70
    private Text textClassification;
71
    private Classification classification;
72
    /**
73
	 * @return the classification
74
	 */
75
	public Classification getClassification() {
76
		return classification;
77
	}
78

  
79
	/**
80
	 * @param classification the classification to set
81
	 */
82
	public void setClassification(Classification classification) {
83
		this.classification = classification;
84
	}
85
	private Button btnBrowseClassification;
86
    private Button btnClear;
59 87

  
60 88
    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
61 89

  
......
77 105
     */
78 106
    @Override
79 107
    public void createPartControl(Composite parent) {
108
    	final Composite composite = new Composite(parent, SWT.NULL);
109

  
110
		GridLayout gridLayout = new GridLayout();
111
		gridLayout.numColumns = 4;
112
		composite.setLayout(gridLayout);
113
    	Label label = new Label(composite, SWT.NONE);
114
		label.setText("Classification");
115
		textClassification = new Text(composite, SWT.NONE);
116
		textClassification.setEnabled(false);
117
		textClassification.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
118
		btnBrowseClassification = new Button(composite, SWT.NONE);
119
		btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
120
		btnBrowseClassification.addListener(SWT.Selection, this);
121
		btnClear = new Button(composite, SWT.NONE);
122
		btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
123
		btnClear.addListener(SWT.Selection, this);
80 124

  
81 125
        CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.FULL_SELECTION);
82 126
        table = checkboxTableViewer.getTable();
83 127
        toolkit.paintBordersFor(table);
84 128

  
129
        
130
        
85 131
        createActions();
86 132
        initializeToolBar();
87 133
        initializeMenu();
......
145 191
    }
146 192

  
147 193
    protected void refresh(){
148
        getTable().removeAll();
194
       // getTable().removeAll();
149 195
        for(T item:results){
150 196
            TableItem tableItem = new TableItem(getTable(), SWT.NONE);
151 197
            tableItem.setText(getTextForTableItem(item));
......
234 280
        }
235 281
        return conversationHolder;
236 282
    }
237

  
283
    @Override
284
	public void handleEvent(Event event) {
285
	    if(event.widget==btnBrowseClassification){
286
	        classification = SelectionDialogFactory.getSelectionFromDialog(Classification.class, getSite().getShell(), null, null);
287
	        if(classification!=null){
288
	            textClassification.setText(classification.getTitleCache());
289
	        }
290
	    }
291
	    else if(event.widget==btnClear){
292
	        classification = null;
293
	        textClassification.setText("");
294
	    }
295
	}
238 296
}

Also available in: Unified diff