2010-11-10 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / model / trange / TimeRangeComponent.java
1 /*******************************************************************************
2 * Copyright (c) 2009 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.linuxtools.lttng.ui.model.trange;
13
14
15 /**
16 * @author alvaro
17 *
18 */
19 public abstract class TimeRangeComponent implements ITimeRangeComponent {
20
21 // ========================================================================
22 // Data
23 // =======================================================================
24 protected Long startTime = 0L;
25 protected Long stopTime = Long.MAX_VALUE;
26 protected TimeRangeComposite eventParent = null;
27 private boolean visible = true;
28
29
30
31 // ========================================================================
32 // Constructor
33 // =======================================================================
34 public TimeRangeComponent(Long stime, Long etime,
35 TimeRangeComposite eventParent) {
36 this.startTime = stime;
37 this.stopTime = etime;
38 this.eventParent = eventParent;
39 }
40
41 // ========================================================================
42 // Methods
43 // =======================================================================
44 /**
45 * This method shall not be used to estimate the starting drawing point of
46 * the time range-event. see interface method getTime(). However this method
47 * can be used to retrieve the tool tip information where we need to reflect
48 * that the actual start of this event is unknown
49 *
50 * @param time
51 */
52 @Override
53 public long getStartTime() {
54 return startTime.longValue();
55 }
56
57 @Override
58 public void setStartTime(long time) {
59 if (time > -1) {
60 startTime = time;
61 }
62 }
63
64 @Override
65 public long getStopTime() {
66 return stopTime.longValue();
67 }
68
69 @Override
70 public void setStopTime(long stopTime) {
71 if (stopTime > -1) {
72 this.stopTime = stopTime;
73 }
74 }
75
76 @Override
77 public ITimeRangeComponent getEventParent() {
78 return eventParent;
79 }
80
81 public void setEventParent(TimeRangeComposite eventParent) {
82 this.eventParent = eventParent;
83 }
84
85 @Override
86 public abstract String getName();
87
88
89 public void setVisible(boolean visible) {
90 this.visible = visible;
91 }
92
93 /* (non-Javadoc)
94 * @see org.eclipse.linuxtools.lttng.ui.model.trange.ITimeRangeComponent#isVisible()
95 */
96 @Override
97 public boolean isVisible() {
98 return visible;
99 }
100
101 @Override
102 @SuppressWarnings("nls")
103 public String toString() {
104 return "[TimeRangeComponent:" + "startTime=" + startTime + ",stopTime=" + stopTime +
105 ",parent=" + (eventParent != null ? eventParent.id : "null") + "]";
106 }
107
108 }
This page took 0.033022 seconds and 6 git commands to generate.