Revision c64d9f63
Added by Patrick Plitzner over 4 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
56 | 56 |
import org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer; |
57 | 57 |
import org.eclipse.nebula.widgets.nattable.freeze.FreezeHelper; |
58 | 58 |
import org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer; |
59 |
import org.eclipse.nebula.widgets.nattable.grid.GridRegion; |
|
60 | 59 |
import org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand; |
61 | 60 |
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider; |
62 | 61 |
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider; |
63 | 62 |
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider; |
64 |
import org.eclipse.nebula.widgets.nattable.grid.data.FixedSummaryRowHeaderLayer; |
|
65 | 63 |
import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer; |
66 | 64 |
import org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer; |
67 | 65 |
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer; |
68 | 66 |
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; |
67 |
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer; |
|
69 | 68 |
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupGroupHeaderLayer; |
70 | 69 |
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupHeaderLayer; |
71 | 70 |
import org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel; |
72 | 71 |
import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; |
73 |
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer; |
|
74 | 72 |
import org.eclipse.nebula.widgets.nattable.layer.DataLayer; |
75 | 73 |
import org.eclipse.nebula.widgets.nattable.layer.ILayer; |
76 |
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator; |
|
77 | 74 |
import org.eclipse.nebula.widgets.nattable.persistence.gui.PersistenceDialog; |
78 | 75 |
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; |
79 | 76 |
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; |
80 | 77 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
81 |
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum; |
|
82 | 78 |
import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration; |
83 |
import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; |
|
84 |
import org.eclipse.nebula.widgets.nattable.summaryrow.SummaryRowLayer; |
|
85 | 79 |
import org.eclipse.nebula.widgets.nattable.tree.ITreeRowModel; |
86 | 80 |
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; |
87 | 81 |
import org.eclipse.nebula.widgets.nattable.tree.command.TreeExpandToLevelCommand; |
... | ... | |
181 | 175 |
|
182 | 176 |
private AbstractLayer topMostLayer; |
183 | 177 |
|
184 |
private FixedSummaryRowLayer summaryRowLayer; |
|
185 |
|
|
186 | 178 |
private ConfigRegistry configRegistry; |
187 | 179 |
|
188 | 180 |
private MatrixBodyLayerStack bodyLayer; |
... | ... | |
218 | 210 |
|
219 | 211 |
private void applyStyles(){ |
220 | 212 |
ModernNatTableThemeConfiguration configuration = new ModernNatTableThemeConfiguration(); |
221 |
configuration.summaryRowHAlign = HorizontalAlignmentEnum.CENTER; |
|
222 | 213 |
// NOTE: Getting the colors and fonts from the GUIHelper ensures that |
223 | 214 |
// they are disposed properly (required by SWT) |
224 | 215 |
configuration.cHeaderBgColor = GUIHelper.getColor(211, 211, 211); |
... | ... | |
249 | 240 |
/** |
250 | 241 |
* configuration |
251 | 242 |
*/ |
252 |
configureNatTable(treeView, configRegistry, topMostLayer, summaryRowLayer);
|
|
243 |
configureNatTable(treeView, configRegistry, topMostLayer); |
|
253 | 244 |
|
254 | 245 |
/** |
255 | 246 |
* handlers and listeners |
... | ... | |
335 | 326 |
* |
336 | 327 |
* |
337 | 328 |
|
338 |
CompositeLayer |
|
339 |
- (top) SummaryRowLayer |
|
340 |
- (bottom) ViewportLayer |
|
341 |
|
|
342 |
^ |
|
343 | 329 |
ViewportLayer |
344 | 330 |
|
345 | 331 |
^ |
... | ... | |
406 | 392 |
|
407 | 393 |
topMostLayer = treeView?treeLayer:compositeFreezeLayer; |
408 | 394 |
|
409 |
summaryRowLayer = new FixedSummaryRowLayer(bodyDataLayer, topMostLayer, configRegistry, false); |
|
410 |
//regoster labels with summary prefix for summary layer |
|
411 |
ColumnOverrideLabelAccumulator summaryColumnLabelAccumulator =new ColumnOverrideLabelAccumulator(bodyDataLayer); |
|
412 |
summaryRowLayer.setConfigLabelAccumulator(summaryColumnLabelAccumulator); |
|
413 |
for(int i=0;i<features.size();i++){ |
|
414 |
Feature feature = features.get(i); |
|
415 |
summaryColumnLabelAccumulator.registerColumnOverrides( |
|
416 |
i+LEADING_COLUMN_COUNT, |
|
417 |
SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX+MatrixUtility.getProperty(feature)); |
|
418 |
} |
|
419 |
// because the horizontal dependency is the ViewportLayer |
|
420 |
// we need to set the composite dependency to false |
|
421 |
summaryRowLayer.setHorizontalCompositeDependency(false); |
|
422 |
|
|
423 |
CompositeLayer composite = new CompositeLayer(1, 2); |
|
424 |
composite.setChildLayer("SUMMARY", summaryRowLayer, 0, 0); //$NON-NLS-1$ |
|
425 |
composite.setChildLayer(GridRegion.BODY, topMostLayer, 0, 1); |
|
426 |
|
|
427 | 395 |
|
428 | 396 |
/** |
429 | 397 |
* column header layer |
... | ... | |
483 | 451 |
*/ |
484 | 452 |
IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider); |
485 | 453 |
DefaultRowHeaderDataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider); |
486 |
FixedSummaryRowHeaderLayer fixedSummaryRowHeaderLayer = new FixedSummaryRowHeaderLayer(rowHeaderDataLayer, |
|
487 |
composite, selectionLayer); |
|
488 |
fixedSummaryRowHeaderLayer.setSummaryRowLabel("\u2211"); //$NON-NLS-1$ |
|
454 |
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, |
|
455 |
topMostLayer, selectionLayer); |
|
489 | 456 |
|
490 | 457 |
|
491 | 458 |
/** |
... | ... | |
493 | 460 |
*/ |
494 | 461 |
ILayer cornerLayer = new CornerLayer( |
495 | 462 |
new DataLayer(new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)), |
496 |
fixedSummaryRowHeaderLayer, sortHeaderLayer);
|
|
463 |
rowHeaderLayer, sortHeaderLayer);
|
|
497 | 464 |
|
498 | 465 |
|
499 | 466 |
/** |
500 | 467 |
* GRID layer (composition of all other layers) |
501 | 468 |
*/ |
502 |
GridLayer gridLayer = new GridLayer(composite, sortHeaderLayer, fixedSummaryRowHeaderLayer, cornerLayer);
|
|
469 |
GridLayer gridLayer = new GridLayer(topMostLayer, sortHeaderLayer, rowHeaderLayer, cornerLayer);
|
|
503 | 470 |
|
504 | 471 |
natTable.setLayer(gridLayer); |
505 | 472 |
|
... | ... | |
557 | 524 |
|
558 | 525 |
private void configureNatTable(boolean treeView, |
559 | 526 |
ConfigRegistry configRegistry, |
560 |
AbstractLayer topMostLayer, |
|
561 |
FixedSummaryRowLayer summaryRowLayer) { |
|
527 |
AbstractLayer topMostLayer) { |
|
562 | 528 |
/** |
563 | 529 |
* CONFIGURATION |
564 | 530 |
*/ |
... | ... | |
587 | 553 |
// add custom configuration for data conversion and add column labels to viewport layer |
588 | 554 |
topMostLayer.addConfiguration(new CellEditorDataConversionConfiguration(this)); |
589 | 555 |
|
590 |
//register aggregation configuration |
|
591 |
summaryRowLayer.addConfiguration(new AggregationConfiguration(this)); |
|
592 |
|
|
593 | 556 |
//copy&paste configuration |
594 | 557 |
natTable.addConfiguration(new CopyPasteEditBindings(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard())); |
595 | 558 |
|
Also available in: Unified diff
ref #8450 Remove aggregation/summary row