View Javadoc

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