// Copyright 1996, Marimba Inc. All Rights Reserved.


// @(#)TableColumn.java, 1.7, 12/10/96





package marimba.gui;





import java.awt.*;


import java.util.*;





import marimba.persist.*;


import marimba.io.*;








/**


 * A column descriptor. This class is used by the TableWidget


 * for storing general information about a column and is not


 * supposed to be used directly. All necessary methods are


 * available in the table widget.


 *


 * @see TableWidget


 *


 * @author	Klaas Waslander


 * @version 	1.7, 12/10/96


 */


public class TableColumn implements PropertyObject, WidgetConstants {


    /**


     * The label for this column.


     */


    public String  label;





    /**


     * The coordinate.


     */


    public int  pos;





    /**


     * The size of the column.


     */


    public int  size;





    /**


     * The index when displaying this column.


     * This index reflects the place where the column must


     * be painted now: columns can be moved.


     */


    public int  displayIndex;





    /**


     * The alignment within this column: LEFT, RIGHT or CENTER.


     */


    public int  align = LEFT;








    /**


     * Constructor


     */


    public TableColumn() {


    }





    /**


     * Constructor


     */


    public TableColumn(String label, int pos, int size, int displayIndex) {


	this.label = label;


	this.pos = pos;


	this.size = size;


	this.displayIndex = displayIndex;


    }





    /**


     * Get the properties of this TableColumn.


     */


    public void getProperties(PropertyList list) {


	list.setString("label", label, "");


	list.setInteger("pos", pos, 0);


	list.setInteger("size", size, 10);


	list.setInteger("displayIndex", displayIndex, 0);


	list.setInteger("align", align, LEFT);


    }





    /**


     * Set the properties of this widget.


     */


    public void setProperties(PropertyList list) {


	label = list.getString("label", "");


	pos = list.getInteger("pos", 0);


	size = list.getInteger("size", 10);


	displayIndex = list.getInteger("displayIndex", 0);


	align = list.getInteger("align", LEFT);


    }





    /**


     * A string representation of this class.


     */


    public String toString() {


	String  result="";


	result += "label="+label+",pos="+pos+",size="+size;


	result += ",displayIndex="+displayIndex;


	return result;


    }


}


