--- projects/cms/source/conient/uk/org/iscream/cms/conient/datacomponents/StringDataComponent.java 2001/01/22 03:03:39 1.1 +++ projects/cms/source/conient/uk/org/iscream/cms/conient/datacomponents/StringDataComponent.java 2001/01/22 12:32:14 1.2 @@ -1,7 +1,37 @@ +//---PACKAGE DECLARATION--- + +//---IMPORTS--- import javax.swing.JLabel; import java.awt.GridLayout; +/** + * This is the most basic of DataComponents. + * + * It simply displays the value as a String + * in a JLabel. + * + * @author $Author: ajm $ + * @version $Id: StringDataComponent.java,v 1.2 2001/01/22 12:32:14 ajm Exp $ + */ public class StringDataComponent extends DataComponent { + +//---FINAL ATTRIBUTES--- + + /** + * The current CVS revision of this class + */ + public final String REVISION = "$Revision: 1.2 $"; + +//---STATIC METHODS--- + +//---CONSTRUCTORS--- + + /** + * Creates the component with a friendly name to be + * used as label + * + * @param name the friendly name + */ public StringDataComponent(String name) { _label = new JLabel(name + ": "); _label.setHorizontalAlignment(JLabel.RIGHT); @@ -10,6 +40,20 @@ public class StringDataComponent extends DataComponent add(_item); } +//---PUBLIC METHODS--- + +//---PRIVATE METHODS--- + +//---ACCESSOR/MUTATOR METHODS--- + + /** + * This takes the String value of the parameter that this component + * is monitoring direct from the packet, it then performs all + * approriate conversions and displays the data. + * + * @param value the value for this data component + * @throws DataFormatException if there was a problem converting the data for display + */ public void setValue(String value) throws DataFormatException { try { _item.setText(value); @@ -17,7 +61,19 @@ public class StringDataComponent extends DataComponent throw new DataFormatException("invalid data type for component"); } } - + +//---ATTRIBUTES--- + + /** + * The friendly label for this component + */ protected JLabel _label; + + /** + * Just a normal label to display our value as a String + */ protected JLabel _item = new JLabel(); + +//---STATIC ATTRIBUTES--- + } \ No newline at end of file