1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.browsing.ui.content;
15 * An interface for decorating aesthetic properties of an UI item, including the
16 * label text, font, background color and foreground color.
18 * @author Tuukka Lehtonen
20 public interface LabelDecorator {
23 * @param label the label before decoration
24 * @param column the name of the UI column which the label is for
25 * @param itemIndex the index of this label within its parenting
27 * @return the decorated label or <code>null</code> to denote
28 * <em>no decoration</em>
30 String decorateLabel(String label, String column, int itemIndex);
32 <Color> Color decorateForeground(Color color, String column, int itemIndex);
34 <Color> Color decorateBackground(Color color, String column, int itemIndex);
37 * @param font <code>null</code> if no default font is set ??
38 * @param column the name of the UI column which the label is for
39 * @param itemIndex the index of this label within its parenting
41 * @return the decorated font instance or <code>null</code> to indicate
44 <Font> Font decorateFont(Font font, String column, int itemIndex);
48 * Stub for simpler implementation of a LabelDecorator.
50 public static class Stub implements LabelDecorator {
52 public <Color> Color decorateBackground(Color color, String column, int itemIndex) {
57 public <Font> Font decorateFont(Font font, String column, int itemIndex) {
62 public <Color> Color decorateForeground(Color color, String column, int itemIndex) {
67 public String decorateLabel(String label, String column, int itemIndex) {