X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcontent%2FLabelDecorator.java;fp=bundles%2Forg.simantics.browsing.ui%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fcontent%2FLabelDecorator.java;h=0afcf95b839b4278b3806187d661d4e1464623e2;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08
diff --git a/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/LabelDecorator.java b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/LabelDecorator.java
new file mode 100644
index 000000000..0afcf95b8
--- /dev/null
+++ b/bundles/org.simantics.browsing.ui/src/org/simantics/browsing/ui/content/LabelDecorator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.content;
+
+/**
+ * An interface for decorating aesthetic properties of an UI item, including the
+ * label text, font, background color and foreground color.
+ *
+ * @author Tuukka Lehtonen
+ */
+public interface LabelDecorator {
+
+ /**
+ * @param label the label before decoration
+ * @param column the name of the UI column which the label is for
+ * @param itemIndex the index of this label within its parenting
+ * INodeContext
+ * @return the decorated label or null
to denote
+ * no decoration
+ */
+ String decorateLabel(String label, String column, int itemIndex);
+
+ Color decorateForeground(Color color, String column, int itemIndex);
+
+ Color decorateBackground(Color color, String column, int itemIndex);
+
+ /**
+ * @param font null
if no default font is set ??
+ * @param column the name of the UI column which the label is for
+ * @param itemIndex the index of this label within its parenting
+ * INodeContext
+ * @return the decorated font instance or null
to indicate
+ * "no decoration"
+ */
+ Font decorateFont(Font font, String column, int itemIndex);
+
+
+ /**
+ * Stub for simpler implementation of a LabelDecorator.
+ */
+ public static class Stub implements LabelDecorator {
+ @Override
+ public Color decorateBackground(Color color, String column, int itemIndex) {
+ return null;
+ }
+
+ @Override
+ public Font decorateFont(Font font, String column, int itemIndex) {
+ return null;
+ }
+
+ @Override
+ public Color decorateForeground(Color color, String column, int itemIndex) {
+ return null;
+ }
+
+ @Override
+ public String decorateLabel(String label, String column, int itemIndex) {
+ return null;
+ }
+ }
+
+}