/*
 * Created on Aug 10, 2003
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package APStudio.models;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.swt.graphics.Image;


/**
 * @author rajags
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class ClassDiagramModel extends BasicSubpart{


	private String _className = null;
	private static int count;
	private static int nameIncrement = 1;
	private Point _location;
	private Dimension _size;
	private boolean selected;
	
	private String _labelContent="ClassName" ;
	private static Image LOGIC_LABEL_ICON = new Image(null,
		ClassGraphModel.class.getResourceAsStream("icons/label16.gif"));  //$NON-NLS-1$
	public static String TERMINAL_OUT[] = new String[]{"OUT1", "OUT2", "OUT3", "OUT4"}; 
	public static String TERMINAL_IN[] = new String[]{"IN1", "IN2", "IN3", "IN4"}; 
	/**
 	*  default constructor does nothing now
 	*
 	*/
	public ClassDiagramModel(){
		System.out.println("ClassDiagramModel Constructor");
		_labelContent = _labelContent + this.getID();
		Name = _labelContent;
	}

	/**
	 * constructor with the className passed
	 * @param ClassName
	 */
	public ClassDiagramModel(String ClassName){
		System.out.println("ClassDiagramModel Constructor");
	_className =  ClassName;
	}
	
	public Image getIconImage() {
		System.out.println("ClassDiagramModel IconImg");
		return LOGIC_LABEL_ICON;
	}
	
	protected String getNewID() {
		return Integer.toString(count++);
	}
	
	//Not used
	public void setLabelContents(String s){
	 _labelContent = s;
	 Name = s;
	 firePropertyChange("labelContents", "", _labelContent);	
	}
	
	//Not used
	public String getLabelContents(){
		
		return _labelContent;
		
	}


	/**
	 * 
	 */
	public String toString()
	{
	  return _className;
	}
  
  	/**
  	 * 
  	 * @param loc
  	 */
	public void setLocation(Point loc)
	{
	  System.out.println("Called ClassDiagramModel.setLocation()="+loc);
    
	  _location = loc;
	  firePropertyChange("location", null, loc);
	}

	/**
	 * 
	 * @return
	 */
	public Point getLocation()
	{
	  System.out.println("Called ClassDiagramModel.getLocation()");
	  System.out.println("ClassDiagramModel.getLocation() return ="+_location);
	  return _location;
	}
  

	/**
	 * 
	 * @param iSize
	 */
	public void setSize(Dimension size)
	{
	  _size = size;
	  firePropertyChange("size", null, size);
	}
  
  	/**
  	 * 
  	 * @return
  	 */
	public Dimension getSize()
	{
	  return _size;
	}

	 
	/**
	 * For future use
	 *
	 */
	public void update(){
		
	}
	/**
	 * @return
	 */
	public boolean isSelected() {
		return selected;
	}

	/**
	 * @param b
	 */
	public void setSelected(boolean b) {
		Object old_selected = Boolean.valueOf(selected);
		selected = b;
		firePropertyChange("color",old_selected,Boolean.valueOf(selected));
	}

}
