import java.io.File;
import java.io.IOException;

import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;
import javafx.scene.shape.Rectangle;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;


public class Grid {
	
	private String simName;
	private String simAuthor;
	private int gridColumns; 
	private int gridRows;
	private int cellSize = 1;
	
//	private FillGrid[] myGrids = {
//			new SegregationFillGrid()
//	};
//	private FillGrid myFillGrid;
	
	public void main(String argv[]) throws SAXException, IOException, ParserConfigurationException {
		File xmlFile = new File("XML FILE HERE"); 
		DocumentBuilderFactory dBFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder dBuilder = dBFactory.newDocumentBuilder();
		Document doc = dBuilder.parse(xmlFile);
		doc.getDocumentElement().normalize();
		
		Dom dom = new Dom();
		simName = dom.getTitle();
		simAuthor = dom.getAuthor();
		gridColumns = dom.getDimensionX();
		gridRows = dom.getDimensionY();
		
		//To figure out, how to call index of grid based on simName
//		myFillGrid = myGrids[simName];
		
	}
	
	public Scene initGrid (int width, int height) {
		
		Group group = new Group();
		Scene window = new Scene(group, width, height, Color.WHITE);
		
        Rectangle cell = new Rectangle();
        
        GridPane grid = new GridPane();
        for (int row = 0; row < gridColumns; row++) {
        	for (int col = 0; col < gridRows; col++) {
        		if ((row+col) % 2 == 0) cell = makeCell(cellSize, "RED");
        		else cell = makeCell(cellSize, "BLUE");
        		grid.add(cell, col, row);
        	}
        }
        group.getChildren().add(grid);
        return window;
    }
	
	public Rectangle makeCell (int size, String color) {
		Rectangle cell = new Rectangle (cellSize, cellSize, Paint.valueOf(color));
		return cell;
	}
}

@@ -715,16 +715,23 @@
 %09public 
+static 
 void mai
@@ -1084,17 +1084,19 @@
 %09%0A%09%09Dom 
-d
+myD
 om = new
@@ -1109,68 +1109,96 @@
 ;%0A%09%09
-simName = dom.getTitle();%0A%09%09simAuthor = dom.getAuthor();%0A%09%09g
+String myAuthor = myDom.getAuthor(doc);%0A%09%09String myName = myDom.getTitle(doc);%0A%09%09int myG
 ridC
@@ -1202,25 +1202,27 @@
 idColumns = 
-d
+myD
 om.getDimens
@@ -1230,14 +1230,23 @@
 onX(
+doc
 );%0A%09%09
-g
+int myG
 ridR
@@ -1251,17 +1251,19 @@
 dRows = 
-d
+myD
 om.getDi
@@ -1271,16 +1271,19 @@
 ensionY(
+doc
 );%0A%09%09%0A%09%09

call dom variables in grid