]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/LabelDecorator.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui / src / org / simantics / browsing / ui / content / LabelDecorator.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.browsing.ui.content;\r
13 \r
14 /**\r
15  * An interface for decorating aesthetic properties of an UI item, including the\r
16  * label text, font, background color and foreground color.\r
17  * \r
18  * @author Tuukka Lehtonen\r
19  */\r
20 public interface LabelDecorator {\r
21 \r
22     /**\r
23      * @param label the label before decoration\r
24      * @param column the name of the UI column which the label is for\r
25      * @param itemIndex the index of this label within its parenting\r
26      *        INodeContext\r
27      * @return the decorated label or <code>null</code> to denote\r
28      *         <em>no decoration</em>\r
29      */\r
30     String decorateLabel(String label, String column, int itemIndex);\r
31 \r
32     <Color> Color decorateForeground(Color color, String column, int itemIndex);\r
33 \r
34     <Color> Color decorateBackground(Color color, String column, int itemIndex);\r
35 \r
36     /**\r
37      * @param font <code>null</code> if no default font is set ??\r
38      * @param column the name of the UI column which the label is for\r
39      * @param itemIndex the index of this label within its parenting\r
40      *        INodeContext\r
41      * @return the decorated font instance or <code>null</code> to indicate\r
42      *         "no decoration"\r
43      */\r
44     <Font> Font decorateFont(Font font, String column, int itemIndex);\r
45 \r
46 \r
47     /**\r
48      * Stub for simpler implementation of a LabelDecorator.\r
49      */\r
50     public static class Stub implements LabelDecorator {\r
51         @Override\r
52         public <Color> Color decorateBackground(Color color, String column, int itemIndex) {\r
53             return null;\r
54         }\r
55 \r
56         @Override\r
57         public <Font> Font decorateFont(Font font, String column, int itemIndex) {\r
58             return null;\r
59         }\r
60 \r
61         @Override\r
62         public <Color> Color decorateForeground(Color color, String column, int itemIndex) {\r
63             return null;\r
64         }\r
65 \r
66         @Override\r
67         public String decorateLabel(String label, String column, int itemIndex) {\r
68             return null;\r
69         }\r
70     }\r
71 \r
72 }\r