55 */
56 public abstract class ValueAxis<T extends Number> extends Axis<T> {
57
58 // -------------- PRIVATE FIELDS -----------------------------------------------------------------------------------
59
60 private final Path minorTickPath = new Path();
61
62 private double offset;
63 /** This is the minimum current data value and it is used while auto ranging.
64 * Package private solely for test purposes */
65 double dataMinValue;
66 /** This is the maximum current data value and it is used while auto ranging.
67 * Package private solely for test purposes */
68 double dataMaxValue;
69 /** List of the values at which there are minor ticks */
70 private List<T> minorTickMarkValues = null;
71 private boolean minorTickMarksDirty = true;
72 // -------------- PRIVATE PROPERTIES -------------------------------------------------------------------------------
73
74 /**
75 * The current value for the lowerBound of this axis, i.e. min value.
76 * This may be the same as lowerBound or different. It is used by NumberAxis to animate the
77 * lowerBound from the old value to the new value.
78 */
79 protected final DoubleProperty currentLowerBound = new SimpleDoubleProperty(this, "currentLowerBound");
80
81 // -------------- PUBLIC PROPERTIES --------------------------------------------------------------------------------
82
83 /** true if minor tick marks should be displayed */
84 private BooleanProperty minorTickVisible = new StyleableBooleanProperty(true) {
85 @Override protected void invalidated() {
86 minorTickPath.setVisible(get());
87 requestAxisLayout();
88 }
89
90 @Override
91 public Object getBean() {
92 return ValueAxis.this;
93 }
94
95 @Override
103 }
104 };
105 public final boolean isMinorTickVisible() { return minorTickVisible.get(); }
106 public final void setMinorTickVisible(boolean value) { minorTickVisible.set(value); }
107 public final BooleanProperty minorTickVisibleProperty() { return minorTickVisible; }
108
109
110 /** The scale factor from data units to visual units */
111 private ReadOnlyDoubleWrapper scale = new ReadOnlyDoubleWrapper(this, "scale", 0) {
112 @Override
113 protected void invalidated() {
114 requestAxisLayout();
115 measureInvalid = true;
116 }
117 };
118 public final double getScale() { return scale.get(); }
119 protected final void setScale(double scale) { this.scale.set(scale); }
120 public final ReadOnlyDoubleProperty scaleProperty() { return scale.getReadOnlyProperty(); }
121 ReadOnlyDoubleWrapper scalePropertyImpl() { return scale; }
122
123 /** The value for the upper bound of this axis, i.e. max value. This is automatically set if auto ranging is on. */
124 private DoubleProperty upperBound = new DoublePropertyBase(100) {
125 @Override protected void invalidated() {
126 if(!isAutoRanging()) {
127 invalidateRange();
128 requestAxisLayout();
129 }
130 }
131
132 @Override
133 public Object getBean() {
134 return ValueAxis.this;
135 }
136
137 @Override
138 public String getName() {
139 return "upperBound";
140 }
141 };
142 public final double getUpperBound() { return upperBound.get(); }
143 public final void setUpperBound(double value) { upperBound.set(value); }
144 public final DoubleProperty upperBoundProperty() { return upperBound; }
145
146 /** The value for the lower bound of this axis, i.e. min value. This is automatically set if auto ranging is on. */
147 private DoubleProperty lowerBound = new DoublePropertyBase(0) {
148 @Override protected void invalidated() {
149 if(!isAutoRanging()) {
150 invalidateRange();
151 requestAxisLayout();
152 }
153 }
154
155 @Override
156 public Object getBean() {
157 return ValueAxis.this;
158 }
159
160 @Override
161 public String getName() {
162 return "lowerBound";
163 }
164 };
165 public final double getLowerBound() { return lowerBound.get(); }
166 public final void setLowerBound(double value) { lowerBound.set(value); }
|
55 */
56 public abstract class ValueAxis<T extends Number> extends Axis<T> {
57
58 // -------------- PRIVATE FIELDS -----------------------------------------------------------------------------------
59
60 private final Path minorTickPath = new Path();
61
62 private double offset;
63 /** This is the minimum current data value and it is used while auto ranging.
64 * Package private solely for test purposes */
65 double dataMinValue;
66 /** This is the maximum current data value and it is used while auto ranging.
67 * Package private solely for test purposes */
68 double dataMaxValue;
69 /** List of the values at which there are minor ticks */
70 private List<T> minorTickMarkValues = null;
71 private boolean minorTickMarksDirty = true;
72 // -------------- PRIVATE PROPERTIES -------------------------------------------------------------------------------
73
74 /**
75 * The current value for the lowerBound of this axis, ie min value.
76 * This may be the same as lowerBound or different. It is used by NumberAxis to animate the
77 * lowerBound from the old value to the new value.
78 */
79 protected final DoubleProperty currentLowerBound = new SimpleDoubleProperty(this, "currentLowerBound");
80
81 // -------------- PUBLIC PROPERTIES --------------------------------------------------------------------------------
82
83 /** true if minor tick marks should be displayed */
84 private BooleanProperty minorTickVisible = new StyleableBooleanProperty(true) {
85 @Override protected void invalidated() {
86 minorTickPath.setVisible(get());
87 requestAxisLayout();
88 }
89
90 @Override
91 public Object getBean() {
92 return ValueAxis.this;
93 }
94
95 @Override
103 }
104 };
105 public final boolean isMinorTickVisible() { return minorTickVisible.get(); }
106 public final void setMinorTickVisible(boolean value) { minorTickVisible.set(value); }
107 public final BooleanProperty minorTickVisibleProperty() { return minorTickVisible; }
108
109
110 /** The scale factor from data units to visual units */
111 private ReadOnlyDoubleWrapper scale = new ReadOnlyDoubleWrapper(this, "scale", 0) {
112 @Override
113 protected void invalidated() {
114 requestAxisLayout();
115 measureInvalid = true;
116 }
117 };
118 public final double getScale() { return scale.get(); }
119 protected final void setScale(double scale) { this.scale.set(scale); }
120 public final ReadOnlyDoubleProperty scaleProperty() { return scale.getReadOnlyProperty(); }
121 ReadOnlyDoubleWrapper scalePropertyImpl() { return scale; }
122
123 /** The value for the upper bound of this axis, ie max value. This is automatically set if auto ranging is on. */
124 private DoubleProperty upperBound = new DoublePropertyBase(100) {
125 @Override protected void invalidated() {
126 if(!isAutoRanging()) {
127 invalidateRange();
128 requestAxisLayout();
129 }
130 }
131
132 @Override
133 public Object getBean() {
134 return ValueAxis.this;
135 }
136
137 @Override
138 public String getName() {
139 return "upperBound";
140 }
141 };
142 public final double getUpperBound() { return upperBound.get(); }
143 public final void setUpperBound(double value) { upperBound.set(value); }
144 public final DoubleProperty upperBoundProperty() { return upperBound; }
145
146 /** The value for the lower bound of this axis, ie min value. This is automatically set if auto ranging is on. */
147 private DoubleProperty lowerBound = new DoublePropertyBase(0) {
148 @Override protected void invalidated() {
149 if(!isAutoRanging()) {
150 invalidateRange();
151 requestAxisLayout();
152 }
153 }
154
155 @Override
156 public Object getBean() {
157 return ValueAxis.this;
158 }
159
160 @Override
161 public String getName() {
162 return "lowerBound";
163 }
164 };
165 public final double getLowerBound() { return lowerBound.get(); }
166 public final void setLowerBound(double value) { lowerBound.set(value); }
|