package reversi.client.gui.game.board;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JButton;
import javax.swing.JPanel;

import reversi.models.ReversiEntity;

import base.models.BoardPiece;
import base.models.Position;

/**
 * Game GUI that shows the game board.
 * 
 * @author shaneb
 * 
 */
public class ReversiGameBoardGUI extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private static final String ReversiWindowName = "Reversi Game Board";

	private static final Integer windowHeight = 544;
	private static final Integer windowWidth = 544;
	
	private static final Dimension WINDOW_SIZE = new Dimension(windowWidth, windowHeight);

	protected final Map<Position, ReversiBoardPieceGUI> boardElements = new HashMap<Position, ReversiBoardPieceGUI>();

	private JPanel boardPanel;

	public void buildBoard() {

		this.boardPanel = new JPanel();
		this.boardPanel.setLayout(new GridLayout(8, 8));
		
		for (int r = 1; r <= 8; r += 1) {

			for (int c = 0; c < 8; c += 1) {
	
				Position position = new Position(c, r);
				ReversiBoardPieceGUI newPiece = new ReversiBoardPieceGUI(position);
				boardElements.put(position, newPiece);
			}
		}
		
	}

	public void updateBoard(ReversiGameBoardGUI board) {

	}
	
	@Override
	public Dimension getPreferredSize() {
		return WINDOW_SIZE;
	}

}

@@ -1241,16 +1241,73 @@
 Piece);%0A
+%09%09%09%09%0A%09%09%09%09newPiece.setActionCommand(position.toString());%0A
 %09%09%09%7D%0A%09%09%7D
@@ -1369,16 +1369,319 @@
 ard) %7B%0A%0A
+%09%09for (int r = 1; r %3C= 8; r += 1) %7B%0A%0A%09%09%09for (int c = 0; c %3C 8; c += 1) %7B%0A%09%0A%09%09%09%09Position position = new Position(c, r);%0A%09%09%09%09ReversiBoardPieceGUI newPiece = new ReversiBoardPieceGUI(position);%0A%09%09%09%09boardElements.put(position, newPiece);%0A%09%09%09%09%0A%09%09%09%09newPiece.setActionCommand(position.toString());%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A
 %09%7D%0A%09%0A%09@O

Add to gameBoard