Revision 49df31fc
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
19 | 19 |
import java.util.UUID; |
20 | 20 |
import java.util.stream.Collectors; |
21 | 21 |
|
22 |
import javax.inject.Inject; |
|
23 |
|
|
22 | 24 |
import org.apache.commons.collections4.map.LinkedMap; |
23 | 25 |
import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; |
24 | 26 |
import org.eclipse.core.runtime.ICoreRunnable; |
25 | 27 |
import org.eclipse.core.runtime.IProgressMonitor; |
28 |
import org.eclipse.core.runtime.jobs.IJobChangeEvent; |
|
26 | 29 |
import org.eclipse.core.runtime.jobs.Job; |
30 |
import org.eclipse.core.runtime.jobs.JobChangeAdapter; |
|
31 |
import org.eclipse.e4.ui.di.UISynchronize; |
|
27 | 32 |
import org.eclipse.jface.layout.GridDataFactory; |
28 | 33 |
import org.eclipse.jface.viewers.ComboViewer; |
29 | 34 |
import org.eclipse.nebula.widgets.nattable.NatTable; |
... | ... | |
113 | 118 |
|
114 | 119 |
static final String LABEL_TAXON_ROW = "TAXON_ROW"; //$NON-NLS-1$ |
115 | 120 |
|
121 |
@Inject |
|
122 |
private UISynchronize sync; |
|
123 |
|
|
116 | 124 |
private DescriptiveDataSet descriptiveDataSet; |
117 | 125 |
|
118 | 126 |
private NatTable natTable; |
... | ... | |
512 | 520 |
UUID monitorUuid = CdmStore.getService(IDescriptiveDataSetService.class).monitGetRowWrapper(descriptiveDataSet); |
513 | 521 |
IProgressMonitorService progressMonitorService = CdmApplicationState.getCurrentAppConfig().getProgressMonitorService(); |
514 | 522 |
|
515 |
|
|
523 |
final Collection<RowWrapperDTO> wrappers = new ArrayList<>(); |
|
516 | 524 |
String jobLabel = "Load character data"; |
517 | 525 |
Job job = Job.create(jobLabel, (ICoreRunnable) monitor -> { |
518 | 526 |
monitor.beginTask(jobLabel, IProgressMonitor.UNKNOWN); |
... | ... | |
524 | 532 |
IRemotingProgressMonitor remotingMonitor = progressMonitorService.getRemotingMonitor(monitorUuid); |
525 | 533 |
Object result = remotingMonitor.getResult(); |
526 | 534 |
if(result instanceof Collection){ |
527 |
Collection<RowWrapperDTO> wrappers = (Collection<RowWrapperDTO>) result; |
|
528 |
wrappers.forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper)); |
|
535 |
wrappers.addAll((Collection<RowWrapperDTO>) result); |
|
529 | 536 |
} |
530 | 537 |
monitor.done(); |
531 | 538 |
}); |
539 |
job.addJobChangeListener(new JobChangeAdapter(){ |
|
540 |
@Override |
|
541 |
public void done(IJobChangeEvent event) { |
|
542 |
sync.syncExec(()->{ |
|
543 |
wrappers.forEach(wrapper->CharacterMatrix.this.descriptions.add(wrapper)); |
|
544 |
loadingDone(); |
|
545 |
}); |
|
546 |
} |
|
547 |
}); |
|
532 | 548 |
job.schedule(1000); |
533 | 549 |
} |
534 | 550 |
|
551 |
private void loadingDone() { |
|
552 |
this.part.loadingDone(); |
|
553 |
} |
|
554 |
|
|
535 | 555 |
public List<State> getSupportedStatesForCategoricalFeature(Feature feature){ |
536 | 556 |
return categoricalFeatureToStateMap.get(feature); |
537 | 557 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixPart.java | ||
---|---|---|
25 | 25 |
import javax.inject.Inject; |
26 | 26 |
|
27 | 27 |
import org.eclipse.core.runtime.IProgressMonitor; |
28 |
import org.eclipse.e4.core.contexts.ContextInjectionFactory; |
|
29 |
import org.eclipse.e4.core.contexts.IEclipseContext; |
|
28 | 30 |
import org.eclipse.e4.ui.di.Focus; |
29 | 31 |
import org.eclipse.e4.ui.di.Persist; |
30 | 32 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
31 | 33 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
32 | 34 |
import org.eclipse.e4.ui.workbench.modeling.ESelectionService; |
33 | 35 |
import org.eclipse.nebula.widgets.nattable.NatTable; |
36 |
import org.eclipse.swt.SWT; |
|
37 |
import org.eclipse.swt.custom.StackLayout; |
|
34 | 38 |
import org.eclipse.swt.widgets.Composite; |
39 |
import org.eclipse.swt.widgets.Label; |
|
35 | 40 |
|
36 | 41 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
37 | 42 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
... | ... | |
105 | 110 |
|
106 | 111 |
private CharacterMatrix matrix; |
107 | 112 |
|
113 |
private StackLayout stackLayout; |
|
114 |
|
|
108 | 115 |
@PostConstruct |
109 |
public void create(Composite parent) { |
|
116 |
public void create(Composite parent, IEclipseContext context) {
|
|
110 | 117 |
if(CdmStore.isActive() && conversation==null){ |
111 | 118 |
conversation = CdmStore.createConversation(); |
112 | 119 |
} |
... | ... | |
116 | 123 |
else{ |
117 | 124 |
return; |
118 | 125 |
} |
126 |
stackLayout = new StackLayout(); |
|
127 |
parent.setLayout(stackLayout); |
|
119 | 128 |
matrix = new CharacterMatrix(parent, this); |
129 |
Label label = new Label(parent, SWT.NONE); |
|
130 |
label.setText("Loading matrix..."); |
|
131 |
stackLayout.topControl = label; |
|
132 |
ContextInjectionFactory.inject(matrix, context); |
|
120 | 133 |
} |
121 | 134 |
|
122 | 135 |
public void init(UUID descriptiveDataSetUuid, boolean treeView) { |
... | ... | |
253 | 266 |
updateResults.add(result); |
254 | 267 |
} |
255 | 268 |
|
269 |
public void loadingDone() { |
|
270 |
stackLayout.topControl = matrix; |
|
271 |
matrix.getParent().layout(); |
|
272 |
} |
|
273 |
|
|
256 | 274 |
} |
Also available in: Unified diff
Add loading label to character matrix