]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java
c1551274e48902138de4286ffcb0db5aaf5ad922
[simantics/platform.git] / bundles / org.simantics.browsing.ui.nattable / src / org / simantics / browsing / ui / nattable / GENatTableThemeConfiguration.java
1 package org.simantics.browsing.ui.nattable;
2
3 import org.eclipse.core.runtime.FileLocator;
4 import org.eclipse.core.runtime.Path;
5 import org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter;
6 import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
7 import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.PaddingDecorator;
8 import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;
9 import org.eclipse.nebula.widgets.nattable.tree.painter.IndentedTreeImagePainter;
10 import org.eclipse.nebula.widgets.nattable.tree.painter.TreeImagePainter;
11 import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
12 import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
13
14 public class GENatTableThemeConfiguration extends ModernNatTableThemeConfiguration{
15         
16         public GENatTableThemeConfiguration(GETreeData treeData, int style) {
17                 super();
18                 TextPainter cellTextPainter = new TextPainter();
19                 cellTextPainter.setTrimText(false);
20                 this.oddRowBgColor = GUIHelper.getColor(250, 250, 250);
21                 this.defaultCellPainter =
22                                 new GEStyler(treeData,
23                         new GEIconPainter(
24                                 new PaddingDecorator(
25                                         cellTextPainter,
26                                         0,
27                                         5,
28                                         0,
29                                         5,
30                                         false)));
31                 
32                  TreeImagePainter treeImagePainter =
33                         new TreeImagePainter(
34                                 false,
35                                 GUIHelper.getImage("right"), //$NON-NLS-1$
36                                 GUIHelper.getImage("right_down"), //$NON-NLS-1$
37                                 GUIHelper.getImageByURL("transparent", 
38                                                 FileLocator.find(Activator.getDefault().getBundle(), 
39                                                 new Path("images/transparent.png"), null))); //$NON-NLS-1$
40                 this.treeStructurePainter =
41                         new BackgroundPainter(
42                                 new PaddingDecorator(
43                                         new IndentedTreeImagePainter(
44                                                 10,
45                                                 null,
46                                                 CellEdgeEnum.LEFT,
47                                                 treeImagePainter,
48                                                 false,
49                                                 2,
50                                                 true),
51                                         0,
52                                         5,
53                                         0,
54                                         5,
55                                         false));
56                 TreeImagePainter treeSelectionImagePainter =
57                         new TreeImagePainter(
58                                 false,
59                                 GUIHelper.getImage("right_inv"), //$NON-NLS-1$
60                                 GUIHelper.getImage("right_down_inv"), //$NON-NLS-1$
61                                 GUIHelper.getImageByURL("transparent", 
62                                                 FileLocator.find(Activator.getDefault().getBundle(), 
63                                                 new Path("images/transparent.png"), null))); //$NON-NLS-1$
64                 this.treeStructureSelectionPainter =
65                         new BackgroundPainter(
66                                 new PaddingDecorator(
67                                         new IndentedTreeImagePainter(
68                                                 10,
69                                                 null,
70                                                 CellEdgeEnum.LEFT,
71                                                 treeSelectionImagePainter,
72                                                 false,
73                                                 2,
74                                                 true),
75                                         0,
76                                         5,
77                                         0,
78                                         5,
79                                         false));
80         }
81
82 }