Merge branch 'master' into lttng-kepler
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / colors / ColorSetting.java
index 37c08cc0d2b422e3e65d57014247e169ed19e1c7..176d10779df3b3ad2240c91679df8540199d1d22 100644 (file)
-/*******************************************************************************\r
- * Copyright (c) 2010, 2012 Ericsson\r
- *\r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *   Patrick Tasse - Initial API and implementation\r
- *   Bernd Hufmann - Updated to use RGB for the tick color\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.tmf.ui.views.colors;\r
-\r
-import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;\r
-import org.eclipse.swt.SWT;\r
-import org.eclipse.swt.graphics.Color;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.eclipse.swt.widgets.Display;\r
-import org.eclipse.ui.themes.ColorUtil;\r
-\r
-/**\r
- * Class for storing color settings of a TMF filter.\r
- *\r
- * Application code must explicitly invoke the ColorSetting.dispose() method to release the operating system\r
- * resources managed by each instance when those instances are no longer required.\r
- *\r
- *  @version 1.0\r
- *  @author Patrick Tasse\r
- */\r
-public class ColorSetting {\r
-\r
-       private RGB fForegroundRGB;\r
-       private RGB fBackgroundRGB;\r
-       private RGB fTickColorRGB;\r
-       private Color fForegroundColor;\r
-       private Color fBackgroundColor;\r
-       private Color fDimmedForegroundColor;\r
-       private Color fDimmedBackgroundColor;\r
-       private Color fTickColor;\r
-       private ITmfFilterTreeNode fFilter;\r
-\r
-           /**\r
-     * Constructor\r
-     *\r
-     * You must dispose the color setting when it is no longer required.\r
-     *\r
-     * @param foreground\r
-     *            The foreground color\r
-     * @param background\r
-     *            The background color\r
-     * @param tickColorRGB\r
-     *            The color for the checkbox ticks\r
-     * @param filter\r
-     *            The filter tree node\r
-     */\r
-       public ColorSetting(RGB foreground, RGB background, RGB tickColorRGB, ITmfFilterTreeNode filter) {\r
-               fForegroundRGB = foreground;\r
-               fBackgroundRGB = background;\r
-               fTickColorRGB = tickColorRGB;\r
-               fFilter = filter;\r
-               Display display = Display.getDefault();\r
-               fForegroundColor = new Color(display, fForegroundRGB);\r
-               fBackgroundColor = new Color(display, fBackgroundRGB);\r
-               fDimmedForegroundColor = new Color(display, ColorUtil.blend(\r
-                               fForegroundRGB, fBackgroundRGB));\r
-               fDimmedBackgroundColor = new Color(display, ColorUtil.blend(\r
-                               fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));\r
-               fTickColor = new Color(display, fTickColorRGB);\r
-       }\r
-\r
-       /**\r
-        * Dispose the color setting resources\r
-        */\r
-       public void dispose() {\r
-               fForegroundColor.dispose();\r
-               fBackgroundColor.dispose();\r
-               fDimmedForegroundColor.dispose();\r
-               fDimmedBackgroundColor.dispose();\r
-               fTickColor.dispose();\r
-       }\r
-\r
-       /**\r
-        * Returns foreground RGB value.\r
-        *\r
-        * @return the foreground RGB\r
-        */\r
-       public RGB getForegroundRGB() {\r
-               return fForegroundRGB;\r
-       }\r
-\r
-       /**\r
-        * Sets the foreground RGB value\r
-        *\r
-        * @param foreground the foreground to set\r
-        */\r
-       public void setForegroundRGB(RGB foreground) {\r
-               fForegroundRGB = foreground;\r
-               fForegroundColor.dispose();\r
-               fDimmedForegroundColor.dispose();\r
-               Display display = Display.getDefault();\r
-               fForegroundColor = new Color(display, fForegroundRGB);\r
-               fDimmedForegroundColor = new Color(display, ColorUtil.blend(\r
-                               fForegroundRGB, fBackgroundRGB));\r
-       }\r
-\r
-       /**\r
-        * Returns the background RGB value.\r
-        *\r
-        * @return the background RGB\r
-        */\r
-       public RGB getBackgroundRGB() {\r
-               return fBackgroundRGB;\r
-       }\r
-\r
-       /**\r
-        * Sets the background RGB value.\r
-        *\r
-        * @param background the background to set\r
-        */\r
-       public void setBackgroundRGB(RGB background) {\r
-               fBackgroundRGB = background;\r
-               fBackgroundColor.dispose();\r
-               fDimmedBackgroundColor.dispose();\r
-               Display display = Display.getDefault();\r
-               fBackgroundColor = new Color(display, fBackgroundRGB);\r
-               fDimmedBackgroundColor = new Color(display, ColorUtil.blend(\r
-                               fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));\r
-       }\r
-\r
-       /**\r
-        * Returns the RGB of the tick color\r
-        *\r
-        * @return the RGB of the tick color\r
-        */\r
-       public RGB getTickColorRGB() {\r
-               return fTickColorRGB;\r
-       }\r
-\r
-       /**\r
-        * Sets the RGB of the tick color\r
-        *\r
-        * @param tickColorRGB the tick color TGB\r
-        */\r
-       public void setTickColorRGB(RGB tickColorRGB) {\r
-              fTickColorRGB = tickColorRGB;\r
-              fTickColor.dispose();\r
-           Display display = Display.getDefault();\r
-           fTickColor = new Color(display, fTickColorRGB);\r
-       }\r
-\r
-       /**\r
-        * Returns the filter implementation.\r
-        * @return the filter\r
-        */\r
-       public ITmfFilterTreeNode getFilter() {\r
-               return fFilter;\r
-       }\r
-\r
-       /**\r
-        * Sets the filter implementation.\r
-        *\r
-        * @param filter the filter to set\r
-        */\r
-       public void setFilter(ITmfFilterTreeNode filter) {\r
-               fFilter = filter;\r
-       }\r
-\r
-       /**\r
-        * Returns the foreground color.\r
-        *\r
-        * @return the foreground color\r
-        */\r
-       public Color getForegroundColor() {\r
-               return fForegroundColor;\r
-       }\r
-\r
-       /**\r
-        * Returns the background color.\r
-        *\r
-        * @return the background color\r
-        */\r
-       public Color getBackgroundColor() {\r
-               return fBackgroundColor;\r
-       }\r
-\r
-       /**\r
-        * Returns the dimmed foreground color.\r
-        *\r
-        * @return the dimmed foreground color\r
-        */\r
-       public Color getDimmedForegroundColor() {\r
-               return fDimmedForegroundColor;\r
-       }\r
-\r
-       /**\r
-        * Returns the dimmed background color.\r
-        *\r
-        * @return the dimmed background color\r
-        */\r
-       public Color getDimmedBackgroundColor() {\r
-               return fDimmedBackgroundColor;\r
-       }\r
-\r
-       /**\r
-        * Returns the tick color.\r
-        *\r
-        * @return the tick color\r
-        */\r
-       public Color getTickColor() {\r
-        return fTickColor;\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2010, 2012 Ericsson
+ *
+ * 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:
+ *   Patrick Tasse - Initial API and implementation
+ *   Bernd Hufmann - Updated to use RGB for the tick color
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.views.colors;
+
+import org.eclipse.linuxtools.tmf.core.filter.model.ITmfFilterTreeNode;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.themes.ColorUtil;
+
+/**
+ * Class for storing color settings of a TMF filter.
+ *
+ * Application code must explicitly invoke the ColorSetting.dispose() method to release the operating system
+ * resources managed by each instance when those instances are no longer required.
+ *
+ *  @version 1.0
+ *  @author Patrick Tasse
+ */
+public class ColorSetting {
+
+       private RGB fForegroundRGB;
+       private RGB fBackgroundRGB;
+       private RGB fTickColorRGB;
+       private Color fForegroundColor;
+       private Color fBackgroundColor;
+       private Color fDimmedForegroundColor;
+       private Color fDimmedBackgroundColor;
+       private Color fTickColor;
+       private ITmfFilterTreeNode fFilter;
+
+           /**
+     * Constructor
+     *
+     * You must dispose the color setting when it is no longer required.
+     *
+     * @param foreground
+     *            The foreground color
+     * @param background
+     *            The background color
+     * @param tickColorRGB
+     *            The color for the checkbox ticks
+     * @param filter
+     *            The filter tree node
+     */
+       public ColorSetting(RGB foreground, RGB background, RGB tickColorRGB, ITmfFilterTreeNode filter) {
+               fForegroundRGB = foreground;
+               fBackgroundRGB = background;
+               fTickColorRGB = tickColorRGB;
+               fFilter = filter;
+               Display display = Display.getDefault();
+               fForegroundColor = new Color(display, fForegroundRGB);
+               fBackgroundColor = new Color(display, fBackgroundRGB);
+               fDimmedForegroundColor = new Color(display, ColorUtil.blend(
+                               fForegroundRGB, fBackgroundRGB));
+               fDimmedBackgroundColor = new Color(display, ColorUtil.blend(
+                               fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
+               fTickColor = new Color(display, fTickColorRGB);
+       }
+
+       /**
+        * Dispose the color setting resources
+        */
+       public void dispose() {
+               fForegroundColor.dispose();
+               fBackgroundColor.dispose();
+               fDimmedForegroundColor.dispose();
+               fDimmedBackgroundColor.dispose();
+               fTickColor.dispose();
+       }
+
+       /**
+        * Returns foreground RGB value.
+        *
+        * @return the foreground RGB
+        */
+       public RGB getForegroundRGB() {
+               return fForegroundRGB;
+       }
+
+       /**
+        * Sets the foreground RGB value
+        *
+        * @param foreground the foreground to set
+        */
+       public void setForegroundRGB(RGB foreground) {
+               fForegroundRGB = foreground;
+               fForegroundColor.dispose();
+               fDimmedForegroundColor.dispose();
+               Display display = Display.getDefault();
+               fForegroundColor = new Color(display, fForegroundRGB);
+               fDimmedForegroundColor = new Color(display, ColorUtil.blend(
+                               fForegroundRGB, fBackgroundRGB));
+       }
+
+       /**
+        * Returns the background RGB value.
+        *
+        * @return the background RGB
+        */
+       public RGB getBackgroundRGB() {
+               return fBackgroundRGB;
+       }
+
+       /**
+        * Sets the background RGB value.
+        *
+        * @param background the background to set
+        */
+       public void setBackgroundRGB(RGB background) {
+               fBackgroundRGB = background;
+               fBackgroundColor.dispose();
+               fDimmedBackgroundColor.dispose();
+               Display display = Display.getDefault();
+               fBackgroundColor = new Color(display, fBackgroundRGB);
+               fDimmedBackgroundColor = new Color(display, ColorUtil.blend(
+                               fBackgroundRGB, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()));
+       }
+
+       /**
+        * Returns the RGB of the tick color
+        *
+        * @return the RGB of the tick color
+        */
+       public RGB getTickColorRGB() {
+               return fTickColorRGB;
+       }
+
+       /**
+        * Sets the RGB of the tick color
+        *
+        * @param tickColorRGB the tick color TGB
+        */
+       public void setTickColorRGB(RGB tickColorRGB) {
+              fTickColorRGB = tickColorRGB;
+              fTickColor.dispose();
+           Display display = Display.getDefault();
+           fTickColor = new Color(display, fTickColorRGB);
+       }
+
+       /**
+        * Returns the filter implementation.
+        * @return the filter
+        */
+       public ITmfFilterTreeNode getFilter() {
+               return fFilter;
+       }
+
+       /**
+        * Sets the filter implementation.
+        *
+        * @param filter the filter to set
+        */
+       public void setFilter(ITmfFilterTreeNode filter) {
+               fFilter = filter;
+       }
+
+       /**
+        * Returns the foreground color.
+        *
+        * @return the foreground color
+        */
+       public Color getForegroundColor() {
+               return fForegroundColor;
+       }
+
+       /**
+        * Returns the background color.
+        *
+        * @return the background color
+        */
+       public Color getBackgroundColor() {
+               return fBackgroundColor;
+       }
+
+       /**
+        * Returns the dimmed foreground color.
+        *
+        * @return the dimmed foreground color
+        */
+       public Color getDimmedForegroundColor() {
+               return fDimmedForegroundColor;
+       }
+
+       /**
+        * Returns the dimmed background color.
+        *
+        * @return the dimmed background color
+        */
+       public Color getDimmedBackgroundColor() {
+               return fDimmedBackgroundColor;
+       }
+
+       /**
+        * Returns the tick color.
+        *
+        * @return the tick color
+        */
+       public Color getTickColor() {
+        return fTickColor;
+    }
+}
This page took 0.04347 seconds and 5 git commands to generate.