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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.browsing.ui.content;
\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
18 * @author Tuukka Lehtonen
\r
20 public interface LabelDecorator {
\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
27 * @return the decorated label or <code>null</code> to denote
\r
28 * <em>no decoration</em>
\r
30 String decorateLabel(String label, String column, int itemIndex);
\r
32 <Color> Color decorateForeground(Color color, String column, int itemIndex);
\r
34 <Color> Color decorateBackground(Color color, String column, int itemIndex);
\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
41 * @return the decorated font instance or <code>null</code> to indicate
\r
44 <Font> Font decorateFont(Font font, String column, int itemIndex);
\r
48 * Stub for simpler implementation of a LabelDecorator.
\r
50 public static class Stub implements LabelDecorator {
\r
52 public <Color> Color decorateBackground(Color color, String column, int itemIndex) {
\r
57 public <Font> Font decorateFont(Font font, String column, int itemIndex) {
\r
62 public <Color> Color decorateForeground(Color color, String column, int itemIndex) {
\r
67 public String decorateLabel(String label, String column, int itemIndex) {
\r