package apps.server.visualization;

import javax.swing.JPanel;

import util.game.Game;
import util.statemachine.implementation.prover.ProverMachineState;
import util.xhtml.GameStateRenderPanel;

public class RenderThread extends Thread {	
	private final Game theGame;
	private final ProverMachineState s;
	private final VisualizationPanel parent;
	private final int stepNum;
	
	public RenderThread(Game theGame, ProverMachineState s, VisualizationPanel parent, int stepNum) {
		this.theGame = theGame;
		this.s = s;
		this.parent = parent;
		this.stepNum = stepNum;
	}
	
	@Override
	public void run()
	{
		JPanel newPanel = null;
		try {
			String XML = s.toXML();
			String XSL = GameStateRenderPanel.getXSLfromFile(theGame.getKey(), 1); //1 because machinestate XMLs only ever have 1 state
			
			// TODO: Figure out a way to render visualizations using the web stylesheets.
			//String XSL = theGame.getStylesheet();
			
			newPanel = new VizContainerPanel(XML, XSL, parent);
		} catch(Exception ex) {}
		
		if(newPanel != null)
			parent.addVizPanel(newPanel, stepNum);
	}
}
@@ -114,36 +114,8 @@
 ine.
-implementation.prover.Prover
 Mach
@@ -121,24 +121,24 @@
 hineState;%0D%0A
+
 import util.
@@ -258,22 +258,16 @@
 e final 
-Prover
 MachineS
@@ -350,16 +350,16 @@
 um;%0D%0A%09%0D%0A
+
 %09public 
@@ -389,14 +389,8 @@
 me, 
-Prover
 Mach

Remove an unnecessary use of the ProverMachineState rather than the MachineState.