-package org.simantics.charts.ui;\r
-\r
-import org.eclipse.jface.resource.FontDescriptor;\r
-import org.eclipse.swt.SWT;\r
-import org.simantics.browsing.ui.content.LabelDecorator;\r
-import org.simantics.browsing.ui.model.labeldecorators.AbstractLabelDecorator;\r
-import org.simantics.browsing.ui.model.labeldecorators.LabelDecorationRule;\r
-import org.simantics.charts.ontology.ChartResource;\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-\r
-/**\r
- * Used for labeling both chart plots and subscription items.\r
- * \r
- * @author Tuukka Lehtonen\r
- */\r
-public class ChartItemLabelDecorationRule implements LabelDecorationRule {\r
-\r
- public static final ChartItemLabelDecorationRule INSTANCE = new ChartItemLabelDecorationRule();\r
-\r
- @Override\r
- public boolean isCompatible(Class<?> contentType) {\r
- return contentType.equals(Resource.class);\r
- }\r
-\r
- @Override\r
- public LabelDecorator getLabelDecorator(ReadGraph graph, Object content) throws DatabaseException {\r
- Resource item = (Resource) content;\r
- ChartResource CHART = ChartResource.getInstance(graph);\r
-\r
- Boolean hidden = graph.getPossibleRelatedValue(item, CHART.Chart_Item_hidden, Bindings.BOOLEAN);\r
- if (hidden == null || !hidden)\r
- return null;\r
-\r
- return HIDDEN_DECORATOR;\r
- }\r
-\r
- private static class HiddenLabelDecorator extends AbstractLabelDecorator {\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public <F> F decorateFont(F font, String column, int itemIndex) {\r
- return (F) ((FontDescriptor) font).withStyle(SWT.ITALIC);\r
- }\r
- @Override\r
- public String decorateLabel(String label, String column, int itemIndex) {\r
- return label + " (hidden)";\r
- }\r
- };\r
-\r
- private static HiddenLabelDecorator HIDDEN_DECORATOR = new HiddenLabelDecorator();\r
-\r
+package org.simantics.charts.ui;
+
+import org.eclipse.jface.resource.FontDescriptor;
+import org.eclipse.swt.SWT;
+import org.simantics.browsing.ui.content.LabelDecorator;
+import org.simantics.browsing.ui.model.labeldecorators.AbstractLabelDecorator;
+import org.simantics.browsing.ui.model.labeldecorators.LabelDecorationRule;
+import org.simantics.charts.ontology.ChartResource;
+import org.simantics.databoard.Bindings;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+
+/**
+ * Used for labeling both chart plots and subscription items.
+ *
+ * @author Tuukka Lehtonen
+ */
+public class ChartItemLabelDecorationRule implements LabelDecorationRule {
+
+ public static final ChartItemLabelDecorationRule INSTANCE = new ChartItemLabelDecorationRule();
+
+ @Override
+ public boolean isCompatible(Class<?> contentType) {
+ return contentType.equals(Resource.class);
+ }
+
+ @Override
+ public LabelDecorator getLabelDecorator(ReadGraph graph, Object content) throws DatabaseException {
+ Resource item = (Resource) content;
+ ChartResource CHART = ChartResource.getInstance(graph);
+
+ Boolean hidden = graph.getPossibleRelatedValue(item, CHART.Chart_Item_hidden, Bindings.BOOLEAN);
+ if (hidden == null || !hidden)
+ return null;
+
+ return HIDDEN_DECORATOR;
+ }
+
+ private static class HiddenLabelDecorator extends AbstractLabelDecorator {
+ @SuppressWarnings("unchecked")
+ @Override
+ public <F> F decorateFont(F font, String column, int itemIndex) {
+ return (F) ((FontDescriptor) font).withStyle(SWT.ITALIC);
+ }
+ @Override
+ public String decorateLabel(String label, String column, int itemIndex) {
+ return label + " (hidden)";
+ }
+ };
+
+ private static HiddenLabelDecorator HIDDEN_DECORATOR = new HiddenLabelDecorator();
+
}
\ No newline at end of file