217 throw new IllegalArgumentException("Duplicate category ; "+category+" already present");
218 }
219 }
220
221 private String getDuplicate() {
222 if (getCategories() != null) {
223 for (int i = 0; i < getCategories().size(); i++) {
224 for (int j = 0; j < getCategories().size(); j++) {
225 if (getCategories().get(i).equals(getCategories().get(j)) && i != j) {
226 return getCategories().get(i);
227 }
228 }
229 }
230 }
231 return null;
232 }
233 /**
234 * Returns a {@link ObservableList} of categories plotted on this axis.
235 *
236 * @return ObservableList of categories for this axis.
237 * @see #categories
238 */
239 public final ObservableList<String> getCategories() {
240 return categories.get();
241 }
242
243 /** This is the gap between one category and the next along this axis */
244 private final ReadOnlyDoubleWrapper categorySpacing = new ReadOnlyDoubleWrapper(this, "categorySpacing", 1);
245 public final double getCategorySpacing() {
246 return categorySpacing.get();
247 }
248 public final ReadOnlyDoubleProperty categorySpacingProperty() {
249 return categorySpacing.getReadOnlyProperty();
250 }
251
252 // -------------- CONSTRUCTORS -------------------------------------------------------------------------------------
253
254 /**
255 * Create a auto-ranging category axis with an empty list of categories.
256 */
257 public CategoryAxis() {
|
217 throw new IllegalArgumentException("Duplicate category ; "+category+" already present");
218 }
219 }
220
221 private String getDuplicate() {
222 if (getCategories() != null) {
223 for (int i = 0; i < getCategories().size(); i++) {
224 for (int j = 0; j < getCategories().size(); j++) {
225 if (getCategories().get(i).equals(getCategories().get(j)) && i != j) {
226 return getCategories().get(i);
227 }
228 }
229 }
230 }
231 return null;
232 }
233 /**
234 * Returns a {@link ObservableList} of categories plotted on this axis.
235 *
236 * @return ObservableList of categories for this axis.
237 */
238 public final ObservableList<String> getCategories() {
239 return categories.get();
240 }
241
242 /** This is the gap between one category and the next along this axis */
243 private final ReadOnlyDoubleWrapper categorySpacing = new ReadOnlyDoubleWrapper(this, "categorySpacing", 1);
244 public final double getCategorySpacing() {
245 return categorySpacing.get();
246 }
247 public final ReadOnlyDoubleProperty categorySpacingProperty() {
248 return categorySpacing.getReadOnlyProperty();
249 }
250
251 // -------------- CONSTRUCTORS -------------------------------------------------------------------------------------
252
253 /**
254 * Create a auto-ranging category axis with an empty list of categories.
255 */
256 public CategoryAxis() {
|