]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java
Faster bounds calculation for zoom to selection and navigate to target
[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                 this.oddRowBgColor = GUIHelper.getColor(250, 250, 250);
19                 this.defaultCellPainter =
20                                 new GEStyler(treeData,
21                         new GEIconPainter(
22                                 new PaddingDecorator(
23                                         new TextPainter(),
24                                         0,
25                                         5,
26                                         0,
27                                         5,
28                                         false)));
29                 
30                  TreeImagePainter treeImagePainter =
31                         new TreeImagePainter(
32                                 false,
33                                 GUIHelper.getImage("right"), //$NON-NLS-1$
34                                 GUIHelper.getImage("right_down"), //$NON-NLS-1$
35                                 GUIHelper.getImageByURL("transparent", 
36                                                 FileLocator.find(Activator.getDefault().getBundle(), 
37                                                 new Path("images/transparent.png"), null))); //$NON-NLS-1$
38                 this.treeStructurePainter =
39                         new BackgroundPainter(
40                                 new PaddingDecorator(
41                                         new IndentedTreeImagePainter(
42                                                 10,
43                                                 null,
44                                                 CellEdgeEnum.LEFT,
45                                                 treeImagePainter,
46                                                 false,
47                                                 2,
48                                                 true),
49                                         0,
50                                         5,
51                                         0,
52                                         5,
53                                         false));
54                 TreeImagePainter treeSelectionImagePainter =
55                         new TreeImagePainter(
56                                 false,
57                                 GUIHelper.getImage("right_inv"), //$NON-NLS-1$
58                                 GUIHelper.getImage("right_down_inv"), //$NON-NLS-1$
59                                 GUIHelper.getImageByURL("transparent", 
60                                                 FileLocator.find(Activator.getDefault().getBundle(), 
61                                                 new Path("images/transparent.png"), null))); //$NON-NLS-1$
62                 this.treeStructureSelectionPainter =
63                         new BackgroundPainter(
64                                 new PaddingDecorator(
65                                         new IndentedTreeImagePainter(
66                                                 10,
67                                                 null,
68                                                 CellEdgeEnum.LEFT,
69                                                 treeSelectionImagePainter,
70                                                 false,
71                                                 2,
72                                                 true),
73                                         0,
74                                         5,
75                                         0,
76                                         5,
77                                         false));
78         }
79
80 }