]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.browsing.ui.nattable/src/org/simantics/browsing/ui/nattable/GENatTableThemeConfiguration.java
NatTable based Graph Explorer styling fixes
[simantics/platform.git] / bundles / org.simantics.browsing.ui.nattable / src / org / simantics / browsing / ui / nattable / GENatTableThemeConfiguration.java
index bcb8bba53a445da1172ffebca139e83bd6486ee5..c1551274e48902138de4286ffcb0db5aaf5ad922 100644 (file)
@@ -1,25 +1,82 @@
-package org.simantics.browsing.ui.nattable;\r
-\r
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;\r
-import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.PaddingDecorator;\r
-import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;\r
-import org.eclipse.nebula.widgets.nattable.util.GUIHelper;\r
-\r
-public class GENatTableThemeConfiguration extends ModernNatTableThemeConfiguration{\r
-       \r
-       public GENatTableThemeConfiguration(GETreeData treeData) {\r
-               super();\r
-               this.oddRowBgColor = GUIHelper.getColor(250, 250, 250);\r
-               this.defaultCellPainter =\r
-                               new GEStyler(treeData,\r
-                       new GEIconPainter(\r
-                               new PaddingDecorator(\r
-                                       new TextPainter(),\r
-                                       0,\r
-                                       5,\r
-                                       0,\r
-                                       5,\r
-                                       false)));\r
-       }\r
-\r
-}\r
+package org.simantics.browsing.ui.nattable;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.PaddingDecorator;
+import org.eclipse.nebula.widgets.nattable.style.theme.ModernNatTableThemeConfiguration;
+import org.eclipse.nebula.widgets.nattable.tree.painter.IndentedTreeImagePainter;
+import org.eclipse.nebula.widgets.nattable.tree.painter.TreeImagePainter;
+import org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeEnum;
+import org.eclipse.nebula.widgets.nattable.util.GUIHelper;
+
+public class GENatTableThemeConfiguration extends ModernNatTableThemeConfiguration{
+       
+       public GENatTableThemeConfiguration(GETreeData treeData, int style) {
+               super();
+               TextPainter cellTextPainter = new TextPainter();
+               cellTextPainter.setTrimText(false);
+               this.oddRowBgColor = GUIHelper.getColor(250, 250, 250);
+               this.defaultCellPainter =
+                               new GEStyler(treeData,
+                       new GEIconPainter(
+                               new PaddingDecorator(
+                                       cellTextPainter,
+                                       0,
+                                       5,
+                                       0,
+                                       5,
+                                       false)));
+               
+                TreeImagePainter treeImagePainter =
+                       new TreeImagePainter(
+                               false,
+                               GUIHelper.getImage("right"), //$NON-NLS-1$
+                               GUIHelper.getImage("right_down"), //$NON-NLS-1$
+                               GUIHelper.getImageByURL("transparent", 
+                                               FileLocator.find(Activator.getDefault().getBundle(), 
+                                               new Path("images/transparent.png"), null))); //$NON-NLS-1$
+               this.treeStructurePainter =
+                       new BackgroundPainter(
+                               new PaddingDecorator(
+                                       new IndentedTreeImagePainter(
+                                               10,
+                                               null,
+                                               CellEdgeEnum.LEFT,
+                                               treeImagePainter,
+                                               false,
+                                               2,
+                                               true),
+                                       0,
+                                       5,
+                                       0,
+                                       5,
+                                       false));
+               TreeImagePainter treeSelectionImagePainter =
+                       new TreeImagePainter(
+                               false,
+                               GUIHelper.getImage("right_inv"), //$NON-NLS-1$
+                               GUIHelper.getImage("right_down_inv"), //$NON-NLS-1$
+                               GUIHelper.getImageByURL("transparent", 
+                                               FileLocator.find(Activator.getDefault().getBundle(), 
+                                               new Path("images/transparent.png"), null))); //$NON-NLS-1$
+               this.treeStructureSelectionPainter =
+                       new BackgroundPainter(
+                               new PaddingDecorator(
+                                       new IndentedTreeImagePainter(
+                                               10,
+                                               null,
+                                               CellEdgeEnum.LEFT,
+                                               treeSelectionImagePainter,
+                                               false,
+                                               2,
+                                               true),
+                                       0,
+                                       5,
+                                       0,
+                                       5,
+                                       false));
+       }
+
+}