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