package com.sandwell.JavaSimulation3D;

import com.jaamsim.input.Keyword;
import com.jaamsim.input.OutputInput;
import com.sandwell.JavaSimulation.ColourInput;

public class BooleanIndicator extends DisplayEntity {

	private final OutputInput<Boolean> boolProp;

	@Keyword(description = "The colour of the indicator when the property is true",
	         example = "BinLevel TrueColor { green }")
	private final ColourInput trueColor;

	@Keyword(description = "The colour of the indicator when the property is false",
	         example = "BinLevel FalseColor { red }")
	private final ColourInput falseColor;

	{
		boolProp = new OutputInput<Boolean>(Boolean.class, "OutputName", "Key Inputs", null);
		this.addInput(boolProp);

		trueColor = new ColourInput("TrueColour", "Graphics", ColourInput.GREEN);
		this.addInput(trueColor);
		this.addSynonym(trueColor, "TrueColor");

		falseColor = new ColourInput("FalseColour", "Graphics", ColourInput.RED);
		this.addInput(falseColor);
		this.addSynonym(falseColor, "FalseColor");
	}

	public BooleanIndicator() {
	}

	@Override
	public void updateGraphics( double time ) {
		if (boolProp.getValue() == null)
			return;
		Boolean b = boolProp.getOutputValue(time);
		if (b.booleanValue()) {
			setTagColour(DisplayModelCompat.TAG_CONTENTS, trueColor.getValue());
		}
		else {
			setTagColour(DisplayModelCompat.TAG_CONTENTS, falseColor.getValue());
		}
	}

}

@@ -102,56 +102,181 @@
 tput
-Input;%0Aimport com.sandwell.JavaSimulation.Colour
+;%0Aimport com.jaamsim.input.OutputInput;%0Aimport com.jaamsim.units.DimensionlessUnit;%0Aimport com.sandwell.JavaSimulation.ColourInput;%0Aimport com.sandwell.JavaSimulation.String
 Inpu
@@ -726,16 +726,404 @@
 Color;%0A%0A
+%09@Keyword(description = %22The string displayed by the Text output when the property is true.%22,%0A%09         example = %22BooleanInd1 TrueText %7B 'True text' %7D%22)%0A%09private final StringInput trueText;%0A%0A%09@Keyword(description = %22The string displayed by the Text output when the property is false.%22,%0A%09         example = %22BooleanInd1 FalseText %7B 'False text' %7D%22)%0A%09private final StringInput falseText;%0A%0A
 %09%7B%0A%09%09boo
@@ -1530,16 +1530,200 @@
 Color%22);
+%0A%0A%09%09trueText = new StringInput(%22TrueText%22, %22Graphics%22, %22TRUE%22);%0A%09%09this.addInput(trueText);%0A%0A%09%09falseText = new StringInput(%22FalseText%22, %22Graphics%22, %22FALSE%22);%0A%09%09this.addInput(falseText);
 %0A%09%7D%0A%0A%09pu
@@ -2091,10 +2091,432 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09@Output(name = %22Text%22,%0A%09 description = %22If the property is true, then return TrueText.  If the property is false, then return FalseText.%22,%0A%09    unitType = DimensionlessUnit.class)%0A%09public String getText(double time) %7B%0A%09%09if (boolProp.getValue() == null)%0A%09%09%09return %22%22;%0A%09%09Boolean b = boolProp.getOutputValue(time);%0A%09%09if (b.booleanValue()) %7B%0A%09%09%09return trueText.getValue();%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09return falseText.getValue();%0A%09%09%7D%0A%09%7D%0A
 %7D%0A

Added BooleanIndicator keywords TrueText and FalseText, and output Text