Revision 1016796d
Added by Patrick Plitzner over 6 years ago
eu.etaxonomy.taxeditor.editor/fragment.e4xmi | ||
---|---|---|
230 | 230 |
</elements> |
231 | 231 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_ARZyMKz2EeeBIsZyvYlAaA" elementId="eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4" label="%editor.name.4" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.group.authority.e4.CdmAuthorityEditorE4"/> |
232 | 232 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_Fa8l4M7XEeex0rHJ7p8Zdw" elementId="eu.etaxonomy.taxeditor.editor.view.workingSet.WorkingSetEditor" label="Working Set Editor" tooltip="Working Set Editor" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.WorkingSetEditor"/> |
233 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_rpaDsNK2EeeWSJT7vW9jsw" elementId="eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix" label="Character Matrix" tooltip="Character Matrix" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix"/> |
|
233 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_rpaDsNK2EeeWSJT7vW9jsw" elementId="eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix" label="Character Matrix" tooltip="Character Matrix" allowMultiple="true" closeable="true" dirtyable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix"> |
|
234 |
<handlers xmi:id="_d_HUYOPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.handler.2" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.charactermatrix.handler.ExportCharacterMatrixHandler" command="_YeWagOPBEeeIH8IplZ0cuA"/> |
|
235 |
<menus xmi:id="_PLw00OPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.menu.characterMatrix" label="Character Matrix"> |
|
236 |
<children xsi:type="menu:HandledMenuItem" xmi:id="_TGK04OPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.characterMatrix.export" label="Export" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/export.gif" command="_YeWagOPBEeeIH8IplZ0cuA"/> |
|
237 |
</menus> |
|
238 |
</elements> |
|
234 | 239 |
<elements xsi:type="basic:PartDescriptor" xmi:id="_XcQMEN8mEee9zP45RW4C3A" elementId="eu.etaxonomy.taxeditor.editor.workingSet.WorkingSetNavigator" label="Working Set Navigator" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.WorkingSetNavigator"> |
235 | 240 |
<handlers xmi:id="_JvYVgNXoEeeLtdyzt6BEAA" elementId="eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenCharacterMatrixHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenCharacterMatrixHandler" command="_FnWwMNXoEeeLtdyzt6BEAA"/> |
236 | 241 |
<handlers xmi:id="_SQL_wN86Eee9zP45RW4C3A" elementId="eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenWorkingSetEditorHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.workingSet.handler.OpenWorkingSetEditorHandler" command="_xdCSwN85Eee9zP45RW4C3A"/> |
... | ... | |
309 | 314 |
<elements xsi:type="commands:Command" xmi:id="_4nv18K21EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.editor.command.new.person" commandName="%command.name.26"/> |
310 | 315 |
<elements xsi:type="commands:Command" xmi:id="_FnWwMNXoEeeLtdyzt6BEAA" elementId="eu.etaxonomy.taxeditor.editor.command.workingSet.openCharacterMatrix" commandName="Open Character Matrix"/> |
311 | 316 |
<elements xsi:type="commands:Command" xmi:id="_xdCSwN85Eee9zP45RW4C3A" elementId="eu.etaxonomy.taxeditor.editor.command.workingSet.openWorkingSetEditor" commandName="Open Working Set Editor"/> |
317 |
<elements xsi:type="commands:Command" xmi:id="_YeWagOPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.command.characterMatrix.export" commandName="Export Character Matrix"/> |
|
312 | 318 |
</fragments> |
313 | 319 |
<fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation"> |
314 | 320 |
<elements xsi:type="menu:HandledMenuItem" xmi:id="_5s52EIZ3EeeOc9DZcjNN7g" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.concept" label="%command.label.6" tooltip="%command.label.6" command="_WPjpoDSnEeek0dKsFNy--Q"> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/charactermatrix/handler/ExportCharacterMatrixHandler.java | ||
---|---|---|
1 |
|
|
2 |
package eu.etaxonomy.taxeditor.editor.view.charactermatrix.handler; |
|
3 |
|
|
4 |
import javax.inject.Named; |
|
5 |
|
|
6 |
import org.eclipse.e4.core.di.annotations.Execute; |
|
7 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
|
8 |
import org.eclipse.e4.ui.services.IServiceConstants; |
|
9 |
import org.eclipse.nebula.widgets.nattable.NatTable; |
|
10 |
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommand; |
|
11 |
import org.eclipse.swt.widgets.Shell; |
|
12 |
|
|
13 |
import eu.etaxonomy.taxeditor.editor.workingSet.matrix.CharacterMatrix; |
|
14 |
|
|
15 |
public class ExportCharacterMatrixHandler { |
|
16 |
|
|
17 |
@Execute |
|
18 |
public void execute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart, |
|
19 |
@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) { |
|
20 |
CharacterMatrix characterMatrix = (CharacterMatrix) activePart.getObject(); |
|
21 |
NatTable natTable = characterMatrix.getNatTable(); |
|
22 |
natTable.doCommand(new ExportCommand(natTable.getConfigRegistry(), shell)); |
|
23 |
} |
|
24 |
|
|
25 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/workingSet/matrix/CharacterMatrix.java | ||
---|---|---|
45 | 45 |
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider; |
46 | 46 |
import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes; |
47 | 47 |
import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider; |
48 |
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommand; |
|
49 | 48 |
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommandHandler; |
50 | 49 |
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer; |
51 | 50 |
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel; |
... | ... | |
82 | 81 |
import org.eclipse.swt.SWT; |
83 | 82 |
import org.eclipse.swt.events.SelectionAdapter; |
84 | 83 |
import org.eclipse.swt.events.SelectionEvent; |
84 |
import org.eclipse.swt.layout.GridData; |
|
85 | 85 |
import org.eclipse.swt.layout.GridLayout; |
86 | 86 |
import org.eclipse.swt.widgets.Button; |
87 | 87 |
import org.eclipse.swt.widgets.Combo; |
... | ... | |
109 | 109 |
import eu.etaxonomy.taxeditor.editor.workingSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter; |
110 | 110 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkable; |
111 | 111 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails; |
112 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
|
112 | 113 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
113 | 114 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
114 | 115 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
... | ... | |
169 | 170 |
this.workingSet = CdmStore.getService(IWorkingSetService.class).load(workingSetUuid); |
170 | 171 |
thisPart.setLabel(workingSet.getLabel()); |
171 | 172 |
|
173 |
Composite toolbarComposite = new Composite(parent, SWT.NONE); |
|
174 |
toolbarComposite.setLayout(new GridLayout(2, false)); |
|
175 |
toolbarComposite.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, true, false)); |
|
176 |
|
|
172 | 177 |
//get features/columns stored in working set |
173 | 178 |
FeatureTree tree = workingSet.getDescriptiveSystem(); |
174 | 179 |
List<Feature> features = new ArrayList<>(tree.getDistinctFeatures()); |
... | ... | |
358 | 363 |
/** |
359 | 364 |
* Table state persistence |
360 | 365 |
*/ |
361 |
Properties natTableState = new Properties();
|
|
366 |
natTableState = new Properties(); |
|
362 | 367 |
//load persisted state |
363 |
File statePropertiesFile = new File(WorkbenchUtility.getBaseLocation(), CHARACTER_MATRIX_STATE_PROPERTIES);
|
|
368 |
File statePropertiesFile = getStatePropertiesFile();
|
|
364 | 369 |
FileInputStream inputStream; |
365 | 370 |
try { |
366 | 371 |
inputStream = new FileInputStream(statePropertiesFile); |
367 | 372 |
natTableState.load(inputStream); |
368 |
natTable.loadState("", natTableState); |
|
369 | 373 |
} catch (IOException e) { |
370 |
MessagingUtils.error(CharacterMatrix.class, e);;e.printStackTrace();
|
|
374 |
MessagingUtils.info("No initial state properties file found for character matrix");
|
|
371 | 375 |
} |
372 | 376 |
|
373 | 377 |
DisplayPersistenceDialogCommandHandler handler = |
374 | 378 |
new DisplayPersistenceDialogCommandHandler(natTableState, natTable); |
375 | 379 |
gridLayer.registerCommandHandler(handler); |
376 | 380 |
// create a combobox for showing the available view states |
377 |
Combo viewStates = new Combo(parent, SWT.DROP_DOWN);
|
|
378 |
viewStates.setItems(PersistenceHelper
|
|
381 |
Combo comboStates = new Combo(toolbarComposite, SWT.DROP_DOWN);
|
|
382 |
comboStates.setItems(PersistenceHelper
|
|
379 | 383 |
.getAvailableStates(natTableState) |
380 | 384 |
.toArray(new String[] {})); |
381 |
viewStates.addSelectionListener(new SelectionAdapter() {
|
|
385 |
comboStates.addSelectionListener(new SelectionAdapter() {
|
|
382 | 386 |
|
383 | 387 |
@Override |
384 | 388 |
public void widgetSelected(SelectionEvent e) { |
385 |
int index = viewStates.getSelectionIndex();
|
|
389 |
int index = comboStates.getSelectionIndex();
|
|
386 | 390 |
if (index >= 0) { |
387 |
String selected = viewStates.getItem(index);
|
|
391 |
String selected = comboStates.getItem(index);
|
|
388 | 392 |
// load the state |
389 | 393 |
natTable.loadState(selected, natTableState); |
390 | 394 |
} |
... | ... | |
396 | 400 |
|
397 | 401 |
@Override |
398 | 402 |
public void handleStateChange(StateChangeEvent event) { |
399 |
viewStates.setItems(PersistenceHelper
|
|
403 |
comboStates.setItems(PersistenceHelper
|
|
400 | 404 |
.getAvailableStates(natTableState) |
401 | 405 |
.toArray(new String[] {})); |
402 | 406 |
} |
403 | 407 |
}); |
404 | 408 |
|
405 | 409 |
// add button to show dialog |
406 |
Button manage = new Button(parent, SWT.PUSH);
|
|
407 |
manage.setText("View Management");
|
|
408 |
manage.addSelectionListener(new SelectionAdapter() {
|
|
410 |
Button btnManageState = new Button(toolbarComposite, SWT.PUSH);
|
|
411 |
btnManageState.setImage(ImageResources.getImage(ImageResources.SETTINGS));
|
|
412 |
btnManageState.addSelectionListener(new SelectionAdapter() {
|
|
409 | 413 |
@Override |
410 | 414 |
public void widgetSelected(SelectionEvent e) { |
411 | 415 |
natTable.doCommand(new DisplayPersistenceDialogCommand(natTable)); |
412 | 416 |
} |
413 | 417 |
}); |
414 |
Button btnSave = new Button(parent, SWT.PUSH); |
|
415 |
btnSave.setText("Save State"); |
|
416 |
btnSave.addSelectionListener(new SelectionAdapter() { |
|
417 |
@Override |
|
418 |
public void widgetSelected(SelectionEvent e) { |
|
419 |
natTable.saveState("", natTableState); |
|
420 |
try (FileOutputStream tableStateStream = |
|
421 |
new FileOutputStream(new File(WorkbenchUtility.getBaseLocation(), CHARACTER_MATRIX_STATE_PROPERTIES))) { |
|
422 |
natTableState.store(tableStateStream, null); |
|
423 |
} catch (IOException ioe) { |
|
424 |
ioe.printStackTrace(); |
|
425 |
} |
|
426 |
} |
|
427 |
}); |
|
428 | 418 |
|
429 | 419 |
/** |
430 | 420 |
* excel export |
431 | 421 |
*/ |
432 |
Button addColumnButton = new Button(parent, SWT.PUSH);
|
|
433 |
addColumnButton.setText("Export");
|
|
434 |
addColumnButton.addSelectionListener(new SelectionAdapter() { |
|
435 |
@Override |
|
436 |
public void widgetSelected(SelectionEvent e) { |
|
437 |
natTable.doCommand( |
|
438 |
new ExportCommand( |
|
439 |
natTable.getConfigRegistry(), |
|
440 |
natTable.getShell())); |
|
441 |
} |
|
442 |
}); |
|
422 |
// Button addColumnButton = new Button(toolbarComposite, SWT.PUSH);
|
|
423 |
// addColumnButton.setImage(ImageResources.getImage(ImageResources.EXPORT));
|
|
424 |
// addColumnButton.addSelectionListener(new SelectionAdapter() {
|
|
425 |
// @Override
|
|
426 |
// public void widgetSelected(SelectionEvent e) {
|
|
427 |
// natTable.doCommand(
|
|
428 |
// new ExportCommand(
|
|
429 |
// natTable.getConfigRegistry(),
|
|
430 |
// natTable.getShell()));
|
|
431 |
// }
|
|
432 |
// });
|
|
443 | 433 |
|
444 | 434 |
parent.layout(); |
445 | 435 |
} |
... | ... | |
548 | 538 |
this.dirty.setDirty(true); |
549 | 539 |
} |
550 | 540 |
|
541 |
public NatTable getNatTable() { |
|
542 |
return natTable; |
|
543 |
} |
|
544 |
|
|
551 | 545 |
@Persist |
552 | 546 |
@Override |
553 | 547 |
public void save(IProgressMonitor monitor) { |
... | ... | |
569 | 563 |
conversation.close(); |
570 | 564 |
conversation = null; |
571 | 565 |
} |
572 |
natTable.saveState("", natTableState); |
|
573 | 566 |
try (FileOutputStream tableStateStream = |
574 | 567 |
new FileOutputStream(getStatePropertiesFile())) { |
575 | 568 |
natTableState.store(tableStateStream, null); |
... | ... | |
579 | 572 |
} |
580 | 573 |
|
581 | 574 |
|
575 |
private File getStatePropertiesFile() { |
|
576 |
return new File(WorkbenchUtility.getBaseLocation(), CHARACTER_MATRIX_STATE_PROPERTIES); |
|
577 |
} |
|
578 |
|
|
579 |
|
|
582 | 580 |
/** |
583 | 581 |
* {@inheritDoc} |
584 | 582 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java | ||
---|---|---|
138 | 138 |
public static final String COLLAPSE_ALL = "collapse_all"; |
139 | 139 |
|
140 | 140 |
public static final String SWITCH_VIEW_TYPE = "switch_view_type"; |
141 |
public static final String SETTINGS = "settings"; |
|
142 |
public static final String EXPORT = "export"; |
|
141 | 143 |
|
142 | 144 |
//derivative icons |
143 | 145 |
public static final String TISSUE_SAMPLE_DERIVATE = "tissue_sample_derivate"; |
... | ... | |
349 | 351 |
"lock_open.png"); |
350 | 352 |
registerImage(registry, SWITCH_VIEW_TYPE, |
351 | 353 |
"switch_view_type-16x16-32.png"); |
354 |
registerImage(registry, SETTINGS, |
|
355 |
"settings.gif"); |
|
352 | 356 |
registerImage(registry, DNA_SAMPLE_DERIVATE, |
353 | 357 |
"dna_derivate-16x16-32.png"); |
354 | 358 |
registerImage(registry, DNA_SAMPLE_DERIVATE_CHARACTER_DATA, |
... | ... | |
395 | 399 |
"character_data_derivate-16x16-32.png"); |
396 | 400 |
registerImage(registry, DEFAULT_DERIVATIVE, |
397 | 401 |
"default_derivate-16x16-32.png"); |
402 |
registerImage(registry, EXPORT, |
|
403 |
"export.gif"); |
|
398 | 404 |
|
399 | 405 |
registerImage(registry, WEB, |
400 | 406 |
"web.gif"); |
Also available in: Unified diff
ref #7095 UI enhancements