1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.xycharts
;
14 import java
.text
.FieldPosition
;
15 import java
.text
.SimpleDateFormat
;
16 import java
.util
.Date
;
18 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimestampFormat
;
21 * SimpleDateFormat class for displaying time information in SWT charts
22 * using the TmfTimestampFormat class.
24 * @author Bernd Hufmann
27 public class TmfChartTimeStampFormat
extends SimpleDateFormat
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
32 private static final long serialVersionUID
= 3719743469686142387L;
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
43 * Standard Constructor
46 * offset to apply before formatting time (time = time + offset)
48 public TmfChartTimeStampFormat(long offset
) {
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 public StringBuffer
format(Date date
, StringBuffer toAppendTo
, FieldPosition fieldPosition
) {
58 long time
= date
.getTime() + fOffset
;
59 toAppendTo
.append(TmfTimestampFormat
.getDefaulTimeFormat().format(time
));