Revision f4928b93
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
67 | 67 |
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent; |
68 | 68 |
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; |
69 | 69 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
70 |
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes; |
|
71 | 70 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
72 | 71 |
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum; |
73 |
import org.eclipse.nebula.widgets.nattable.style.Style; |
|
74 | 72 |
import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration; |
75 | 73 |
import org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration; |
76 | 74 |
import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; |
... | ... | |
81 | 79 |
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; |
82 | 80 |
import org.eclipse.nebula.widgets.nattable.ui.menu.AbstractHeaderMenuConfiguration; |
83 | 81 |
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder; |
82 |
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; |
|
84 | 83 |
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; |
85 | 84 |
import org.eclipse.swt.SWT; |
86 | 85 |
import org.eclipse.swt.layout.GridData; |
... | ... | |
190 | 189 |
new CharacterMatrixBottomToolbar(this, SWT.NONE); |
191 | 190 |
} |
192 | 191 |
|
193 |
private void applyStyles(){ |
|
194 |
natTable.addConfiguration(new ModernNatTableThemeConfiguration()); |
|
195 | 192 |
|
193 |
private void applyStyles(){ |
|
194 |
ModernNatTableThemeConfiguration configuration = new ModernNatTableThemeConfiguration(); |
|
195 |
configuration.summaryRowHAlign = HorizontalAlignmentEnum.CENTER; |
|
196 |
configuration.summaryRowBgColor = GUIHelper.getColor(255, 255, 153); |
|
197 |
configuration.cHeaderBgColor = GUIHelper.getColor(211, 211, 211); |
|
198 |
configuration.rHeaderBgColor = GUIHelper.getColor(211, 211, 211); |
|
199 |
natTable.addConfiguration(configuration); |
|
196 | 200 |
// // NOTE: Getting the colors and fonts from the GUIHelper ensures that |
197 | 201 |
// // they are disposed properly (required by SWT) |
198 | 202 |
// DefaultNatTableStyleConfiguration natTableConfiguration = new DefaultNatTableStyleConfiguration(); |
... | ... | |
258 | 262 |
*/ |
259 | 263 |
configureNatTable(treeView, configRegistry, topMostLayer, summaryRowLayer); |
260 | 264 |
|
261 |
|
|
262 |
/** |
|
263 |
* style table |
|
264 |
*/ |
|
265 |
applyStyles(); |
|
266 |
|
|
267 | 265 |
/** |
268 | 266 |
* handlers and listeners |
269 | 267 |
*/ |
... | ... | |
502 | 500 |
*/ |
503 | 501 |
natTable.setConfigRegistry(configRegistry); |
504 | 502 |
|
503 |
applyStyles(); |
|
504 |
|
|
505 | 505 |
//add default configuration because autoconfigure is set to false in constructor |
506 | 506 |
natTable.addConfiguration(new DefaultNatTableStyleConfiguration()); |
507 | 507 |
|
... | ... | |
527 | 527 |
|
528 | 528 |
}); |
529 | 529 |
|
530 |
Style cellStyle = new Style(); |
|
531 |
cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.LEFT); |
|
532 |
|
|
533 | 530 |
// add custom configuration for data conversion and add column labels to viewport layer |
534 | 531 |
topMostLayer.addConfiguration(new AbstractRegistryConfiguration() { |
535 | 532 |
@Override |
... | ... | |
540 | 537 |
new SupplementalInfoDisplayConverter(), |
541 | 538 |
DisplayMode.NORMAL, |
542 | 539 |
TAXON_COLUMN); |
543 |
configRegistry.registerConfigAttribute( |
|
544 |
CellConfigAttributes.CELL_STYLE, |
|
545 |
cellStyle, |
|
546 |
DisplayMode.NORMAL, |
|
547 |
TAXON_COLUMN); |
|
548 | 540 |
configRegistry.registerConfigAttribute( |
549 | 541 |
CellConfigAttributes.DISPLAY_CONVERTER, |
550 | 542 |
new SupplementalInfoDisplayConverter(), |
551 | 543 |
DisplayMode.NORMAL, |
552 | 544 |
COLLECTOR_COLUMN); |
553 |
configRegistry.registerConfigAttribute( |
|
554 |
CellConfigAttributes.CELL_STYLE, |
|
555 |
cellStyle, |
|
556 |
DisplayMode.NORMAL, |
|
557 |
COLLECTOR_COLUMN); |
|
558 | 545 |
configRegistry.registerConfigAttribute( |
559 | 546 |
CellConfigAttributes.DISPLAY_CONVERTER, |
560 | 547 |
new SupplementalInfoDisplayConverter(), |
561 | 548 |
DisplayMode.NORMAL, |
562 | 549 |
IDENTIFIER_COLUMN); |
563 |
configRegistry.registerConfigAttribute( |
|
564 |
CellConfigAttributes.CELL_STYLE, |
|
565 |
cellStyle, |
|
566 |
DisplayMode.NORMAL, |
|
567 |
IDENTIFIER_COLUMN); |
|
568 | 550 |
configRegistry.registerConfigAttribute( |
569 | 551 |
CellConfigAttributes.DISPLAY_CONVERTER, |
570 | 552 |
new SupplementalInfoDisplayConverter(), |
571 | 553 |
DisplayMode.NORMAL, |
572 | 554 |
COUNTRY_COLUMN); |
573 |
configRegistry.registerConfigAttribute( |
|
574 |
CellConfigAttributes.CELL_STYLE, |
|
575 |
cellStyle, |
|
576 |
DisplayMode.NORMAL, |
|
577 |
COUNTRY_COLUMN); |
|
578 | 555 |
features.forEach(feature->registerColumnConfiguration(feature, configRegistry)); |
579 | 556 |
} |
580 | 557 |
|
Also available in: Unified diff
Updated style of character matrix