package sim.lib.others;

import java.awt.*;

import sim.*;
import sim.engine.*;
import sim.lib.EditBusSize;
import sim.lib.wires.Junction;

public class TextBox extends RotatableFlippableWrapperPainted implements EngineModule {
	/* ==================================================================
	 Creation Part
	 ================================================================= */

	private static Image ICON = GuiFileLink.getImage("sim/lib/others/TextField.gif");

	public Image getIcon() {
		return this.ICON;
	}

	public Wrapper createWrapper() {
		return this.getCopy();
	}

	public Wrapper createWrapper(Point gridPosition) {
		TextBox result = this.getCopy();
		result.setGridLocation(gridPosition);
		return result;
	}

	public String getBubbleHelp() {
		return "Text Box";
	}
	/* ==================================================================
	 GUI part
	 ================================================================= */
	private String text = "Text";
	private int fontSize;
	private String fontName;
	private String fontStyle;

	public TextBox() {
		super();
	}

	public TextBox getCopy() {
		TextBox result = new TextBox();

		return result;
	}

	public void initializeGridSize() {
		this.setGridSize(4, 4);
	}

	public void setContent(String fontName, String fontStyle, int fontSize, String text) {
		this.fontName = fontName;

	}

	/* ==================================================================
	 Maintanance Part
	 ================================================================= */
	public void selected() {
		this.changeColor(Color.green);
	}

	public void checkAfterSelected() {
	}
	/* ==================================================================
	 Simulation part
	 ================================================================= */

	public void evaluateOutput(double currentTime, Data[] currentInputs, EnginePeer peer) {
	}

	public void createEnginePeer(EnginePeerList epl) {
		EnginePeer ep = new EnginePeer(this);
		epl.insertItem(ep);
	}

	public void reset() {
	}

	public Wrapper getParentWrapper() {
		return this;
	}

	/* ==================================================================
	 Storage Part
	 ================================================================= */
	public String getSpecificParameters() {
		return (this.fontName + Wrapper.SEPARATOR + this.fontStyle + Wrapper.SEPARATOR + Integer.toString(this.fontSize) + Wrapper.SEPARATOR + this.text);
	}

	public void loadWrapper(String[] specificParameters) throws SimException {
		if (specificParameters.length == this.getNumberOfSpecificParameters()) {
			try {
			} catch (NumberFormatException e) {
				throw (new SimException("incorrect parameter type"));
			}
		} else {
			throw (new SimException("incorrect number of parameters"));
		}
	}

	public int getNumberOfSpecificParameters() {
		return 4;
	}

	/* ==================================================================
	 Rotation abd Flipping Part
	 ================================================================= */
	protected void paintNormal_0(Graphics g) {
	}

	protected void paintNormal_90(Graphics g) {
	}

	protected void paintNormal_180(Graphics g) {
	}

	protected void paintNormal_270(Graphics g) {
	}

	protected void paintFlipped_0(Graphics g) {
		this.paintNormal_0(g);
	}

	protected void paintFlipped_90(Graphics g) {
		this.paintNormal_270(g);
	}

	protected void paintFlipped_180(Graphics g) {
		this.paintNormal_180(g);
	}

	protected void paintFlipped_270(Graphics g) {
		this.paintNormal_90(g);
	}

	protected boolean canDropNormal_0() {
		return true;
	}

	protected boolean canDropNormal_90() {
		return true;
	}

	protected boolean canDropNormal_180() {
		return true;
	}

	protected boolean canDropNormal_270() {
		return true;
	}

	protected boolean canDropFlipped_0() {
		return false;
	}

	protected boolean canDropFlipped_90() {
		return false;
	}

	protected boolean canDropFlipped_180() {
		return false;
	}

	protected boolean canDropFlipped_270() {
		return false;
	}

	protected void dropedNormal_0() {
	}

	protected void dropedNormal_90() {
	}

	protected void dropedNormal_180() {
	}

	protected void dropedNormal_270() {
	}

	protected void dropedFlipped_0() {
	}

	protected void dropedFlipped_90() {
	}

	protected void dropedFlipped_180() {
	}

	protected void dropedFlipped_270() {
	}

	protected void adjustToChanges() {
	}
	/* ==================================================================
	 Popup Part
	 ================================================================= */
	private int oldBusSize = 0;

	public boolean hasProperties() {
		return true;
	}

	public Component getPropertyWindow() {
		return null;
	}

	public void respondToChanges(Component property) {
	}

	public void restoreOriginalProperties() {
	}

	@Override
	public void writeVHDLEntity(String path) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public String getVHDLName() {
		// TODO Auto-generated method stub
		return null;
	}
}
