Revision 1a7f5070
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/DataImportViewE4.java | ||
---|---|---|
35 | 35 |
import org.eclipse.swt.widgets.TableItem; |
36 | 36 |
import org.eclipse.swt.widgets.Text; |
37 | 37 |
import org.eclipse.ui.IMemento; |
38 |
import org.eclipse.ui.PlatformUI; |
|
39 | 38 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
40 | 39 |
import org.eclipse.wb.swt.ResourceManager; |
41 | 40 |
|
... | ... | |
51 | 50 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData; |
52 | 51 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
53 | 52 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory; |
54 |
import eu.etaxonomy.taxeditor.view.dataimport.SaveImportedSpecimenAction; |
|
55 | 53 |
|
56 | 54 |
/** |
57 | 55 |
* View which shows a list of "data" that can be imported into the CDM |
... | ... | |
73 | 71 |
|
74 | 72 |
private static ConversationHolder conversationHolder; |
75 | 73 |
|
76 |
private SaveImportedSpecimenAction saveImportedSpecimenAction; |
|
74 |
private SaveImportedSpecimenActionE4 saveImportedSpecimenAction;
|
|
77 | 75 |
|
78 | 76 |
private Text textClassification; |
79 | 77 |
|
... | ... | |
83 | 81 |
|
84 | 82 |
private Button toggleButton; |
85 | 83 |
|
84 |
private Button importButton; |
|
85 |
|
|
86 | 86 |
private boolean state; |
87 | 87 |
|
88 | 88 |
private Button openConfigurator; |
... | ... | |
102 | 102 |
private final FormToolkit toolkit = new FormToolkit(Display.getCurrent()); |
103 | 103 |
|
104 | 104 |
private Table table; |
105 |
private Composite composite_3; |
|
105 | 106 |
|
106 | 107 |
/** |
107 | 108 |
* Constructs a new DataImportEditor and registers it to listen to context changes |
108 | 109 |
*/ |
109 | 110 |
public DataImportViewE4() { |
110 | 111 |
CdmStore.getContextManager().addContextListener(this); |
111 |
|
|
112 | 112 |
} |
113 | 113 |
|
114 | 114 |
/** |
... | ... | |
132 | 132 |
composite_1.setLayoutData(gd_composite_1); |
133 | 133 |
composite_1.setLayout(new GridLayout(3, false)); |
134 | 134 |
|
135 |
Label label = new Label(composite_1, SWT.TOP);
|
|
136 |
label.setText("Classification");
|
|
137 |
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
|
|
138 |
textClassification = new Text(composite_1, SWT.BORDER);
|
|
139 |
textClassification.setEnabled(false);
|
|
140 |
GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
|
141 |
gd_textClassification.widthHint = 118;
|
|
142 |
textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
|
|
143 |
btnBrowseClassification = new Button(composite_1, SWT.NONE);
|
|
144 |
btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
|
|
145 |
btnBrowseClassification.addListener(SWT.Selection, this);
|
|
146 |
btnClear = new Button(composite_1, SWT.NONE);
|
|
147 |
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
|
|
148 |
btnClear.addListener(SWT.Selection, this);
|
|
149 |
//source reference
|
|
135 |
Label label = new Label(composite_1, SWT.TOP);
|
|
136 |
label.setText("Classification");
|
|
137 |
label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
|
|
138 |
textClassification = new Text(composite_1, SWT.BORDER);
|
|
139 |
textClassification.setEnabled(false);
|
|
140 |
GridData gd_textClassification = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
|
141 |
gd_textClassification.widthHint = 118;
|
|
142 |
textClassification.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, true));
|
|
143 |
btnBrowseClassification = new Button(composite_1, SWT.NONE);
|
|
144 |
btnBrowseClassification.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/open.gif"));
|
|
145 |
btnBrowseClassification.addListener(SWT.Selection, this);
|
|
146 |
btnClear = new Button(composite_1, SWT.NONE);
|
|
147 |
btnClear.setImage(ResourceManager.getPluginImage("eu.etaxonomy.taxeditor.store", "icons/trash.gif"));
|
|
148 |
btnClear.addListener(SWT.Selection, this);
|
|
149 |
//source reference
|
|
150 | 150 |
|
151 | 151 |
Label labelRef = new Label(composite_1, SWT.NONE); |
152 | 152 |
labelRef.setText("Default import souce reference"); |
... | ... | |
167 | 167 |
public void widgetSelected(SelectionEvent e) { |
168 | 168 |
|
169 | 169 |
IWizard wizard = new ImportPreferencesWizard(); |
170 |
WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
|
|
170 |
WizardDialog dialog = new WizardDialog(e.display.getActiveShell(), wizard);
|
|
171 | 171 |
dialog.open(); |
172 | 172 |
} |
173 | 173 |
}); |
174 | 174 |
|
175 |
//checkbox table for result |
|
175 |
//checkbox table for result
|
|
176 | 176 |
Composite composite_2 = new Composite(composite, SWT.NONE); |
177 | 177 |
GridData gd_composite_2 = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1); |
178 | 178 |
gd_composite_2.heightHint = 454; |
179 | 179 |
gd_composite_2.widthHint = 403; |
180 | 180 |
composite_2.setLayoutData(gd_composite_2); |
181 |
composite_2.setLayout(new GridLayout(2, false)); |
|
182 |
|
|
183 |
|
|
184 |
CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite_2, SWT.BORDER | SWT.FULL_SELECTION); |
|
185 |
|
|
186 |
|
|
187 |
table = checkboxTableViewer.getTable(); |
|
188 |
GridData gd_table = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1); |
|
189 |
gd_table.heightHint = 444; |
|
190 |
gd_table.widthHint = 312; |
|
191 |
table.setLayoutData(gd_table); |
|
192 |
toolkit.paintBordersFor(table); |
|
193 |
//toggle button |
|
194 |
toggleButton = new Button(composite_2, SWT.PUSH); |
|
195 |
GridData gd_toggleButton = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1); |
|
196 |
gd_toggleButton.widthHint = 56; |
|
197 |
toggleButton.setLayoutData(gd_toggleButton); |
|
198 |
toggleButton.setText("Toggle"); |
|
199 |
toggleButton.addSelectionListener(new SelectionAdapter(){ |
|
200 |
@Override |
|
201 |
public void widgetSelected(SelectionEvent e) { |
|
202 |
state = state ? false : true; |
|
203 |
for (TableItem item: getTable().getItems()){ |
|
204 |
item.setChecked(state); |
|
205 |
} |
|
206 |
|
|
207 |
} |
|
208 |
}); |
|
209 |
createActions(); |
|
210 |
initializeToolBar(); |
|
211 |
} |
|
181 |
composite_2.setLayout(new GridLayout(2, false)); |
|
182 |
|
|
183 |
|
|
184 |
CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(composite_2, SWT.BORDER | SWT.FULL_SELECTION); |
|
185 |
|
|
186 |
|
|
187 |
table = checkboxTableViewer.getTable(); |
|
188 |
GridData gd_table = new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1); |
|
189 |
gd_table.heightHint = 444; |
|
190 |
gd_table.widthHint = 312; |
|
191 |
table.setLayoutData(gd_table); |
|
192 |
toolkit.paintBordersFor(table); |
|
193 |
|
|
194 |
composite_3 = new Composite(composite_2, SWT.NONE); |
|
195 |
composite_3.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); |
|
196 |
toolkit.paintBordersFor(composite_3); |
|
197 |
composite_3.setLayout(new GridLayout(1, false)); |
|
198 |
//toggle button |
|
199 |
toggleButton = new Button(composite_3, SWT.PUSH); |
|
200 |
toggleButton.setText("Toggle"); |
|
201 |
|
|
202 |
importButton = new Button(composite_3, SWT.PUSH); |
|
203 |
importButton.setText("Import"); |
|
204 |
importButton.addSelectionListener(new SelectionAdapter(){ |
|
205 |
@Override |
|
206 |
public void widgetSelected(SelectionEvent e) { |
|
207 |
saveImportedSpecimenAction.run(); |
|
208 |
} |
|
209 |
}); |
|
210 |
toggleButton.addSelectionListener(new SelectionAdapter(){ |
|
211 |
@Override |
|
212 |
public void widgetSelected(SelectionEvent e) { |
|
213 |
state = state ? false : true; |
|
214 |
for (TableItem item: getTable().getItems()){ |
|
215 |
item.setChecked(state); |
|
216 |
} |
|
212 | 217 |
|
213 |
/**
|
|
214 |
* Create the actions.
|
|
215 |
*/
|
|
216 |
private void createActions() {
|
|
217 |
saveImportedSpecimenAction = new SaveImportedSpecimenAction();
|
|
218 |
}
|
|
219 |
});
|
|
220 |
//import button
|
|
221 |
saveImportedSpecimenAction = new SaveImportedSpecimenActionE4(this);
|
|
222 |
initializeToolBar();
|
|
218 | 223 |
} |
219 | 224 |
|
220 | 225 |
/** |
... | ... | |
254 | 259 |
if (getTable() != null){ |
255 | 260 |
getTable().removeAll(); |
256 | 261 |
} |
257 |
for(T item:results){ |
|
258 |
TableItem tableItem = new TableItem(getTable(), SWT.NONE); |
|
259 |
tableItem.setText(getTextForTableItem(item)); |
|
260 |
tableItem.setData(item); |
|
262 |
if(results!=null){ |
|
263 |
for(T item:results){ |
|
264 |
TableItem tableItem = new TableItem(getTable(), SWT.NONE); |
|
265 |
tableItem.setText(getTextForTableItem(item)); |
|
266 |
tableItem.setData(item); |
|
267 |
} |
|
261 | 268 |
} |
262 | 269 |
updated = true; |
263 | 270 |
} |
... | ... | |
279 | 286 |
|
280 | 287 |
@Focus |
281 | 288 |
public void setFocus() { |
282 |
getTable().setFocus(); |
|
289 |
if(getTable()!=null){ |
|
290 |
getTable().setFocus(); |
|
291 |
} |
|
283 | 292 |
//make sure to bind again if maybe in another view the conversation was unbound |
284 | 293 |
if(getConversationHolder()!=null && !getConversationHolder().isBound()){ |
285 | 294 |
getConversationHolder().bind(); |
Also available in: Unified diff
fix #6921 Migrate ABCD and GBIF import views