1 /*
2 * Copyright (c) 2003-2008 by Cosylab d. d.
3 *
4 * This file is part of CosyBeans-Common.
5 *
6 * CosyBeans-Common is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * CosyBeans-Common is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with CosyBeans-Common. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package com.cosylab.gui.components.range2;
21
22 /**
23 * Helper class for the Ticks class. Tick contains information about individual
24 * tick that is rendered on the scale.
25 *
26 * @author <a href="mailto:ales.pucelj@cosylab.com">Ales Pucelj</a>
27 * @version 1.0
28 */
29 public final class Tick
30 {
31 /** DOCUMENT ME! */
32 public static final int TICKS_OFFSET_PIXELS = 20;
33
34 // Value in range [0..1] indicating the position of the tick on the scale
35
36 /** DOCUMENT ME! */
37 public double proportional = 0;
38
39 /** DOCUMENT ME! */
40 public double absolute = 0;
41
42 // If true, the tick will be rendered longer
43
44 /** DOCUMENT ME! */
45 public boolean major = false;
46
47 // Text to be displayed for this tick.
48 // Text is only displayed if major == true.
49
50 /** DOCUMENT ME! */
51 public String text = null;
52
53 /**
54 * Constructs new Tick
55 *
56 * @param proportional
57 * @param major
58 */
59 public Tick(double absolute, double proportional, boolean major)
60 {
61 this.absolute= absolute;
62 this.proportional = proportional;
63 this.major = major;
64 this.text = null;
65 }
66
67 /**
68 * Constructs new Tick
69 *
70 * @param proportional
71 * @param major
72 * @param text
73 */
74 public Tick(double absolute, double proportional, boolean major, String text)
75 {
76 this.absolute= absolute;
77 this.proportional = proportional;
78 this.major = major;
79 this.text = text;
80 }
81
82 /* (non-Javadoc)
83 * @see java.lang.Object#toString()
84 */
85 public String toString()
86 {
87 StringBuffer sb = new StringBuffer();
88 sb.append("Tick = { text='");
89 sb.append(text);
90 sb.append("' major='");
91 sb.append(major);
92 sb.append("' prop='");
93 sb.append(proportional);
94 sb.append("' abs='");
95 sb.append(absolute);
96 sb.append("' }");
97
98 return sb.toString();
99 }
100 }
101
102 /* __oOo__ */