package jacorb.ir.gui.remoteobject;

import jacorb.ir.gui.typesystem.*;
import jacorb.ir.gui.typesystem.remote.*;
import javax.swing.tree.*;
import jacorb.ir.gui.typesystem.*;

/**
 * This class was generated by a SmartGuide.
 * 
 */

public class ObjectRepresentant extends ModelParticipant 
{
    protected Object counterPart;
    // da können echte entfernte Objekte und lokale Objekte drinstecken
    protected String name;
    protected TypeSystemNode typeSystemNode;



    /**
     * This method was created by a SmartGuide.
     * @param counterPart java.lang.Object
     */
    protected ObjectRepresentant (Object counterPart, TypeSystemNode type, String name) {
	this.counterPart = counterPart;
	if (name!=null) {
            setName(name);
	}	
	else {
            setName("this");
	}		
	typeSystemNode = type;
	System.out.println(this+" value: "+value());
    }
    /**
     * This method was created by a SmartGuide.
     * @return int
     * @param other jacorb.ir;.gui.typesystem.ModelParticipant
     */
    public int compareTo(ModelParticipant other) {
	return this.toString().compareTo(other.toString());
    }
    /**
     * This method was created by a SmartGuide.
     * @return TreeModel
     */
    public TreeModel getTreeModel() {
	return ModelBuilder.getSingleton().buildTreeModelAsync(this);
    }	
    /**
     * This method was created by a SmartGuide.
     * @return jacorb.ir;.gui.typesystem.TypeSystemNode
     */
    public TypeSystemNode getTypeSystemNode() {
	return typeSystemNode;
    }
    /**
     * This method was created by a SmartGuide.
     * @param name java.lang.String
     */
    protected void setName(String name) {
	this.name = name;
    }
    /**
     * This method was created by a SmartGuide.
     * @return java.lang.String
     */
    public String toString() {
	if (typeSystemNode!=null) {	// kann null sein z.B. bei PIDLs
            return typeSystemNode.getAbsoluteName() + " " + name;
	}	
	else {
            return name;
	}	
    }
    /**
     * This method was created by a SmartGuide.
     * @return java.lang.String
     */
    public String value() {
	if (counterPart!=null) {
            return counterPart.toString();
	}
	else {
            return "nil";
	}		
    }
}





