From: <jbo...@li...> - 2005-11-20 14:25:42
|
Author: aron.gombas Date: 2005-11-20 09:25:24 -0500 (Sun, 20 Nov 2005) New Revision: 1605 Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java Log: Oops, this one left out Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java 2005-11-20 14:24:00 UTC (rev 1604) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ColorCodedKey.java 2005-11-20 14:25:24 UTC (rev 1605) @@ -0,0 +1,46 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.server.util; + +import java.awt.Color; + +/** + * Key for color coded pie sections. + * Wraps immutable label and color values. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class ColorCodedKey implements Comparable { + /** Label for the pie section. */ + private String label; + /** Color for the pie section. */ + private Color color; + + public ColorCodedKey(String label, Color color) { + this.color = color; + this.label = label; + } + + public String getLabel() { + return label; + } + + public Color getColor() { + return color; + } + + /** Ensures that only label string will appear in the charts. */ + @Override + public String toString() { + return label; + } + + public int compareTo(Object obj) { + return getLabel().compareTo(((ColorCodedKey)obj).getLabel()); + } +} |