1 /*
2
3 dsh-piccolo-venn Piccolo2D venn diagram nodes and supporting classes.
4 Copyright (c) 2009-2013 held jointly by the individual authors.
5
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 3 of the License, or (at
9 your option) any later version.
10
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19
20 > http://www.fsf.org/licensing/licenses/lgpl.html
21 > http://www.opensource.org/licenses/lgpl-license.php
22
23 */
24 package org.dishevelled.piccolo.venn;
25
26 import java.util.Arrays;
27 import java.util.List;
28 import java.util.Set;
29
30 import org.piccolo2d.nodes.PText;
31 import org.dishevelled.observable.event.SetChangeEvent;
32 import org.dishevelled.observable.event.SetChangeListener;
33 import org.dishevelled.venn.QuaternaryVennModel;
34 import org.dishevelled.venn.model.QuaternaryVennModelImpl;
35
36 /**
37 * Abstract quaternary venn diagram node.
38 *
39 * @param <E> value type
40 * @author Michael Heuer
41 * @version $Revision$ $Date$
42 */
43 public abstract class AbstractQuaternaryVennNode<E>
44 extends AbstractVennNode<E>
45 {
46 /** Quaternary venn model. */
47 private QuaternaryVennModel<E> model;
48
49 /** Label text for the first set. */
50 private String firstLabelText = DEFAULT_FIRST_LABEL_TEXT;
51
52 /** Label text for the second set. */
53 private String secondLabelText = DEFAULT_SECOND_LABEL_TEXT;
54
55 /** Label text for the third set. */
56 private String thirdLabelText = DEFAULT_THIRD_LABEL_TEXT;
57
58 /** Label text for the fourth set. */
59 private String fourthLabelText = DEFAULT_FOURTH_LABEL_TEXT;
60
61 /** Label text for the first only view. */
62 private String firstOnlyLabelText = DEFAULT_FIRST_ONLY_LABEL_TEXT;
63
64 /** Label text for the second only view. */
65 private String secondOnlyLabelText = DEFAULT_SECOND_ONLY_LABEL_TEXT;
66
67 /** Label text for the third only view. */
68 private String thirdOnlyLabelText = DEFAULT_THIRD_ONLY_LABEL_TEXT;
69
70 /** Label text for the fourth only view. */
71 private String fourthOnlyLabelText = DEFAULT_FOURTH_ONLY_LABEL_TEXT;
72
73 /** Label text for the first second view. */
74 private String firstSecondLabelText = DEFAULT_FIRST_SECOND_LABEL_TEXT;
75
76 /** Label text for the first third view. */
77 private String firstThirdLabelText = DEFAULT_FIRST_THIRD_LABEL_TEXT;
78
79 /** Label text for the second third view. */
80 private String secondThirdLabelText = DEFAULT_SECOND_THIRD_LABEL_TEXT;
81
82 /** Label text for the first fourth view. */
83 private String firstFourthLabelText = DEFAULT_FIRST_FOURTH_LABEL_TEXT;
84
85 /** Label text for the second fourth view. */
86 private String secondFourthLabelText = DEFAULT_SECOND_FOURTH_LABEL_TEXT;
87
88 /** Label text for the third fourth view. */
89 private String thirdFourthLabelText = DEFAULT_THIRD_FOURTH_LABEL_TEXT;
90
91 /** Label text for the first second third view. */
92 private String firstSecondThirdLabelText = DEFAULT_FIRST_SECOND_THIRD_LABEL_TEXT;
93
94 /** Label text for the first second fourth view. */
95 private String firstSecondFourthLabelText = DEFAULT_FIRST_SECOND_FOURTH_LABEL_TEXT;
96
97 /** Label text for the first third fourth view. */
98 private String firstThirdFourthLabelText = DEFAULT_FIRST_THIRD_FOURTH_LABEL_TEXT;
99
100 /** Label text for the second third fourth view. */
101 private String secondThirdFourthLabelText = DEFAULT_SECOND_THIRD_FOURTH_LABEL_TEXT;
102
103 /** Label text for the intersection view. */
104 private String intersectionLabelText = DEFAULT_INTERSECTION_LABEL_TEXT;
105
106 /** Label text for the union view. */
107 private String unionLabelText = DEFAULT_UNION_LABEL_TEXT;
108
109 /** Label for the first set. */
110 private final PText firstLabel = new PText();
111
112 /** Label for the second set. */
113 private final PText secondLabel = new PText();
114
115 /** Label for the third set. */
116 private final PText thirdLabel = new PText();
117
118 /** Label for the fourth set. */
119 private final PText fourthLabel = new PText();
120
121 /** Label for the first only view. */
122 private final PText firstOnlyLabel = new PText();
123
124 /** Label for the second only view. */
125 private final PText secondOnlyLabel = new PText();
126
127 /** Label for the third only view. */
128 private final PText thirdOnlyLabel = new PText();
129
130 /** Label for the fourth only view. */
131 private final PText fourthOnlyLabel = new PText();
132
133 /** Label for the first second view. */
134 private final PText firstSecondLabel = new PText();
135
136 /** Label for the first third view. */
137 private final PText firstThirdLabel = new PText();
138
139 /** Label for the second third view. */
140 private final PText secondThirdLabel = new PText();
141
142 /** Label for the first fourth view. */
143 private final PText firstFourthLabel = new PText();
144
145 /** Label for the second fourth view. */
146 private final PText secondFourthLabel = new PText();
147
148 /** Label for the third fourth view. */
149 private final PText thirdFourthLabel = new PText();
150
151 /** Label for the first second third view. */
152 private final PText firstSecondThirdLabel = new PText();
153
154 /** Label for the first second fourth view. */
155 private final PText firstSecondFourthLabel = new PText();
156
157 /** Label for the first third fourth view. */
158 private final PText firstThirdFourthLabel = new PText();
159
160 /** Label for the second third fourth view. */
161 private final PText secondThirdFourthLabel = new PText();
162
163 /** Label for the intersection view. */
164 private final PText intersectionLabel = new PText();
165
166 /** Label for the union view. */
167 private final PText unionLabel = new PText();
168
169 /** List of labels. */
170 private final List<PText> labels = Arrays.asList(new PText[] { firstLabel, secondLabel, thirdLabel, fourthLabel,
171 firstOnlyLabel, secondOnlyLabel, thirdOnlyLabel, fourthOnlyLabel,
172 firstSecondLabel, firstThirdLabel, secondThirdLabel, firstFourthLabel,
173 secondFourthLabel, thirdFourthLabel, firstSecondThirdLabel,
174 firstSecondFourthLabel, firstThirdFourthLabel, secondThirdFourthLabel,
175 intersectionLabel, unionLabel });
176
177 /** Update labels and contents. */
178 private final SetChangeListener<E> update = new SetChangeListener<E>()
179 {
180 @Override
181 public void setChanged(final SetChangeEvent<E> event)
182 {
183 updateLabels();
184 updateContents();
185 }
186 };
187
188 /** Default label text for the first set, <code>"First set"</code>. */
189 public static final String DEFAULT_FIRST_LABEL_TEXT = "First set";
190
191 /** Default label text for the second set, <code>"Second set"</code>. */
192 public static final String DEFAULT_SECOND_LABEL_TEXT = "Second set";
193
194 /** Default label text for the third set, <code>"Third set"</code>. */
195 public static final String DEFAULT_THIRD_LABEL_TEXT = "Third set";
196
197 /** Default label text for the fourth set, <code>"Fourth set"</code>. */
198 public static final String DEFAULT_FOURTH_LABEL_TEXT = "Fourth set";
199
200 /** Default label text for the first only view, <code>"First only"</code>. */
201 public static final String DEFAULT_FIRST_ONLY_LABEL_TEXT = "First only";
202
203 /** Default label text for the second only view, <code>"Second only"</code>. */
204 public static final String DEFAULT_SECOND_ONLY_LABEL_TEXT = "Second only";
205
206 /** Default label text for the third only view, <code>"Third only"</code>. */
207 public static final String DEFAULT_THIRD_ONLY_LABEL_TEXT = "Third only";
208
209 /** Default label text for the fourth only view, <code>"Fourth only"</code>. */
210 public static final String DEFAULT_FOURTH_ONLY_LABEL_TEXT = "Fourth only";
211
212 /** Default label text for the first second view, <code>"First and second only"</code>. */
213 public static final String DEFAULT_FIRST_SECOND_LABEL_TEXT = "First and second only";
214
215 /** Default label text for the first third view, <code>"First and third only"</code>. */
216 public static final String DEFAULT_FIRST_THIRD_LABEL_TEXT = "First and third only";
217
218 /** Default label text for the second third view, <code>"Second and third only"</code>. */
219 public static final String DEFAULT_SECOND_THIRD_LABEL_TEXT = "Second and third only";
220
221 /** Default label text for the first fourth view, <code>"First and fourth only"</code>. */
222 public static final String DEFAULT_FIRST_FOURTH_LABEL_TEXT = "First and fourth only";
223
224 /** Default label text for the second fourth view, <code>"Second and fourth only"</code>. */
225 public static final String DEFAULT_SECOND_FOURTH_LABEL_TEXT = "Second and fourth only";
226
227 /** Default label text for the third fourth view, <code>"Third and fourth only"</code>. */
228 public static final String DEFAULT_THIRD_FOURTH_LABEL_TEXT = "Third and fourth only";
229
230 /** Default label text for the first second third view, <code>"First, second, and third only"</code>. */
231 public static final String DEFAULT_FIRST_SECOND_THIRD_LABEL_TEXT = "First, second, and third only";
232
233 /** Default label text for the first second fourth view, <code>"First, second, and fourth only"</code>. */
234 public static final String DEFAULT_FIRST_SECOND_FOURTH_LABEL_TEXT = "First, second, and fourth only";
235
236 /** Default label text for the first third fourth view, <code>"First, third, and fourth only"</code>. */
237 public static final String DEFAULT_FIRST_THIRD_FOURTH_LABEL_TEXT = "First, third, and fourth only";
238
239 /** Default label text for the second third fourth view, <code>"Second, third, and fourth only"</code>. */
240 public static final String DEFAULT_SECOND_THIRD_FOURTH_LABEL_TEXT = "Second, third, and fourth only";
241
242 /** Default label text for the intersection view, <code>"Intersection"</code>. */
243 public static final String DEFAULT_INTERSECTION_LABEL_TEXT = "Intersection";
244
245 /** Default label text for the union view, <code>"Union"</code>. */
246 public static final String DEFAULT_UNION_LABEL_TEXT = "Union";
247
248
249 /**
250 * Create a new empty abstract quaternary venn diagram node.
251 */
252 protected AbstractQuaternaryVennNode()
253 {
254 super();
255 model = new QuaternaryVennModelImpl<E>();
256
257 installListeners();
258 updateLabels();
259 }
260
261 /**
262 * Create a new abstract quaternary venn diagram node with the specified sets.
263 *
264 * @param firstLabelText label text for the first set
265 * @param first first set, must not be null
266 * @param secondLabelText label text for the second set
267 * @param second second set, must not be null
268 * @param thirdLabelText label text for the third set
269 * @param third third set, must not be null
270 * @param fourthLabelText label text for the fourth set
271 * @param fourth fourth set, must not be null
272 */
273 protected AbstractQuaternaryVennNode(final String firstLabelText, final Set<? extends E> first,
274 final String secondLabelText, final Set<? extends E> second,
275 final String thirdLabelText, final Set<? extends E> third,
276 final String fourthLabelText, final Set<? extends E> fourth)
277 {
278 super();
279 model = new QuaternaryVennModelImpl<E>(first, second, third, fourth);
280 this.firstLabelText = firstLabelText;
281 this.secondLabelText = secondLabelText;
282 this.thirdLabelText = thirdLabelText;
283 this.fourthLabelText = fourthLabelText;
284 this.firstOnlyLabelText = firstLabelText + " only";
285 this.secondOnlyLabelText = secondLabelText + " only";
286 this.thirdOnlyLabelText = thirdLabelText + " only";
287 this.fourthOnlyLabelText = fourthLabelText + " only";
288 this.firstSecondLabelText = firstLabelText + " and " + secondLabelText + " only";
289 this.firstThirdLabelText = firstLabelText + " and " + thirdLabelText + " only";
290 this.secondThirdLabelText = secondLabelText + " and " + thirdLabelText + " only";
291 this.firstFourthLabelText = firstLabelText + " and " + fourthLabelText + " only";
292 this.secondFourthLabelText = secondLabelText + " and " + fourthLabelText + " only";
293 this.thirdFourthLabelText = thirdLabelText + " and " + fourthLabelText + " only";
294 this.firstSecondThirdLabelText = firstLabelText + ", " + secondLabelText + ", and " + thirdLabelText + " only";
295 this.firstSecondFourthLabelText = firstLabelText + ", " + secondLabelText + ", and " + fourthLabelText + " only";
296 this.firstThirdFourthLabelText = firstLabelText + ", " + thirdLabelText + ", and " + fourthLabelText + " only";
297 this.secondThirdFourthLabelText = secondLabelText + ", " + thirdLabelText + ", and " + fourthLabelText + " only";
298
299 installListeners();
300 updateLabels();
301 }
302
303 /**
304 * Create a new abstract quaternary venn diagram node with the specified model.
305 *
306 * @param model model for this abstract quaternary venn diagram node, must not be null
307 */
308 protected AbstractQuaternaryVennNode(final QuaternaryVennModel<E> model)
309 {
310 super();
311 if (model == null)
312 {
313 throw new IllegalArgumentException("model must not be null");
314 }
315 this.model = model;
316
317 installListeners();
318 updateLabels();
319 }
320
321
322 /**
323 * Install listeners.
324 */
325 private void installListeners()
326 {
327 model.first().addSetChangeListener(update);
328 model.second().addSetChangeListener(update);
329 model.third().addSetChangeListener(update);
330 model.fourth().addSetChangeListener(update);
331 }
332
333 /**
334 * Uninstall listeners.
335 */
336 private void uninstallListeners()
337 {
338 model.first().removeSetChangeListener(update);
339 model.second().removeSetChangeListener(update);
340 model.third().removeSetChangeListener(update);
341 model.fourth().removeSetChangeListener(update);
342 }
343
344 @Override
345 protected void updateLabels()
346 {
347 firstLabel.setText(buildLabel(firstLabelText, model.first().size()));
348 secondLabel.setText(buildLabel(secondLabelText, model.second().size()));
349 thirdLabel.setText(buildLabel(thirdLabelText, model.third().size()));
350 fourthLabel.setText(buildLabel(fourthLabelText, model.fourth().size()));
351 firstOnlyLabel.setText(buildLabel(firstOnlyLabelText, model.firstOnly().size()));
352 secondOnlyLabel.setText(buildLabel(secondOnlyLabelText, model.secondOnly().size()));
353 thirdOnlyLabel.setText(buildLabel(thirdOnlyLabelText, model.thirdOnly().size()));
354 fourthOnlyLabel.setText(buildLabel(fourthOnlyLabelText, model.fourthOnly().size()));
355 firstSecondLabel.setText(buildLabel(firstSecondLabelText, model.firstSecond().size()));
356 firstThirdLabel.setText(buildLabel(firstThirdLabelText, model.firstThird().size()));
357 secondThirdLabel.setText(buildLabel(secondThirdLabelText, model.secondThird().size()));
358 firstFourthLabel.setText(buildLabel(firstFourthLabelText, model.firstFourth().size()));
359 secondFourthLabel.setText(buildLabel(secondFourthLabelText, model.secondFourth().size()));
360 thirdFourthLabel.setText(buildLabel(thirdFourthLabelText, model.thirdFourth().size()));
361 firstSecondThirdLabel.setText(buildLabel(firstSecondThirdLabelText, model.firstSecondThird().size()));
362 firstSecondFourthLabel.setText(buildLabel(firstSecondFourthLabelText, model.firstSecondFourth().size()));
363 firstThirdFourthLabel.setText(buildLabel(firstThirdFourthLabelText, model.firstThirdFourth().size()));
364 secondThirdFourthLabel.setText(buildLabel(secondThirdFourthLabelText, model.secondThirdFourth().size()));
365 intersectionLabel.setText(buildLabel(intersectionLabelText, model.intersection().size()));
366 unionLabel.setText(buildLabel(unionLabelText, model.union().size()));
367
368 firstLabel.setVisible(getDisplayLabels());
369 secondLabel.setVisible(getDisplayLabels());
370 thirdLabel.setVisible(getDisplayLabels());
371 fourthLabel.setVisible(getDisplayLabels());
372 firstOnlyLabel.setVisible(getDisplayLabels());
373 secondOnlyLabel.setVisible(getDisplayLabels());
374 thirdOnlyLabel.setVisible(getDisplayLabels());
375 fourthOnlyLabel.setVisible(getDisplayLabels());
376 firstSecondLabel.setVisible(getDisplayLabels());
377 firstThirdLabel.setVisible(getDisplayLabels());
378 secondThirdLabel.setVisible(getDisplayLabels());
379 firstFourthLabel.setVisible(getDisplayLabels());
380 secondFourthLabel.setVisible(getDisplayLabels());
381 thirdFourthLabel.setVisible(getDisplayLabels());
382 firstSecondThirdLabel.setVisible(getDisplayLabels());
383 firstSecondFourthLabel.setVisible(getDisplayLabels());
384 firstThirdFourthLabel.setVisible(getDisplayLabels());
385 secondThirdFourthLabel.setVisible(getDisplayLabels());
386 intersectionLabel.setVisible(getDisplayLabels());
387 unionLabel.setVisible(getDisplayLabels());
388 }
389
390 /**
391 * Update contents.
392 */
393 protected abstract void updateContents();
394
395
396 @Override
397 public Iterable<PText> labels()
398 {
399 return labels;
400 }
401
402 /**
403 * Return the model for this quaternary venn label. The model will not be null.
404 *
405 * @return the model for this quaternary venn label
406 */
407 public final QuaternaryVennModel<E> getModel()
408 {
409 return model;
410 }
411
412 /**
413 * Set the model for this quaternary venn label to <code>model</code>.
414 *
415 * <p>This is a bound property.</p>
416 *
417 * @param model model for this quaternary venn label, must not be null
418 */
419 public final void setModel(final QuaternaryVennModel<E> model)
420 {
421 if (model == null)
422 {
423 throw new IllegalArgumentException("model must not be null");
424 }
425 QuaternaryVennModel<E> oldModel = this.model;
426 uninstallListeners();
427 this.model = model;
428 installListeners();
429 updateLabels();
430 firePropertyChange(-1, "model", oldModel, this.model);
431 }
432
433 /**
434 * Return the label text for the first set. Defaults to {@link #DEFAULT_FIRST_LABEL_TEXT}.
435 *
436 * @return the label text for the first set
437 */
438 public final String getFirstLabelText()
439 {
440 return firstLabelText;
441 }
442
443 /**
444 * Set the label text for the first set to <code>firstLabelText</code>.
445 *
446 * <p>This is a bound property.</p>
447 *
448 * @param firstLabelText label text for the first set
449 */
450 public final void setFirstLabelText(final String firstLabelText)
451 {
452 String oldFirstLabelText = this.firstLabelText;
453 this.firstLabelText = firstLabelText;
454 firstLabel.setText(buildLabel(this.firstLabelText, model.first().size()));
455 firePropertyChange(-1, "firstLabelText", this.firstLabelText, oldFirstLabelText);
456 }
457
458 /**
459 * Return the label text for the second set. Defaults to {@link #DEFAULT_SECOND_LABEL_TEXT}.
460 *
461 * @return the label text for the second set
462 */
463 public final String getSecondLabelText()
464 {
465 return secondLabelText;
466 }
467
468 /**
469 * Set the label text for the second set to <code>secondLabelText</code>.
470 *
471 * <p>This is a bound property.</p>
472 *
473 * @param secondLabelText label text for the second set
474 */
475 public final void setSecondLabelText(final String secondLabelText)
476 {
477 String oldSecondLabelText = this.secondLabelText;
478 this.secondLabelText = secondLabelText;
479 secondLabel.setText(buildLabel(this.secondLabelText, model.second().size()));
480 firePropertyChange(-1, "secondLabelText", this.secondLabelText, oldSecondLabelText);
481 }
482
483 /**
484 * Return the label text for the third set. Defaults to {@link #DEFAULT_THIRD_LABEL_TEXT}.
485 *
486 * @return the label text for the third set
487 */
488 public final String getThirdLabelText()
489 {
490 return thirdLabelText;
491 }
492
493 /**
494 * Set the label text for the third set to <code>thirdLabelText</code>.
495 *
496 * <p>This is a bound property.</p>
497 *
498 * @param thirdLabelText label text for the third set
499 */
500 public final void setThirdLabelText(final String thirdLabelText)
501 {
502 String oldThirdLabelText = this.thirdLabelText;
503 this.thirdLabelText = thirdLabelText;
504 thirdLabel.setText(buildLabel(this.thirdLabelText, model.third().size()));
505 firePropertyChange(-1, "thirdLabelText", this.thirdLabelText, oldThirdLabelText);
506 }
507
508 /**
509 * Return the label text for the fourth set. Defaults to {@link #DEFAULT_FOURTH_LABEL_TEXT}.
510 *
511 * @return the label text for the fourth set
512 */
513 public final String getFourthLabelText()
514 {
515 return fourthLabelText;
516 }
517
518 /**
519 * Set the label text for the fourth set to <code>fourthLabelText</code>.
520 *
521 * <p>This is a bound property.</p>
522 *
523 * @param fourthLabelText label text for the fourth set
524 */
525 public final void setFourthLabelText(final String fourthLabelText)
526 {
527 String oldFourthLabelText = this.fourthLabelText;
528 this.fourthLabelText = fourthLabelText;
529 fourthLabel.setText(buildLabel(this.fourthLabelText, model.fourth().size()));
530 firePropertyChange(-1, "fourthLabelText", this.fourthLabelText, oldFourthLabelText);
531 }
532
533 /**
534 * Return the label text for the first only view. Defaults to {@link #DEFAULT_FIRST_ONLY_LABEL_TEXT}.
535 *
536 * @return the label text for the first only view
537 */
538 public final String getFirstOnlyLabelText()
539 {
540 return firstOnlyLabelText;
541 }
542
543 /**
544 * Set the label text for the first only view to <code>firstOnlyLabelText</code>.
545 *
546 * <p>This is a bound property.</p>
547 *
548 * @param firstOnlyLabelText label text for the first only view
549 */
550 public final void setFirstOnlyLabelText(final String firstOnlyLabelText)
551 {
552 String oldFirstOnlyLabelText = this.firstOnlyLabelText;
553 this.firstOnlyLabelText = firstOnlyLabelText;
554 firstOnlyLabel.setText(buildLabel(this.firstOnlyLabelText, model.firstOnly().size()));
555 firePropertyChange(-1, "firstOnlyLabelText", this.firstOnlyLabelText, oldFirstOnlyLabelText);
556 }
557
558 /**
559 * Return the label text for the second only view. Defaults to {@link #DEFAULT_SECOND_ONLY_LABEL_TEXT}.
560 *
561 * @return the label text for the second only view
562 */
563 public final String getSecondOnlyLabelText()
564 {
565 return secondOnlyLabelText;
566 }
567
568 /**
569 * Set the label text for the second only view to <code>secondOnlyLabelText</code>.
570 *
571 * <p>This is a bound property.</p>
572 *
573 * @param secondOnlyLabelText label text for the second only view
574 */
575 public final void setSecondOnlyLabelText(final String secondOnlyLabelText)
576 {
577 String oldSecondOnlyLabelText = this.secondOnlyLabelText;
578 this.secondOnlyLabelText = secondOnlyLabelText;
579 secondOnlyLabel.setText(buildLabel(this.secondOnlyLabelText, model.secondOnly().size()));
580 firePropertyChange(-1, "secondOnlyLabelText", this.secondOnlyLabelText, oldSecondOnlyLabelText);
581 }
582
583 /**
584 * Return the label text for the third only view. Defaults to {@link #DEFAULT_THIRD_ONLY_LABEL_TEXT}.
585 *
586 * @return the label text for the third only view
587 */
588 public final String getThirdOnlyLabelText()
589 {
590 return thirdOnlyLabelText;
591 }
592
593 /**
594 * Set the label text for the third only view to <code>thirdOnlyLabelText</code>.
595 *
596 * <p>This is a bound property.</p>
597 *
598 * @param thirdOnlyLabelText label text for the third only view
599 */
600 public final void setThirdOnlyLabelText(final String thirdOnlyLabelText)
601 {
602 String oldThirdOnlyLabelText = this.thirdOnlyLabelText;
603 this.thirdOnlyLabelText = thirdOnlyLabelText;
604 thirdOnlyLabel.setText(buildLabel(this.thirdOnlyLabelText, model.thirdOnly().size()));
605 firePropertyChange(-1, "thirdOnlyLabelText", this.thirdOnlyLabelText, oldThirdOnlyLabelText);
606 }
607
608
609 /**
610 * Return the label text for the fourth only view. Defaults to {@link #DEFAULT_FOURTH_ONLY_LABEL_TEXT}.
611 *
612 * @return the label text for the fourth only view
613 */
614 public final String getFourthOnlyLabelText()
615 {
616 return fourthOnlyLabelText;
617 }
618
619 /**
620 * Set the label text for the fourth only view to <code>fourthOnlyLabelText</code>.
621 *
622 * <p>This is a bound property.</p>
623 *
624 * @param fourthOnlyLabelText label text for the fourth only view
625 */
626 public final void setFourthOnlyLabelText(final String fourthOnlyLabelText)
627 {
628 String oldFourthOnlyLabelText = this.fourthOnlyLabelText;
629 this.fourthOnlyLabelText = fourthOnlyLabelText;
630 fourthOnlyLabel.setText(buildLabel(this.fourthOnlyLabelText, model.fourthOnly().size()));
631 firePropertyChange(-1, "fourthOnlyLabelText", this.fourthOnlyLabelText, oldFourthOnlyLabelText);
632 }
633
634 /**
635 * Return the label text for the first second view. Defaults to {@link #DEFAULT_FIRST_SECOND_LABEL_TEXT}.
636 *
637 * @return the label text for the first second view
638 */
639 public final String getFirstSecondLabelText()
640 {
641 return firstSecondLabelText;
642 }
643
644 /**
645 * Set the label text for the first second view to <code>firstSecondLabelText</code>.
646 *
647 * <p>This is a bound property.</p>
648 *
649 * @param firstSecondLabelText label text for the first second view
650 */
651 public final void setFirstSecondLabelText(final String firstSecondLabelText)
652 {
653 String oldFirstSecondLabelText = this.firstSecondLabelText;
654 this.firstSecondLabelText = firstSecondLabelText;
655 firstSecondLabel.setText(buildLabel(this.firstSecondLabelText, model.firstSecond().size()));
656 firePropertyChange(-1, "firstSecondLabelText", this.firstSecondLabelText, oldFirstSecondLabelText);
657 }
658
659 /**
660 * Return the label text for the first third view. Defaults to {@link #DEFAULT_FIRST_THIRD_LABEL_TEXT}.
661 *
662 * @return the label text for the first third view
663 */
664 public final String getFirstThirdLabelText()
665 {
666 return firstThirdLabelText;
667 }
668
669 /**
670 * Set the label text for the first third view to <code>firstThirdLabelText</code>.
671 *
672 * <p>This is a bound property.</p>
673 *
674 * @param firstThirdLabelText label text for the first third view
675 */
676 public final void setFirstThirdLabelText(final String firstThirdLabelText)
677 {
678 String oldFirstThirdLabelText = this.firstThirdLabelText;
679 this.firstThirdLabelText = firstThirdLabelText;
680 firstThirdLabel.setText(buildLabel(this.firstThirdLabelText, model.firstThird().size()));
681 firePropertyChange(-1, "firstThirdLabelText", this.firstThirdLabelText, oldFirstThirdLabelText);
682 }
683
684 /**
685 * Return the label text for the second third view. Defaults to {@link #DEFAULT_SECOND_THIRD_LABEL_TEXT}.
686 *
687 * @return the label text for the second third view
688 */
689 public final String getSecondThirdLabelText()
690 {
691 return secondThirdLabelText;
692 }
693
694 /**
695 * Set the label text for the second third view to <code>secondThirdLabelText</code>.
696 *
697 * <p>This is a bound property.</p>
698 *
699 * @param secondThirdLabelText label text for the second third view
700 */
701 public final void setSecondThirdLabelText(final String secondThirdLabelText)
702 {
703 String oldSecondThirdLabelText = this.secondThirdLabelText;
704 this.secondThirdLabelText = secondThirdLabelText;
705 secondThirdLabel.setText(buildLabel(this.secondThirdLabelText, model.secondThird().size()));
706 firePropertyChange(-1, "secondThirdLabelText", this.secondThirdLabelText, oldSecondThirdLabelText);
707 }
708
709 /**
710 * Return the label text for the intersection view. Defaults to {@link #DEFAULT_INTERSECTION_LABEL_TEXT}.
711 *
712 * @return the label text for the intersection view
713 */
714 public final String getIntersectionLabelText()
715 {
716 return intersectionLabelText;
717 }
718
719 /**
720 * Set the label text for the intersection view to <code>intersectionLabelText</code>.
721 *
722 * <p>This is a bound property.</p>
723 *
724 * @param intersectionLabelText label text for the intersection view
725 */
726 public final void setIntersectionLabelText(final String intersectionLabelText)
727 {
728 String oldIntersectionLabelText = this.intersectionLabelText;
729 this.intersectionLabelText = intersectionLabelText;
730 intersectionLabel.setText(buildLabel(this.intersectionLabelText, model.intersection().size()));
731 firePropertyChange(-1, "intersectionLabelText", this.intersectionLabelText, oldIntersectionLabelText);
732 }
733
734 /**
735 * Return the label text for the union view. Defaults to {@link #DEFAULT_UNION_LABEL_TEXT}.
736 *
737 * @return the label text for the union view
738 */
739 public final String getUnionLabelText()
740 {
741 return unionLabelText;
742 }
743
744 /**
745 * Set the label text for the union view to <code>unionLabelText</code>.
746 *
747 * <p>This is a bound property.</p>
748 *
749 * @param unionLabelText label text for the union view
750 */
751 public final void setUnionLabelText(final String unionLabelText)
752 {
753 String oldUnionLabelText = this.unionLabelText;
754 this.unionLabelText = unionLabelText;
755 unionLabel.setText(buildLabel(this.unionLabelText, model.union().size()));
756 firePropertyChange(-1, "unionLabelText", this.unionLabelText, oldUnionLabelText);
757 }
758
759 /**
760 * Return the label for the first set. The text for the returned PText
761 * should not be changed, as the text is synchronized to the quaternary
762 * venn model backing this venn diagram. Use methods
763 * {@link #setFirstLabelText(String)} and {@link #setDisplaySizes(boolean)}
764 * to set the label text and whether to display sizes respectively.
765 *
766 * @return the label for the first set
767 */
768 public final PText getFirstLabel()
769 {
770 return firstLabel;
771 }
772
773 /**
774 * Return the label for the second set. The text for the returned PText
775 * should not be changed, as the text is synchronized to the quaternary
776 * venn model backing this venn diagram. Use methods
777 * {@link #setSecondLabelText(String)} and {@link #setDisplaySizes(boolean)}
778 * to set the label text and whether to display sizes respectively.
779 *
780 * @return the label for the second set
781 */
782 public final PText getSecondLabel()
783 {
784 return secondLabel;
785 }
786
787 /**
788 * Return the label for the third set. The text for the returned PText
789 * should not be changed, as the text is synchronized to the quaternary
790 * venn model backing this venn diagram. Use methods
791 * {@link #setThirdLabelText(String)} and {@link #setDisplaySizes(boolean)}
792 * to set the label text and whether to display sizes respectively.
793 *
794 * @return the label for the third set
795 */
796 public final PText getThirdLabel()
797 {
798 return thirdLabel;
799 }
800
801 /**
802 * Return the label for the fourth set. The text for the returned PText
803 * should not be changed, as the text is synchronized to the quaternary
804 * venn model backing this venn diagram. Use methods
805 * {@link #setFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
806 * to set the label text and whether to display sizes respectively.
807 *
808 * @return the label for the fourth set
809 */
810 public final PText getFourthLabel()
811 {
812 return fourthLabel;
813 }
814
815 /**
816 * Return the label for the first only view. The text for the returned PText
817 * should not be changed, as the text is synchronized to the quaternary
818 * venn model backing this venn diagram. Use methods
819 * {@link #setFirstOnlyLabelText(String)} and {@link #setDisplaySizes(boolean)}
820 * to set the label text and whether to display sizes respectively.
821 *
822 * @return the label for the first only view
823 */
824 public final PText getFirstOnlyLabel()
825 {
826 return firstOnlyLabel;
827 }
828
829 /**
830 * Return the label for the second only view. The text for the returned PText
831 * should not be changed, as the text is synchronized to the quaternary
832 * venn model backing this venn diagram. Use methods
833 * {@link #setSecondOnlyLabelText(String)} and {@link #setDisplaySizes(boolean)}
834 * to set the label text and whether to display sizes respectively.
835 *
836 * @return the label for the second only view
837 */
838 public final PText getSecondOnlyLabel()
839 {
840 return secondOnlyLabel;
841 }
842
843 /**
844 * Return the label for the third only view. The text for the returned PText
845 * should not be changed, as the text is synchronized to the quaternary
846 * venn model backing this venn diagram. Use methods
847 * {@link #setThirdOnlyLabelText(String)} and {@link #setDisplaySizes(boolean)}
848 * to set the label text and whether to display sizes respectively.
849 *
850 * @return the label for the third only view
851 */
852 public final PText getThirdOnlyLabel()
853 {
854 return thirdOnlyLabel;
855 }
856
857 /**
858 * Return the label for the fourth only view. The text for the returned PText
859 * should not be changed, as the text is synchronized to the quaternary
860 * venn model backing this venn diagram. Use methods
861 * {@link #setFourthOnlyLabelText(String)} and {@link #setDisplaySizes(boolean)}
862 * to set the label text and whether to display sizes respectively.
863 *
864 * @return the label for the fourth only view
865 */
866 public final PText getFourthOnlyLabel()
867 {
868 return fourthOnlyLabel;
869 }
870
871 /**
872 * Return the label for the first second view. The text for the returned PText
873 * should not be changed, as the text is synchronized to the quaternary
874 * venn model backing this venn diagram. Use methods
875 * {@link #setFirstSecondLabelText(String)} and {@link #setDisplaySizes(boolean)}
876 * to set the label text and whether to display sizes respectively.
877 *
878 * @return the label for the first second view
879 */
880 public final PText getFirstSecondLabel()
881 {
882 return firstSecondLabel;
883 }
884
885 /**
886 * Return the label for the first third view. The text for the returned PText
887 * should not be changed, as the text is synchronized to the quaternary
888 * venn model backing this venn diagram. Use methods
889 * {@link #setFirstThirdLabelText(String)} and {@link #setDisplaySizes(boolean)}
890 * to set the label text and whether to display sizes respectively.
891 *
892 * @return the label for the first third view
893 */
894 public final PText getFirstThirdLabel()
895 {
896 return firstThirdLabel;
897 }
898
899 /**
900 * Return the label for the second third view. The text for the returned PText
901 * should not be changed, as the text is synchronized to the quaternary
902 * venn model backing this venn diagram. Use methods
903 * {@link #setSecondThirdLabelText(String)} and {@link #setDisplaySizes(boolean)}
904 * to set the label text and whether to display sizes respectively.
905 *
906 * @return the label for the second third view
907 */
908 public final PText getSecondThirdLabel()
909 {
910 return secondThirdLabel;
911 }
912
913 /**
914 * Return the label for the intersection view. The text for the returned PText
915 * should not be changed, as the text is synchronized to the quaternary
916 * venn model backing this venn diagram. Use methods
917 * {@link #setIntersectionLabelText(String)} and {@link #setDisplaySizes(boolean)}
918 * to set the label text and whether to display sizes respectively.
919 *
920 * @return the label for the intersection view
921 */
922 public final PText getIntersectionLabel()
923 {
924 return intersectionLabel;
925 }
926
927 /**
928 * Return the label for the union view. The text for the returned PText
929 * should not be changed, as the text is synchronized to the quaternary
930 * venn model backing this venn diagram. Use methods
931 * {@link #setUnionLabelText(String)} and {@link #setDisplaySizes(boolean)}
932 * to set the label text and whether to display sizes respectively.
933 *
934 * @return the label for the union view
935 */
936 public final PText getUnionLabel()
937 {
938 return unionLabel;
939 }
940
941 /**
942 * Return the label text for the first fourth view. Defaults to {@link #DEFAULT_FIRST_FOURTH_LABEL_TEXT}.
943 *
944 * @return the label text for the first fourth view
945 */
946 public final String getFirstFourthLabelText()
947 {
948 return firstFourthLabelText;
949 }
950
951 /**
952 * Set the label text for the first fourth view to <code>firstFourthLabelText</code>.
953 *
954 * <p>This is a bound property.</p>
955 *
956 * @param firstFourthLabelText label text for the first fourth view
957 */
958 public final void setFirstFourthLabelText(final String firstFourthLabelText)
959 {
960 String oldFirstFourthLabelText = this.firstFourthLabelText;
961 this.firstFourthLabelText = firstFourthLabelText;
962 firstFourthLabel.setText(buildLabel(this.firstFourthLabelText, model.firstFourth().size()));
963 firePropertyChange(-1, "firstFourthLabelText", this.firstFourthLabelText, oldFirstFourthLabelText);
964 }
965
966 /**
967 * Return the label for the first fourth view. The text for the returned PText
968 * should not be changed, as the text is synchronized to the quaternary
969 * venn model backing this venn diagram. Use methods
970 * {@link #setFirstFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
971 * to set the label text and whether to display sizes respectively.
972 *
973 * @return the label for the first fourth view
974 */
975 public final PText getFirstFourthLabel()
976 {
977 return firstFourthLabel;
978 }
979
980 /**
981 * Return the label text for the second fourth view. Defaults to {@link #DEFAULT_SECOND_FOURTH_LABEL_TEXT}.
982 *
983 * @return the label text for the second fourth view
984 */
985 public final String getSecondFourthLabelText()
986 {
987 return secondFourthLabelText;
988 }
989
990 /**
991 * Set the label text for the second fourth view to <code>secondFourthLabelText</code>.
992 *
993 * <p>This is a bound property.</p>
994 *
995 * @param secondFourthLabelText label text for the second fourth view
996 */
997 public final void setSecondFourthLabelText(final String secondFourthLabelText)
998 {
999 String oldSecondFourthLabelText = this.secondFourthLabelText;
1000 this.secondFourthLabelText = secondFourthLabelText;
1001 secondFourthLabel.setText(buildLabel(this.secondFourthLabelText, model.secondFourth().size()));
1002 firePropertyChange(-1, "secondFourthLabelText", this.secondFourthLabelText, oldSecondFourthLabelText);
1003 }
1004
1005 /**
1006 * Return the label for the second fourth view. The text for the returned PText
1007 * should not be changed, as the text is synchronized to the quaternary
1008 * venn model backing this venn diagram. Use methods
1009 * {@link #setSecondFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
1010 * to set the label text and whether to display sizes respectively.
1011 *
1012 * @return the label for the second fourth view
1013 */
1014 public final PText getSecondFourthLabel()
1015 {
1016 return secondFourthLabel;
1017 }
1018
1019 /**
1020 * Return the label text for the third fourth view. Defaults to {@link #DEFAULT_THIRD_FOURTH_LABEL_TEXT}.
1021 *
1022 * @return the label text for the third fourth view
1023 */
1024 public final String getThirdFourthLabelText()
1025 {
1026 return thirdFourthLabelText;
1027 }
1028
1029 /**
1030 * Set the label text for the third fourth view to <code>thirdFourthLabelText</code>.
1031 *
1032 * <p>This is a bound property.</p>
1033 *
1034 * @param thirdFourthLabelText label text for the third fourth view
1035 */
1036 public final void setThirdFourthLabelText(final String thirdFourthLabelText)
1037 {
1038 String oldThirdFourthLabelText = this.thirdFourthLabelText;
1039 this.thirdFourthLabelText = thirdFourthLabelText;
1040 thirdFourthLabel.setText(buildLabel(this.thirdFourthLabelText, model.thirdFourth().size()));
1041 firePropertyChange(-1, "thirdFourthLabelText", this.thirdFourthLabelText, oldThirdFourthLabelText);
1042 }
1043
1044 /**
1045 * Return the label for the third fourth view. The text for the returned PText
1046 * should not be changed, as the text is synchronized to the quaternary
1047 * venn model backing this venn diagram. Use methods
1048 * {@link #setThirdFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
1049 * to set the label text and whether to display sizes respectively.
1050 *
1051 * @return the label for the third fourth view
1052 */
1053 public final PText getThirdFourthLabel()
1054 {
1055 return thirdFourthLabel;
1056 }
1057
1058 /**
1059 * Return the label text for the first second third view. Defaults to
1060 * {@link #DEFAULT_FIRST_SECOND_THIRD_LABEL_TEXT}.
1061 *
1062 * @return the label text for the first second third view
1063 */
1064 public final String getFirstSecondThirdLabelText()
1065 {
1066 return firstSecondThirdLabelText;
1067 }
1068
1069 /**
1070 * Set the label text for the first second third view to <code>firstSecondThirdLabelText</code>.
1071 *
1072 * <p>This is a bound property.</p>
1073 *
1074 * @param firstSecondThirdLabelText label text for the first second third view
1075 */
1076 public final void setFirstSecondThirdLabelText(final String firstSecondThirdLabelText)
1077 {
1078 String oldFirstSecondThirdLabelText = this.firstSecondThirdLabelText;
1079 this.firstSecondThirdLabelText = firstSecondThirdLabelText;
1080 firstSecondThirdLabel.setText(buildLabel(this.firstSecondThirdLabelText, model.firstSecondThird().size()));
1081 firePropertyChange(-1,
1082 "firstSecondThirdLabelText",
1083 this.firstSecondThirdLabelText,
1084 oldFirstSecondThirdLabelText);
1085 }
1086
1087 /**
1088 * Return the label for the first second third view. The text for the returned PText
1089 * should not be changed, as the text is synchronized to the quaternary
1090 * venn model backing this venn diagram. Use methods
1091 * {@link #setFirstSecondThirdLabelText(String)} and {@link #setDisplaySizes(boolean)}
1092 * to set the label text and whether to display sizes respectively.
1093 *
1094 * @return the label for the first second third view
1095 */
1096 public final PText getFirstSecondThirdLabel()
1097 {
1098 return firstSecondThirdLabel;
1099 }
1100
1101 /**
1102 * Return the label text for the first second fourth view. Defaults to
1103 * {@link #DEFAULT_FIRST_SECOND_FOURTH_LABEL_TEXT}.
1104 *
1105 * @return the label text for the first second fourth view
1106 */
1107 public final String getFirstSecondFourthLabelText()
1108 {
1109 return firstSecondFourthLabelText;
1110 }
1111
1112 /**
1113 * Set the label text for the first second fourth view to <code>firstSecondFourthLabelText</code>.
1114 *
1115 * <p>This is a bound property.</p>
1116 *
1117 * @param firstSecondFourthLabelText label text for the first second fourth view
1118 */
1119 public final void setFirstSecondFourthLabelText(final String firstSecondFourthLabelText)
1120 {
1121 String oldFirstSecondFourthLabelText = this.firstSecondFourthLabelText;
1122 this.firstSecondFourthLabelText = firstSecondFourthLabelText;
1123 firstSecondFourthLabel.setText(buildLabel(this.firstSecondFourthLabelText, model.firstSecondFourth().size()));
1124 firePropertyChange(-1,
1125 "firstSecondFourthLabelText",
1126 this.firstSecondFourthLabelText,
1127 oldFirstSecondFourthLabelText);
1128 }
1129
1130 /**
1131 * Return the label for the first second fourth view. The text for the returned PText
1132 * should not be changed, as the text is synchronized to the quaternary
1133 * venn model backing this venn diagram. Use methods
1134 * {@link #setFirstSecondFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
1135 * to set the label text and whether to display sizes respectively.
1136 *
1137 * @return the label for the first second fourth view
1138 */
1139 public final PText getFirstSecondFourthLabel()
1140 {
1141 return firstSecondFourthLabel;
1142 }
1143
1144 /**
1145 * Return the label text for the first third fourth view. Defaults to
1146 * {@link #DEFAULT_FIRST_THIRD_FOURTH_LABEL_TEXT}.
1147 *
1148 * @return the label text for the first third fourth view
1149 */
1150 public final String getFirstThirdFourthLabelText()
1151 {
1152 return firstThirdFourthLabelText;
1153 }
1154
1155 /**
1156 * Set the label text for the first third fourth view to <code>firstThirdFourthLabelText</code>.
1157 *
1158 * <p>This is a bound property.</p>
1159 *
1160 * @param firstThirdFourthLabelText label text for the first third fourth view
1161 */
1162 public final void setFirstThirdFourthLabelText(final String firstThirdFourthLabelText)
1163 {
1164 String oldFirstThirdFourthLabelText = this.firstThirdFourthLabelText;
1165 this.firstThirdFourthLabelText = firstThirdFourthLabelText;
1166 firstThirdFourthLabel.setText(buildLabel(this.firstThirdFourthLabelText, model.firstThirdFourth().size()));
1167 firePropertyChange(-1,
1168 "firstThirdFourthLabelText",
1169 this.firstThirdFourthLabelText,
1170 oldFirstThirdFourthLabelText);
1171 }
1172
1173 /**
1174 * Return the label for the first third fourth view. The text for the returned PText
1175 * should not be changed, as the text is synchronized to the quaternary
1176 * venn model backing this venn diagram. Use methods
1177 * {@link #setFirstThirdFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
1178 * to set the label text and whether to display sizes respectively.
1179 *
1180 * @return the label for the first third fourth view
1181 */
1182 public final PText getFirstThirdFourthLabel()
1183 {
1184 return firstThirdFourthLabel;
1185 }
1186
1187 /**
1188 * Return the label text for the second third fourth view. Defaults to
1189 * {@link #DEFAULT_SECOND_THIRD_FOURTH_LABEL_TEXT}.
1190 *
1191 * @return the label text for the second third fourth view
1192 */
1193 public final String getSecondThirdFourthLabelText()
1194 {
1195 return secondThirdFourthLabelText;
1196 }
1197
1198 /**
1199 * Set the label text for the second third fourth view to <code>secondThirdFourthLabelText</code>.
1200 *
1201 * <p>This is a bound property.</p>
1202 *
1203 * @param secondThirdFourthLabelText label text for the second third fourth view
1204 */
1205 public final void setSecondThirdFourthLabelText(final String secondThirdFourthLabelText)
1206 {
1207 String oldSecondThirdFourthLabelText = this.secondThirdFourthLabelText;
1208 this.secondThirdFourthLabelText = secondThirdFourthLabelText;
1209 secondThirdFourthLabel.setText(buildLabel(this.secondThirdFourthLabelText, model.secondThirdFourth().size()));
1210 firePropertyChange(-1,
1211 "secondThirdFourthLabelText",
1212 this.secondThirdFourthLabelText,
1213 oldSecondThirdFourthLabelText);
1214 }
1215
1216 /**
1217 * Return the label for the second third fourth view. The text for the returned PText
1218 * should not be changed, as the text is synchronized to the quaternary
1219 * venn model backing this venn diagram. Use methods
1220 * {@link #setSecondThirdFourthLabelText(String)} and {@link #setDisplaySizes(boolean)}
1221 * to set the label text and whether to display sizes respectively.
1222 *
1223 * @return the label for the second third fourth view
1224 */
1225 public final PText getSecondThirdFourthLabel()
1226 {
1227 return secondThirdFourthLabel;
1228 }
1229 }