]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLLabelBackgroundColorRule.java
Possibility to define label color decorator rules in SCL
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / adapters / SCLLabelBackgroundColorRule.java
1 package org.simantics.modeling.adapters;
2
3 import org.simantics.browsing.ui.content.LabelDecorator;
4 import org.simantics.browsing.ui.model.labeldecorators.AbstractLabelDecorator;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.modeling.ModelingResources;
9
10 public class SCLLabelBackgroundColorRule extends SCLLabelColorRule {
11     
12     public SCLLabelBackgroundColorRule(ReadGraph graph, Resource rule) {
13         super(graph, rule, ModelingResources.getInstance(graph).SCLLabelBackgroundColorRule_getColor);
14     }
15
16     @Override
17     public LabelDecorator getLabelDecorator(ReadGraph graph, Object content) throws DatabaseException {
18         return new AbstractLabelDecorator() {
19
20             @Override
21             public <Color> Color decorateBackground(Color color, String column, int itemIndex) {
22                 return decorateColor(graph, content, color, column, itemIndex);
23             }
24         };
25     }
26 }