tmf: Update some Javadoc in tmf.ui
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / core / Metrics.java
CommitLineData
73005152 1/**********************************************************************
df0b8ff4
BH
2 * Copyright (c) 2005, 2008 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
013a5f1c 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
013a5f1c
AM
9 *
10 * Contributors:
73005152
BH
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14package org.eclipse.linuxtools.tmf.ui.views.uml2sd.core;
15
16/**
17 * This class contains the metrics used to layout a sequence diagram on a view The class method are mostly used in
18 * combination with the preferences
013a5f1c
AM
19 *
20 * @version 1.0
73005152 21 * @author sveyrier
013a5f1c 22 *
73005152
BH
23 */
24public class Metrics {
df0b8ff4
BH
25 // ------------------------------------------------------------------------
26 // Constants
27 // ------------------------------------------------------------------------
73005152
BH
28
29 /**
30 * Space between the Frame and the top of the View This also represent the space between the frame and the bottom of
31 * the View
32 */
33 public static final int FRAME_H_MARGIN = 10;
34 /**
35 * Space between the Frame and the left of the View This also represent the space between the Frame and the right of
36 * the View
37 */
38 public static final int FRAME_V_MARGIN = 10;
39 /**
40 * Space between the Lifelines and the right of the Frame
41 */
42 public static final int LIFELINE_H_MAGIN = 23;
73005152
BH
43 /**
44 * Space between the Lifelines and the bottom of the Frame
45 */
46 public static final int LIFELINE_VB_MAGIN = 20;
47 /**
48 * Space between the Lifelines and the top of the Frame
49 */
50 public static final int LIFELINE_VT_MAGIN = 30;// 18
51 /**
52 * Vertical space between the lifeline name and the rectangle which contains that name This is only for the
53 * "always visible" lifeline name rectangle
54 */
55 public static final int LIFELINE_HEARDER_TEXT_V_MARGIN = 4;
56 /**
57 * Vertical spacing between messages
58 */
df0b8ff4 59 public static final int MESSAGES_SPACING = 30;
73005152
BH
60 /**
61 * Vertical spacing between the message and its name
62 */
63 public static final int MESSAGES_NAME_SPACING = 10;
64 /**
65 * Horizontal spacing between the Frame name and its containing rectangle
66 */
67 public static final int FRAME_NAME_H_MARGIN = 4;
68 /**
69 * Vertical spacing between the Frame name and its containing rectangle
70 */
71 public static final int FRAME_NAME_V_MARGIN = 8;
72 /**
73 * Horizontal spacing between the lifeline name and its containing rectangle
74 */
75 public static final int LIFELINE_NAME_H_MARGIN = 14;
76 /**
77 * Vertical spacing between the lifeline name and its containing rectangle
78 */
79 public static final int LIFELINE_NAME_V_MARGIN = 20;
80 /**
81 * Space between the rectangles which contain the Lifelines name
82 */
83 public static final int LIFELINE_SPACING = 45;
84 /**
85 * The circle ray used to draw the circle which compose Found and Lost messages
86 */
87 public static final int MESSAGE_CIRCLE_RAY = 5;
88 /**
89 * Execution occurrence vertical width
90 */
91 public static final int EXECUTION_OCCURRENCE_WIDTH = 8;
92 /**
93 * The square width which contains the Stop representation (a cross)
94 */
95 public static final int STOP_WIDTH = 20;
df0b8ff4 96 /**
013a5f1c 97 * The internal message width.
df0b8ff4 98 */
73005152 99 public static final int INTERNAL_MESSAGE_WIDTH = 20;
df0b8ff4
BH
100 /**
101 * The internal sychrounous message height.
102 */
73005152 103 public static final int SYNC_INTERNAL_MESSAGE_HEIGHT = 10;
73005152
BH
104 /**
105 * Line width used when drawing selected GraphNode
106 */
107 public static final int SELECTION_LINE_WIDTH = 5;
108 /**
109 * Line width used when drawing non selected GraphNode
110 */
111 public static final int NORMAL_LINE_WIDTH = 1;
df0b8ff4
BH
112 /**
113 * The internal vertical message margin
114 */
73005152
BH
115 public static final int INTERNAL_MESSAGE_V_MARGIN = 10;
116
117 /**
118 * Used to sample the diagram. When the lifeline spacing is smaller than this constant when zooming out then less
119 * lifelines are displayed to avoid lifelines overlapping and mainly saving some execution time
120 */
121 public static final int LIFELINE_SIGNIFICANT_HSPACING = 10;
122 /**
123 * Used to sample the diagram. When the message spacing is smaller than this constant when zooming out then less
124 * message are displayed to avoid message overlapping and mainly saving some execution time
125 */
126 public static final int MESSAGE_SIGNIFICANT_VSPACING = 1;
df0b8ff4
BH
127 /**
128 * Message selection tolerance. Used for internal syncMessages only
129 */
73005152 130 public static final int MESSAGE_SELECTION_TOLERANCE = 30;
df0b8ff4
BH
131 /**
132 * The focus drawing margin.
133 */
73005152 134 public static final int FOCUS_DRAWING_MARGIN = 10;
013a5f1c 135
df0b8ff4
BH
136 // ------------------------------------------------------------------------
137 // Attributes
138 // ------------------------------------------------------------------------
139 /**
140 * The lifeline font height
141 */
eb63f5ff 142 private static int fLifelineFontHeight = 0;
df0b8ff4
BH
143 /**
144 * The message font height
145 */
eb63f5ff 146 private static int fMessageFontHeight = 0;
df0b8ff4
BH
147 /**
148 * The frame font height
149 */
eb63f5ff 150 private static int fFrameFontHeight = 0;
df0b8ff4
BH
151 /**
152 * The lifeline header font height
153 */
eb63f5ff 154 private static int fLifelineHeaderFontHeight = 0;
df0b8ff4
BH
155 /**
156 * The lifeline font widht
157 */
eb63f5ff 158 private static int fLifelineFontWidth = 0;
df0b8ff4
BH
159 /**
160 * The lifeline width
161 */
eb63f5ff 162 private static int fLifeLineWidth = 119;
df0b8ff4
BH
163 /**
164 * The (forced) event spacing
165 */
eb63f5ff 166 private static int fForcedEventSpacing = -1;
73005152 167
3145ec83
BH
168 // ------------------------------------------------------------------------
169 // Constructor
170 // ------------------------------------------------------------------------
171 /**
172 * Constructor
013a5f1c 173 *
3145ec83
BH
174 * Hide private constructor
175 */
176 private Metrics() {
177 }
013a5f1c 178
df0b8ff4
BH
179 // ------------------------------------------------------------------------
180 // Methods
181 // ------------------------------------------------------------------------
73005152
BH
182
183 /**
184 * Set the character height used to draw the lifeline name
013a5f1c 185 *
73005152
BH
186 * @param height the character height
187 */
188 static public void setLifelineFontHeight(int height) {
eb63f5ff 189 fLifelineFontHeight = height;
73005152
BH
190 }
191
192 /**
193 * Set the character width used to draw the lifeline name
013a5f1c 194 *
73005152
BH
195 * @param width the character width
196 */
197 static public void setLifelineFontWidth(int width) {
eb63f5ff 198 fLifelineFontWidth = width;
73005152
BH
199 }
200
201 /**
202 * Set the character height used to draw the message name
013a5f1c 203 *
73005152
BH
204 * @param fontHeight the character height
205 */
206 static public void setMessageFontHeight(int fontHeight) {
eb63f5ff 207 fMessageFontHeight = fontHeight;
73005152
BH
208 }
209
210 /**
211 * Returns the character height used to draw the lifeline name
013a5f1c 212 *
73005152
BH
213 * @return the character height
214 */
215 static public int getFrameFontHeigth() {
eb63f5ff 216 return fFrameFontHeight;
73005152
BH
217 }
218
219 /**
220 * Set the character height used to draw the message name
013a5f1c 221 *
73005152
BH
222 * @param fontHeight the character height
223 */
224 static public void setFrameFontHeight(int fontHeight) {
eb63f5ff 225 fFrameFontHeight = fontHeight;
73005152
BH
226 }
227
228 /**
229 * Returns the character height used to draw the lifeline name
013a5f1c 230 *
73005152
BH
231 * @return the character height
232 */
233 static public int getLifelineHeaderFontHeigth() {
eb63f5ff 234 return fLifelineHeaderFontHeight;
73005152
BH
235 }
236
237 /**
238 * Set the character height used to draw the message name
013a5f1c 239 *
73005152
BH
240 * @param fontHeight the character height
241 */
242 static public void setLifelineHeaderFontHeight(int fontHeight) {
eb63f5ff 243 fLifelineHeaderFontHeight = fontHeight;
73005152
BH
244 }
245
246 /**
247 * Returns the character height used to draw the lifeline name
013a5f1c 248 *
73005152
BH
249 * @return the character height
250 */
251 static public int getLifelineFontHeigth() {
eb63f5ff 252 return fLifelineFontHeight;
73005152
BH
253 }
254
255 /**
256 * Returns the character height used to draw the message name
013a5f1c 257 *
73005152
BH
258 * @return the character height
259 */
260 static public int getMessageFontHeigth() {
eb63f5ff 261 if (fForcedEventSpacing >= 0) {
73005152 262 return 0;
df0b8ff4 263 }
eb63f5ff 264 return fMessageFontHeight;
73005152
BH
265 }
266
267 /**
268 * This is the vertical space used by a Lifeline (mostly the rectangle which contain its name)
013a5f1c 269 *
73005152
BH
270 * @return the vertical space used by a Lifeline
271 */
272 static public int getLifelineWidth() {
eb63f5ff 273 return fLifeLineWidth;
73005152
BH
274 }
275
276 /**
277 * Set the vertical space used by a Lifeline (mostly the rectangle which contain its name)
013a5f1c 278 *
73005152
BH
279 * @param value the vertical space
280 */
281 static public void setLifelineWidth(int value) {
eb63f5ff 282 fLifeLineWidth = value;
73005152
BH
283 }
284
285 /**
286 * Returns the swimming lane width
013a5f1c 287 *
73005152
BH
288 * @return the swimming lane width
289 */
290 static public int swimmingLaneWidth() {
291 return getLifelineWidth() + LIFELINE_SPACING;
292 }
293
294 /**
295 * Returns the character width used to draw the Lifelines name
013a5f1c 296 *
73005152
BH
297 * @return the average character width
298 */
299 static public int getAverageCharWidth() {
eb63f5ff 300 return fLifelineFontWidth;
73005152
BH
301 }
302
df0b8ff4
BH
303 /**
304 * Returns the message spacing.
013a5f1c 305 *
df0b8ff4
BH
306 * @return the message spacing
307 */
73005152 308 static public int getMessagesSpacing() {
eb63f5ff
BH
309 if (fForcedEventSpacing >= 0) {
310 return fForcedEventSpacing;
013a5f1c 311 }
df0b8ff4 312 return MESSAGES_SPACING;
73005152
BH
313 }
314
315 /**
316 * Sets the forced event spacing value .
013a5f1c 317 *
73005152
BH
318 * @param eventSpacing
319 */
320 static public void setForcedEventSpacing(int eventSpacing) {
eb63f5ff 321 fForcedEventSpacing = eventSpacing;
73005152
BH
322 }
323
324 /**
325 * Gets the forced event spacing value.
013a5f1c 326 *
73005152
BH
327 * @return forcedEventSpacing
328 */
329 static public int getForcedEventSpacing() {
eb63f5ff 330 return fForcedEventSpacing;
73005152
BH
331 }
332}
This page took 0.044698 seconds and 5 git commands to generate.