import java.applet.*;
import java.awt.*;
import java.lang.*;
import java.util.*;
import java.io.*;
import java.net.*;


/*
	NameInput class - allows user to enter name for state/input. CLK
*/


class NameInput extends Input
{
	final static int STATE = 1;
	final static int INPUT = 2;
	private int mode;

	private InputSignal			inputSignal;
	private InputMaintenance	inputMaintenance;
	private State				ersterZustand;

	/* constructor method */

	public NameInput (Container par, String label)
	{
		super (par, label);
		mode = STATE;
	}

	public void setMachine (Machine m, Help h, InputSignal inps, InputMaintenance inpm)
	{
		machine = m;
		help = h;
		inputSignal = inps;
		inputMaintenance = inpm;
	}

	public void setMode (int m)
	{
		mode = m;
	}

	public void setErsterZustand (State s)
	{
		ersterZustand = s;
	}

    /*
        pass input to the state machine
    */

    public void passInput (String newName)
    {
    	if (mode == STATE)  // rename state
   		{
    		machine.renameState(newName);
   			ersterZustand.highlightOff();
    	}
   		else               // add/rename input signal
   		{
   			System.out.println("passInput reicht weiter: " + newName);
   			if (! (newName.equals((Object) "")) || (newName.equals((Object) "All")))
   			{
	    		inputSignal.handleInput(newName);
   				inputMaintenance.updateTokens(newName);
   			}
    	}
    }

} /* end NameInput */

