]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
19a5ee03feba6839db009c8b322645853d6b98a1
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.browser.contributions;\r
2 \r
3 import org.eclipse.jface.resource.FontDescriptor;\r
4 import org.eclipse.swt.SWT;\r
5 import org.eclipse.swt.graphics.Font;\r
6 import org.simantics.browsing.ui.content.LabelDecorator;\r
7 import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor;\r
8 import org.simantics.db.Builtins;\r
9 import org.simantics.db.ReadGraph;\r
10 import org.simantics.db.exception.DatabaseException;\r
11 import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
12 \r
13 public class SimulationResultDecorator extends LabelDecoratorContributor<SimulationResultNode>{\r
14 \r
15     @Override\r
16     public LabelDecorator getDecorator(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
17         Builtins b = graph.getBuiltins();\r
18         if (graph.hasStatement(result.resource, b.IsActive)) {\r
19             return new LabelDecorator.Stub() {\r
20 \r
21                 @SuppressWarnings("unchecked")\r
22                 @Override\r
23                 public <F> F decorateFont(F font, String column, int itemIndex) {\r
24                     return (F) FontDescriptor.createFrom((Font) font).withStyle(SWT.BOLD);\r
25                 }\r
26             };\r
27         }\r
28         return null;\r
29     }\r
30 \r
31 }\r