Java Doc and API clean up of TMF UML Sequence diagram framework
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / drawings / impl / ColorImpl.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
73005152
BH
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
73005152
BH
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.impl;
15
16import org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor;
17import org.eclipse.swt.graphics.Color;
18import org.eclipse.swt.widgets.Display;
19
20/**
df0b8ff4
BH
21 * Default implementation of the IColor interface.
22 *
23 * @version 1.0
73005152
BH
24 * @author sveyrier
25 *
26 */
27public class ColorImpl implements IColor {
28
df0b8ff4
BH
29 // ------------------------------------------------------------------------
30 // Attributes
31 // ------------------------------------------------------------------------
32 /**
33 * The color object.
34 */
73005152 35 protected Color col = null;
df0b8ff4
BH
36 /**
37 * Flag to indicate that this object is managing the resource.
38 */
73005152
BH
39 protected boolean manageColor = true;
40
df0b8ff4
BH
41 // ------------------------------------------------------------------------
42 // Constructors
43 // ------------------------------------------------------------------------
44 /**
45 * Constructor
46 *
47 * @param display The display to use
48 * @param r A value for red
49 * @param g A value for green
50 * @param b A value for blue
51 */
73005152
BH
52 public ColorImpl(Display display, int r, int g, int b) {
53 col = new Color(display, r, g, b);
54 }
55
df0b8ff4
BH
56 /**
57 * Copy constructor
58 *
59 * @param A color to copy
60 */
73005152
BH
61 protected ColorImpl(Color color) {
62 col = color;
63 manageColor = false;
64 }
65
df0b8ff4
BH
66 // ------------------------------------------------------------------------
67 // Methods
68 // ------------------------------------------------------------------------
69
70 /**
71 * Returns a system color.
72 *
73 * @param color The color ID
74 * @return a system color
75 */
73005152
BH
76 public static ColorImpl getSystemColor(int color) {
77 return new ColorImpl(Display.getDefault().getSystemColor(color));
78 }
df0b8ff4
BH
79
80 /*
81 * (non-Javadoc)
82 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor#getColor()
83 */
73005152
BH
84 @Override
85 public Object getColor() {
86 return col;
87 }
88
df0b8ff4
BH
89 /*
90 * (non-Javadoc)
91 * @see org.eclipse.linuxtools.tmf.ui.views.uml2sd.drawings.IColor#dispose()
92 */
73005152
BH
93 @Override
94 public void dispose() {
df0b8ff4 95 if ((col != null) && (manageColor)) {
73005152 96 col.dispose();
df0b8ff4 97 }
73005152
BH
98 }
99
100}
This page took 0.049248 seconds and 5 git commands to generate.