package org.jacorb.ir.gui.remoteobject;

import org.jacorb.ir.gui.typesystem.*;
import org.jacorb.ir.gui.typesystem.remote.*;
import javax.swing.tree.*;
import org.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 org.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 org.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";
	}		
    }
}











