Revision 2c54db81
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java | ||
---|---|---|
54 | 54 |
import org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer; |
55 | 55 |
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer; |
56 | 56 |
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer; |
57 |
import org.eclipse.nebula.widgets.nattable.grid.layer.config.DefaultRowStyleConfiguration; |
|
58 | 57 |
import org.eclipse.nebula.widgets.nattable.layer.AbstractLayer; |
59 | 58 |
import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer; |
60 | 59 |
import org.eclipse.nebula.widgets.nattable.layer.DataLayer; |
... | ... | |
62 | 61 |
import org.eclipse.nebula.widgets.nattable.layer.ILayerListener; |
63 | 62 |
import org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator; |
64 | 63 |
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; |
65 |
import org.eclipse.nebula.widgets.nattable.layer.config.DefaultColumnHeaderStyleConfiguration; |
|
66 |
import org.eclipse.nebula.widgets.nattable.layer.config.DefaultRowHeaderStyleConfiguration; |
|
67 | 64 |
import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; |
68 | 65 |
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack; |
69 | 66 |
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer; |
70 |
import org.eclipse.nebula.widgets.nattable.selection.config.DefaultSelectionStyleConfiguration; |
|
71 | 67 |
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent; |
72 | 68 |
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; |
73 | 69 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
... | ... | |
75 | 71 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
76 | 72 |
import org.eclipse.nebula.widgets.nattable.style.HorizontalAlignmentEnum; |
77 | 73 |
import org.eclipse.nebula.widgets.nattable.style.Style; |
78 |
import org.eclipse.nebula.widgets.nattable.style.VerticalAlignmentEnum;
|
|
74 |
import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;
|
|
79 | 75 |
import org.eclipse.nebula.widgets.nattable.summaryrow.DefaultSummaryRowConfiguration; |
80 | 76 |
import org.eclipse.nebula.widgets.nattable.summaryrow.FixedSummaryRowLayer; |
81 | 77 |
import org.eclipse.nebula.widgets.nattable.summaryrow.ISummaryProvider; |
... | ... | |
85 | 81 |
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer; |
86 | 82 |
import org.eclipse.nebula.widgets.nattable.ui.menu.AbstractHeaderMenuConfiguration; |
87 | 83 |
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder; |
88 |
import org.eclipse.nebula.widgets.nattable.util.GUIHelper; |
|
89 | 84 |
import org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer; |
90 | 85 |
import org.eclipse.swt.SWT; |
91 |
import org.eclipse.swt.graphics.Color; |
|
92 |
import org.eclipse.swt.graphics.FontData; |
|
93 | 86 |
import org.eclipse.swt.layout.GridData; |
94 | 87 |
import org.eclipse.swt.layout.GridLayout; |
95 | 88 |
import org.eclipse.swt.widgets.Button; |
... | ... | |
118 | 111 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.quantitative.QuantitativeDataDisplayConverter; |
119 | 112 |
import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter; |
120 | 113 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
121 |
import eu.etaxonomy.taxeditor.model.ColorResources; |
|
122 | 114 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
123 |
import eu.etaxonomy.taxeditor.preference.Resources; |
|
124 | 115 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
125 | 116 |
import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility; |
126 | 117 |
|
... | ... | |
186 | 177 |
|
187 | 178 |
natTable = new NatTable(this, false); |
188 | 179 |
|
189 |
applyStyles(); |
|
190 |
|
|
191 | 180 |
createBottomToolbar(); |
192 | 181 |
|
193 | 182 |
} |
... | ... | |
202 | 191 |
} |
203 | 192 |
|
204 | 193 |
private void applyStyles(){ |
205 |
// NOTE: Getting the colors and fonts from the GUIHelper ensures that |
|
206 |
// they are disposed properly (required by SWT) |
|
207 |
DefaultNatTableStyleConfiguration natTableConfiguration = new DefaultNatTableStyleConfiguration(); |
|
208 |
natTableConfiguration.bgColor = GUIHelper.getColor(249, 172, 7); |
|
209 |
natTableConfiguration.fgColor = GUIHelper.getColor(30, 76, 19); |
|
210 |
natTableConfiguration.hAlign = HorizontalAlignmentEnum.LEFT; |
|
211 |
natTableConfiguration.vAlign = VerticalAlignmentEnum.TOP; |
|
212 |
// natTableConfiguration.borderStyle = new BorderStyle(1, GUIHelper.getColor(249, 172, 7), LineStyleEnum.SOLID); |
|
213 |
|
|
214 |
// Setup even odd row colors - row colors override the NatTable default |
|
215 |
// colors |
|
216 |
DefaultRowStyleConfiguration rowStyleConfiguration = new DefaultRowStyleConfiguration(); |
|
217 |
rowStyleConfiguration.oddRowBgColor = ColorResources.getColor(Resources.COLOR_LIST_ODD); |
|
218 |
rowStyleConfiguration.evenRowBgColor = ColorResources.getColor(Resources.COLOR_LIST_EVEN); |
|
219 |
|
|
220 |
// Setup selection styling |
|
221 |
DefaultSelectionStyleConfiguration selectionStyle = new DefaultSelectionStyleConfiguration(); |
|
222 |
// selectionStyle.selectionFont = GUIHelper.getFont(new FontData("Verdana", 8, SWT.NORMAL)); |
|
223 |
// selectionStyle.selectionBgColor = GUIHelper.getColor(217, 232, 251); |
|
224 |
// selectionStyle.selectionFgColor = GUIHelper.COLOR_BLACK; |
|
225 |
// selectionStyle.anchorBorderStyle = new BorderStyle(1, GUIHelper.COLOR_DARK_GRAY, LineStyleEnum.SOLID); |
|
226 |
// selectionStyle.anchorBgColor = GUIHelper.getColor(65, 113, 43); |
|
227 |
selectionStyle.selectedHeaderBgColor = GUIHelper.getColor(156, 209, 103); |
|
228 |
|
|
229 |
// Add all style configurations to NatTable |
|
230 |
natTable.addConfiguration(natTableConfiguration); |
|
231 |
natTable.addConfiguration(rowStyleConfiguration); |
|
232 |
natTable.addConfiguration(selectionStyle); |
|
233 |
|
|
234 |
// Column/Row header style and custom painters |
|
235 |
DefaultRowHeaderStyleConfiguration rowHeaderConfig = new DefaultRowHeaderStyleConfiguration(); |
|
236 |
Color rowColumnColor = GUIHelper.getColor(230, 255, 255); |
|
237 |
rowHeaderConfig.bgColor = rowColumnColor; |
|
238 |
natTable.addConfiguration(rowHeaderConfig); |
|
239 |
DefaultColumnHeaderStyleConfiguration columnHeaderStyle = new DefaultColumnHeaderStyleConfiguration(); |
|
240 |
columnHeaderStyle.bgColor = rowColumnColor; |
|
241 |
columnHeaderStyle.font = GUIHelper.getFont(new FontData("Verdana", 9, SWT.BOLD)); //$NON-NLS-1$ |
|
242 |
natTable.addConfiguration(columnHeaderStyle); |
|
194 |
natTable.addConfiguration(new ModernNatTableThemeConfiguration()); |
|
195 |
|
|
196 |
// // NOTE: Getting the colors and fonts from the GUIHelper ensures that |
|
197 |
// // they are disposed properly (required by SWT) |
|
198 |
// DefaultNatTableStyleConfiguration natTableConfiguration = new DefaultNatTableStyleConfiguration(); |
|
199 |
// natTableConfiguration.bgColor = GUIHelper.getColor(249, 172, 7); |
|
200 |
// natTableConfiguration.fgColor = GUIHelper.getColor(30, 76, 19); |
|
201 |
// natTableConfiguration.hAlign = HorizontalAlignmentEnum.LEFT; |
|
202 |
// natTableConfiguration.vAlign = VerticalAlignmentEnum.TOP; |
|
203 |
//// natTableConfiguration.borderStyle = new BorderStyle(1, GUIHelper.getColor(249, 172, 7), LineStyleEnum.SOLID); |
|
204 |
// |
|
205 |
// // Setup even odd row colors - row colors override the NatTable default |
|
206 |
// // colors |
|
207 |
// DefaultRowStyleConfiguration rowStyleConfiguration = new DefaultRowStyleConfiguration(); |
|
208 |
// rowStyleConfiguration.oddRowBgColor = ColorResources.getColor(Resources.COLOR_LIST_ODD); |
|
209 |
// rowStyleConfiguration.evenRowBgColor = ColorResources.getColor(Resources.COLOR_LIST_EVEN); |
|
210 |
// |
|
211 |
// // Setup selection styling |
|
212 |
// DefaultSelectionStyleConfiguration selectionStyle = new DefaultSelectionStyleConfiguration(); |
|
213 |
//// selectionStyle.selectionFont = GUIHelper.getFont(new FontData("Verdana", 8, SWT.NORMAL)); |
|
214 |
//// selectionStyle.selectionBgColor = GUIHelper.getColor(217, 232, 251); |
|
215 |
//// selectionStyle.selectionFgColor = GUIHelper.COLOR_BLACK; |
|
216 |
//// selectionStyle.anchorBorderStyle = new BorderStyle(1, GUIHelper.COLOR_DARK_GRAY, LineStyleEnum.SOLID); |
|
217 |
//// selectionStyle.anchorBgColor = GUIHelper.getColor(65, 113, 43); |
|
218 |
// selectionStyle.selectedHeaderBgColor = GUIHelper.getColor(156, 209, 103); |
|
219 |
// |
|
220 |
// // Add all style configurations to NatTable |
|
221 |
// natTable.addConfiguration(natTableConfiguration); |
|
222 |
// natTable.addConfiguration(rowStyleConfiguration); |
|
223 |
// natTable.addConfiguration(selectionStyle); |
|
224 |
// |
|
225 |
// // Column/Row header style and custom painters |
|
226 |
// DefaultRowHeaderStyleConfiguration rowHeaderConfig = new DefaultRowHeaderStyleConfiguration(); |
|
227 |
// Color rowColumnColor = GUIHelper.getColor(230, 255, 255); |
|
228 |
// rowHeaderConfig.bgColor = rowColumnColor; |
|
229 |
// natTable.addConfiguration(rowHeaderConfig); |
|
230 |
// DefaultColumnHeaderStyleConfiguration columnHeaderStyle = new DefaultColumnHeaderStyleConfiguration(); |
|
231 |
// columnHeaderStyle.bgColor = rowColumnColor; |
|
232 |
// columnHeaderStyle.font = GUIHelper.getFont(new FontData("Verdana", 9, SWT.BOLD)); //$NON-NLS-1$ |
|
233 |
// natTable.addConfiguration(columnHeaderStyle); |
|
243 | 234 |
|
244 | 235 |
} |
245 | 236 |
|
... | ... | |
267 | 258 |
*/ |
268 | 259 |
configureNatTable(treeView, configRegistry, topMostLayer, summaryRowLayer); |
269 | 260 |
|
261 |
|
|
262 |
/** |
|
263 |
* style table |
|
264 |
*/ |
|
265 |
applyStyles(); |
|
266 |
|
|
270 | 267 |
/** |
271 | 268 |
* handlers and listeners |
272 | 269 |
*/ |
Also available in: Unified diff
Apply modern theme to CharacterMatrix